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 239016 - Test connection fails when no Proxy
Summary: Test connection fails when no Proxy
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Proxy (show other bugs)
Version: 7.4
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Libor Fischmeistr
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-12-01 11:20 UTC by phansson
Modified: 2013-12-09 02:22 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
IDE log with stacktrace (49.41 KB, text/plain)
2013-12-07 10:21 UTC, phansson
Details

Note You need to log in before you can comment on or make changes to this bug.
Description phansson 2013-12-01 11:20:43 UTC
In NB 7.4 a new "Test Connection" was introduced in Options Panel.

When I press this button I get "connect: Address is invalid on local machine, or port is not valid on remote machine".

Rather strange as I do not have a proxy between my workstation and the Internet. In fact I don't mess with these settings in NB at all since there's no need. I think the problem here is that the NB developer has been too focused on the case about testing with a Proxy that the simple case - when there's no proxy - has been kind of forgotten. The button says "Test connection" which leads me to believe that it is a GENERAL test of Internet connectivity, not one specifically for the case when there's a proxy involved.

Digging further into the NB Platform source code and log file it seems the problem arises when NB tries to figure out which port to use for the test against http://netbeans.org (which is the address that NB uses for the test).

NB will try to retrieve the port for the test via Preferences. As there are no Preferences the port will default to "" (empty string) which cannot be translated to integer which results in a NumberFormatException and is probably the true cause of the somewhat misleading UI error message when then "Test Connection" button is pressed.

I believe the logic for figuring out the host (via Preferences) is similarly flawed.

All in all I believe the problem can be fixed in org.netbeans.coreProxySettings.java, currently:

    public static String getTestSystemHttpHost() {
        return getPreferences().get(TEST_SYSTEM_PROXY_HTTP_HOST, "");
    }
    
    public static String getTestSystemHttpPort() {
        return getPreferences().get(TEST_SYSTEM_PROXY_HTTP_PORT, "");
    }


could/should be replaced with:


    public static String getTestSystemHttpHost() {
        return getPreferences().get(TEST_SYSTEM_PROXY_HTTP_HOST, HTTP_CONNECTION_TEST_URL);
    }
    
    public static String getTestSystemHttpPort() {
        return getPreferences().get(TEST_SYSTEM_PROXY_HTTP_PORT, "80");
    }


although I cannot say for sure.

Actually I first discovered the problem on an RCP application but the problem of course applies equally to the IDE.
Comment 1 Theofanis Oikonomou 2013-12-02 08:55:08 UTC
re-assigning to module owner. Thank you for reporting.
Comment 2 Libor Fischmeistr 2013-12-07 10:04:38 UTC
May I ask you for the IDE log - http://wiki.netbeans.org/FaqLogMessagesFile
Comment 3 phansson 2013-12-07 10:21:00 UTC
Created attachment 142930 [details]
IDE log with stacktrace
Comment 4 phansson 2013-12-07 10:23:10 UTC
(In reply to Libor Fischmeistr from comment #2)
> May I ask you for the IDE log - http://wiki.netbeans.org/FaqLogMessagesFile

Done. Attached.
Comment 5 Libor Fischmeistr 2013-12-08 10:43:05 UTC
Thanks for the log.

Fixed in changeset: http://hg.netbeans.org/core-main/rev/95c0961b3eb2

Please verify the fix.

Thank you.

Now it's necessary to check if it helped to solve issue 235202
Comment 6 phansson 2013-12-08 16:03:53 UTC
(In reply to Libor Fischmeistr from comment
Comment 7 phansson 2013-12-08 16:05:32 UTC
(In reply to Libor Fischmeistr from comment #5)
> Thanks for the log.
> 
> Fixed in changeset: http://hg.netbeans.org/core-main/rev/95c0961b3eb2
> 
> Please verify the fix.
> 
> Thank you.
> 
> Now it's necessary to check if it helped to solve issue 235202

The fix looks ok to me although I'll verify finally tomorrow using Nightly Build. 

One concern though:  It seems to me that there's some duplication in the sense that the testProxy() method tries to establish its own isolated proxy context, solely for the purpose of the test. This may or may not be equal to the actual ProxySelector that the NB Platform will use. All in all succeeding in the "Test Connection" is in this way no guarantee that NB can establish connections successfully.

Am I seeing problems that don't exist?
Comment 8 Quality Engineering 2013-12-09 02:22:52 UTC
Integrated into 'main-silver', will be available in build *201312090002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/95c0961b3eb2
User: Libor Fischmeistr <lfischmeistr@netbeans.org>
Log: #239016: Test connection fails when no Proxy