ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 20457] New: - VAJRemoteUtil calls getAbsolutePath instead of getPath
Date Tue, 03 Jun 2003 18:12:08 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20457>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20457

VAJRemoteUtil calls getAbsolutePath instead of getPath

           Summary: VAJRemoteUtil calls getAbsolutePath instead of getPath
           Product: Ant
           Version: 1.5.3
          Platform: Sun
        OS/Version: Solaris
            Status: NEW
          Severity: Minor
          Priority: Other
         Component: Optional Tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: douglas_reith@yahoo.com.au


(Apologies if duplicate - couldn't find it)

I am starting an Ant build on Sun Solaris which eventually connects to a Visual 
Age workbench running on a Windows 2000 PC using the optional task vajexport.
The servlet URL that it creates is incorrect because the destination directory 
(destdir) attribute has the UNIX user.dir appended to the front like so:

http://vajhost:2525/servlet/vajexport?
deb=false&owr=true&dir=/ant_files/tmp/C:/temp&cls=true&res=true&src=false&dex=tr
ue&include=SystemProj/com/world/hello

Here the problem is: dir=/ant_files/tmp/C:/temp
Where it should just be: dir=C:/temp

I tried to replicate on Windows but the error did not appear (could be a 
difference in Java versions as well).

I tracked it down to this method:
org.apache.tools.ant.taskdefs.optional.ide
VAJRemoteUtil.assembleImportExportParams(..blah..)

And this line:
String result =
            VAJToolsServlet.DIR_PARAM + "="
            + dir.getAbsolutePath().replace('\\', '/') ...etc

Which I changed to:
String result =
            VAJToolsServlet.DIR_PARAM + "="
            + dir.getPath().replace('\\', '/') ...etc

That is, I've changed the getAbsolutePath() to getPath() after reading the Java 
API which states for getAbsolutePath() that:
"On UNIX systems, a relative pathname is made absolute by resolving it against 
the current user directory."

Now this fix is obviously a bit of a quick one.. not necessarily the right one.

Here are the UNIX environment details (I've removed sections that are not 
important and/or sensitive):
------- Ant diagnostics report -------
Apache Ant version 1.5.3 compiled on April 16 2003

-------------------------------------------
 Implementation Version (JDK1.2+ only)
-------------------------------------------
core tasks     : 1.5.3
optional tasks : 1.5.3

-------------------------------------------
 ANT_HOME/lib jar listing
-------------------------------------------
ant.jar (737884 bytes)
xml-apis.jar (108484 bytes)
xercesImpl.jar (885250 bytes)
optional.jar (671546 bytes)

-------------------------------------------
 System properties
-------------------------------------------
java.runtime.name : Java(TM) 2 Runtime Environment, Standard Edition
java.vm.version : 1.3.0_04
java.vm.vendor : Sun Microsystems Inc.
java.vm.name : Java HotSpot(TM) Client VM
file.encoding.pkg : sun.io
java.vm.specification.name : Java Virtual Machine Specification
user.dir : /ant_files/tmp
java.runtime.version : 1.3.0_04
os.version : 5.8

Thanks for your time.

P.S. Spent time solving remote feature problems (import statements, resource 
files)... and THEN found bug 10016... should have looked here first!

Mime
View raw message