classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cp-patches]: Patch: UIDefaults fix


From: Meskauskas Audrius
Subject: Re: [cp-patches]: Patch: UIDefaults fix
Date: Thu, 13 Oct 2005 11:40:27 +0200
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

Surely. Class.forName uses the class loader of the current class. As the core class was loaded by the system class loader, it will not find the user code. getSystemClassLoader returns the different loader that has loaded the application, same as the default Thread.getConextClassLoader() that I would use in this case. I have just posted the related message into Classpath discussion list.

Lillian Angel wrote:

When running applications that have their own UI's created, I was
getting exceptions all the time. Tom Tromey suggested this fix a while
back, and it has seemed to fix the problem every time. It has not had
any adverse side effects either.

2005-10-12  Lillian Angel  <address@hidden>

       * javax/swing/UIDefaults.java
       (getUIClass): Fixed to use the system class loader if
       the loader is null.

------------------------------------------------------------------------

Index: javax/swing/UIDefaults.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/UIDefaults.java,v
retrieving revision 1.23
diff -u -r1.23 UIDefaults.java
--- javax/swing/UIDefaults.java 28 Sep 2005 14:53:40 -0000      1.23
+++ javax/swing/UIDefaults.java 12 Oct 2005 20:19:20 -0000
@@ -674,9 +674,9 @@
      return null;
try {
-        if (loader != null)
- return loader.loadClass (className); - return Class.forName (className);
+        if (loader == null)
+          loader = ClassLoader.getSystemClassLoader();
+        return loader.loadClass (className);
      }
    catch (Exception e)
      {
------------------------------------------------------------------------

_______________________________________________
Classpath-patches mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/classpath-patches





reply via email to

[Prev in Thread] Current Thread [Next in Thread]