felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r957859 - in /felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal: compendium/WireAdminConfigurationPrinter.java core/PermissionsConfigurationPrinter.java misc/ConfigurationRender.java
Date Fri, 25 Jun 2010 09:17:07 GMT
Author: fmeschbe
Date: Fri Jun 25 09:17:06 2010
New Revision: 957859

URL: http://svn.apache.org/viewvc?rev=957859&view=rev
Log:
FELIX-2448 Prevent WireAdmin and PermissionAdmin plugins from corrupting the Configuration
Render output and improve Configuration Render to log ConfigurationPrinter failure instead
of failing

Modified:
    felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/WireAdminConfigurationPrinter.java
    felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/PermissionsConfigurationPrinter.java
    felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ConfigurationRender.java

Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/WireAdminConfigurationPrinter.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/WireAdminConfigurationPrinter.java?rev=957859&r1=957858&r2=957859&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/WireAdminConfigurationPrinter.java
(original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/WireAdminConfigurationPrinter.java
Fri Jun 25 09:17:06 2010
@@ -31,7 +31,7 @@ import org.osgi.service.wireadmin.Wire;
 import org.osgi.service.wireadmin.WireAdmin;
 
 /**
- * WireAdminConfigurationPrinter reads the configured wires in WireAdmin service, and 
+ * WireAdminConfigurationPrinter reads the configured wires in WireAdmin service, and
  * prints them along their properties and values.
  */
 public final class WireAdminConfigurationPrinter extends AbstractConfigurationPrinter
@@ -39,6 +39,9 @@ public final class WireAdminConfiguratio
 
     private static final String TITLE = "Wire Admin";
 
+    private static final String WIRE_ADMIN_NAME = "org.osgi.service.wireadmin.WireAdmin";
+
+
     /**
      * @see org.apache.felix.webconsole.ConfigurationPrinter#getTitle()
      */
@@ -53,7 +56,7 @@ public final class WireAdminConfiguratio
     public final void printConfiguration(PrintWriter pw)
     {
         final BundleContext bc = getBundleContext();
-        final ServiceReference ref = bc.getServiceReference(WireAdmin.class.getName());
+        final ServiceReference ref = bc.getServiceReference( WIRE_ADMIN_NAME );
         final WireAdmin wireAdmin = (WireAdmin) (ref != null ? bc.getService(ref) : null);
 
         try

Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/PermissionsConfigurationPrinter.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/PermissionsConfigurationPrinter.java?rev=957859&r1=957858&r2=957859&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/PermissionsConfigurationPrinter.java
(original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/PermissionsConfigurationPrinter.java
Fri Jun 25 09:17:06 2010
@@ -31,7 +31,7 @@ import org.osgi.service.permissionadmin.
 import org.osgi.service.permissionadmin.PermissionInfo;
 
 /**
- * PermissionsPrinter reads the given permissions from PermissionAdmin and 
+ * PermissionsPrinter reads the given permissions from PermissionAdmin and
  * ConditionalPermissionAdmin and prints them.
  */
 public final class PermissionsConfigurationPrinter extends AbstractConfigurationPrinter
@@ -39,6 +39,11 @@ public final class PermissionsConfigurat
 
     private static final String TITLE = "Permissions";
 
+    private static final String PERMISSION_ADMIN_NAME = "org.osgi.service.permissionadmin.PermissionAdmin";
+
+    private static final String CONDITIONAL_PERMISSION_ADMIN_NAME = "org.osgi.service.condpermadmin.ConditionalPermissionAdmin";
+
+
     /**
      * @see org.apache.felix.webconsole.ConfigurationPrinter#getTitle()
      */
@@ -53,8 +58,8 @@ public final class PermissionsConfigurat
     public final void printConfiguration(PrintWriter pw)
     {
         final BundleContext bc = getBundleContext();
-        final ServiceReference paRef = bc.getServiceReference(PermissionAdmin.class.getName());
-        final ServiceReference cpaRef = bc.getServiceReference(ConditionalPermissionAdmin.class.getName());
+        final ServiceReference paRef = bc.getServiceReference( PERMISSION_ADMIN_NAME );
+        final ServiceReference cpaRef = bc.getServiceReference( CONDITIONAL_PERMISSION_ADMIN_NAME
);
         final PermissionAdmin pa = paRef != null ? (PermissionAdmin) bc.getService(paRef)
             : null;
         final ConditionalPermissionAdmin cpa = cpaRef != null ? (ConditionalPermissionAdmin)
bc.getService(cpaRef)

Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ConfigurationRender.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ConfigurationRender.java?rev=957859&r1=957858&r2=957859&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ConfigurationRender.java
(original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ConfigurationRender.java
Fri Jun 25 09:17:06 2010
@@ -339,13 +339,23 @@ public class ConfigurationRender extends
     {
         pw.title( desc.title );
         final ConfigurationPrinter cp = desc.printer;
-        if ( cp instanceof ModeAwareConfigurationPrinter )
+        try
         {
-            ( ( ModeAwareConfigurationPrinter ) cp ).printConfiguration( pw, mode );
+            if ( cp instanceof ModeAwareConfigurationPrinter )
+            {
+                ( ( ModeAwareConfigurationPrinter ) cp ).printConfiguration( pw, mode );
+            }
+            else
+            {
+                cp.printConfiguration( pw );
+            }
         }
-        else
+        catch ( Throwable t )
         {
-            cp.printConfiguration( pw );
+            pw.println();
+            pw.println( "Configuration Printer failed: " + t.toString() );
+            pw.println();
+            log( "Configuration Printer " + desc.title + " (" + cp.getClass() + ") failed",
t );
         }
         pw.end();
     }



Mime
View raw message