import java.io.OutputStream;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
+import java.net.URL;
+import java.security.CodeSource;
+import java.security.ProtectionDomain;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.regex.Pattern;\r
-\r
+
import junit.framework.TestCase;\r
+
import org.junit.Test;\r
import org.junit.internal.TextListener;\r
import org.junit.runner.JUnitCore;import org.junit.runner.Result;
Vector<Class<?>> classes = (Vector<Class<?>>) _classes.get(appLoader);
Map<String, Class<?>> map = new HashMap<String, Class<?>>();
for (Class<?> cls : classes) {
- // e.g. proxy-classes, ...
- if(cls.getProtectionDomain() == null ||
- cls.getProtectionDomain().getCodeSource() == null) {
- continue;
- }
-
- String jar = cls.getProtectionDomain().getCodeSource().getLocation().toString();
- if(jar.indexOf(ptrn) != -1) map.put(cls.getName(), cls);
+ // e.g. proxy-classes, ...
+ ProtectionDomain pd = cls.getProtectionDomain();
+ if (pd == null) continue;
+ CodeSource cs = pd.getCodeSource();
+ if (cs == null) continue;
+ URL loc = cs.getLocation();
+ if (loc == null) continue;
+
+ String jar = loc.toString();
+ if(jar.indexOf(ptrn) != -1) map.put(cls.getName(), cls);
}
return map;
} catch (IllegalAccessException e) {