This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-javadoc-plugin.git
The following commit(s) were added to refs/heads/master by this push:
new 88ca8523 Issue #372 Do not split the -d option on commas in the output
path
88ca8523 is described below
commit 88ca8523ac0c4c93de27862378ecdf587fecee5b
Author: Arturo Bernal <[email protected]>
AuthorDate: Wed Oct 28 14:45:38 2026 +0100
Issue #372 Do not split the -d option on commas in the output path
AbstractJavadocMojo wrote the -d (output directory) argument through
the addArgIfNotEmpty overload that tokenizes its value on commas, the
same helper used for genuinely comma-separated options. A directory
containing a comma was split into two argument-file lines, so javadoc
received a truncated, invalid package name and failed with "Illegal
package name".
The output directory is always a single path, never a list, so pass
splitValue=false for -d, matching how -bottom, -doctitle and the other
single-value options are already handled.
---
.../maven/plugins/javadoc/AbstractJavadocMojo.java | 3 +-
.../maven/plugins/javadoc/JavadocReportTest.java | 21 +++++++
.../commapath-test-plugin-config.xml | 70 ++++++++++++++++++++++
.../unit/commapath,test/commapath/test/App.java | 35 +++++++++++
4 files changed, 128 insertions(+), 1 deletion(-)
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 7daeff50..2a6b144f 100644
--- a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
+++ b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
@@ -4683,7 +4683,8 @@ public abstract class AbstractJavadocMojo extends
AbstractMojo {
addArgIfNotEmpty(arguments, "-charset",
JavadocUtil.quotedArgument(getCharset()));
- addArgIfNotEmpty(arguments, "-d",
JavadocUtil.quotedPathArgument(javadocOutputDirectory.toString()));
+ addArgIfNotEmpty(
+ arguments, "-d",
JavadocUtil.quotedPathArgument(javadocOutputDirectory.toString()), false,
false);
addArgIfNotEmpty(arguments, "-docencoding",
JavadocUtil.quotedArgument(getDocencoding()));
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 d3f2e5ef..524fae52 100644
--- a/src/test/java/org/apache/maven/plugins/javadoc/JavadocReportTest.java
+++ b/src/test/java/org/apache/maven/plugins/javadoc/JavadocReportTest.java
@@ -514,6 +514,27 @@ class JavadocReportTest {
}
}
+ /**
+ * Method to test when the path to the project sources has a comma (,)
+ *
+ * @throws Exception if any
+ */
+ @InjectMojo(goal = "javadoc", pom = "commapath-test-plugin-config.xml")
+ @Basedir("/unit/commapath,test")
+ @Test
+ void testCommaPath(JavadocReport mojo) throws Exception {
+ mojo.execute();
+
+ Path apidocs = new File(getBasedir(), "/target/site/apidocs").toPath();
+
+ // package level generated javadoc files
+ assertThat(apidocs.resolve("commapath/test/App.html")).exists();
+
+ // project level generated javadoc files
+ assertThat(apidocs.resolve("index-all.html")).exists();
+ assertThat(apidocs.resolve("index.html")).exists();
+ }
+
/**
* Method to test when the options file has umlauts.
*
diff --git
a/src/test/resources/unit/commapath,test/commapath-test-plugin-config.xml
b/src/test/resources/unit/commapath,test/commapath-test-plugin-config.xml
new file mode 100644
index 00000000..3455dcfd
--- /dev/null
+++ b/src/test/resources/unit/commapath,test/commapath-test-plugin-config.xml
@@ -0,0 +1,70 @@
+<!--
+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>commapath-test</artifactId>
+ <packaging>jar</packaging>
+ <version>1.0-SNAPSHOT</version>
+ <inceptionYear>2006</inceptionYear>
+ <name>Maven Javadoc Plugin Comma Path Test</name>
+ <url>http://maven.apache.org</url>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <sourcepath>${basedir}</sourcepath>
+ <outputDirectory>${basedir}/target/site</outputDirectory>
+
<javadocOptionsDir>${basedir}/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>
+ <windowtitle>Maven Javadoc Plugin Comma Path Test 1.0-SNAPSHOT
API</windowtitle>
+ <debug>true</debug>
+ <failOnError>true</failOnError>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/src/test/resources/unit/commapath,test/commapath/test/App.java
b/src/test/resources/unit/commapath,test/commapath/test/App.java
new file mode 100644
index 00000000..9da85b05
--- /dev/null
+++ b/src/test/resources/unit/commapath,test/commapath/test/App.java
@@ -0,0 +1,35 @@
+package commapath.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 );
+ }
+
+}