File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
gwtmockito/src/main/java/com/google/gwtmockito Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -26,11 +26,14 @@ public static void cleanUpThreadLocalValues(ClassLoader classLoader) {
26
26
if (mapEntry != null && mapEntry .get () != null ) {
27
27
ClassLoader mapEntryKeyClassLoader = mapEntry .get ().getClass ().getClassLoader ();
28
28
Field mapEntryValueField = getPrivateAttributeAccessibleField (mapEntry .getClass (), "value" );
29
- ClassLoader mapEntryValueClassLoader = mapEntryValueField .get (mapEntry ).getClass ().getClassLoader ();
30
- if (mapEntryKeyClassLoader == classLoader || mapEntryValueClassLoader == classLoader ) {
31
- mapEntry .clear ();
32
- mapEntryValueField .set (mapEntry , null );
33
- // The ThreadLocalMap is able to expunge the remaining stale entries, no need to remove it from the map
29
+ Object value = mapEntryValueField .get (mapEntry );
30
+ if (value != null ) {
31
+ ClassLoader mapEntryValueClassLoader = value .getClass ().getClassLoader ();
32
+ if (mapEntryKeyClassLoader == classLoader || mapEntryValueClassLoader == classLoader ) {
33
+ mapEntry .clear ();
34
+ mapEntryValueField .set (mapEntry , null );
35
+ // The ThreadLocalMap is able to expunge the remaining stale entries, no need to remove it from the map
36
+ }
34
37
}
35
38
}
36
39
}
You can’t perform that action at this time.
0 commit comments