Hi Christian,
thank you so very much for looking into this! I am enclosing a java class that reproduces the NPE using the 6.1 base libraries. This code assumes that you have created an 'Annotations' database with one <Annotations/> root element.
Ciao Stefano
On Mon, May 24, 2010 at 8:56 AM, Christian Grün christian.gruen@gmail.com wrote:
Stefano,
sorry for the delay. Yes, this looks like a bug. To speed this up, could you provide us with a code snippet that's running out of the box? (I didn't manage to quickly reproduce the problem).
Thanks, Christian
On Sat, May 22, 2010 at 12:05 AM, stefano@santoro.org wrote:
Hi,
I am attempting to execute an XQJ prepared expression that uses an external bind variable that accepts an xml element, and inserts it into the database document:
declare variable $inserto as element(*,xs:untyped) external; let $root := basex:db('Annotations')/Annotations return (insert node $inserto into $root)
I prepare the above statement and I bind DOM element as follows (groovy syntax):
eltype = conn.createElementType(null, XQItemType.XQBASETYPE_ANYTYPE); ixpr.bindNode(new QName("inserto"), irel, eltype);
irel is dom element that serializes as follows:
<inserto id="6"> <testo>six</testo> </inserto>
unfortunately I get an NPE when I try to execute the Query:
groovy:000> rs = ixpr.executeQuery() ERROR java.lang.NullPointerException: null at org.basex.query.item.FElem.copy (FElem.java:214) at org.basex.query.item.FElem.copy (FElem.java:1) at org.basex.query.item.FElem.copy (FElem.java:210) at org.basex.query.item.FElem.copy (FElem.java:1) at org.basex.query.expr.Constr.add (Constr.java:107) at org.basex.query.expr.Constr.<init> (Constr.java:53) at org.basex.query.up.Insert.atomic (Insert.java:60) at org.basex.query.up.Insert.atomic (Insert.java:1) at org.basex.query.expr.Expr.iter (Expr.java:53) at org.basex.query.QueryContext.iter (QueryContext.java:322) at org.basex.query.QueryContext.iter (QueryContext.java:290) at org.basex.api.xqj.BXQDynamicContext.execute (BXQDynamicContext.java:247) at org.basex.api.xqj.BXQPreparedExpression.executeQuery (BXQPreparedExpression.java:54) at groovysh_evaluate.run (groovysh_evaluate:10) ...
I am using BaseX 6.1
Am I doing anything wrong?
Stefano