felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r903208 - /felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ResourceBundleCache.java
Date Tue, 26 Jan 2010 13:02:57 GMT
Author: fmeschbe
Date: Tue Jan 26 13:02:57 2010
New Revision: 903208

URL: http://svn.apache.org/viewvc?rev=903208&view=rev
Log:
Prevent NullPointerException if the bundle has no locale properties file

Modified:
    felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ResourceBundleCache.java

Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ResourceBundleCache.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ResourceBundleCache.java?rev=903208&r1=903207&r2=903208&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ResourceBundleCache.java
(original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ResourceBundleCache.java
Tue Jan 26 13:02:57 2010
@@ -122,17 +122,20 @@
             HashMap resourceBundleEntries = new HashMap();
 
             Enumeration locales = bundle.findEntries( path, fileName + "*.properties", false
);
-            while ( locales.hasMoreElements() )
+            if ( locales != null )
             {
-                URL entry = ( URL ) locales.nextElement();
+                while ( locales.hasMoreElements() )
+                {
+                    URL entry = ( URL ) locales.nextElement();
+
+                    // calculate the key
+                    String entryPath = entry.getPath();
+                    final int start = 1 + file.length(); // leading slash
+                    final int end = entryPath.length() - 11; // .properties suffix
+                    entryPath = entryPath.substring( start, end );
 
-                // calculate the key
-                String entryPath = entry.getPath();
-                final int start = 1 + file.length(); // leading slash
-                final int end = entryPath.length() - 11; // .properties suffix
-                entryPath = entryPath.substring( start, end );
-
-                resourceBundleEntries.put( entryPath, entry );
+                    resourceBundleEntries.put( entryPath, entry );
+                }
             }
 
             this.resourceBundleEntries = resourceBundleEntries;



Mime
View raw message