[ 
http://jira.codehaus.org/browse/MJAVADOC-135?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Benjamin Bentmann updated MJAVADOC-135:
---------------------------------------

    Attachment: javadoc-version.patch

As the existing patch most likely does not solve MJAVADOC-143, I would like to 
propose another approach. To my knowledge, the target platform for the plugin 
is Java 1.4, allowing the usage of regular expressions. Therefore, this patch 
tries to find the (first occurrence of the) pattern "#.#(.#)", leaving most of 
the parsing to the regex engine.  

Besides, the patch falls back to the output from stdout, if stderr is empty. I 
did not find any spec that guarantees that the version output will be on 
stderr, so I felt this would help robustness.

Furthermore, a unit test is added to check the proper parsing of the various 
version outputs mentioned in this issue so far.

As far as I got from the commit logs, the source of this whole problem (i.e. 
the additions made to support MJAVADOC-98) just exists to support another but 
exceptional use case. Having robustness in mind, the exceptional cases should 
have as less impact on the default case as possible. Therefore, the patch 
completely avoids calling getJavadocVersion() if the javadoc executable is not 
specified in the POM, i.e when the default javadoc for the currently running 
JVM is used as in previous versions of the plugin always the case.

NOTE: The patch includes one TODO that somebody should deal with. It's rather a 
philosophical concern that the project leader should decide.

> Error parsing javadoc version when used with IBM jdk 1.4.2
> ----------------------------------------------------------
>
>                 Key: MJAVADOC-135
>                 URL: http://jira.codehaus.org/browse/MJAVADOC-135
>             Project: Maven 2.x Javadoc Plugin
>          Issue Type: Bug
>    Affects Versions: 2.3
>         Environment: IBM JDK 1.4.2
>            Reporter: Manuel Santillán
>         Attachments: AbstractJavadocMojo.java.patch, javadoc-version.patch
>
>
> Error parsing javadocVersion in plugin 2.3 when using IBM JDK. Plugin works 
> fine in version 2.2.
> java.lang.NumberFormatException: For input string: "J2R"
>       at 
> java.lang.NumberFormatException.forInputString(NumberFormatException.java:63)
>       at 
> java.lang.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1230)
>       at java.lang.Float.parseFloat(Float.java:246)
>       at 
> org.apache.maven.plugin.javadoc.AbstractJavadocMojo.getJavadocVersion(AbstractJavadocMojo.java:2966)
>       at 
> org.apache.maven.plugin.javadoc.AbstractJavadocMojo.executeReport(AbstractJavadocMojo.java:1085)
>       at 
> org.apache.maven.plugin.javadoc.JavadocJar.execute(JavadocJar.java:108)
>       at 
> org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:443)
>       at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539)
>       at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:493)
>       at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:463)
>       at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
>       at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:224)
>       at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
>       at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:334)
>       at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:125)
>       at org.apache.maven.cli.MavenCli.main(MavenCli.java:272)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60)
>       at java.lang.reflect.Method.invoke(Method.java:391)
>       at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
>       at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
>       at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
>       at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Total time: 18 seconds
> [INFO] Finished at: Mon Jul 23 10:57:16 CEST 2007
> [INFO] Final Memory: 12M/512M
> [INFO] 
> ------------------------------------------------------------------------

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira


Reply via email to