tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kuiper, Arnout" <Arnout.Kui...@nl.origin-it.com>
Subject RE: cvs commit: jakarta-tools/ant/src/main/org/apache/tools/ant P roject.java
Date Fri, 03 Dec 1999 14:16:31 GMT
Hi,

I got the same problem last night. I fixed it as follows:

    public File resolveFile(String fileName) {
	// deal with absolute files
      File file = new File(fileName);
	if(file.isAbsolute() ) return file;

	file = new File(baseDir.getAbsolutePath());
	StringTokenizer tok = new StringTokenizer(fileName, "/", false);
      ...

I prefer this above the do-it-yourself approach. File.isAbsolute() is
standard Java, and should work on the most obscure (future) platforms.
When we implement this test ourselves, it is our responsibility,
otherwise we can blame the Java platform implementors;-)

Arnout Kuiper

> -----Original Message-----
> From: pier@hyperreal.org [mailto:pier@hyperreal.org]
> Sent: vrijdag 3 december 1999 13:42
> To: jakarta-tools-cvs@apache.org
> Subject: cvs commit: jakarta-tools/ant/src/main/org/apache/tools/ant
> Project.java
> 
> 
> pier        99/12/03 04:41:43
> 
>   Modified:    ant/src/main/org/apache/tools/ant Project.java
>   Log:
>   I found a small bug: on Windows NT i get this error message:
>   IOException getting canonical path for 
> C:\CVSArchive\jakarta-tools\ant\C:\WinNT\Profiles\Pier\opt\ant
> \lib\ant.jar: The filename, directory name, or volume label 
> syntax is incorrect
>   
>   Yous see that "C:\CVSArchive\jakarta-tools\ant\" is appears 
> two times?
>   Well, it's not a typo. This fixes it.
>   
>   Revision  Changes    Path
>   1.15      +3 -1      
> jakarta-tools/ant/src/main/org/apache/tools/ant/Project.java
>   
>   Index: Project.java
>   ===================================================================
>   RCS file: 
> /home/cvs/jakarta-tools/ant/src/main/org/apache/tools/ant/Proj
> ect.java,v
>   retrieving revision 1.14
>   retrieving revision 1.15
>   diff -u -r1.14 -r1.15
>   --- Project.java	1999/11/30 21:45:20	1.14
>   +++ Project.java	1999/12/03 12:41:42	1.15
>   @@ -310,7 +310,9 @@
>    
>        public File resolveFile(String fileName) {
>    	// deal with absolute files
>   -	if(fileName.startsWith("/") ) return new File( fileName );
>   +	if (fileName.startsWith("/")) return new File( fileName );
>   +	if 
> (System.getProperty("os.name").toLowerCase().startsWith("windows"))
>   +	    if (fileName.indexOf(":\\")==1) return new File( fileName );
>    
>    	File file = new File(baseDir.getAbsolutePath());
>    	StringTokenizer tok = new StringTokenizer(fileName, "/", false);
>   
>   
>   
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
> 

Mime
View raw message