tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From funk...@apache.org
Subject cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/realm JNDIRealm.java
Date Fri, 08 Aug 2003 16:40:13 GMT
funkman     2003/08/08 09:40:13

  Modified:    catalina/src/share/org/apache/catalina/realm JNDIRealm.java
  Log:
  Fix bug 22236.
  
  addAttributeValues may return null. This could trigger a NPE
  if debugging was turned up >=2
  
  Also addAttributeValues() returns null if attrId or attrs is null while
  ignoring the third parameter "values". So always return
  values. I think this behavior is more consistent with the javadocs too.
  
  Revision  Changes    Path
  1.14      +14 -10    jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/realm/JNDIRealm.java
  
  Index: JNDIRealm.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/realm/JNDIRealm.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- JNDIRealm.java	6 Aug 2003 18:43:00 -0000	1.13
  +++ JNDIRealm.java	8 Aug 2003 16:40:13 -0000	1.14
  @@ -1304,11 +1304,15 @@
               list = addAttributeValues(roleName, attrs, list);
           }
   
  -        // Return the augmented list of roles
  +
           if (debug >= 2) {
  -            log("  Returning " + list.size() + " roles");
  -            for (int i=0; i<list.size(); i++)
  -                log(  "  Found role " + list.get(i));
  +            if (list != null) {
  +                log("  Returning " + list.size() + " roles");
  +                for (int i=0; i<list.size(); i++)
  +                    log(  "  Found role " + list.get(i));
  +            } else {
  +                log("  getRoles about to return null ");
  +            }
           }
   
           return (list);
  @@ -1366,12 +1370,12 @@
           if (debug >= 3)
               log("  retrieving values for attribute " + attrId);
           if (attrId == null || attrs == null)
  -            return null;
  +            return values;
           if (values == null)
               values = new ArrayList();
           Attribute attr = attrs.get(attrId);
           if (attr == null)
  -            return (null);
  +            return (values);
           NamingEnumeration e = attr.getAll();
           while(e.hasMore()) {
               String value = (String)e.next();
  
  
  

Mime
View raw message