FELIX-2198 Prevent NullPointerException if ConfigurationAdmin service is not running.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@922246 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigManager.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigManager.java
index fb8e90a..fb9d031 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigManager.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigManager.java
@@ -284,30 +284,27 @@
final Locale loc = getLocale( request );
final String locale = ( loc != null ) ? loc.toString() : null;
-
+
JSONObject json = new JSONObject();
try
{
json.put("status", ca != null ? Boolean.TRUE : Boolean.FALSE);
- listConfigurations(json, ca, pidFilter, locale, loc);
- listFactoryConfigurations(json, pidFilter, locale);
+ if ( ca != null )
+ {
+ listConfigurations( json, ca, pidFilter, locale, loc );
+ listFactoryConfigurations( json, pidFilter, locale );
+ }
}
catch (JSONException e)
{
throw new IOException(e.toString());
}
-
+
// if a configuration is addressed, display it immediately
- final Configuration config;
if ( request.getParameter( "create" ) != null && pid != null )
{
- config = new PlaceholderConfiguration( pid );
- pid = config.getPid();
- }
- else
- {
- config = getConfiguration( ca, pid );
+ pid = new PlaceholderConfiguration( pid ).getPid();
}
@@ -709,7 +706,7 @@
}
else if ( value.getClass().isArray() )
{
- if ( value.getClass().getComponentType().isPrimitive() )
+ if ( value.getClass().getComponentType().isPrimitive() )
{
final int len = Array.getLength(value);
final Object[] tmp = new Object[len];