[ 
https://issues.apache.org/jira/browse/MJAVADOC-544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16709048#comment-16709048
 ] 

ASF GitHub Bot commented on MJAVADOC-544:
-----------------------------------------

michael-st commented on issue #10: [MJAVADOC-544] - Changed behaviour of 
Javadoc for temporary files encoding (options, argfile, ...)
URL: 
https://github.com/apache/maven-javadoc-plugin/pull/10#issuecomment-444195245
 
 
   too bad...
   
   The error message occurs when compiling the file 
"/src/test/resources/unit/argfileumlautencoding-test/argfileumlautencoding/test/Appäöüß.java".
   The compiler complains about a name mismatch between class "Appäöüß" and the 
filename "Appäöüß.java".
   This is a charset-problem, which occurs only in the linux environment.
   
   I tried to reproduce the problem:
   
   The build passes when I execute the maven build in a docker container 
(image: maven:3-jdk-9-slim) in which the LANG is set to C.UTF-8.
   If I change the LANG-environment variable in the container ("export 
LANG=en_US.ISO-8859-1") - the build fails.
   
   ```
   FROM maven:3-jdk-9-slim
   RUN echo $LANG
   > C.UTF-8
   RUN apt update && apt install -y git && echo dirty no cleanup of apt
   RUN git clone https://github.com/michael-st/maven-javadoc-plugin.git
   RUN cd maven-javadoc-plugin
   RUN git checkout MJAVADOC-544
   RUN mvn 
-Dtest=org.apache.maven.plugins.javadoc.JavadocReportTest#testArgfileUmlautEncoding
 clean test
   > build passes
   RUN export LANG=en_US.ISO-8859-1
   RUN echo $LANG
   > en_US.ISO-8859-1
   RUN mvn 
-Dtest=org.apache.maven.plugins.javadoc.JavadocReportTest#testArgfileUmlautEncoding
 clean test
   > build fails
   ```
   
   I tried to convert the file itself and the corresponding .xml-file to 
ISO-8859-1, but that did not go well either.
   
   At the moment I'm out of ideas and I don't think that I can find a working 
solution for this (besides setting the LANG to ...UTF-8 in the build 
environment).
   
   My initial problem was only related to the options file, which would be 
fixed with this pull request.
   For this all tests should pass (hopefully).
   
   So, for this issue, I have removed the special handling for argfile, which 
would only be needed if someone is using special characters in java class names.
   I also modified the commit message to reflect this change.
   
   Is this course of action okay?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> Changed behaviour of Javadoc for temporary files encoding (options, argfile, 
> ...)
> ---------------------------------------------------------------------------------
>
>                 Key: MJAVADOC-544
>                 URL: https://issues.apache.org/jira/browse/MJAVADOC-544
>             Project: Maven Javadoc Plugin
>          Issue Type: Bug
>          Components: javadoc
>    Affects Versions: 3.0.1
>         Environment: JDK9+, Windows
>            Reporter: Michael Stumpf
>            Priority: Major
>
> With JDK9 the behaviour of javadoc has apparently changed (at least on 
> Windows platform).
> In a project with special characters (umlaut) in the organization name the 
> content of the options file was written with the default platform encoding 
> (cp1252).
> As a result, the javadoc generation fails on javadoc execution with "Exit 
> code: 1 - javadoc: error - cannot read Input length = 1".
> With JDK8 javadoc generation works.
> It also succeeds with JDK9 and setting the environment variable: 
> JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8
> However, this should not be necessary, and maven-javadoc-plugin should work 
> out of the box.
>  
> h6. Cause:
> After some tests it appears to be the case that the JDK9 Javadoc reads 
> @-files always with UTF-8 charset, regardless of platform encoding.
> I looked into the issue and prepared a patch for the plugin when working with 
> JDK9+ and added two tests for the temporary files options and argfile.
> To my knowledge, the temporary file "packages" cannot contain special 
> characters, since this isn't allowed in the java specification, so no 
> workaround is added.
> The file javadoc.bat is not affected (a test with a JDK in the directory 
> "C:\jdk9äöüß" worked with the file being platform encoded).
> h6. 
> Resolution:
> I'll try to create a pull request from 
> https://github.com/michael-st/maven-javadoc-plugin



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to