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=25856>. 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=25856 GCJ version of Javac task wrongly checks for destdir errors Summary: GCJ version of Javac task wrongly checks for destdir errors Product: Ant Version: 1.6.0 Platform: All OS/Version: All Status: NEW Severity: Normal Priority: Other Component: Core tasks AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] On line 122 of src/main/org/apache/tools/ant/taskdefs/compilers/Gcj.java, the destination directory (destdir) is created by calling destdir.mkdirs(). The return value of mkdirs is checked, and if true, a BuildException is thrown. This is not the correct behavior because according to the Java docs for mkdirs ( http://java.sun.com/j2se/1.4.2/docs/api/java/io/File.html#mkdirs() ), mkdirs returns true if the directories are created; false otherwise. That means if destdir does not exist, the Gcj task will create it and then promptly throw an exception. On the other hand, if destdir already exists, then mkdirs will return false, even though it has completed successfully! And because destdir usually exists already, the Gcj task does not throw an exception in the typical case. This is why the code cannot simply be changed to throw an exception on a false return value rather than true. The proper fix is to call mkdirs if and only if the destdir does not exist (by calling destdir.exists()). The task can then check the return value of mkdirs and throw an exception if it gets back false. This will give the desired behavior of the task. By the way, there is an unneeded semicolon on line 125. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]