Re: Xupdate throws namespace-related NPE

Andy Putnins <[email protected]> Fri, 26 Dec 2008 11:27:13 -0600
Newsgroups gmane.text.xml.xindice.user
Message-ID <[email protected]>
I've tried to track this down with the Eclipse debugger attached to the Tomcat degug port, 
but I'm stuck  because I can't find the source for org.xmldb.xupdate.lexus.XUpdateQueryImpl. 
Where are the sources for the org.xmldb.xupdate.lexus.* packages which Xindice extends?

The issue appears to be that my default namespace, "lett.com/example" is stored in the "namespaces"
HashMap within org.xmldb.xupdate.lexus.XUpdateQueryImpl with a *null* prefix key instead of a 
zero-length string (""). The debugger shows the contents of "namespaces" as:

{null=lett.com/example, urn=urn:ietf:params:xml:ns:netconf:base:1.0, xu=http://www.xmldb.org/xupdate}

org.apache.xindice.xml.NamespaceMap.getContextNode() throws a NPE at line 63 because pfx is null:
                if (pfx.equals("")) {...}

I can't see how the "namespaces" hashmap is constructed without the source.

	- Andy

On Thu, 25 Dec 2008 12:38:43 -0600  Andy Putnins wrote:
 > I am trying to execute an XUpdate transaction against a document, 
 > and getting a null pointer exception. Any ideas what the problem
 > might be?
 > 
 > Document in DB:
 > 
 > <?xml version="1.0" encoding="utf-8"?>
 > <root xmlns="http://lett.com/ns/netconf/server/1.0"><top xmlns="lett.com/example" /></
     root>
 > 
 > Xindice log:
 > 
 > INFO: [http-8888-1] '/db/netconf' Query document candidate, query: <?xml version
 > ="1.0" encoding="UTF-8"?>
 > <xu:modifications xmlns:xu="http://www.xmldb.org/xupdate" version="1.0">
 > 
 >     <xu:insert-after select="/top">
 >         <interface xmlns="lett.com/example" xmlns:urn="urn:ietf:params:xml:ns:ne
 > tconf:base:1.0">
 >           <name>Ethernet0/0</name>
 >           <mtu>1500</mtu>
 >         </interface>
 >     </xu:insert-after>
 > 
 > </xu:modifications>
 > Dec 25, 2008 12:08:50 PM org.apache.xindice.core.xupdate.XUpdateQueryResolver$XU
 > pdateQuery execute
 > WARNING: ignored exception
 > java.lang.NullPointerException
 > 	at org.apache.xindice.xml.NamespaceMap.getContextNode(NamespaceMap.java:
 > 63)
 > 	at org.apache.xindice.core.xupdate.XUpdateImpl.execute(XUpdateImpl.java:
 > 99)
 > 	at org.apache.xindice.core.xupdate.XUpdateQueryResolver$XUpdateQuery.exe
 > cute(XUpdateQueryResolver.java:141)
 > 	at org.apache.xindice.core.xupdate.XUpdateQueryResolver.query(XUpdateQue
 > ryResolver.java:83)
 > 	at org.apache.xindice.core.query.QueryEngine.query(QueryEngine.java:126)
 > 	at org.apache.xindice.core.Collection.queryDocument(Collection.java:1291
 > )
 > 	at org.apache.xindice.server.rpc.messages.Query.execute(Query.java:58)
 > 	at org.apache.xindice.server.rpc.RPCMessageInterface.run(RPCMessageInter
 > face.java:49)
 > 	at sun.reflect.GeneratedMethodAccessor28.invoke(Unknown Source)
 > 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
 > sorImpl.java:25)
 > 	at java.lang.reflect.Method.invoke(Method.java:597)
 > 	at org.apache.xmlrpc.Invoker.execute(XmlRpcServer.java)
 > 	at org.apache.xmlrpc.XmlRpcServer$Worker.executeInternal(XmlRpcServer.ja
 > va)
 > 	at org.apache.xmlrpc.XmlRpcServer$Worker.execute(XmlRpcServer.java)
 > 	at org.apache.xmlrpc.XmlRpcServer.execute(XmlRpcServer.java)
 > 	at org.apache.xmlrpc.XmlRpcServer.execute(XmlRpcServer.java)
 > 	at org.apache.xindice.server.XindiceServlet.doPost(XindiceServlet.java:9
 > 2)
 > 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
 > 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
 > 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
 > icationFilterChain.java:290)
 > 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
 > ilterChain.java:206)
 > 	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
 > alve.java:233)
 > 	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
 > alve.java:191)
 > 	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
 > ava:128)
 > 	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
 > ava:102)
 > 	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
 > ve.java:109)
 > 	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
 > a:286)
 > 	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
 > :845)
 > 	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
 > ss(Http11Protocol.java:583)
 > 	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:44
 > 7)
 > 	at java.lang.Thread.run(Thread.java:619)
 > 
 > 
 > 	- Andy
 > 

	- Andy
________________________________________________________________
Andris Putnins, Principal
Lett Engineering		phone:  (847) 997-0002
300 Bramble Lane		fax:    (847) 550-0633
Deer Park, IL 60011		email:  [email protected]