1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
package org.kuali.student.common.ui.server.serialization; |
17 |
|
|
18 |
|
import java.util.HashMap; |
19 |
|
import java.util.Map; |
20 |
|
|
21 |
|
import com.google.gwt.user.client.rpc.SerializationException; |
22 |
|
import com.google.gwt.user.server.rpc.impl.LegacySerializationPolicy; |
23 |
|
import com.google.gwt.user.server.rpc.impl.StandardSerializationPolicy; |
24 |
|
|
25 |
|
|
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
@author |
30 |
|
|
|
|
| 0% |
Uncovered Elements: 32 (32) |
Complexity: 13 |
Complexity Density: 0.57 |
|
31 |
|
public class KSSerializationPolicy extends StandardSerializationPolicy { |
32 |
|
LegacySerializationPolicy legacySerializationPolicy = LegacySerializationPolicy.getInstance(); |
33 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
34 |
0
|
public KSSerializationPolicy(Map<Class<?>, Boolean> whitelist) {... |
35 |
0
|
super(whitelist, whitelist, new HashMap<Class<?>, String>()); |
36 |
|
} |
37 |
|
|
38 |
|
|
39 |
|
|
40 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
41 |
0
|
@Override... |
42 |
|
public boolean shouldDeserializeFields(Class<?> clazz) { |
43 |
0
|
return super.shouldDeserializeFields(clazz)||legacySerializationPolicy.shouldDeserializeFields(clazz); |
44 |
|
} |
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
50 |
0
|
@Override... |
51 |
|
public boolean shouldSerializeFields(Class<?> clazz) { |
52 |
0
|
return super.shouldSerializeFields(clazz)||legacySerializationPolicy.shouldSerializeFields(clazz); |
53 |
|
} |
54 |
|
|
55 |
|
|
56 |
|
|
57 |
|
|
58 |
|
|
59 |
|
@param |
60 |
|
@throws |
61 |
|
|
62 |
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 5 |
Complexity Density: 0.5 |
|
63 |
0
|
@Override... |
64 |
|
public void validateDeserialize(Class<?> clazz) |
65 |
|
throws SerializationException{ |
66 |
0
|
boolean throwedFromStandardSerializationPolicy = false; |
67 |
0
|
boolean throwedFromLegacySerializationPolicy = false; |
68 |
0
|
try{ |
69 |
0
|
super.validateDeserialize(clazz); |
70 |
|
}catch(SerializationException e){ |
71 |
0
|
throwedFromStandardSerializationPolicy = true; |
72 |
|
} |
73 |
0
|
try{ |
74 |
0
|
legacySerializationPolicy.validateDeserialize(clazz); |
75 |
|
}catch(SerializationException e){ |
76 |
0
|
throwedFromLegacySerializationPolicy = true; |
77 |
|
} |
78 |
|
|
79 |
0
|
if(throwedFromStandardSerializationPolicy && |
80 |
|
throwedFromLegacySerializationPolicy){ |
81 |
0
|
throw new SerializationException( |
82 |
|
"Type '" |
83 |
|
+ clazz.getName() |
84 |
|
+ "' was not included in the set of types which can be deserialized by this SerializationPolicy or its Class object could not be loaded. For security purposes, this type will not be deserialized."); |
85 |
|
} |
86 |
|
} |
87 |
|
|
88 |
|
|
89 |
|
|
90 |
|
|
91 |
|
|
92 |
|
@param |
93 |
|
@throws |
94 |
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 5 |
Complexity Density: 0.5 |
|
95 |
0
|
@Override... |
96 |
|
public void validateSerialize(Class<?> clazz) |
97 |
|
throws SerializationException{ |
98 |
0
|
boolean throwedFromStandardSerializationPolicy = false; |
99 |
0
|
boolean throwedFromLegacySerializationPolicy = false; |
100 |
0
|
try{ |
101 |
0
|
super.validateSerialize(clazz); |
102 |
|
}catch(SerializationException e){ |
103 |
0
|
throwedFromStandardSerializationPolicy = true; |
104 |
|
} |
105 |
0
|
try{ |
106 |
0
|
legacySerializationPolicy.validateSerialize(clazz); |
107 |
|
}catch(SerializationException e){ |
108 |
0
|
throwedFromLegacySerializationPolicy = true; |
109 |
|
} |
110 |
|
|
111 |
0
|
if(throwedFromStandardSerializationPolicy && |
112 |
|
throwedFromLegacySerializationPolicy){ |
113 |
0
|
throw new SerializationException( |
114 |
|
"Type '" |
115 |
|
+ clazz.getName() |
116 |
|
+ "' was not included in the set of types which can be serialized by this SerializationPolicy or its Class object could not be loaded. For security purposes, this type will not be serialized."); |
117 |
|
} |
118 |
|
} |
119 |
|
} |