Prevent NullPointerException if the bundle has no locale properties file
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@903208 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ResourceBundleCache.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ResourceBundleCache.java
index 5bf3f91..6ac874f 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ResourceBundleCache.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ResourceBundleCache.java
@@ -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;