Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4391364

javax.swing.UIDefaults.ProxyLazyValue.createValue() can not load user classes

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 1.3.0
    • client-libs



      Name: krC82822 Date: 11/21/2000


      21 Nov 2000, eval1127@eng -- reproducible with 1.3.0 on Solaris.

      java version "1.3.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
      Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)

      The method
          createValue()
      of class
          javax.swing.UIDefaults.ProxyLazyValue

      can not load user classes, that are not included in the Java runtime libraries.
      The user class is surely accessible, but for some strange reasons
      ProxyLazyValue.createValue() raises java.lang.ClassNotFoundException.

      In the following demo, it's obvious that java.lang.Math.random() is executed,
      but Test.getHello() is not.

      --------------------------------------------
      Here is the demonstrating test case:
      --------------------------------------------

      import javax.swing.UIDefaults;

      public class Test {

      public static void main(String[] args) {
      test("java.lang.Math", "random");
      test("Test", "getHello");
      }

      public static void test(String classname, String methodname) {
      UIDefaults.ProxyLazyValue p =
      new UIDefaults.ProxyLazyValue(classname, methodname);
      System.out.println(p.createValue(null));
      }

      public static String getHello() {
      return "Hello";
      }
      }

      --------------------------------------------
      And here is the output:
      --------------------------------------------

      0.5032680194124979
      Problem creating Test with method getHello and args { : java.lang.ClassNotFoundE
      xception: Test
      java.lang.Exception: Stack trace
              at java.lang.Thread.dumpStack(Unknown Source)
              at javax.swing.UIDefaults$ProxyLazyValue.createValue(Unknown Source)
              at Test.test(Test.java:13)
              at Test.main(Test.java:7)
      null
      (Review ID: 106138)
      ======================================================================

            svioletsunw Scott Violet (Inactive)
            kryansunw Kevin Ryan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: