JDK-6723715 : unable to parse Auto Proxy configuration file if there is a space in before the semi-colon separator
  • Type: Bug
  • Component: deploy
  • Sub-Component: plugin
  • Affected Version: 6u10
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2008-07-08
  • Updated: 2010-09-17
  • Resolved: 2008-09-26
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.
JDK 6 JDK 7
6u10 b31Fixed 7Fixed
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 It will be fixed in 6u11.
25-08-2008

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