Repository: cxf
Updated Branches:
  refs/heads/3.1.x-fixes 558c0ffe3 -> 0967819ec


[CXF-7454] fixed NullPointerException during wsdl validation


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/46c47ebd
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/46c47ebd
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/46c47ebd

Branch: refs/heads/3.1.x-fixes
Commit: 46c47ebd7aaae1c09ed2c287223bbcaedaf15be4
Parents: 558c0ff
Author: Dennis Kieselhorst <[email protected]>
Authored: Wed Jul 26 13:58:46 2017 +0200
Committer: Dennis Kieselhorst <[email protected]>
Committed: Wed Jul 26 14:09:36 2017 +0200

----------------------------------------------------------------------
 .../wsdlto/databinding/jaxb/JAXBDataBinding.java    | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/46c47ebd/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
----------------------------------------------------------------------
diff --git 
a/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
 
b/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
index a84a2b5..8822477 100644
--- 
a/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
+++ 
b/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
@@ -984,14 +984,18 @@ public class JAXBDataBinding implements 
DataBindingProfile {
                                            String systemId,
                                            String baseURI) {
                 String s = JAXBDataBinding.mapSchemaLocation(systemId, 
baseURI, catalog);
-                //System.out.println(namespaceURI + " " + systemId + " " + 
baseURI + " " + s);
+                LOG.fine("validating: " + namespaceURI + " " + systemId + " " 
+ baseURI + " " + s);
                 if (s == null) {
                     XmlSchema sc = 
schemaCollection.getSchemaByTargetNamespace(namespaceURI);
-                    StringWriter writer = new StringWriter();
-                    sc.write(writer);
-                    InputSource src = new InputSource(new 
StringReader(writer.toString()));
-                    src.setSystemId(sc.getSourceURI());
-                    return new LSInputSAXWrapper(src);
+                    if (sc != null) {
+                        StringWriter writer = new StringWriter();
+                        sc.write(writer);
+                        InputSource src = new InputSource(new 
StringReader(writer.toString()));
+                        src.setSystemId(sc.getSourceURI());
+                        return new LSInputSAXWrapper(src);
+                    } else {
+                        throw new ToolException("Schema not found for 
namespace: " + namespaceURI);
+                    }
                 }
                 return new LSInputSAXWrapper(new InputSource(s));
             }

Reply via email to