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

JDK demo jfc/Java2D/Java2Demo.html needs to be updated after fix of JDK-8001167.

XMLWordPrintable

      After JDK-8001167, JDK demo jfc/Java2D/Java2Demo.html no longer works because local applet could not get codebase and all operations related to it will fail.

      Steps to reproduce:
      1. install JRE 8b103
      2. download demo from http://jre.us.oracle.com/java/re/jdk/1.8.0/promoted/latest/bundles/windows-i586/jdk-8-ea-bin-b103-windows-i586-demos-14_aug_2013.zip and unzip it somewhere to local disk
      3. run demo jfc/Java2D/Java2Demo.html locally in browsers (you need to set security level to medium, otherwise it could not be run)
      4. after accepting unsigned security dialog, if you see exception as below, then the issue is reproduced:
      ==========
      java.lang.NullPointerException
          at sun.awt.SunToolkit.createImage(SunToolkit.java:798)
          at java2d.DemoImages.getImage(DemoImages.java:95)
          at java2d.DemoImages.newDemoImages(DemoImages.java:72)
          at java2d.Java2Demo.<init>(Java2Demo.java:140)
          at java2d.Java2DemoApplet.init(Java2DemoApplet.java:122)
          at com.sun.deploy.uitoolkit.impl.awt.AWTAppletAdapter.init(Unknown Source)
          at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
          at java.lang.Thread.run(Thread.java:724)
      ===========

      If you access the same page remotely, then it's working fine. - http://sqeweb.us.oracle.com/net/sqenfs-1/export1/comp/jsn/users/stephen/deployment_stuff/do.NOT.remove.me/jdk1.8.0/demo/jfc/Java2D/Java2Demo.html .

      Suggested fix:
      Now to load resource inside the applet jar, we could use getResoruceAsStream. Code like
      ========
      img = ImageIO.read(cmp.getClass().getResourceAsStream("/images/" + name));
      ========

      is working fine.

            dtitov Daniil Titov (Inactive)
            stephenh Stephen Hu (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: