You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bo...@apache.org on 2003/07/16 13:00:36 UTC
cvs commit: ant/src/testcases/org/apache/tools/ant/types PathTest.java
bodewig 2003/07/16 04:00:36
Modified: src/main/org/apache/tools/ant PathTokenizer.java
src/testcases/org/apache/tools/ant/types PathTest.java
Log:
PathTokenizer didn't deal correctly with ../ style relative paths
following a colon in Unix style PATH structures on Netware.
Submitted by: Jeff Tulley <JTULLEY at novell dot com>
Revision Changes Path
1.18 +4 -2 ant/src/main/org/apache/tools/ant/PathTokenizer.java
Index: PathTokenizer.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/PathTokenizer.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- PathTokenizer.java 9 Jul 2003 13:12:23 -0000 1.17
+++ PathTokenizer.java 16 Jul 2003 11:00:36 -0000 1.18
@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2000,2002 The Apache Software Foundation. All rights
+ * Copyright (c) 2000,2002-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -176,7 +176,9 @@
// make sure we aren't going to get the path separator next
if (!nextToken.equals(File.pathSeparator)) {
if (nextToken.equals(":")) {
- if (!token.startsWith("/") && !token.startsWith("\\")) {
+ if (!token.startsWith("/") && !token.startsWith("\\")
+ && !token.startsWith(".")
+ && !token.startsWith("..")) {
// it indeed is a drive spec, get the next bit
String oneMore = tokenizer.nextToken().trim();
if (!oneMore.equals(File.pathSeparator)) {
1.19 +24 -1 ant/src/testcases/org/apache/tools/ant/types/PathTest.java
Index: PathTest.java
===================================================================
RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/types/PathTest.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- PathTest.java 7 Mar 2003 11:23:13 -0000 1.18
+++ PathTest.java 16 Jul 2003 11:00:36 -0000 1.19
@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2000-2002 The Apache Software Foundation. All rights
+ * Copyright (c) 2000-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -102,6 +102,29 @@
assertEquals(":\\a", l[0].substring(1));
assertEquals(":\\b", l[1].substring(1));
}
+ }
+
+ public void testRelativePathUnixStyle() {
+ project.setBasedir("src/etc");
+ Path p = new Path(project, "..:testcases");
+ String[] l = p.list();
+ assertEquals("two items, Unix style", 2, l.length);
+ if (isUnixStyle) {
+ assertTrue("test resolved relative to src/etc",
+ l[0].endsWith("/src"));
+ assertTrue("test resolved relative to src/etc",
+ l[1].endsWith("/src/etc/testcases"));
+ } else if (isNetWare) {
+ assertTrue("test resolved relative to src/etc",
+ l[0].endsWith("\\src"));
+ assertTrue("test resolved relative to src/etc",
+ l[1].endsWith("\\src\\etc\\testcases"));
+ } else {
+ assertTrue("test resolved relative to src/etc",
+ l[0].endsWith("\\src"));
+ assertTrue("test resolved relative to src/etc",
+ l[1].endsWith("\\src\\etc\\testcases"));
+ }
}
public void testConstructorWindowsStyle() {
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org