Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
6328855: String: Matches hangs at short and easy Strings containing \…
…r \n

6192895: java.util.regex.Matcher: Performance issue
6345469: java.util.regex.Matcher utilizes 100% of the CPU
6988218: RegEx matcher loops
6693451: RegEx matcher goes into infinite delay
7006761: Matcher.matches() has infinite loop
8140212: Slow performance of Matcher.find
8151481: j.u.regex.Pattern cleanup
6609854: Regex does not match correctly for negative nested character classes
4916384: CANON_EQ supports only combining character sequences with non-spacing marks
4867170: Pattern doesn't work with composite character in CANON_EQ mode
6995635: CANON_EQ pattern flag is buggy
6728861: ExceptionInInitializerError is caught when the pattern has precomposed character
6736245: A character in Composition Exclusion Table does not match itself
7080302: the normalization in java regex pattern may have flaw

Reviewed-by: rriggs, okutsu, alanb
  • Loading branch information
Xueming Shen committed May 11, 2016
1 parent 772322c commit b45ea89
Show file tree
Hide file tree
Showing 10 changed files with 1,712 additions and 1,109 deletions.
Expand Up @@ -139,8 +139,6 @@ or dynamic (via a policy refresh) */
*/
final Key key = new Key();

private static final Debug debug = Debug.getInstance("domain");

/**
* Creates a new ProtectionDomain with the given CodeSource and
* Permissions. If the permissions object is not null, then
Expand Down Expand Up @@ -338,6 +336,13 @@ boolean impliesCreateAccessControlContext() {
" "+pc+"\n";
}

/*
* holder class for the static field "debug" to delay its initialization
*/
private static class DebugHolder {
private static final Debug debug = Debug.getInstance("domain");
}

/**
* Return true (merge policy permissions) in the following cases:
*
Expand All @@ -359,7 +364,7 @@ private static boolean seeAllp() {
if (sm == null) {
return true;
} else {
if (debug != null) {
if (DebugHolder.debug != null) {
if (sm.getClass().getClassLoader() == null &&
Policy.getPolicyNoCheck().getClass().getClassLoader()
== null) {
Expand Down
Expand Up @@ -62,8 +62,6 @@ public class SecureClassLoader extends ClassLoader {
private final Map<CodeSourceKey, ProtectionDomain> pdcache
= new ConcurrentHashMap<>(11);

private static final Debug debug = Debug.getInstance("scl");

static {
ClassLoader.registerAsParallelCapable();
}
Expand Down Expand Up @@ -202,6 +200,13 @@ protected PermissionCollection getPermissions(CodeSource codesource)
return new Permissions(); // ProtectionDomain defers the binding
}

/*
* holder class for the static field "debug" to delay its initialization
*/
private static class DebugHolder {
private static final Debug debug = Debug.getInstance("scl");
}

/*
* Returned cached ProtectionDomain for the specified CodeSource.
*/
Expand All @@ -222,9 +227,9 @@ public ProtectionDomain apply(CodeSourceKey key /* not used */) {
= SecureClassLoader.this.getPermissions(cs);
ProtectionDomain pd = new ProtectionDomain(
cs, perms, SecureClassLoader.this, null);
if (debug != null) {
debug.println(" getPermissions " + pd);
debug.println("");
if (DebugHolder.debug != null) {
DebugHolder.debug.println(" getPermissions " + pd);
DebugHolder.debug.println("");
}
return pd;
}
Expand Down

0 comments on commit b45ea89

Please sign in to comment.