javadoc:jar FATAL ERROR Host name may not be null
-------------------------------------------------

                 Key: MJAVADOC-292
                 URL: http://jira.codehaus.org/browse/MJAVADOC-292
             Project: Maven 2.x Javadoc Plugin
          Issue Type: Bug
    Affects Versions: 2.7
         Environment: Ubuntu 10.04 & Windows XP. Running maven 2.2.1 java 
1.6.0_14
            Reporter: Richard Mortimer
         Attachments: maven-javadoc-null-host.patch

For some reason (that I have yet to determine) I am using a bad URL when 
linking to the jdk6 apidocs. This causes my javadoc:jar to terminate with a 
fatal error. This is doubly problematic because
(a) the error message does not include the URL that is at fault; and
(b) the build crashes out where other similar badly configured javadoc link 
URLs continue after emitting a warning message.

[INFO] [INFO] [javadoc:jar {execution: attach-javadocs}]
[INFO] [INFO] 
------------------------------------------------------------------------
[INFO] [ERROR] FATAL ERROR
[INFO] [INFO] 
------------------------------------------------------------------------
[INFO] [INFO] Host name may not be null
[INFO] [INFO] 
------------------------------------------------------------------------
[INFO] [INFO] Trace
[INFO] java.lang.IllegalArgumentException: Host name may not be null
[INFO]  at org.apache.commons.httpclient.HttpHost.<init>(HttpHost.java:68)
[INFO]  at org.apache.commons.httpclient.HttpHost.<init>(HttpHost.java:107)
[INFO]  at 
org.apache.commons.httpclient.HttpMethodBase.setURI(HttpMethodBase.java:280)
[INFO]  at 
org.apache.commons.httpclient.HttpMethodBase.<init>(HttpMethodBase.java:220)
[INFO]  at 
org.apache.commons.httpclient.methods.GetMethod.<init>(GetMethod.java:89)
[INFO]  at 
org.apache.maven.plugin.javadoc.JavadocUtil.fetchURL(JavadocUtil.java:797)
[INFO]  at 
org.apache.maven.plugin.javadoc.AbstractJavadocMojo.isValidJavadocLink(AbstractJavadocMojo.java:5539)
[INFO]  at 
org.apache.maven.plugin.javadoc.AbstractJavadocMojo.addLinkArguments(AbstractJavadocMojo.java:3852)
[INFO]  at 
org.apache.maven.plugin.javadoc.AbstractJavadocMojo.addStandardDocletOptions(AbstractJavadocMojo.java:4617)
[INFO]  at 
org.apache.maven.plugin.javadoc.AbstractJavadocMojo.executeReport(AbstractJavadocMojo.java:1919)
[INFO]  at 
org.apache.maven.plugin.javadoc.JavadocJar.execute(JavadocJar.java:184)
[INFO]  at 
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
[INFO]  at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
[INFO]  at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
[INFO]  at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
[INFO]  at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
[INFO]  at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
[INFO]  at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
[INFO]  at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
[INFO]  at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
[INFO]  at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
[INFO]  at 
org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
[INFO]  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[INFO]  at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[INFO]  at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[INFO]  at java.lang.reflect.Method.invoke(Method.java:597)
[INFO]  at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
[INFO]  at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
[INFO]  at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
[INFO]  at org.codehaus.classworlds.Launcher.main(Launcher.java:375)



I have attached a patch that catches the IllegalArgumentException that is 
thrown by httpclient and logs a suitable error message. I suspect that this is 
not the best way to fix the issue because it might mask other errors but it 
certainly gets me past my immediate issue.

With the patch applied the fatal error becomes a single line as follows and the 
build continues.

[ERROR] Malformed link: http:///jdk6.dev.java.net/apidocs/package-list. Ignored 
it.

I have tested with both 2.7 and trunk and have confirmed that the problem 
exists in both and that the patch works on both.

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