Author: gnodet
Date: Mon May 17 11:19:24 2010
New Revision: 945085
URL: http://svn.apache.org/viewvc?rev=945085&view=rev
Log:
FELIX-2326: NullPointerException thrown from PropertiesLoginModule if a user
doesn't exist in the properties file
Modified:
felix/trunk/karaf/jaas/modules/src/main/java/org/apache/felix/karaf/jaas/modules/properties/PropertiesLoginModule.java
Modified:
felix/trunk/karaf/jaas/modules/src/main/java/org/apache/felix/karaf/jaas/modules/properties/PropertiesLoginModule.java
URL:
http://svn.apache.org/viewvc/felix/trunk/karaf/jaas/modules/src/main/java/org/apache/felix/karaf/jaas/modules/properties/PropertiesLoginModule.java?rev=945085&r1=945084&r2=945085&view=diff
==============================================================================
---
felix/trunk/karaf/jaas/modules/src/main/java/org/apache/felix/karaf/jaas/modules/properties/PropertiesLoginModule.java
(original)
+++
felix/trunk/karaf/jaas/modules/src/main/java/org/apache/felix/karaf/jaas/modules/properties/PropertiesLoginModule.java
Mon May 17 11:19:24 2010
@@ -93,13 +93,19 @@ public class PropertiesLoginModule imple
tmpPassword = new char[0];
}
- String userInfos = (String) users.get(user);
+ String userInfos = null;
+
+ try {
+ userInfos = (String) users.get(user);
+ } catch (NullPointerException e) {
+ //error handled in the next statement
+ }
if (userInfos == null) {
- throw new FailedLoginException("User does not exist");
+ throw new FailedLoginException("User " + user + " does not exist");
}
String[] infos = userInfos.split(",");
if (!new String(tmpPassword).equals(infos[0])) {
- throw new FailedLoginException("Password does not match");
+ throw new FailedLoginException("Password for " + user + " does not
match");
}
principals = new HashSet<Principal>();
@@ -111,7 +117,7 @@ public class PropertiesLoginModule imple
users.clear();
if (debug) {
- LOG.debug("login " + user);
+ LOG.debug("Successfully logged in " + user);
}
return true;
}