Javadoc plugin fails when -J-fullversion returns localized version string
-------------------------------------------------------------------------

                 Key: MJAVADOC-152
                 URL: http://jira.codehaus.org/browse/MJAVADOC-152
             Project: Maven 2.x Javadoc Plugin
          Issue Type: Bug
    Affects Versions: 2.2
         Environment: FreeBSD
            Reporter: Matt Whitlock
         Attachments: AbstractJavadocMojo.java.patch

On Mac OS X:
$ javadoc -J-fullversion
java full version "1.5.0_07-164"

On FreeBSD:
> javadoc -J-fullversion
java full version "diablo-1.5.0-b01"

The difference causes this exception:
java.lang.NumberFormatException: For input string: "dial"
        at 
sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1224)
        at java.lang.Float.parseFloat(Float.java:394)
        at 
org.apache.maven.plugin.javadoc.AbstractJavadocMojo.getJavadocVersion(AbstractJavadocMojo.java:2966)
        ...

See attached patch for a more robust way of parsing the output from 'javadoc 
-J-fullversion'.

Do note that both the original code and the patched code will have problems 
with Java versions like 1.10.0 or 1.6.10.  The original code will fail with an 
exception, while the patched code will return a somewhat nonsensical value from 
the getJavadocVersion method.  The Java version logically should not be 
expressed as a float because semantically it is not a floating-point number but 
rather an integer vector.  A more appropriate return type for the 
getJavadocVersion method would be int[].

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