Implement better error checking in AbstractXSDToJavaMojo for missing extension 
fields
-------------------------------------------------------------------------------------

                 Key: CXF-3138
                 URL: https://issues.apache.org/jira/browse/CXF-3138
             Project: CXF
          Issue Type: Bug
          Components: Tooling
    Affects Versions: 2.3.0
            Reporter: David M. Karr
            Priority: Trivial


Maven POMs can be generated, or they can be hand-coded.  It's useful in some 
cases to not assume XML microformat conventions are not syntactically correct 
in the POM, in case the POM is hand-coded.  One case in point:

In "org.apache.cxf.maven_plugin.AbstractXSDToJavaMojo", the "getArguments()" 
method assumes the "extension" value is a colon-separated value with three 
subfields. If the value is malformed, like missing the last subfield (version), 
Maven just fails with "Could not download extension artifact" with no 
information.  If you then add "-X" to the command line, you'll see this small 
additional information:

-----------------------
[ERROR] Failed to execute goal org.apache.cxf:cxf-xjc-plugin:2.3.0:xsdtojava 
(generate-sources) on project SunlightDataService-war: Could not download 
extension artifact -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal 
org.apache.cxf:cxf-xjc-plugin:2.3.0:xsdtojava (generate-sources) on project 
SunlightDataService-war: Could not download extension artifact
        at 
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:203)
...
Caused by: org.apache.maven.plugin.MojoExecutionException: Could not download 
extension artifact
        at 
org.apache.cxf.maven_plugin.AbstractXSDToJavaMojo.getArguments(AbstractXSDToJavaMojo.java:274)
...
Caused by: java.lang.ArrayIndexOutOfBoundsException: 2
        at 
org.apache.cxf.maven_plugin.AbstractXSDToJavaMojo.getArguments(AbstractXSDToJavaMojo.java:254)
-----------------------

if someone then examined the source for AbstractXSDToJavaMojo, they would then 
discover the reference to "s[2]" and hopefully realize that they left off the 
version subfield in the "extension" value.

My suggestion is to check the array length and print an error message 
indicating the required format of the "extension" value.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to