Discussion:
[jira] [Created] (MJAVADOC-544) Changed behaviour of Javadoc for temporary files encoding (options, argfile, ...)
Michael Stumpf (JIRA)
2018-11-13 21:19:00 UTC
Permalink
Michael Stumpf created MJAVADOC-544:
---------------------------------------

Summary: 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


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)
ASF GitHub Bot (JIRA)
2018-11-13 22:08:00 UTC
Permalink
[ https://issues.apache.org/jira/browse/MJAVADOC-544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16685814#comment-16685814 ]

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

michael-st opened a new pull request #10: [MJAVADOC-544] - Changed behaviour of Javadoc for temporary files encoding (options, argfile, ...)
URL: https://github.com/apache/maven-javadoc-plugin/pull/10


mvn -Prun-its verify was run with JDK9 on windows without errors

----------------------------------------------------------------
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.
Post by Michael Stumpf (JIRA)
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.
 
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.
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)
Michael Stumpf (JIRA)
2018-11-13 22:13:00 UTC
Permalink
[ https://issues.apache.org/jira/browse/MJAVADOC-544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16685826#comment-16685826 ]

Michael Stumpf commented on MJAVADOC-544:
-----------------------------------------

pull request added: [https://github.com/apache/maven-javadoc-plugin/pull/10]
Post by Michael Stumpf (JIRA)
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.
 
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.
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)
ASF GitHub Bot (JIRA)
2018-11-29 10:21:00 UTC
Permalink
[ https://issues.apache.org/jira/browse/MJAVADOC-544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16702982#comment-16702982 ]

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-442781481


Due to changes to readFile in b78042ec conflicts were introduced.

I rebased the PR and fixed some style-issues in the tests.

----------------------------------------------------------------
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.
Post by Michael Stumpf (JIRA)
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.
 
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.
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)
ASF GitHub Bot (JIRA)
2018-11-30 10:13:00 UTC
Permalink
[ https://issues.apache.org/jira/browse/MJAVADOC-544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16704518#comment-16704518 ]

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

rfscholte commented on a change in pull request #10: [MJAVADOC-544] - Changed behaviour of Javadoc for temporary files encoding (options, argfile, ...)
URL: https://github.com/apache/maven-javadoc-plugin/pull/10#discussion_r237807959



##########
File path: src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
##########
@@ -4414,9 +4430,15 @@ private void addCommandLineArgFile( Commandline cmd, File javadocOutputDirectory
cmd.createArg().setValue( "@" + FILES_FILE_NAME );
}

+ /* default to platform encoding */
+ String encoding = null;
+ if ( JAVA_VERSION.compareTo( SINCE_JAVADOC_9 ) >= 0 )

Review comment:
Please switch to `isAtLeast()` or `isBefore()`, which are better readable.

----------------------------------------------------------------
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.
Post by Michael Stumpf (JIRA)
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.
 
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.
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)
ASF GitHub Bot (JIRA)
2018-11-30 10:13:00 UTC
Permalink
[ https://issues.apache.org/jira/browse/MJAVADOC-544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16704517#comment-16704517 ]

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

rfscholte commented on a change in pull request #10: [MJAVADOC-544] - Changed behaviour of Javadoc for temporary files encoding (options, argfile, ...)
URL: https://github.com/apache/maven-javadoc-plugin/pull/10#discussion_r237807890



##########
File path: src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
##########
@@ -4368,9 +4378,15 @@ private void addCommandLineOptions( Commandline cmd, List<String> arguments, Fil
options.append( StringUtils.join( arguments.iterator(),
SystemUtils.LINE_SEPARATOR ) );

+ /* default to platform encoding */
+ String encoding = null;
+ if ( JAVA_VERSION.compareTo( SINCE_JAVADOC_9 ) >= 0 )

Review comment:
Please switch to `isAtLeast()` or `isBefore()`, which are better readable.

----------------------------------------------------------------
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.
Post by Michael Stumpf (JIRA)
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.
 
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.
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)
ASF GitHub Bot (JIRA)
2018-12-02 09:45:00 UTC
Permalink
[ https://issues.apache.org/jira/browse/MJAVADOC-544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16706155#comment-16706155 ]

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

rfscholte commented on a change in pull request #10: [MJAVADOC-544] - Changed behaviour of Javadoc for temporary files encoding (options, argfile, ...)
URL: https://github.com/apache/maven-javadoc-plugin/pull/10#discussion_r238091505



##########
File path: src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
##########
@@ -4414,9 +4430,15 @@ private void addCommandLineArgFile( Commandline cmd, File javadocOutputDirectory
cmd.createArg().setValue( "@" + FILES_FILE_NAME );
}

+ /* default to platform encoding */
+ String encoding = null;
+ if ( JAVA_VERSION.compareTo( SINCE_JAVADOC_9 ) >= 0 )

Review comment:
Don't forget to squash your commits

----------------------------------------------------------------
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.
Post by Michael Stumpf (JIRA)
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.
 
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.
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)
ASF GitHub Bot (JIRA)
2018-12-03 09:33:00 UTC
Permalink
[ https://issues.apache.org/jira/browse/MJAVADOC-544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16706883#comment-16706883 ]

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

michael-st commented on a change in pull request #10: [MJAVADOC-544] - Changed behaviour of Javadoc for temporary files encoding (options, argfile, ...)
URL: https://github.com/apache/maven-javadoc-plugin/pull/10#discussion_r238194654



##########
File path: src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
##########
@@ -4414,9 +4430,15 @@ private void addCommandLineArgFile( Commandline cmd, File javadocOutputDirectory
cmd.createArg().setValue( "@" + FILES_FILE_NAME );
}

+ /* default to platform encoding */
+ String encoding = null;
+ if ( JAVA_VERSION.compareTo( SINCE_JAVADOC_9 ) >= 0 )

Review comment:
I addressed your points and squashed the commits.

Ran mvn -Prun-its verify with JDK8 and JDK9 on Windows successfully.

----------------------------------------------------------------
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.
Post by Michael Stumpf (JIRA)
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.
 
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.
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)
ASF GitHub Bot (JIRA)
2018-12-03 19:22:00 UTC
Permalink
[ https://issues.apache.org/jira/browse/MJAVADOC-544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16707677#comment-16707677 ]

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

rfscholte 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-443835546


https://builds.apache.org/view/M-R/view/Maven/job/maven-box/job/maven-javadoc-plugin/job/MJAVADOC-544/ we're not there yet.

----------------------------------------------------------------
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.
Post by Michael Stumpf (JIRA)
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.
 
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.
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)
ASF GitHub Bot (JIRA)
2018-12-04 17:57:00 UTC
Permalink
[ 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.
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.
 
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.
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)
ASF GitHub Bot (JIRA)
2018-12-04 19:01:00 UTC
Permalink
[ https://issues.apache.org/jira/browse/MJAVADOC-544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16709113#comment-16709113 ]

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

rfscholte closed pull request #10: [MJAVADOC-544] - Changed behaviour of Javadoc for temporary files encoding (options, argfile, ...)
URL: https://github.com/apache/maven-javadoc-plugin/pull/10




This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/pom.xml b/pom.xml
index 43011e6..de6326c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -116,6 +116,9 @@ under the License.
<contributor>
<name>Kevin Risden</name>
</contributor>
+ <contributor>
+ <name>Michael Stumpf</name>
+ </contributor>
</contributors>

<dependencies>
diff --git a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
index 7a506ba..addcd36 100644
--- a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
+++ b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
@@ -108,6 +108,7 @@
import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLClassLoader;
+import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
@@ -4374,9 +4375,15 @@ private void addCommandLineOptions( Commandline cmd, List<String> arguments, Fil
options.append( StringUtils.join( arguments.iterator(),
SystemUtils.LINE_SEPARATOR ) );

+ /* default to platform encoding */
+ String outputFileEncoding = null;
+ if ( JAVA_VERSION.isAtLeast( "9" ) )
+ {
+ outputFileEncoding = StandardCharsets.UTF_8.name();
+ }
try
{
- FileUtils.fileWrite( optionsFile.getAbsolutePath(), null /* platform encoding */, options.toString() );
+ FileUtils.fileWrite( optionsFile.getAbsolutePath(), outputFileEncoding, options.toString() );
}
catch ( IOException e )
{
diff --git a/src/test/java/org/apache/maven/plugins/javadoc/JavadocReportTest.java b/src/test/java/org/apache/maven/plugins/javadoc/JavadocReportTest.java
index 0f18b6b..46358ab 100644
--- a/src/test/java/org/apache/maven/plugins/javadoc/JavadocReportTest.java
+++ b/src/test/java/org/apache/maven/plugins/javadoc/JavadocReportTest.java
@@ -26,6 +26,7 @@
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
+import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.util.HashMap;
@@ -189,10 +190,26 @@ private void createTestRepo()
*/
private static String readFile( File file )
throws IOException
+ {
+ return readFile( file, StandardCharsets.UTF_8 );
+ }
+
+ /**
+ * Convenience method that reads the contents of the specified file object into a string with a
+ * <code>space</code> as line separator.
+ *
+ * @see #LINE_SEPARATOR
+ * @param file the file to be read
+ * @param cs charset to use
+ * @return a String object that contains the contents of the file
+ * @throws IOException if any
+ */
+ private static String readFile( File file, Charset cs )
+ throws IOException
{
StringBuilder str = new StringBuilder( (int) file.length() );

- for ( String strTmp : Files.readAllLines( file.toPath(), StandardCharsets.UTF_8 ) )
+ for ( String strTmp : Files.readAllLines( file.toPath(), cs ) )
{
str.append( LINE_SEPARATOR);
str.append( strTmp );
@@ -497,6 +514,55 @@ public void testQuotedPath()
}
}

+ /**
+ * Method to test when the options file has umlauts.
+ *
+ * @throws Exception if any
+ */
+ public void testOptionsUmlautEncoding()
+ throws Exception
+ {
+ File testPom = new File(unit, "optionsumlautencoding-test/optionsumlautencoding-test-plugin-config.xml" );
+ JavadocReport mojo = lookupMojo( testPom );
+ mojo.execute();
+
+ File optionsFile = new File( mojo.getOutputDirectory(), "options" );
+ assertTrue( optionsFile.exists() );
+
+ // check for a part of the window title
+ String content;
+ if ( JavaVersion.JAVA_VERSION.isAtLeast( "9" ) )
+ {
+ content = readFile( optionsFile, StandardCharsets.UTF_8 );
+ }
+ else
+ {
+ content = readFile( optionsFile, Charset.defaultCharset() );
+ }
+ assertTrue( content.contains( "Options Umlaut Encoding ö ä ü ß" ) );
+
+ File apidocs = new File( getBasedir(), "target/test/unit/optionsumlautencoding-test/target/site/apidocs" );
+
+ // package level generated javadoc files
+ assertTrue( new File( apidocs, "optionsumlautencoding/test/App.html" ).exists() );
+ assertTrue( new File( apidocs, "optionsumlautencoding/test/AppSample.html" ).exists() );
+
+ // project level generated javadoc files
+ assertTrue( new File( apidocs, "index-all.html" ).exists() );
+ assertTrue( new File( apidocs, "index.html" ).exists() );
+ assertTrue( new File( apidocs, "overview-tree.html" ).exists() );
+ assertTrue( new File( apidocs, "stylesheet.css" ).exists() );
+
+ if ( JavaVersion.JAVA_VERSION.isBefore( "10" ) )
+ {
+ assertTrue( new File( apidocs, "package-list" ).exists() );
+ }
+ else
+ {
+ assertTrue( new File( apidocs, "element-list" ).exists() );
+ }
+ }
+
/**
* @throws Exception if any
*/
diff --git a/src/test/java/org/apache/maven/plugins/javadoc/stubs/OptionsUmlautEncodingMavenProjectStub.java b/src/test/java/org/apache/maven/plugins/javadoc/stubs/OptionsUmlautEncodingMavenProjectStub.java
new file mode 100644
index 0000000..a38d7ce
--- /dev/null
+++ b/src/test/java/org/apache/maven/plugins/javadoc/stubs/OptionsUmlautEncodingMavenProjectStub.java
@@ -0,0 +1,80 @@
+package org.apache.maven.plugins.javadoc.stubs;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
+import org.apache.maven.model.Scm;
+import org.apache.maven.model.Build;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.io.File;
+
+public class OptionsUmlautEncodingMavenProjectStub
+ extends MavenProjectStub
+{
+ private Scm scm;
+
+ public OptionsUmlautEncodingMavenProjectStub()
+ {
+ readModel( new File( getBasedir(), "optionsumlautencoding-test-plugin-config.xml" ) );
+
+ setGroupId( "org.apache.maven.plugins.maven-javadoc-plugin.unit" );
+ setArtifactId( "optionsumlautencoding-test" );
+ setVersion( "1.0-SNAPSHOT" );
+ setName( "Maven Javadoc Plugin Options Umlaut Encoding Test" );
+ setUrl( "http://maven.apache.org" );
+ setPackaging( "jar" );
+
+ Scm scm = new Scm();
+ scm.setConnection( "scm:svn:http://svn.apache.org/maven/sample/trunk" );
+ setScm( scm );
+
+ Build build = new Build();
+ build.setFinalName( "optionsumlautencoding-test" );
+ build.setDirectory( super.getBasedir() + "/target/test/unit/optionsumlautencoding-test/target" );
+ setBuild( build );
+
+ List<String> compileSourceRoots = new ArrayList<>();
+ compileSourceRoots.add( getBasedir() + "/optionsumlautencoding/test" );
+ setCompileSourceRoots( compileSourceRoots );
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public Scm getScm()
+ {
+ return scm;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void setScm( Scm scm )
+ {
+ this.scm = scm;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public File getBasedir()
+ {
+ return new File( super.getBasedir() + "/src/test/resources/unit/optionsumlautencoding-test" );
+ }
+}
diff --git a/src/test/resources/unit/optionsumlautencoding-test/optionsumlautencoding-test-plugin-config.xml b/src/test/resources/unit/optionsumlautencoding-test/optionsumlautencoding-test-plugin-config.xml
new file mode 100644
index 0000000..eed07c7
--- /dev/null
+++ b/src/test/resources/unit/optionsumlautencoding-test/optionsumlautencoding-test-plugin-config.xml
@@ -0,0 +1,73 @@
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.maven.plugins.maven-javadoc-plugin.unit</groupId>
+ <artifactId>optionsumlautencoding-test</artifactId>
+ <packaging>jar</packaging>
+ <version>1.0-SNAPSHOT</version>
+ <inceptionYear>2006</inceptionYear>
+ <name>Maven Javadoc Plugin Options Umlaut Encoding Test</name>
+ <url>http://maven.apache.org</url>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <project implementation="org.apache.maven.plugins.javadoc.stubs.OptionsUmlautEncodingMavenProjectStub"/>
+ <localRepository>${localRepository}</localRepository>
+ <outputDirectory>${basedir}/target/test/unit/optionsumlautencoding-test/target/site/apidocs</outputDirectory>
+ <javadocOptionsDir>${basedir}/target/test/unit/optionsumlautencoding-test/target/javadoc-bundle-options</javadocOptionsDir>
+ <breakiterator>false</breakiterator>
+ <old>false</old>
+ <show>protected</show>
+ <quiet>true</quiet>
+ <verbose>false</verbose>
+ <author>true</author>
+ <encoding>ISO-8859-1</encoding>
+ <docfilessubdirs>false</docfilessubdirs>
+ <linksource>false</linksource>
+ <nocomment>false</nocomment>
+ <nodeprecated>false</nodeprecated>
+ <nodeprecatedlist>false</nodeprecatedlist>
+ <nohelp>false</nohelp>
+ <noindex>false</noindex>
+ <nonavbar>false</nonavbar>
+ <nosince>false</nosince>
+ <notree>false</notree>
+ <serialwarn>false</serialwarn>
+ <splitindex>false</splitindex>
+ <stylesheet>java</stylesheet>
+ <groups/>
+ <tags/>
+ <use>true</use>
+ <version>true</version>
+ <!-- include umlauts in windowtitle which are written to options-file -->
+ <windowtitle>Maven Javadoc Plugin Options Umlaut Encoding ö ä ü ß Test 1.0-SNAPSHOT API</windowtitle>
+ <debug>true</debug>
+ <failOnError>true</failOnError>
+ <detectJavaApiLink>true</detectJavaApiLink>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/src/test/resources/unit/optionsumlautencoding-test/optionsumlautencoding/test/App.java b/src/test/resources/unit/optionsumlautencoding-test/optionsumlautencoding/test/App.java
new file mode 100644
index 0000000..ad8447b
--- /dev/null
+++ b/src/test/resources/unit/optionsumlautencoding-test/optionsumlautencoding/test/App.java
@@ -0,0 +1,36 @@
+package optionsumlautencoding.test;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+public class App
+{
+
+ public static void main( String[] args )
+ {
+ System.out.println( "Sample Application." );
+ }
+
+
+ protected void sampleMethod( String str )
+ {
+ System.out.println( str );
+ }
+
+}
\ No newline at end of file
diff --git a/src/test/resources/unit/optionsumlautencoding-test/optionsumlautencoding/test/AppSample.java b/src/test/resources/unit/optionsumlautencoding-test/optionsumlautencoding/test/AppSample.java
new file mode 100644
index 0000000..dcae2e3
--- /dev/null
+++ b/src/test/resources/unit/optionsumlautencoding-test/optionsumlautencoding/test/AppSample.java
@@ -0,0 +1,39 @@
+package optionsumlautencoding.test;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * @author Maria Odea Ching
+ * @since 1.4
+ * @version %I%, %G%
+ */
+public class AppSample
+{
+
+ /**
+ * The main method
+ *
+ * @param args an array of strings that contains the arguments
+ */
+ public static void main( String[] args )
+ {
+ System.out.println( "Another Sample Application" );
+ }
+}
\ No newline at end of file




----------------------------------------------------------------
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.
Post by Michael Stumpf (JIRA)
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.
 
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.
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)
Robert Scholte (JIRA)
2018-12-04 19:02:00 UTC
Permalink
[ https://issues.apache.org/jira/browse/MJAVADOC-544?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Robert Scholte closed MJAVADOC-544.
-----------------------------------
Resolution: Fixed
Assignee: Robert Scholte
Fix Version/s: 3.0.2

Fixed in [b9ec67bbf5a865bbfff0a8eaa76bc990d568a55c|https://gitbox.apache.org/repos/asf?p=maven-javadoc-plugin.git;a=commit;h=b9ec67bbf5a865bbfff0a8eaa76bc990d568a55c]
Thanks for the patch!
Post by Michael Stumpf (JIRA)
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
Assignee: Robert Scholte
Priority: Major
Fix For: 3.0.2
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.
 
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.
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)
Hudson (JIRA)
2018-12-04 19:21:00 UTC
Permalink
[ https://issues.apache.org/jira/browse/MJAVADOC-544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16709161#comment-16709161 ]

Hudson commented on MJAVADOC-544:
---------------------------------

Build failed in Jenkins: Maven TLP » maven-javadoc-plugin » master #84

See https://builds.apache.org/job/maven-box/job/maven-javadoc-plugin/job/master/84/
Post by Michael Stumpf (JIRA)
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
Assignee: Robert Scholte
Priority: Major
Fix For: 3.0.2
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.
 
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.
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)
Michael Osipov (JIRA)
2018-12-04 21:25:00 UTC
Permalink
[ https://issues.apache.org/jira/browse/MJAVADOC-544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16709262#comment-16709262 ]

Michael Osipov commented on MJAVADOC-544:
-----------------------------------------

The change introduced a superfluous merge commit as well as files with mixed line endings.

I did not yet find the proper spot in the JDK source, but I think this is related to the use of {{Files.newBufferedReader()}} where the default encoding is UTF-8.
Post by Michael Stumpf (JIRA)
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
Assignee: Robert Scholte
Priority: Major
Fix For: 3.0.2
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.
 
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.
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)
Michael Osipov (JIRA)
2018-12-10 09:06:00 UTC
Permalink
[ https://issues.apache.org/jira/browse/MJAVADOC-544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16714457#comment-16714457 ]

Michael Osipov commented on MJAVADOC-544:
-----------------------------------------

[~michael-st], exactly! That's what I was looking for. My assumption was correct. This was never properly documented...
[~rfscholte], this should give you the proof.
Post by Michael Stumpf (JIRA)
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
Assignee: Robert Scholte
Priority: Major
Fix For: 3.0.2
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.
 
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.
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)
Robert Scholte (JIRA)
2018-12-09 16:10:00 UTC
Permalink
[ https://issues.apache.org/jira/browse/MJAVADOC-544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16714008#comment-16714008 ]

Robert Scholte commented on MJAVADOC-544:
-----------------------------------------

[~michael-o] can't see any evidence of that. Can you recheck master?
Post by Michael Stumpf (JIRA)
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
Assignee: Robert Scholte
Priority: Major
Fix For: 3.0.2
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.
 
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.
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)
Michael Osipov (JIRA)
2018-12-09 19:44:00 UTC
Permalink
[ https://issues.apache.org/jira/browse/MJAVADOC-544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16714076#comment-16714076 ]

Michael Osipov commented on MJAVADOC-544:
-----------------------------------------

I searched for an hour in the jdk source code, but wasn't unable to find the spot. As far as I understand the code there is a common parser for the options file. We need to find this and we have our proof. I'll see again to tomorrow whether I can find that parser.
Post by Michael Stumpf (JIRA)
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
Assignee: Robert Scholte
Priority: Major
Fix For: 3.0.2
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.
 
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.
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)
Michael Stumpf (JIRA)
2018-12-09 21:13:00 UTC
Permalink
[ https://issues.apache.org/jira/browse/MJAVADOC-544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16714100#comment-16714100 ]

Michael Stumpf commented on MJAVADOC-544:
-----------------------------------------

Is this the change you are looking for?

[http://hg.openjdk.java.net/jdk9/jdk9/langtools/diff/527e819dbc95/src/jdk.compiler/share/classes/com/sun/tools/javac/main/CommandLine.java]

 
Post by Michael Stumpf (JIRA)
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
Assignee: Robert Scholte
Priority: Major
Fix For: 3.0.2
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.
 
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.
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)

Loading...