felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r918449 - in /felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal: core/UpdateHelper.java obr/BundleRepositoryRender.java
Date Wed, 03 Mar 2010 12:46:45 GMT
Author: fmeschbe
Date: Wed Mar  3 12:46:44 2010
New Revision: 918449

URL: http://svn.apache.org/viewvc?rev=918449&view=rev
Log:
FELIX-2119 Prevent ClassDefNotFoundException if OBR API is not available: Use constant string
for service name instead of PackageAdmin.class expression, which requires the class to load

Modified:
    felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/UpdateHelper.java
    felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/obr/BundleRepositoryRender.java

Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/UpdateHelper.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/UpdateHelper.java?rev=918449&r1=918448&r2=918449&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/UpdateHelper.java
(original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/UpdateHelper.java
Wed Mar  3 12:46:44 2010
@@ -38,6 +38,10 @@
 abstract class UpdateHelper extends BaseUpdateInstallHelper
 {
 
+    // Define a constant of that name to prevent NoClassDefFoundError in
+    // updateFromOBR trying to load the class with RepositoryAdmin.class
+    private static final String REPOSITORY_ADMIN_NAME = "org.osgi.service.obr.RepositoryAdmin";
+
     private final Bundle bundle;
 
 
@@ -128,7 +132,7 @@
 
     private boolean updateFromOBR()
     {
-        RepositoryAdmin ra = ( RepositoryAdmin ) getService( RepositoryAdmin.class.getName()
);
+        RepositoryAdmin ra = ( RepositoryAdmin ) getService( REPOSITORY_ADMIN_NAME );
         if ( ra != null )
         {
             getLog().log( LogService.LOG_DEBUG, "Trying to update from OSGi Bundle Repository"
);
@@ -179,7 +183,7 @@
         }
         else
         {
-            getLog().log( LogService.LOG_DEBUG, "Cannot updated from OSGi Bundle Repository:
Service not available" );
+            getLog().log( LogService.LOG_INFO, "Cannot update from OSGi Bundle Repository:
Service not available" );
         }
 
         // fallback to false, nothing done

Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/obr/BundleRepositoryRender.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/obr/BundleRepositoryRender.java?rev=918449&r1=918448&r2=918449&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/obr/BundleRepositoryRender.java
(original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/obr/BundleRepositoryRender.java
Wed Mar  3 12:46:44 2010
@@ -49,6 +49,10 @@
     private static final String TITLE = "OSGi Repository";
     private static final String[] CSS = null;
 
+    // Define a constant of that name to prevent NoClassDefFoundError in
+    // updateFromOBR trying to load the class with RepositoryAdmin.class
+    private static final String REPOSITORY_ADMIN_NAME = "org.osgi.service.obr.RepositoryAdmin";
+
     // templates
     private final String TEMPLATE;
 
@@ -115,7 +119,7 @@
     {
         try
         {
-            return (RepositoryAdmin) super.getService(RepositoryAdmin.class.getName());
+            return ( RepositoryAdmin ) super.getService( REPOSITORY_ADMIN_NAME );
         }
         catch (Throwable t)
         {



Mime
View raw message