[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug classpath/31590] URI parsing bug
From: |
mark at gcc dot gnu dot org |
Subject: |
[Bug classpath/31590] URI parsing bug |
Date: |
16 Apr 2007 14:22:31 -0000 |
------- Comment #1 from mark at gcc dot gnu dot org 2007-04-16 15:22 -------
Could you print out the expected result of:
class uri
{
public static void main(String[] args) throws Exception
{
java.net.URI uri = new java.net.URI("failover://tcp://localhost:61616");
System.out.println("scheme: " + uri.getScheme());
System.out.println("auth: " + uri.getAuthority());
System.out.println("user: " + uri.getUserInfo());
System.out.println("host: " + uri.getHost());
System.out.println("post: " + uri.getPort());
System.out.println("path: " + uri.getPath());
System.out.println("query: " + uri.getQuery());
System.out.println("frag: " + uri.getFragment());
}
}
I assume that an empty string is accepted for port. And that it will default to
-1 in that case. If so, then the following patch should solve your issue:
diff -u -r1.19 URI.java
--- java/net/URI.java 10 Dec 2006 20:25:45 -0000 1.19
+++ java/net/URI.java 16 Apr 2007 14:19:37 -0000
@@ -693,7 +693,7 @@
String portStr = getURIGroup(matcher, AUTHORITY_PORT_GROUP);
- if (portStr != null)
+ if (portStr != null && ! portStr.isEmpty())
try
{
port = Integer.parseInt(portStr);
--
mark at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2007-04-16 15:22:31
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31590