-
Bug
-
Resolution: Not an Issue
-
P3
-
7u40, 8
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.
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.
- relates to
-
JDK-8025917 JDK demo applets not running with >=7u40 or (JDK 8 and JDK 9)
- Closed
-
JDK-8041450 [TESTBUG] Java2DTest applet doesn't work with NPE
- Closed