You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by je...@apache.org on 2003/01/22 14:44:01 UTC
cvs commit: jakarta-commons/httpclient/src/test/org/apache/commons/httpclient TestURIUtil.java
jericho 2003/01/22 05:44:01
Modified: httpclient/src/java/org/apache/commons/httpclient/util
URIUtil.java
httpclient/src/test/org/apache/commons/httpclient
TestURIUtil.java
Log:
- Fix the getPath method and add its test case.
Patched by Armando_Ant=F3n?= <ar...@newknow.com>
Thank you!
Revision Changes Path
1.14 +6 -6 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/util/URIUtil.java
Index: URIUtil.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/util/URIUtil.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- URIUtil.java 16 Jan 2003 10:53:09 -0000 1.13
+++ URIUtil.java 22 Jan 2003 13:44:01 -0000 1.14
@@ -142,8 +142,8 @@
// the authority part of URI ignored
int to = uri.length();
// check the query
- if (uri.lastIndexOf("?") > from)
- to = uri.lastIndexOf("?");
+ if (uri.indexOf('?', from) != -1)
+ to = uri.indexOf('?', from);
// check the fragment
if (uri.lastIndexOf("#") > from && uri.lastIndexOf("#") < to)
to = uri.lastIndexOf("#");
1.4 +8 -6 jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestURIUtil.java
Index: TestURIUtil.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestURIUtil.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- TestURIUtil.java 7 Jan 2003 23:51:01 -0000 1.3
+++ TestURIUtil.java 22 Jan 2003 13:44:01 -0000 1.4
@@ -87,7 +87,8 @@
new URITestCase("/noscheme/nohost/path", "/noscheme/nohost/path"),
new URITestCase("http://www.server.com", "/"),
new URITestCase("https://www.server.com:443/ssl/path", "/ssl/path"),
- new URITestCase("http://www.server.com:8080/path/with/port", "/path/with/port")};
+ new URITestCase("http://www.server.com:8080/path/with/port", "/path/with/port"),
+ new URITestCase("http://www.server.com/path1/path2?query1=string?1&query2=string2", "/path1/path2")};
URITestCase queryTests[] = {new URITestCase("http://www.server.com/path1/path2", null),
new URITestCase("http://www.server.com/path1/path2?query=string", "query=string"),
@@ -95,7 +96,8 @@
new URITestCase("www.noscheme.com/path1/path2#anchor?query=string", "query=string"),
new URITestCase("/noscheme/nohost/path?query1=string1&query2=string2", "query1=string1&query2=string2"),
new URITestCase("https://www.server.com:443/ssl/path?query1=string1&query2=string2", "query1=string1&query2=string2"),
- new URITestCase("http://www.server.com:8080/path/with/port?query1=string1&query2=string2", "query1=string1&query2=string2")};
+ new URITestCase("http://www.server.com:8080/path/with/port?query1=string1&query2=string2", "query1=string1&query2=string2"),
+ new URITestCase("http://www.server.com/path1/path2?query1=string?1&query2=string2", "query1=string?1&query2=string2")};
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>