United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6723715 unable to parse Auto Proxy configuration file if there is a space in before the semi-colon separator
JDK-6723715 : unable to parse Auto Proxy configuration file if there is a space in before the semi-colon separator

Details
Type:
Bug
Submit Date:
2008-07-08
Status:
Closed
Updated Date:
2010-09-17
Project Name:
JDK
Resolved Date:
2008-09-26
Component:
deploy
OS:
windows_xp
Sub-Component:
plugin
CPU:
x86
Priority:
P3
Resolution:
Fixed
Affected Versions:
6u10
Fixed Versions:
6u10 (b31)

Related Reports
Backport:

Sub Tasks

Description
J2SE Version (please include all output from java -version flag):

java version "1.6.0_10-beta"
Java(TM) SE Runtime Environment (build 1.6.0_10-beta-b25)
Java HotSpot(TM) Client VM (build 11.0-b12, mixed mode, sharing)


Does this problem occur on J2SE 1.3, 1.4.x or 1.5?  Yes / No (pick one)

Yes, 1.5.0_15


Operating System Configuration Information (be specific):
Windows XP Service Pack 2


Hardware Configuration Information (be specific):
Standard Windows desktop hardware.

Bug Description:

Java Plug-in is unable to parse Auto Proxy configuration file if there
is a space in before the semi-colon separator

To reproduce the bug:

1) Create an Auto Proxy configuration file, with something like this:

	
function FindProxyForURL(url, host)
{
	return "PROXY xyz.abcde.com:1234 ;Proxy gggg.abcde.com:80";
}

Please substitute the proxy server with a valid working ones. Notice
that the space after 1234 and the semi-colon is intentional here.

2) Setup IE to use that Auto Proxy config file.

3) Open any Web page with an applet.

4) In the Java console you will see this:


java.lang.IllegalArgumentException: port out of range:-1
	at java.net.InetSocketAddress.<init>(Unknown Source)
	at com.sun.deploy.net.proxy.DynamicProxyManager$1.run(Unknown
Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at com.sun.deploy.net.proxy.DynamicProxyManager.getProxy(Unknown
Source)
	at
com.sun.deploy.net.proxy.DynamicProxyManager.getProxyList(Unknown
Source)
	at com.sun.deploy.net.proxy.DeployProxySelector.select(Unknown
Source)
	at
sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown
Source)
	at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown
Source)
	at java.net.HttpURLConnection.getResponseCode(Unknown Source)
	at sun.applet.AppletClassLoader.getBytes(Unknown Source)
	at sun.applet.AppletClassLoader.access$100(Unknown Source)
	at sun.applet.AppletClassLoader$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.applet.AppletClassLoader.findClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at sun.applet.AppletClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at sun.applet.AppletClassLoader.loadCode(Unknown Source)
	at sun.applet.AppletPanel.createApplet(Unknown Source)
	at sun.plugin.AppletViewer.createApplet(Unknown Source)
	at sun.applet.AppletPanel.runLoader(Unknown Source)
	at sun.applet.AppletPanel.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
java.lang.IllegalArgumentException: port out of range:-1
	at java.net.InetSocketAddress.<init>(Unknown Source)
	at com.sun.deploy.net.proxy.DynamicProxyManager$1.run(Unknown
Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at com.sun.deploy.net.proxy.DynamicProxyManager.getProxy(Unknown
Source)
	at
com.sun.deploy.net.proxy.DynamicProxyManager.getProxyList(Unknown
Source)
	at com.sun.deploy.net.proxy.DeployProxySelector.select(Unknown
Source)
	at
sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown
Source)
	at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown
Source)
	at java.net.HttpURLConnection.getResponseCode(Unknown Source)
	at sun.applet.AppletClassLoader.getBytes(Unknown Source)
	at sun.applet.AppletClassLoader.access$100(Unknown Source)
	at sun.applet.AppletClassLoader$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.applet.AppletClassLoader.findClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at sun.applet.AppletClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at sun.applet.AppletClassLoader.loadCode(Unknown Source)
	at sun.applet.AppletPanel.createApplet(Unknown Source)
	at sun.plugin.AppletViewer.createApplet(Unknown Source)
	at sun.applet.AppletPanel.runLoader(Unknown Source)
	at sun.applet.AppletPanel.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
load: class testvmDynamicJavaComPopUp819.class not found.
java.lang.ClassNotFoundException: testvmDynamicJavaComPopUp819.class
	at sun.applet.AppletClassLoader.findClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at sun.applet.AppletClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at sun.applet.AppletClassLoader.loadCode(Unknown Source)
	at sun.applet.AppletPanel.createApplet(Unknown Source)
	at sun.plugin.AppletViewer.createApplet(Unknown Source)
	at sun.applet.AppletPanel.runLoader(Unknown Source)
	at sun.applet.AppletPanel.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)

4) If you remove the space in between the number and the semi-colon it will work again.

The problem is in the com.sun.deploy.net.proxy.ProxyInfo constructor:

	    ix = pinfo.lastIndexOf(':');
	    if (ix >= 0)  {
		proxy = pinfo.substring(0, ix);
		try  {
		    port = Integer.parseInt(pinfo.substring(ix + 1));
		} catch (Exception e)  {
		}
	    }

What happens is that the space in between has not been trimmed and
therefore it will try to parse "1234 " which is an invalid input for
parseInt. Then the exception is caught and ignored so the port number is
set to -1 (default in ProxyInfo), which is invalid.

                                    

Comments
EVALUATION

Yes, this is a bug in Java plugin code, I will fix it in 6u12.
                                     
2008-07-10
EVALUATION

It will be fixed in 6u11.
                                     
2008-08-25



Hardware and Software, Engineered to Work Together