Patch: issue RT-14177

Florian Brunner fbrunner at gmx.ch
Thu Apr 5 08:57:02 PDT 2012


The patch attachement has been filtered by the mailing list. What is the best way to submit a patch?

diff -r 4d1d81b2c178 javafx-ui-controls/src/javafx/scene/control/Control.java
--- a/javafx-ui-controls/src/javafx/scene/control/Control.java	Wed Mar 28 12:38:20 2012 -0700
+++ b/javafx-ui-controls/src/javafx/scene/control/Control.java	Thu Apr 05 17:35:09 2012 +0200
@@ -968,10 +968,14 @@
             try {
                 skinClass = Class.forName(skinClassName.get());
             } catch (ClassNotFoundException clne) {
-                if (Thread.currentThread().getContextClassLoader() != null) {
-                    skinClass = Thread.currentThread().getContextClassLoader().loadClass(skinClassName.get());
-                } else {
-                    throw clne;
+                try {
+                    skinClass = loadClass(getClass(), skinClassName.get());
+                } catch (ClassNotFoundException clne2) {
+                    if (Thread.currentThread().getContextClassLoader() != null) {
+                        skinClass = Thread.currentThread().getContextClassLoader().loadClass(skinClassName.get());
+                    } else {
+                        throw clne2;
+                    }
                 }
             }
             
@@ -1032,7 +1036,22 @@
 
     }
 
-    
+    private Class<?> loadClass(Class<?> type, String className) throws ClassNotFoundException {
+        Class<?> currentType = type;
+        if (currentType == null) {
+            throw new IllegalArgumentException("Type must not be null!");
+        }
+        ClassNotFoundException ex = null;
+        while (currentType != null) {
+            try {
+                return currentType.getClassLoader().loadClass(className);
+            } catch (ClassNotFoundException cnfe) {
+                ex = cnfe;
+                currentType = currentType.getSuperclass();
+            }
+        }
+        throw ex;
+    }
     
     /***************************************************************************
      *                                                                         *

 
Am Donnerstag 05 April 2012, 17:50:13 schrieb Florian Brunner:
> Hi,
> 
> Let me introduce myself: my name is Florian Brunner and I'm a Senior Software Engineer from Switzerland.
> 
> I started to use JavaFX in an OSGi environment. Now I stumbled over the following issue, which blocks me:
> http://javafx-jira.kenai.com/browse/RT-14177
> 
> I have written a patch now. It probably doesn't solve the whole issue, but at least it unblocks me for now.
> 
> It would be great if you could integrate it.
> 
> Note that I contributed to OpenJDK before (Swing) and have signed the Sun Contributor Agreement:
> 
> http://www.oracle.com/technetwork/community/oca-486395.html#b
> Florian Brunner - java.net - puce
> 
> Regards,
> Florian
> 



More information about the openjfx-dev mailing list