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 238843 - IllegalArgumentException: Invalid characters in hostname
Summary: IllegalArgumentException: Invalid characters in hostname
Status: RESOLVED WONTFIX
Alias: None
Product: platform
Classification: Unclassified
Component: JDK Problems (show other bugs)
Version: 7.4
Hardware: All All
: P1 normal (vote)
Assignee: Antonin Nebuzelsky
URL:
Keywords: JDK_8
: 239632 258756 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-11-26 19:40 UTC by dimaki
Modified: 2016-04-21 22:38 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 205593


Attachments
stacktrace (2.80 KB, text/plain)
2013-11-26 19:40 UTC, dimaki
Details

Note You need to log in before you can comment on or make changes to this bug.
Description dimaki 2013-11-26 19:40:19 UTC
Build: NetBeans IDE 7.4 (Build 201310111528)
VM: Java HotSpot(TM) Client VM, 25.0-b59, Java(TM) SE Runtime Environment, 1.8.0-ea-b117
OS: Windows 7

User Comments:
dimaki: Cannot connect to bitbucket.org GIT repo.




Stacktrace: 
java.lang.IllegalArgumentException: Invalid characters in hostname
   at java.net.HostPortrange.toLowerCase(HostPortrange.java:189)
   at java.net.HostPortrange.<init>(HostPortrange.java:150)
   at java.net.URLPermission$Authority.<init>(URLPermission.java:476)
   at java.net.URLPermission.parseURI(URLPermission.java:446)
   at java.net.URLPermission.init(URLPermission.java:167)
   at java.net.URLPermission.<init>(URLPermission.java:163)
Comment 1 dimaki 2013-11-26 19:40:23 UTC
Created attachment 142612 [details]
stacktrace
Comment 2 Ondrej Vrabec 2013-11-26 19:47:11 UTC
What URL are you entering before getting this exception? It must be an invalid one.
Comment 3 dimaki 2013-11-26 20:04:58 UTC
No. It's the one pasted directly from the bitbucket.org project page. The URL is working fine when using 'git clone ...' on the command line. I tried the HTTPS and the SSH URL.
I switched back to jdk 1.7.0_45 and rebooted the system and now git clone works.

(In reply to Ondrej Vrabec from comment #2)
> What URL are you entering before getting this exception? It must be an
> invalid one.
Comment 4 Ondrej Vrabec 2013-11-27 09:23:12 UTC
with jdk 1.8 b116 this worked fine, started occurring in b117. This seems to happen when trying to open a http(s) connection to a server with username in the URL: https://ovrabec@bitbucket.org/ovrabec/anagramgame.git.

From debugging:
1) at java.net.HostPortrange.toLowerCase(HostPortrange.java:189)
2) at java.net.HostPortrange.<init>(HostPortrange.java:150)
3) at java.net.URLPermission$Authority.<init>(URLPermission.java:476)
4) at java.net.URLPermission.parseURI(URLPermission.java:446)
5) at java.net.URLPermission.init(URLPermission.java:167)
6) at java.net.URLPermission.<init>(URLPermission.java:163)

6) called as URLPermission("https://ovrabec@bitbucket.org/ovrabec/anagramgame.git/info/refs", "GET:Accept-Encoding,Pragma,User-Agent,Accept")
3) instantiated as URLPermission$Authority("https", "ovrabec@bitbucket.org")
2) finally hostname is incorrectly parsed in HostPortrange.<init> and tries to call toLowerCase(ovrabec@bitbucket.org)

100% reproducible, cannot clone a git repository over https with authentication
Comment 5 Ondrej Vrabec 2013-11-27 13:00:06 UTC
the difference between b116 and b117 is the last step in the stacktrace. While b116 simply called:
> hoststr = hoststr.toLowerCase();
b117 now calls:
> hoststr = HostPortrange.toLowerCase(hoststr);
In both builds the current value of hoststr was "ovrabec@bitbucket.org", the new method cannot handle '@' and throws the exception. According to spec at http://tools.ietf.org/html/rfc3986#section-3.2.1 username may probably contain also other non-ascii characters (encoded as %XX i guess) so permitting only '@' may not be sufficient. JDK should probably correctly parse just the host name and skip the userinfo part of the URI.
Comment 6 Antonin Nebuzelsky 2013-11-29 10:46:12 UTC
Ondro, thanks for the detailed evaluation.

JDK bug:
https://bugs.openjdk.java.net/browse/JDK-8029354
Comment 7 Ondrej Vrabec 2013-12-19 08:27:13 UTC
*** Bug 239632 has been marked as a duplicate of this bug. ***
Comment 8 Jiri Prox 2016-04-21 22:38:49 UTC
*** Bug 258756 has been marked as a duplicate of this bug. ***