Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 323114

Summary: [Net] NPE when hostname part of a URL contains underscore and using a proxy
Product: [Eclipse Project] Platform Reporter: Julien HENRY <julien.henry>
Component: TeamAssignee: Platform Team Inbox <platform-team-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: major    
Priority: P3 CC: a.gurov, michael, tomasz.zarna, wojciech.galanciak
Version: 3.6   
Target Milestone: ---   
Hardware: PC   
OS: Windows Vista   
Whiteboard: stalebug
Attachments:
Description Flags
Stacktrace
none
Stacktrace 2 none

Description Julien HENRY CLA 2010-08-19 05:20:14 EDT
Build Identifier: 20100218-1602

My company is using a proxy for internet access but our SVN server should be reached without using the proxy. So I have configured Eclipse global network properties with a MANUAL connection + internet proxy + added our SVN server in the list of non proxy hosts.

As a result, each SVN operation fail with the following error (full stack trace in attachment):

ava.lang.NullPointerException
	at org.eclipse.core.internal.net.AbstractProxyProvider.select(AbstractProxyProvider.java:37)
	at org.eclipse.core.internal.net.ProxyManager.getProxyDataForHost(ProxyManager.java:365)
	at org.eclipse.team.svn.core.utility.SVNUtility.configureProxy(SVNUtility.java:831)


Reproducible: Always

Steps to Reproduce:
1.Add a MANUAL connection with a proxy
2.Add "your_svn_server" to the list of non proxy host
3.Perform any SVN operation (like team->update)
Comment 1 Julien HENRY CLA 2010-08-19 05:21:30 EDT
Created attachment 176972 [details]
Stacktrace
Comment 2 Julien HENRY CLA 2010-08-20 04:17:39 EDT
After more investigation, the error occurs even with NATIVE connexion mode. So only the DIRECT mode is working.
Comment 3 Julien HENRY CLA 2010-09-21 10:01:22 EDT
Created attachment 179313 [details]
Stacktrace 2

With Helios I get a different stacktrace:

java.lang.NullPointerException
at org.eclipse.core.internal.net.StringMatcher.match(StringMatcher.java:223)
at org.eclipse.core.internal.net.ProxyManager.matchesFilter(ProxyManager.java:352)
at org.eclipse.core.internal.net.ProxyManager.isHostFiltered(ProxyManager.java:344)
at org.eclipse.core.internal.net.ProxyManager.getProxyDataForHost(ProxyManager.java:315)
at org.eclipse.core.internal.net.ProxyManager.getProxyDataForHost(ProxyManager.java:372)
at org.eclipse.team.svn.core.utility.SVNUtility.configureProxy(SVNUtility.java:809)
Comment 4 Julien HENRY CLA 2010-09-21 11:35:46 EDT
I finally managed to narrow down the issue. This is caused by an issue in the implementation of URI when there is a underscore in hostname.

See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5083594
and
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6587184

In org.eclipse.core.internal.net.ProxyManager.tryGetUri("http://my_svnhost") will return a not null URI object but calling getHost() on the URI will return null.

The workaround mentioned in 6587184:
FYI, to work around this problem with java.net.URI use org.apache.commons.httpclient.URI instead; it doesn't suffer from this bug.

Test program to reproduce the bug:

import java.net.URI;
import java.net.URISyntaxException;

public class Test {

    public static URI tryGetURI(String host) {
        try {
            int i = host.indexOf(":");
            if (i == -1) {
                return new URI("//" + host);
            }
            return new URI(host.substring(i + 1));
        } catch (URISyntaxException e) {
            return null;
        }
    }

    public static void main(String[] args) {
        System.out.println(tryGetURI("http://mysvnserver").getHost());// display mysvnserver
        System.out.println(tryGetURI("http://my_svnserver").getHost());// display null
    }
}
Comment 5 Wojciech Galanciak CLA 2010-11-22 06:21:29 EST
This bug should be moved to Platform Team (it is responsible for proxy).
Comment 6 Wojciech Galanciak CLA 2010-11-22 06:30:38 EST
*** Bug 293078 has been marked as a duplicate of this bug. ***
Comment 7 Alexander Gurov CLA 2010-12-22 03:52:14 EST
Hi!

Thank you guys for your help!
We will move this issue to the "Platform" as proposed.
Comment 8 Eclipse Webmaster CLA 2019-09-06 16:09:26 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.
Comment 9 Eclipse Genie CLA 2021-12-30 17:00:37 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.