User: oleg    
  Date: 00/10/05 08:54:04

  Modified:    src/main/org/jboss/security DatabaseRealmMapping.java
                        SimpleRealmMapping.java
  Log:
  If ejb-jar.xml didn't contain role definitions NullPointerException was thrown
  
  Revision  Changes    Path
  1.2       +5 -3      jboss/src/main/org/jboss/security/DatabaseRealmMapping.java
  
  Index: DatabaseRealmMapping.java
  ===================================================================
  RCS file: 
/products/cvs/ejboss/jboss/src/main/org/jboss/security/DatabaseRealmMapping.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DatabaseRealmMapping.java 2000/10/04 14:56:44     1.1
  +++ DatabaseRealmMapping.java 2000/10/05 15:54:03     1.2
  @@ -43,9 +43,11 @@
   public class DatabaseRealmMapping implements RealmMapping
   {
   
  -     public boolean doesUserHaveRole( Principal principal, Set roleNames )
  -     {
  +  public boolean doesUserHaveRole( Principal principal, Set roleNames )
  +  {
       Connection con = null;
  +    if (roleNames == null)
  +      return false;
       try
       {
         InitialContext initial = new InitialContext();
  @@ -85,6 +87,6 @@
       }
     }
   
  -     
  +    
   }
   
  
  
  
  1.2       +9 -7      jboss/src/main/org/jboss/security/SimpleRealmMapping.java
  
  Index: SimpleRealmMapping.java
  ===================================================================
  RCS file: 
/products/cvs/ejboss/jboss/src/main/org/jboss/security/SimpleRealmMapping.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SimpleRealmMapping.java   2000/08/06 21:52:14     1.1
  +++ SimpleRealmMapping.java   2000/10/05 15:54:03     1.2
  @@ -31,9 +31,9 @@
   import org.jboss.system.RealmMapping;
   
   /**
  - *   SimpleRealmMapping removes the level of indirection
  - *   in the specification between roles and principals/groups
  - *   for the standard "deploy without configuring"
  + *  SimpleRealmMapping removes the level of indirection
  + *  in the specification between roles and principals/groups
  + *  for the standard "deploy without configuring"
    *      
    *   @see EJBSecurityManager
    *   @author Daniel O'Connor [EMAIL PROTECTED]
  @@ -41,8 +41,10 @@
   public class SimpleRealmMapping implements RealmMapping
   {
   
  -     public boolean doesUserHaveRole( Principal principal, Set roleNames )
  -     {
  +  public boolean doesUserHaveRole( Principal principal, Set roleNames )
  +  {
  +    if (roleNames == null)
  +      return true;
       Iterator iter = roleNames.iterator();
       while (iter.hasNext())
       {
  @@ -51,7 +53,7 @@
           return true;
       }
       return false;
  -     }
  -     
  +  }
  +    
   }
   
  
  
  

Reply via email to