mbenson 2005/01/31 14:35:56
Modified: src/main/org/apache/tools/ant/util FileUtils.java
Log:
Fixed isSymbolicLink logic for null parent file; made isAbsolutePath() public.
Revision Changes Path
1.86 +8 -4 ant/src/main/org/apache/tools/ant/util/FileUtils.java
Index: FileUtils.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/util/FileUtils.java,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -r1.85 -r1.86
--- FileUtils.java 26 Jan 2005 17:26:33 -0000 1.85
+++ FileUtils.java 31 Jan 2005 22:35:55 -0000 1.86
@@ -714,7 +714,7 @@
* @param filename the file name to be checked for being an absolute
path.
* @return true if the filename represents an absolute path.
*/
- private static boolean isAbsolutePath(String filename) {
+ public static boolean isAbsolutePath(String filename) {
if (filename.startsWith(File.separator)) {
// common for all os
return true;
@@ -1166,8 +1166,12 @@
*/
public boolean isSymbolicLink(File parent, String name)
throws IOException {
- File toTest = new File(((parent == null)
- ? null : parent.getCanonicalPath()), name);
+ if (parent == null) {
+ File f = new File(name);
+ parent = f.getParentFile();
+ name = f.getName();
+ }
+ File toTest = new File(parent.getCanonicalPath(), name);
return !toTest.getAbsolutePath().equals(toTest.getCanonicalPath());
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]