muttley73 / jlibs

Automatically exported from code.google.com/p/jlibs
0 stars 0 forks source link

Exception running XSInstance.java #34

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
  If I run XSInstance with the latest code (svn 1766) and the file trunk/xml/xsds/purchaseOrder.xsd I get the exception:
Exception in thread "main" java.lang.NullPointerException
    at jlibs.xml.sax.helpers.MyNamespaceSupport.declarePrefix(MyNamespaceSupport.java:104)
    at jlibs.xml.sax.XMLDocument.declarePrefix(XMLDocument.java:94)
    at jlibs.xml.sax.XMLDocument.toQName(XMLDocument.java:112)
    at jlibs.xml.sax.XMLDocument.addAttribute(XMLDocument.java:232)
    at jlibs.xml.xsd.XSInstance$XSSampleVisitor$2.preProcess(XSInstance.java:286)
    at jlibs.xml.xsd.XSInstance$XSSampleVisitor$2.preProcess(XSInstance.java:1)
    at jlibs.core.graph.WalkerUtil.walk(WalkerUtil.java:40)
    at jlibs.xml.xsd.XSInstance.generate(XSInstance.java:103)
    at jlibs.xml.xsd.XSInstance.main(XSInstance.java:704)

This does work with svn rev. 1753 so it is an error that was introduced with 
the changes between those builds. 

What is the expected output? What do you see instead?
Should generate the XML

What version of the product are you using? On what operating system?
Windows, but I ran the test just in Java with the XSIntance

Please provide any additional information below.
I appreciate your solution and it looks like it could be very helpful to us. 
Thanks for maintaining it.

Original issue reported on code.google.com by george.d...@gmail.com on 4 Nov 2013 at 10:48

GoogleCodeExporter commented 9 years ago
seems this got fixed already.

Original comment by santhosh.tekuri@gmail.com on 8 Nov 2013 at 9:43

GoogleCodeExporter commented 9 years ago
Wow, quick turn around on that fix. It's working great now. Thanks for your 
useful code.

Original comment by george.d...@gmail.com on 8 Nov 2013 at 6:18

GoogleCodeExporter commented 9 years ago
thanks

the problem is XSObject.getNamespace() can return null string as per its javadoc
but jdk's xml apis never expect null for namespaceuri

thus problems arise when we use to libraries which don't conform.

Original comment by santhosh.tekuri@gmail.com on 8 Nov 2013 at 6:26