Created
September 13, 2010 19:04
-
-
Save gnodet/577818 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/exception/src/main/java/java/lang/Exception.java b/exception/src/main/java/java/lang/Exception.java | |
index db67518..6ed84ea 100644 | |
--- a/exception/src/main/java/java/lang/Exception.java | |
+++ b/exception/src/main/java/java/lang/Exception.java | |
@@ -30,7 +30,7 @@ package java.lang; | |
public class Exception extends Throwable { | |
private static final long serialVersionUID = -3387516993124229948L; | |
- private transient Class[] classContext = sm.getThrowableContext(this); | |
+ private transient Class[] classContext = getSm().getThrowableContext(this); | |
/** | |
* Constructs a new {@code Exception} that includes the current stack trace. | |
@@ -78,9 +78,16 @@ public class Exception extends Throwable { | |
return classContext; | |
} | |
- private static final SecurityManagerEx sm = new SecurityManagerEx(); | |
+ private static volatile SecurityManagerEx sm; | |
- static class SecurityManagerEx extends SecurityManager | |
+ private static SecurityManagerEx getSm() { | |
+ if (sm == null) { | |
+ sm = new SecurityManagerEx(); | |
+ } | |
+ return sm; | |
+ } | |
+ | |
+ private static class SecurityManagerEx extends SecurityManager | |
{ | |
public Class[] getClassContext() | |
{ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment