1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.script.internal.safe; |
21 |
|
|
22 |
|
import java.lang.reflect.Constructor; |
23 |
|
import java.util.ArrayList; |
24 |
|
import java.util.Collection; |
25 |
|
import java.util.List; |
26 |
|
import java.util.ListIterator; |
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
@param |
32 |
|
@param |
33 |
|
@version |
34 |
|
@since |
35 |
|
|
|
|
| 0% |
Uncovered Elements: 26 (26) |
Complexity: 11 |
Complexity Density: 0.73 |
|
36 |
|
public class SafeList<E, L extends List<E>> extends SafeCollection<E, L> implements List<E> |
37 |
|
{ |
38 |
|
|
39 |
|
@param |
40 |
|
@param |
41 |
|
@param |
42 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
43 |
0 |
public SafeList(L list, ScriptSafeProvider< ? > safeProvider, Constructor< ? extends E> safeConstructor)... |
44 |
|
{ |
45 |
0 |
super(list, safeProvider, safeConstructor); |
46 |
|
} |
47 |
|
|
48 |
|
|
49 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
50 |
0 |
@Override... |
51 |
|
public boolean addAll(int index, Collection< ? extends E> c) |
52 |
|
{ |
53 |
0 |
throw new UnsupportedOperationException(FORBIDDEN); |
54 |
|
} |
55 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
56 |
0 |
@Override... |
57 |
|
public E get(int index) |
58 |
|
{ |
59 |
0 |
return safeElement(getWrapped().get(index)); |
60 |
|
} |
61 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
62 |
0 |
@Override... |
63 |
|
public E set(int index, E element) |
64 |
|
{ |
65 |
0 |
throw new UnsupportedOperationException(FORBIDDEN); |
66 |
|
} |
67 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
68 |
0 |
@Override... |
69 |
|
public void add(int index, E element) |
70 |
|
{ |
71 |
0 |
throw new UnsupportedOperationException(FORBIDDEN); |
72 |
|
} |
73 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
74 |
0 |
@Override... |
75 |
|
public E remove(int index) |
76 |
|
{ |
77 |
0 |
throw new UnsupportedOperationException(FORBIDDEN); |
78 |
|
} |
79 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
80 |
0 |
@Override... |
81 |
|
public int indexOf(Object o) |
82 |
|
{ |
83 |
0 |
return getWrapped().indexOf(o); |
84 |
|
} |
85 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
86 |
0 |
@Override... |
87 |
|
public int lastIndexOf(Object o) |
88 |
|
{ |
89 |
0 |
return getWrapped().lastIndexOf(o); |
90 |
|
} |
91 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
92 |
0 |
@Override... |
93 |
|
public ListIterator<E> listIterator() |
94 |
|
{ |
95 |
0 |
return new SafeListIterator<E>(getWrapped().listIterator(), this.safeProvider, this.safeConstructor); |
96 |
|
} |
97 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
98 |
0 |
@Override... |
99 |
|
public ListIterator<E> listIterator(int index) |
100 |
|
{ |
101 |
0 |
return new SafeListIterator<E>(getWrapped().listIterator(index), this.safeProvider, this.safeConstructor); |
102 |
|
} |
103 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
104 |
0 |
@Override... |
105 |
|
public List<E> subList(int fromIndex, int toIndex) |
106 |
|
{ |
107 |
0 |
List<E> list = getWrapped().subList(fromIndex, toIndex); |
108 |
|
|
109 |
0 |
List<E> safeList = new ArrayList<E>(list.size()); |
110 |
0 |
for (E element : list) { |
111 |
0 |
safeList.add(safeElement(element)); |
112 |
|
} |
113 |
|
|
114 |
0 |
return safeList; |
115 |
|
} |
116 |
|
} |