ugo 2004/04/28 15:14:19
Modified: src/java/org/apache/cocoon/util NetUtils.java
src/test/org/apache/cocoon/util/test NetUtilsTestCase.java
Log:
Check for empty string.
PR: 28670
Revision Changes Path
1.12 +4 -1 cocoon-2.1/src/java/org/apache/cocoon/util/NetUtils.java
Index: NetUtils.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/util/NetUtils.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- NetUtils.java 18 Apr 2004 23:17:39 -0000 1.11
+++ NetUtils.java 28 Apr 2004 22:14:19 -0000 1.12
@@ -321,6 +321,9 @@
* @return The normalized uri
*/
public static String normalize(String uri) {
+ if ("".equals(uri)) {
+ return uri;
+ }
String[] dirty = StringUtils.split(uri, '/');
int length = dirty.length;
String[] clean = new String[length];
1.6 +2 -1
cocoon-2.1/src/test/org/apache/cocoon/util/test/NetUtilsTestCase.java
Index: NetUtilsTestCase.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/test/org/apache/cocoon/util/test/NetUtilsTestCase.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- NetUtilsTestCase.java 5 Mar 2004 13:03:04 -0000 1.5
+++ NetUtilsTestCase.java 28 Apr 2004 22:14:19 -0000 1.6
@@ -63,6 +63,7 @@
*/
public void testGetPath() throws Exception {
Object[] test_values = {
+ new String[]{"", ""},
new String[]{"/", ""},
new String[]{"/foo.bar", ""},
new String[]{"foo/bar", "foo"},