You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2011/10/14 16:00:47 UTC

DO NOT REPLY [Bug 52030] New: Javac Task looses source files when forked and special characters exists in the class name

https://issues.apache.org/bugzilla/show_bug.cgi?id=52030

             Bug #: 52030
           Summary: Javac Task looses source files when forked and special
                    characters exists in the class name
           Product: Ant
           Version: 1.8.2
          Platform: Macintosh
            Status: NEW
          Severity: major
          Priority: P2
         Component: Core tasks
        AssignedTo: notifications@ant.apache.org
        ReportedBy: divan.mostert@c24.biz
    Classification: Unclassified


The following code works for classes with ascii only characters:

<javac source="1.5" target="1.5" sourcepath="" srcdir="${src.dir}"
destdir="${classes.dir}" deprecation="on" debug="on" classpathref="classpath"
fork="true" memoryMaximumSize="@maxMemorySize@" encoding="UTF-8">
            <include name="${app.directory}/**/*.java"/>
        </javac>

However, it fails when compiling clsses with special characters in the class
names:

[iosession]   Task javac started
[iosession]    
/C24/PUB/io-stds/trunk/standards/GSIT/build/test/deployment/build-biz.c24.io.minos.xml:73:
warning: 'includeantruntime' was not set, defaulting to
build.sysclasspath=last; set to false for repeatable builds
[iosession]     Compiling 131 source files to
/C24/PUB/io-stds/trunk/standards/GSIT/build/test/deployment/build/classes
[iosession]     javac: file not found:
/C24/PUB/io-stds/trunk/standards/GSIT/build/test/deployment/src/java/biz/c24/io/minos/AléaChiffréClass.java
[iosession]     Usage: javac <options> <source files>
[iosession]     use -help for a list of possible options
[iosession] Target compile finished

It's as if encoding setting is ignored.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 52030] Javac Task looses source files when forked and special characters exists in the class name

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52030

Divan Mostert <di...@c24.biz> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         OS/Version|                            |All

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 52030] Javac Task looses source files when forked and special characters exists in the class name

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52030

Jesse Glick <jg...@netbeans.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |jglick@netbeans.org
         Resolution|                            |WORKSFORME

--- Comment #3 from Jesse Glick <jg...@netbeans.org> 2011-10-29 03:53:08 UTC ---
Not clear that Ant is doing anything wrong here; it relies on java.io.File to
supply Unicode paths. The native filesystem may have difficulties with
non-ASCII path names, and this might be specific to a certain kind of mount,
especially for network drives. Certainly there is no problem using Ant to
compile projects with non-ASCII (indeed non-ISO-Latin-1) class names on a local
ext3 mount in Ubuntu.

While I do not know of any reason it would trigger encoding bugs, your use of
<include/> here is rather suspicious. There is no reason to specify includes of
all **/*.java. Just make sure your source path is correct; in this case,
${src.dir} ought to be
"/C24/PUB/io-stds/trunk/standards/GSIT/build/test/deployment/src/java".

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 52030] Javac Task looses source files when forked and special characters exists in the class name

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52030

--- Comment #2 from Divan Mostert <di...@c24.biz> 2011-10-14 15:39:30 UTC ---
Would it be possible to add a setting for it in the next release?

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 52030] Javac Task looses source files when forked and special characters exists in the class name

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52030

--- Comment #1 from Stefan Bodewig <bo...@apache.org> 2011-10-14 15:36:39 UTC ---
the encoding attribute applies to the encoding of the file's content not of the
file's name.  I don't think we have anything in javac that would control
encoding of file names.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 52030] Javac Task looses source files when forked and special characters exists in the class name

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52030

--- Comment #5 from Divan Mostert <di...@c24.biz> 2011-10-31 12:15:56 UTC ---
It does indeed look like the file was correctly picked up from using
@/tmp/files. However, the new JVM  does seem to ignore the encoding setting
when it is trying access the file at the given location.

I had to force writing out the Java classes with a specific encoding like so:
writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file),
Charset.forName("UTF-8")));

You'd have to be doing the same/similar when reading files in.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 52030] Javac Task looses source files when forked and special characters exists in the class name

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52030

--- Comment #4 from Jesse Glick <jg...@netbeans.org> 2011-10-29 04:07:06 UTC ---
Note that when you are running a forked compiler and the javac command line
exceeds the POSIX maximum guaranteed size of 4Kb,
org.apache.tools.ant.taskdefs.compilers.DefaultCompilerAdapter.executeExternalCompile
will create a temp file for arguments (including source filenames) and pass it
to javac using @/tmp/files syntax. This temp file uses the operating system's
default character encoding, since
com.sun.tools.javac.main.CommandLine.loadCmdFile expects it in that encoding.
On modern Linux distributions at least, UTF-8 is the default encoding, which is
safe for any characters; on Mac OS X some other limited encoding might be the
default, meaning you can only deal with filenames that can be represented in
that encoding, though I would expect 'é' to be safe. Anyway the error message
you quote seems to indicate that javac received the filename intact but was
unable to open it.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.