Author: davsclaus
Date: Thu Feb  3 05:39:57 2011
New Revision: 1066734

URL: http://svn.apache.org/viewvc?rev=1066734&view=rev
Log:
Fixed CS.

Modified:
    
camel/trunk/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiDefaultCamelContext.java
    
camel/trunk/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/utils/BundleContextUtils.java

Modified: 
camel/trunk/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiDefaultCamelContext.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiDefaultCamelContext.java?rev=1066734&r1=1066733&r2=1066734&view=diff
==============================================================================
--- 
camel/trunk/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiDefaultCamelContext.java
 (original)
+++ 
camel/trunk/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiDefaultCamelContext.java
 Thu Feb  3 05:39:57 2011
@@ -49,7 +49,7 @@ public class OsgiDefaultCamelContext ext
 
     @Override
     protected TypeConverter createTypeConverter() {
-               // CAMEL-3614: make sure we use a bundle context which imports 
org.apache.camel.impl.converter package
+        // CAMEL-3614: make sure we use a bundle context which imports 
org.apache.camel.impl.converter package
         BundleContext ctx = BundleContextUtils.getBundleContext(getClass());
         if (ctx == null) {
             ctx = bundleContext;

Modified: 
camel/trunk/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/utils/BundleContextUtils.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/utils/BundleContextUtils.java?rev=1066734&r1=1066733&r2=1066734&view=diff
==============================================================================
--- 
camel/trunk/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/utils/BundleContextUtils.java
 (original)
+++ 
camel/trunk/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/utils/BundleContextUtils.java
 Thu Feb  3 05:39:57 2011
@@ -24,7 +24,10 @@ import org.osgi.framework.BundleContext;
 /**
  * Helper class
  */
-public class BundleContextUtils {
+public final class BundleContextUtils {
+
+    private BundleContextUtils() {
+    }
 
     /**
      * Retrieve the BundleContext that the given class has been loaded from.
@@ -32,13 +35,12 @@ public class BundleContextUtils {
      * @param clazz the class to find the bundle context from
      * @return the bundle context or <code>null</code> if it can't be found
      */
-    public static final BundleContext getBundleContext(Class clazz) {
-        //
+    public static BundleContext getBundleContext(Class clazz) {
+
         // Ideally we should use 
FrameworkUtil.getBundle(clazz).getBundleContext()
         // but that does not exist in OSGi 4.1, so until we upgrade, we keep 
that one
-        //
-        try
-        {
+
+        try {
             ClassLoader cl = clazz.getClassLoader();
             Class clClazz = cl.getClass();
             Method mth = null;
@@ -55,11 +57,11 @@ public class BundleContextUtils {
                 mth.setAccessible(true);
                 return ((Bundle) mth.invoke(cl)).getBundleContext();
             }
-        }
-        catch (Throwable t)
-        {
+        } catch (Throwable t) {
             // Ignore
         }
+
         return null;
     }
+
 }


Reply via email to