NPE in cxf-codegen-plugin when trying to use defaultOptions with wsdlOptions
----------------------------------------------------------------------------

                 Key: CXF-2368
                 URL: https://issues.apache.org/jira/browse/CXF-2368
             Project: CXF
          Issue Type: Bug
          Components: Tooling
    Affects Versions: 2.2.2
         Environment: Windows XP, Eclipse 3.3.2 + m2eclipse plug-in 
            Reporter: John McGinn
            Priority: Minor
         Attachments: Equipment.xsd, EquipmentService.wsdl, pom.xml

I setup the plug-in with defaultOptions + a wsdlOption and get the following 
stack trace:

java.lang.NullPointerException
        at java.io.File.<init>(File.java:222)
        at org.apache.cxf.maven_plugin.WSDL2JavaMojo.mergeOptions(WSDL2JavaMojo.
java:143)
        at org.apache.cxf.maven_plugin.WSDL2JavaMojo.execute(WSDL2JavaMojo.java:
195)

This appears to be happening at this line of code:
private void mergeOptions(List<WsdlOption> options) {
        File outputDirFile = testSourceRoot == null ? sourceRoot : 
testSourceRoot;
        for (WsdlOption o : wsdlOptions) {
            if (o.getOutputDir() == null) {
                o.setOutputDir(outputDirFile);
            }
            
            File file = new File(o.getWsdl()); <!------------------

I believe this method is merging default options with wsdl options, but the 
default options doesn't have a wsdl file those the File constructor fails.

I put a wsdl option in my default options and the exception went away and the 
code was generated.

My plugin config:

                        <plugin>
                                <groupId>org.apache.cxf</groupId>
                                <artifactId>cxf-codegen-plugin</artifactId>
                                <version>2.2.2</version>
                                <executions>
                                        <execution>
                                                <id>generate-sources</id>
                                                <phase>generate-sources</phase>
                                                <configuration>
                                                        <wsdlOptions>
                                                                <defaultOptions>
                                                                        
<validateWsdl>true</validateWsdl>
                                                                        
<wsdl>src/main/wsdl/EquipmentService.wsdl</wsdl>
                                                                
</defaultOptions>
                                                                <wsdlOption>
                                                                 <bindingFiles> 
                                                      
<bindingFile>src/main/wsdl/bindings/bindings.xjb</bindingFile> 
                                                  </bindingFiles>
                                                                        
<wsdl>src/main/wsdl/EquipmentService.wsdl</wsdl>
                                                                </wsdlOption>
                                                        </wsdlOptions>
                                                </configuration>
                                                <goals>
                                                        <goal>wsdl2java</goal>
                                                </goals>
                                        </execution>
                                </executions>
                        </plugin>


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