JDK-6354767 : applet can not work when placed in double-byte folder.
  • Type: Bug
  • Component: deploy
  • Sub-Component: plugin
  • Affected Version: 5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2005-11-23
  • Updated: 2011-02-16
  • Resolved: 2005-12-05
Description
FULL PRODUCT VERSION :
1.5.0_05 and 1.6.0 53

ADDITIONAL OS VERSION INFORMATION :
Windows XP service pack2

A DESCRIPTION OF THE PROBLEM :
I have an applet, it works fine on IE,Firefox,Netscape with JRE 1.5. How ever, when i placed it in a double-byte character folder, it doesn't work anymore.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1) Create a folder with the name - "c��"
2) Try to open the html file in IE / firefox. The below error is thrown

When accessing this from another folder this behavior is not seen.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The applet is shown
ACTUAL -
The error is thrown 

ERROR MESSAGES/STACK TRACES THAT OCCUR :
Java Plug-in 1.5.0_05
Using JRE version 1.5.0_05 Java HotSpot(TM) Client VM
User home directory = D:\Documents and Settings\Administrator
----------------------------------------------------
c:   clear console window
f:   finalize objects on finalization queue
g:   garbage collect
h:   display this help message
l:   dump classloader list
m:   print memory usage
o:   trigger logging
p:   reload proxy configuration
q:   hide console
r:   reload policy configuration
s:   dump system and deployment properties
t:   dump thread list
v:   dump thread stack
x:   clear classloader cache
0-5: set trace level to <n>
----------------------------------------------------

Exception in thread "Thread-2" java.lang.IllegalArgumentException
	at sun.net.www.ParseUtil.decode(Unknown Source)
	at sun.net.www.protocol.file.Handler.openConnection(Unknown Source)
	at sun.net.www.protocol.file.Handler.openConnection(Unknown Source)
	at java.net.URL.openConnection(Unknown Source)
	at sun.applet.AppletPanel.getAccessControlContext(Unknown Source)
	at sun.applet.AppletPanel.getClassLoader(Unknown Source)
	at sun.applet.AppletPanel.createAppletThread(Unknown Source)
	at sun.applet.AppletPanel.init(Unknown Source)
	at sun.plugin.AppletViewer.createClassLoader(Unknown Source)
	at sun.plugin.AppletViewer.appletInit(Unknown Source)
	at sun.plugin.viewer.LifeCycleManager.initAppletPanel(Unknown Source)
	at sun.plugin.viewer.IExplorerPluginObject$Initer.run(Unknown Source)

REPRODUCIBILITY :
This bug can be reproduced always.


---------- BEGIN SOURCE ----------

HelloWorldApplet.java 

import java.applet.Applet;
import java.awt.Graphics;

public class HelloWorldApplet extends Applet {
    public void paint(Graphics g) {
        g.drawString("Hello world!", 50, 25);
    }
}


Test.html
<HTML>
<BODY>
<APPLET CODE="HelloWorldApplet.class" WIDTH="200" HEIGHT="200">
</APPLET>
</BODY>
</HTML>

---------- END SOURCE ----------

Comments
EVALUATION It seems a MS VM problem. When using applet tag, Sun JRE is impersonating the MS VM by resetting applet(an activex control) control's "Treatas" to Sun's applet control. When loading applet from local filesystem with no explicit codebase setting, the applet control will get a "codebase" attribute with the value as "file:///x:/somedirectory". The problem is that the default value is SOMETIMES encoded by "ISO-8859-1", not by "UTF-8". For instance, when the applet's directory is "c��". It can't be fixed on Sun's JRE side, since we can't tell if the codebase value is explictly set by developers when using applet tag. We have many workarounds for this problem. See "Work Around". Besides, when accessing from web, the applet tag works fine.
29-11-2005

WORK AROUND 1.Change file folder "c��" to "co" or other name. 2.Use "Object" tag instead of "Applet" 3.Explicitly set "CodeBase=../c%c3%b3" (It's "c��",UTF-8 encoding.) if using "applet" tag.
29-11-2005