NPE in JavaToWSContainer when using java2ws maven plugin.
---------------------------------------------------------

                 Key: CXF-2962
                 URL: https://issues.apache.org/jira/browse/CXF-2962
             Project: CXF
          Issue Type: Bug
          Components: Tooling
    Affects Versions: 2.2.10
            Reporter: Julien HENRY
            Priority: Critical


I am trying to generate a WSDL from Java code using Maven plugin.

Here is the error I get:
{code}
...
Caused by: java.lang.NullPointerException
        at 
org.apache.cxf.tools.java2ws.JavaToWSContainer.execute(JavaToWSContainer.java:89)
        at 
org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:103)
{code}

Looking at source code it seems the real error is lost because of the NPE:

JavaToWSContainer.java
{code}
85         } catch (Exception ex) {
86
87            // Try to find an exception with a message on the stack
88             Throwable e = ex.getCause();
89             while ((e.getMessage() == null || "".equals(e.getMessage())) && 
e.getCause() != null) {
90                 e = e.getCause();
91             }
{code}

In fact the code should be replaced by:
{code}
         } catch (Exception ex) {
             Throwable e = null;
            if (ex.getCause() != null) {
                // Try to find an exception with a message on the stack
               e = ex.getCause();
               while ((e.getMessage() == null || "".equals(e.getMessage())) && 
e.getCause() != null) {
                  e = e.getCause();
               }
           }
           else {
              e = ex;
           }
{code}


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