Author: markt
Date: Mon Nov 20 13:10:15 2017
New Revision: 1815802
URL: http://svn.apache.org/viewvc?rev=1815802&view=rev
Log:
Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=61779
Avoid a NullPointerException when a null RegistrationListener is passed to
AuthConfigFactory.getConfigProvider()
Patch provided by Lazar.
Modified:
tomcat/trunk/java/org/apache/catalina/authenticator/jaspic/AuthConfigFactoryImpl.java
tomcat/trunk/test/org/apache/catalina/authenticator/jaspic/TestAuthConfigFactoryImpl.java
tomcat/trunk/webapps/docs/changelog.xml
Modified:
tomcat/trunk/java/org/apache/catalina/authenticator/jaspic/AuthConfigFactoryImpl.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/authenticator/jaspic/AuthConfigFactoryImpl.java?rev=1815802&r1=1815801&r2=1815802&view=diff
==============================================================================
---
tomcat/trunk/java/org/apache/catalina/authenticator/jaspic/AuthConfigFactoryImpl.java
(original)
+++
tomcat/trunk/java/org/apache/catalina/authenticator/jaspic/AuthConfigFactoryImpl.java
Mon Nov 20 13:10:15 2017
@@ -75,9 +75,11 @@ public class AuthConfigFactoryImpl exten
RegistrationContextImpl registrationContext =
findRegistrationContextImpl(layer, appContext);
if (registrationContext != null) {
- RegistrationListenerWrapper wrapper = new
RegistrationListenerWrapper(
- layer, appContext, listener);
- registrationContext.addListener(wrapper);
+ if (listener != null) {
+ RegistrationListenerWrapper wrapper = new
RegistrationListenerWrapper(
+ layer, appContext, listener);
+ registrationContext.addListener(wrapper);
+ }
return registrationContext.getProvider();
}
return null;
Modified:
tomcat/trunk/test/org/apache/catalina/authenticator/jaspic/TestAuthConfigFactoryImpl.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/authenticator/jaspic/TestAuthConfigFactoryImpl.java?rev=1815802&r1=1815801&r2=1815802&view=diff
==============================================================================
---
tomcat/trunk/test/org/apache/catalina/authenticator/jaspic/TestAuthConfigFactoryImpl.java
(original)
+++
tomcat/trunk/test/org/apache/catalina/authenticator/jaspic/TestAuthConfigFactoryImpl.java
Mon Nov 20 13:10:15 2017
@@ -274,6 +274,19 @@ public class TestAuthConfigFactoryImpl {
}
+ @Test
+ public void testRegistrationNullListener() {
+ AuthConfigFactory factory = new AuthConfigFactoryImpl();
+ AuthConfigProvider acp1 = new SimpleAuthConfigProvider(null, null);
+ String registrationId = factory.registerConfigProvider(acp1, "L_1",
"AC_1", null);
+
+ factory.getConfigProvider("L_1", "AC_1", null);
+
+ boolean result = factory.removeRegistration(registrationId);
+ Assert.assertTrue(result);
+ }
+
+
private static class SimpleRegistrationListener implements
RegistrationListener {
private final String layer;
Modified: tomcat/trunk/webapps/docs/changelog.xml
URL:
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1815802&r1=1815801&r2=1815802&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Mon Nov 20 13:10:15 2017
@@ -91,6 +91,12 @@
<bug>61778</bug>: Correct the return value when detaching a JASPIC
<code>RegistrationListener</code>. Patch provided by Lazar. (markt)
</fix>
+ <fix>
+ <bug>61779</bug>: Avoid a <code>NullPointerException</code> when a
+ <code>null</code> <code>RegistrationListener</code> is passed to
+ <code>AuthConfigFactory.getConfigProvider()</code>. Patch provided by
+ Lazar. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]