User: starksm 
  Date: 01/04/23 09:17:33

  Modified:    src/main/org/jboss/security/auth/spi
                        UsersRolesLoginModule.java
  Log:
  Clean up properties file loading to avoid NPEs
  
  Revision  Changes    Path
  1.4       +8 -4      
jbosssx/src/main/org/jboss/security/auth/spi/UsersRolesLoginModule.java
  
  Index: UsersRolesLoginModule.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jbosssx/src/main/org/jboss/security/auth/spi/UsersRolesLoginModule.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- UsersRolesLoginModule.java        2001/04/13 20:04:54     1.3
  +++ UsersRolesLoginModule.java        2001/04/23 16:17:33     1.4
  @@ -182,17 +182,21 @@
       private Properties LoadProperties(String propertiesName) throws IOException
       {
         Properties bundle = null;
  -      InputStream is 
=Thread.currentThread().getContextClassLoader().getResource(propertiesName).openStream();
  -
  -      if (null != is)
  +      ClassLoader loader = Thread.currentThread().getContextClassLoader();
  +      URL url = loader.getResource(propertiesName);
  +      if( url == null )
  +          throw new IOException("Properties file " + propertiesName + " not found");
  +      InputStream is = url.openStream();
  +      if( is != null )
         {
            bundle = new Properties();
            bundle.load(is);
         }
         else
         {
  -         throw new IOException("Properties file " + propertiesName + " not found");
  +         throw new IOException("Properties file " + propertiesName + " not 
avilable");
         }
         return bundle;
       }
   }
  +
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to