[CXF-6090] Add some NPE guards in xmlbeans tooling.
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/d951a5d4 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/d951a5d4 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/d951a5d4 Branch: refs/heads/2.7.x-fixes Commit: d951a5d407f48165b3295f75e3b9cd9fe390d3e8 Parents: ce10114 Author: Daniel Kulp <dk...@apache.org> Authored: Fri Nov 7 13:16:39 2014 -0500 Committer: Daniel Kulp <dk...@apache.org> Committed: Fri Nov 7 14:42:46 2014 -0500 ---------------------------------------------------------------------- .../cxf/xmlbeans/tools/XMLBeansToolingDataBinding.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/d951a5d4/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/tools/XMLBeansToolingDataBinding.java ---------------------------------------------------------------------- diff --git a/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/tools/XMLBeansToolingDataBinding.java b/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/tools/XMLBeansToolingDataBinding.java index b5491ef..a8d867f 100644 --- a/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/tools/XMLBeansToolingDataBinding.java +++ b/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/tools/XMLBeansToolingDataBinding.java @@ -42,6 +42,7 @@ import org.w3c.dom.Document; import org.xml.sax.EntityResolver; import org.xml.sax.InputSource; +import org.apache.cxf.common.jaxb.JAXBUtils; import org.apache.cxf.helpers.IOUtils; import org.apache.cxf.helpers.XMLUtils; import org.apache.cxf.tools.common.ToolConstants; @@ -50,6 +51,7 @@ import org.apache.cxf.tools.common.ToolException; import org.apache.cxf.tools.common.model.DefaultValueWriter; import org.apache.cxf.tools.util.ClassCollector; import org.apache.cxf.tools.wsdlto.core.DataBindingProfile; +import org.apache.ws.commons.schema.constants.Constants; import org.apache.xmlbeans.SchemaGlobalElement; import org.apache.xmlbeans.SchemaProperty; import org.apache.xmlbeans.SchemaType; @@ -144,6 +146,9 @@ public class XMLBeansToolingDataBinding implements DataBindingProfile { if (type == null) { type = typeLoader.findDocumentType(qn); } + if (type == null) { + return null; + } ret = type.getFullJavaName(); if (ret.contains("$")) { @@ -157,6 +162,13 @@ public class XMLBeansToolingDataBinding implements DataBindingProfile { type = typeLoader.findType(qn); } + if (type == null + && Constants.URI_2001_SCHEMA_XSD.equals(qn.getNamespaceURI())) { + return JAXBUtils.builtInTypeToJavaType(qn.getLocalPart()); + } + if (type == null) { + return null; + } ret = type.getFullJavaName(); return ret.replace('$', '.'); }