GitHub user spark404 opened a pull request:
https://github.com/apache/cxf-xjc-utils/pull/1
getFile() can return a null, which causes an NPE
While building CXF i encountered an NPE (see below.) It appears to be
possible for org.apache.maven.artifact.Artifact.getFile() to return a null,
which will trigger the NPE in AbstractXSDToJavaMojo.getArguments. It should
throw a MojoExecutionException telling the user that it was unable to resolve a
dependency.
```
[ERROR] Failed to execute goal
org.apache.cxf:cxf-xjc-plugin:3.0.2:xsdtojava (generate-sources) on project
cxf-core: Could not download extension artifact: NullPointerException -> [Help
1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute
goal org.apache.cxf:cxf-xjc-plugin:3.0.2:xsdtojava (generate-sources) on
project cxf-core: Could not download extension artifact
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at
org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at
org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at
org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at
org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at
org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at
org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Could not
download extension artifact
at
org.apache.cxf.maven_plugin.AbstractXSDToJavaMojo.execute(AbstractXSDToJavaMojo.java:238)
at
org.apache.cxf.maven_plugin.XSDToJavaMojo.execute(XSDToJavaMojo.java:41)
at
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 20 more
Caused by: org.apache.maven.plugin.MojoExecutionException: Could not
download extension artifact
at
org.apache.cxf.maven_plugin.AbstractXSDToJavaMojo.getArguments(AbstractXSDToJavaMojo.java:325)
at
org.apache.cxf.maven_plugin.AbstractXSDToJavaMojo.run(AbstractXSDToJavaMojo.java:288)
at
org.apache.cxf.maven_plugin.AbstractXSDToJavaMojo.execute(AbstractXSDToJavaMojo.java:225)
... 23 more
Caused by: java.lang.NullPointerException
at
org.apache.cxf.maven_plugin.AbstractXSDToJavaMojo.getArguments(AbstractXSDToJavaMojo.java:320)
... 25 more
```
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/spark404/cxf-xjc-utils NPE-fix
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/cxf-xjc-utils/pull/1.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #1
----
commit 6c7770ccca2ccfaa752d469ae69252f57106f6d9
Author: Hugo Trippaers <[email protected]>
Date: 2015-04-16T07:41:50Z
Throw an exception when a dependency fails to resolve
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---