ugo 2004/04/20 09:10:52
Modified: src/test/org/apache/cocoon/util/test IOUtilsTestCase.java
src/java/org/apache/cocoon/util NetUtils.java IOUtils.java
Log:
Ported fixes from 2.1.
Revision Changes Path
1.5 +3 -2
cocoon-2.2/src/test/org/apache/cocoon/util/test/IOUtilsTestCase.java
Index: IOUtilsTestCase.java
===================================================================
RCS file:
/home/cvs/cocoon-2.2/src/test/org/apache/cocoon/util/test/IOUtilsTestCase.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- IOUtilsTestCase.java 8 Mar 2004 14:04:20 -0000 1.4
+++ IOUtilsTestCase.java 20 Apr 2004 16:10:52 -0000 1.5
@@ -62,7 +62,8 @@
Object[] test_values = {
new String[]{".", "__"},
new String[]{"", ""},
- new String[]{"file://", "file_" + File.separator + "_" +
File.separator + "_"},
+ new String[]{"file://", "file_"},
+ // was new String[]{"file://", "file_" + File.separator +
"_" + File.separator + "_"},
new String[]{"/a/b/c", "a" + File.separator + "b" +
File.separator + "c"},
new String[]{"\\a\\b\\c", "a" + File.separator + "b" +
File.separator + "c"},
new String[]{"a/b/c", "a" + File.separator + "b" +
File.separator + "c"},
1.9 +8 -1 cocoon-2.2/src/java/org/apache/cocoon/util/NetUtils.java
Index: NetUtils.java
===================================================================
RCS file: /home/cvs/cocoon-2.2/src/java/org/apache/cocoon/util/NetUtils.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- NetUtils.java 28 Mar 2004 21:01:20 -0000 1.8
+++ NetUtils.java 20 Apr 2004 16:10:52 -0000 1.9
@@ -362,6 +362,13 @@
}
StringBuffer b = new StringBuffer(uri.length());
+
+ // Added this check to satisfy NetUtilsTestCase. I cannot ascertain
whether
+ // this is correct or not, since the description of this method is
not very
+ // clear. [Ugo Cei <[EMAIL PROTECTED]> 2004-04-19]
+ if (uri.charAt(0) == '/') {
+ b.append('/');
+ }
for (int i = 0; (i < length) && (clean[i] != null); i++) {
b.append(clean[i]);
1.4 +4 -1 cocoon-2.2/src/java/org/apache/cocoon/util/IOUtils.java
Index: IOUtils.java
===================================================================
RCS file: /home/cvs/cocoon-2.2/src/java/org/apache/cocoon/util/IOUtils.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- IOUtils.java 28 Mar 2004 21:01:20 -0000 1.3
+++ IOUtils.java 20 Apr 2004 16:10:52 -0000 1.4
@@ -195,6 +195,9 @@
* @return The transformed filename
*/
public static String normalizedFilename(String filename) {
+ if ("".equals(filename)) {
+ return "";
+ }
if(File.separatorChar == '\\')
filename = filename.replace('/','\\');
else