Author: markt
Date: Mon Jun 15 17:22:05 2015
New Revision: 1685637
URL: http://svn.apache.org/r1685637
Log:
Trivial clean-up.
Based on a patch by fjodorver
Modified:
tomcat/trunk/java/javax/security/auth/message/config/AuthConfigFactory.java
Modified:
tomcat/trunk/java/javax/security/auth/message/config/AuthConfigFactory.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/javax/security/auth/message/config/AuthConfigFactory.java?rev=1685637&r1=1685636&r2=1685637&view=diff
==============================================================================
--- tomcat/trunk/java/javax/security/auth/message/config/AuthConfigFactory.java
(original)
+++ tomcat/trunk/java/javax/security/auth/message/config/AuthConfigFactory.java
Mon Jun 15 17:22:05 2015
@@ -66,30 +66,33 @@ public abstract class AuthConfigFactory
public static synchronized AuthConfigFactory getFactory() {
checkPermission(getFactorySecurityPermission);
- if (factory == null) {
- final String className = getFactoryClassName();
- try {
- factory = AccessController.doPrivileged(
- new PrivilegedExceptionAction<AuthConfigFactory>() {
- @Override
- public AuthConfigFactory run() throws
ClassNotFoundException,
- InstantiationException, IllegalAccessException {
- // TODO Review this
- Class<?> clazz = Class.forName(className, true,
contextClassLoader);
- return (AuthConfigFactory) clazz.newInstance();
- }
- });
- } catch (PrivilegedActionException e) {
- Exception inner = e.getException();
- if (inner instanceof InstantiationException) {
- throw (SecurityException) new
SecurityException("AuthConfigFactory error:"
- +
inner.getCause().getMessage()).initCause(inner.getCause());
- } else {
- throw (SecurityException) new SecurityException(
- "AuthConfigFactory error: " +
inner).initCause(inner);
+ if (factory != null) {
+ return factory;
+ }
+
+ final String className = getFactoryClassName();
+ try {
+ factory = AccessController.doPrivileged(
+ new PrivilegedExceptionAction<AuthConfigFactory>() {
+ @Override
+ public AuthConfigFactory run() throws ClassNotFoundException,
+ InstantiationException, IllegalAccessException {
+ // TODO Review this
+ Class<?> clazz = Class.forName(className, true,
contextClassLoader);
+ return (AuthConfigFactory) clazz.newInstance();
}
+ });
+ } catch (PrivilegedActionException e) {
+ Exception inner = e.getException();
+ if (inner instanceof InstantiationException) {
+ throw (SecurityException) new
SecurityException("AuthConfigFactory error:" +
+
inner.getCause().getMessage()).initCause(inner.getCause());
+ } else {
+ throw (SecurityException) new SecurityException(
+ "AuthConfigFactory error: " + inner).initCause(inner);
}
}
+
return factory;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]