This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 166947 - use of HttpURLConnection is always redirected to a proxy
Summary: use of HttpURLConnection is always redirected to a proxy
Status: RESOLVED DUPLICATE of bug 134745
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: PC Windows XP
: P2 blocker (vote)
Assignee: issues@guibuilder
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-06-11 21:37 UTC by gz4p9c
Modified: 2009-06-16 16:11 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description gz4p9c 2009-06-11 21:37:23 UTC
I have an application that was developed using Matisse. It uses the following code:

        try {
            URL u = new URL("http://usplsbes040.business-exchange.eds.com:8080/rest/elitfiles");
            HttpURLConnection c = (HttpURLConnection)u.openConnection();
            InputStream in = c.getInputStream();
            System.out.println("Resp Code from HttpUrl: " + c.getResponseMessage());
        }
        catch (Exception e) {
            e.printStackTrace();
        }

This code will always return the following if the URL is any valid host other than "localhost":

java.io.IOException: Server returned HTTP response code: 407 for URL: http://usplsbes040.business-
exchange.eds.com:8080/rest/elitfiles
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1245)
        at testswing.TestSwingView.showAboutBox(TestSwingView.java:93)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.jdesktop.application.ApplicationAction.noProxyActionPerformed(ApplicationAction.java:662)
        at org.jdesktop.application.ApplicationAction.actionPerformed(ApplicationAction.java:698)
        at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
        at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
        at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
        at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
        at javax.swing.AbstractButton.doClick(AbstractButton.java:357)
        at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1170)
        at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1211)
        at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:272)
        at java.awt.Component.processMouseEvent(Component.java:6038)
        at javax.swing.JComponent.processMouseEvent(JComponent.java:3260)
        at java.awt.Component.processEvent(Component.java:5803)
        at java.awt.Container.processEvent(Container.java:2058)
        at java.awt.Component.dispatchEventImpl(Component.java:4410)
        at java.awt.Container.dispatchEventImpl(Container.java:2116)
        at java.awt.Component.dispatchEvent(Component.java:4240)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
        at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
        at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
        at java.awt.Container.dispatchEventImpl(Container.java:2102)
        at java.awt.Window.dispatchEventImpl(Window.java:2429)
        at java.awt.Component.dispatchEvent(Component.java:4240)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)

The exact same code works properly when run in a standard "java" project - it only fails when run in a NB projected 
developed as a "java desktop application" (using "Swing Application Framework' libraries).
Comment 1 Tomas Pavek 2009-06-16 16:11:14 UTC
Looks like you run into the known issue caused by Swing App Framework setting the java.net.useSystemProxies system
property. See http://www.netbeans.org/issues/show_bug.cgi?id=134745#desc16 for a workaround. Let us know if it does not
help.

*** This issue has been marked as a duplicate of 134745 ***