|
@@ -216,28 +216,43 @@ public class ApplicationClassLoader extends URLClassLoader {
|
|
return c;
|
|
return c;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Checks if a class should be included as a system class.
|
|
|
|
+ *
|
|
|
|
+ * A class is a system class if and only if it matches one of the positive
|
|
|
|
+ * patterns and none of the negative ones.
|
|
|
|
+ *
|
|
|
|
+ * @param name the class name to check
|
|
|
|
+ * @param systemClasses a list of system class configurations.
|
|
|
|
+ * @return true if the class is a system class
|
|
|
|
+ */
|
|
public static boolean isSystemClass(String name, List<String> systemClasses) {
|
|
public static boolean isSystemClass(String name, List<String> systemClasses) {
|
|
|
|
+ boolean result = false;
|
|
if (systemClasses != null) {
|
|
if (systemClasses != null) {
|
|
String canonicalName = name.replace('/', '.');
|
|
String canonicalName = name.replace('/', '.');
|
|
while (canonicalName.startsWith(".")) {
|
|
while (canonicalName.startsWith(".")) {
|
|
canonicalName=canonicalName.substring(1);
|
|
canonicalName=canonicalName.substring(1);
|
|
}
|
|
}
|
|
for (String c : systemClasses) {
|
|
for (String c : systemClasses) {
|
|
- boolean result = true;
|
|
|
|
|
|
+ boolean shouldInclude = true;
|
|
if (c.startsWith("-")) {
|
|
if (c.startsWith("-")) {
|
|
c = c.substring(1);
|
|
c = c.substring(1);
|
|
- result = false;
|
|
|
|
|
|
+ shouldInclude = false;
|
|
}
|
|
}
|
|
if (canonicalName.startsWith(c)) {
|
|
if (canonicalName.startsWith(c)) {
|
|
if ( c.endsWith(".") // package
|
|
if ( c.endsWith(".") // package
|
|
|| canonicalName.length() == c.length() // class
|
|
|| canonicalName.length() == c.length() // class
|
|
|| canonicalName.length() > c.length() // nested
|
|
|| canonicalName.length() > c.length() // nested
|
|
&& canonicalName.charAt(c.length()) == '$' ) {
|
|
&& canonicalName.charAt(c.length()) == '$' ) {
|
|
- return result;
|
|
|
|
|
|
+ if (shouldInclude) {
|
|
|
|
+ result = true;
|
|
|
|
+ } else {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- return false;
|
|
|
|
|
|
+ return result;
|
|
}
|
|
}
|
|
-}
|
|
|
|
|
|
+}
|