Hi Andy, Last time I worked on the xupdate source code I used this download from sourceforge and it matched up in the debugger.
http://sourceforge.net/project/showfiles.php?group_id=75532&package_id=160698&release_id=348903 Start with the 0.3 version. I have used xupdate with Xindice extensively but I didn't have any namespace so I don't know off the top of my head how to fix this particular NPE. If you can spend some more time tracking this into the xupdate source code. Please keep us abreast of any results you find. Todd Byrne On Sat, Dec 27, 2008 at 11:19 AM, Andy Putnins <[email protected]> wrote: > I guess this boils down to the question of how namespaces are handled by > Xupdate. > > I tried this same xupdate modification on an eXist database. It doesn't > throw a Null Pointer exception, but instead it ignores the entire > modification. The only way I can get it to apply the modification is by > removing both of the default namespace attributes (xmlns=" > http://lett.com/ns/netconf/server/1.0" on the <root> element and xmlns=" > lett.com/example" on the <top> element). > > I would really appreciate it if someone could explain what is going on > here. > > - Andy > > > Andy Putnins wrote: > >> 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 >> > >> >> >
