JDK-5076692 : Installed Extensions Image I/O reader-writer plug-ins unusable in applet context
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.imageio
  • Affected Version: 1.0_01,5.0
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic,windows_2000
  • CPU: generic,x86
  • Submitted: 2004-07-21
  • Updated: 2005-10-10
  • Resolved: 2005-10-10
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other JDK 6
5.0u7Fixed 6 b56Fixed
Description
Image I/O Plugins provided as part of an extension installed into the JDK don't seem to be picked in an applet environment.

A simple test case demonstrating this is attached.

To run, first JAI Image I/O tools needs to be installed. This can be downloaded from here

http://java.sun.com/developer/earlyAccess/jai_imageio/index.html

Installation instructions are outlined here

http://java.sun.com/developer/earlyAccess/jai_imageio/INSTALL-jai_imageio.html

Look under "Installation in a JRE" heading

Once you have this installed, to try this out in an application environment, simply run "java IIOAppletTest" and you should see this output

Reader names:
tif tiff JPEG-LOSSLESS jfif wbmp jpeg-lossless jpeg2000 gif WBMP BMP bmp jpeg-ls JPEG 2000 TIF JPEG2000 JPG PNG JPEG raw PNM jpeg RAW jpeg 2000 pnm TIFF JPEG-LS png jpg JFIF
Reader Mime Types:
image/x-portable-graymap image/jpeg image/x-portable-pixmap image/x-portable-anymap image/png image/x-png image/jpeg2000 image/tiff image/vnd.wap.wbmp image/bmp image/x-portable-bitmap image/gif

Running as an applet, "appletviewer IIOAppletTest.html" gives the following output, not reporting any of the extension reader/writer plugins

Reader names:
BMP bmp jpeg wbmp gif png JPG jpg WBMP JPEG
Reader Mime Types:
image/png image/jpeg image/x-png image/vnd.wap.wbmp image/bmp image/gif Reader names:
BMP bmp jpeg wbmp gif png JPG jpg WBMP JPEG
Reader Mime Types:
image/png image/jpeg image/x-png image/vnd.wap.wbmp image/bmp image/gif

This seems to indicate that plugins from installed extensions are not picked up in an applet environment.

Comments
EVALUATION The problem is: the imageio registry initialization code do not have read access to jars in the java.ext.dirs when it is called form applet context. Therefore, imageio plugins installed to java.ext.dirs are not available in case of applets. The fix idea is to register plugins from java.ext.dirs in the privileged action block. Unfortunately, this fix has some bad side effect - we will read jars in the java.ext.dirs twice: first time when we register services available in current thread context (IIORegistry.java, lines 182-185) and second time when we register installed services (lines 203-206). It was made in order to avoid the loading of plugins which is available in the application classpath in the privileged mode.
26-09-2005

CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: dragon
21-08-2004

PUBLIC COMMENTS Installed Extensions Image I/O reader-writer plug-ins unusable in applet context
21-08-2004

EVALUATION Serious issue that prevents applets from making use of the JAI IIO Tools plugins. It seems that we are not loading the plugins installed in jre/lib/ext through the IIORegistry; could be that we're using the wrong ClassLoader to look for the plugin classes. Should be investigated for Dragonfly, if not sooner. ###@###.### 2004-07-21
21-07-2004