slachiewicz opened a new issue, #1376:
URL: https://github.com/apache/maven-javadoc-plugin/issues/1376

   ### Affected version
   
   3.12.0, and master at 336c35aa.
   
   ### Bug description
   
   `release` defaults to `${maven.compiler.release}`. When a build declares 
that property but leaves it blank, Maven injects an empty string and the plugin 
fails on JDK 9+:
   
   ```
   java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
       at 
org.apache.maven.plugins.javadoc.AbstractJavadocMojo.getDefaultJavadocApiLink(AbstractJavadocMojo.java:5535)
   ```
   
   JDK 11 words the same failure as `String index out of range: 0`.
   
   The mojo tests `release != null` at four sites: the pre-9 auto-exclude 
decision, the module path support check, the `--release` argument, and the 
default API link. An empty string passes all four. The API link site then calls 
`JavaVersion.parse("").asMajor().toString().charAt(0)` and throws, and the 
argument site would otherwise pass a literal `--release ""` to the javadoc tool.
   
   A blank property is a real configuration. `org.apache:apache:32` and later 
set `maven.compiler.release` to their `javaVersion` in a `jdk9+` profile, and a 
child that keeps `source`/`target` semantics has to blank the property to get 
javac back onto `-source`/`-target`. maven-compiler-plugin treats the empty 
value as unset (plexus-compiler checks `isEmpty`), so the compiler half of that 
workaround works and only javadoc breaks. Reproduced against 
flink-connector-kafka in 
[FLINK-40630](https://issues.apache.org/jira/browse/FLINK-40630).
   
   Expected: an empty `release` counts as unset, the same as for the compiler, 
and `source` is used instead.
   
   *This issue was created with AI assistance.*


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to