Ok, I finally had some time to look at this. Here is my feedback:
on NetWare the existing code only needed two small changes to work, in
both toURI and fromURI. The change in toURI is one that I think is
necessary for all platforms anyway.
In toURI. there is the following code:
try {
path = normalize(path).getAbsolutePath();
sb.append("//");
// add an extra slash for filesystems with drive-specifiers
if (!path.startsWith("/")) {
sb.append("/");
}
} catch (BuildException e) {
// relative path
}
Shouldn't the last if statement instead be the following?:
if (!path.startsWith(File.separator)) {
sb.append("/");
}
With this one change, toURI seems to work well on NetWare. I would
also add some tests to FileUtilsTest.java (diff file attached,
FileUtilsTestFromURIPatch.txt)
in fromURI, I think it is sufficient to look for a ":" anywhere in the
filename, instead of just at the second position. An change from
uri.charAt(2) == ':' to uri.lastIndexOf(':') > -1 seems to work for on
Windows and NetWare. I've attached diff files for Locator and
FileUtils
Hopefully my attachments are in a format that won't be stripped by the
mailing list, I can never remember what extension they need.
I'll look into the other test failures on NetWare as well, that didn't
seem to be related to this new Launcher and / or FileUtils changes.
(Available and SignJar both fail on NW currently).
Jeff Tulley ([EMAIL PROTECTED])
(801)861-5322
Novell, Inc., The Leading Provider of Net Business Solutions
http://www.novell.com
>>> [EMAIL PROTECTED] 7/11/03 2:23:33 AM >>>
On Thu, 10 Jul 2003, Jeff Tulley <[EMAIL PROTECTED]> wrote:
> Looking at it, the fromURI is a method I should have considered and
> added some NetWare test cases for.
fromURI is rather new - compared to the other Netware related stuff
you've submitted.
> I'll work out some test cases, see if the previous code handled them
> and suggest changes if necessary.
Great.
Stefan
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Index: Locator.java
===================================================================
RCS file:
/home/cvspublic/ant/src/main/org/apache/tools/ant/launch/Locator.java,v
retrieving revision 1.3
diff -u -r1.3 Locator.java
--- Locator.java 9 Jul 2003 13:11:15 -0000 1.3
+++ Locator.java 15 Jul 2003 19:17:31 -0000
@@ -134,7 +134,7 @@
uri = uri.replace('/', File.separatorChar);
if (File.pathSeparatorChar == ';' && uri.startsWith("\\") &&
uri.length() > 2
- && Character.isLetter(uri.charAt(1)) && uri.charAt(2) == ':') {
+ && Character.isLetter(uri.charAt(1)) && uri.lastIndexOf(':') > -1)
{
uri = uri.substring(1);
}
RCS file:
/home/cvspublic/ant/src/main/org/apache/tools/ant/util/FileUtils.java,v
retrieving revision 1.48
diff -u -r1.48 FileUtils.java
--- FileUtils.java 9 Jul 2003 13:11:16 -0000 1.48
+++ FileUtils.java 15 Jul 2003 19:19:28 -0000
@@ -1219,7 +1219,7 @@
path = normalize(path).getAbsolutePath();
sb.append("//");
// add an extra slash for filesystems with drive-specifiers
- if (!path.startsWith("/")) {
+ if (!path.startsWith(File.separator)) {
sb.append("/");
}
diff -u -r1.19 FileUtilsTest.java
--- FileUtilsTest.java 28 Jun 2003 14:18:40 -0000 1.19
+++ FileUtilsTest.java 15 Jul 2003 19:21:27 -0000
@@ -444,6 +444,9 @@
dosRoot = "c:/";
}
}
+ if (Os.isFamily("netware")) {
+ assertEquals("file:///SYS:/foo", fu.toURI("sys:\\foo"));
+ }
assertEquals("file:///" + dosRoot + "foo", fu.toURI("/foo"));
assertEquals("file:./foo", fu.toURI("./foo"));
assertEquals("file:///" + dosRoot + "foo", fu.toURI("\\foo"));
@@ -458,6 +461,9 @@
* test fromUri
*/
public void testFromURI() {
+ if (Os.isFamily("netware")) {
+ assertEqualsIgnoreDriveCase("SYS:\\foo",
fu.fromURI("file:///sys:/foo"));
+ }
if (Os.isFamily("dos")) {
assertEqualsIgnoreDriveCase("C:\\foo",
fu.fromURI("file:///c:/foo"));
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]