Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6723715

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

    Details

    • Subcomponent:
    • Resolved In Build:
      b31
    • CPU:
      x86
    • OS:
      windows_xp
    • Verification:
      Verified

      Backports

        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.

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  dgu Dennis Gu (Inactive)
                  Reporter:
                  tyao Ting-Yun Ingrid Yao (Inactive)
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  0 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Imported:
                    Indexed: