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

NullPointerException when proxy file is invalid

XMLWordPrintable

    • b01
    • x86
    • windows
    • Verified

        java.lang.NullPointerException
           at com.sun.deploy.net.proxy.AbstractAutoProxyHandler.isSupportedINSFile(AbstractAutoProxyHandler.java:168)
           at com.sun.deploy.net.proxy.AbstractAutoProxyHandler.init(AbstractAutoProxyHandler.java:135)
           at com.sun.deploy.net.proxy.DynamicProxyManager.reset(DynamicProxyManager.java:338)
           at com.sun.deploy.net.proxy.DeployProxySelector.reset(DeployProxySelector.java:58)
           at com.sun.javaws.Main.initializeExecutionEnvironment(Main.java:1310)
           at com.sun.javaws.Main.continueInSecureThread(Main.java:248)
           at com.sun.javaws.Main.access$000(Main.java:61)
           at com.sun.javaws.Main$1.run(Main.java:160)
           at java.lang.Thread.run(Thread.java:722)

        When the proxy file is specified but does not exist. I don't know how to reproduce this in the wild, but here is a test case:

            public void testInvalidProxyFile() throws Exception {
                SetupHelpers.setupServices();
                server = WebServer.startServer(port, null, false);

                proxyInfo = new BrowserProxyInfo();
                serverName = "http://localhost:%d";

                // test.pac is an invalid proxy file.
                proxyFileName = getServerName() + "/test.pac";
                proxyInfo.setAutoConfigURL(proxyFileName);
                proxyInfo.setType(ProxyType.AUTO);

                proxyHandler = createProxyHandlerForPlatform();

                try {
                    proxyHandler.init(proxyInfo);
                    ProxyInfo pi[] = proxyHandler.getProxyInfo(
                        new URL("http://callalert.some.domain/hello.jar"));
                    assertEquals("Expect list of 2 proxies", 2, pi.length);
                }
                catch (NullPointerException e) {
                    fail("Failed to initialize proxy handler");
                }
            }

              cbensen Chris Bensen (Inactive)
              cbensen Chris Bensen (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: