Strange bug ? testing the db:path of a non-stored database node
Tuesday, 21 April 2015 · 3 messages
C
cmarchand21 Apr 2015 16:23 #
Hello,
I have this error. According to
http://docs.basex.org/wiki/Database_Module#Database_Nodes, I thought modify() was transforming a node to a database node
It seems it does not initialize a document name...
Best regards,
Christophe
Error:
Improper use? Potential bug? Your feedback is welcome:
Contact: basex-talk at mailman.uni-konstanz.de
Version: BaseX 8.1
Java: Oracle Corporation, 1.8.0_31
OS: Windows 7, amd64
Stack Trace:
java.lang.NullPointerException
at org.basex.query.value.item.Str.get(Str.java:49)
at org.basex.query.func.db.DbPath.item(DbPath.java:23)
at org.basex.query.expr.ParseExpr.value(ParseExpr.java:64)
at org.basex.query.QueryContext.value(QueryContext.java:415)
at org.basex.query.up.expr.Transform.value(Transform.java:91)
at org.basex.query.up.expr.Transform.iter(Transform.java:59)
at org.basex.query.up.expr.Transform.iter(Transform.java:25)
at org.basex.query.MainModule.iter(MainModule.java:114)
at org.basex.query.QueryContext.iter(QueryContext.java:343)
at org.basex.query.QueryContext.execute(QueryContext.java:605)
at org.basex.query.QueryProcessor.execute(QueryProcessor.java:98)
at org.basex.core.cmd.AQuery.query(AQuery.java:83)
at org.basex.core.cmd.XQuery.run(XQuery.java:22)
at org.basex.core.Command.run(Command.java:379)
at org.basex.core.Command.execute(Command.java:95)
at org.basex.gui.GUI.exec(GUI.java:466)
at org.basex.gui.GUI.access$400(GUI.java:41)
at org.basex.gui.GUI$7.run(GUI.java:410)
Query:
copy $c := <test/> modify () return db:path($c)
Query plan:
<QueryPlan compiled="true">
<Transform>
<Let>
<Var name="$c" id="0" as="node()"/>
<CElem>
<QNm value="test" type="xs:QName"/>
</CElem>
</Let>
<Empty size="0"/>
<DbPath name="path(node)">
<VarRef>
<Var name="$c" id="0" as="node()"/>
</VarRef>
</DbPath>
</Transform>
</QueryPlan>CG
Christian Grün21 Apr 2015 16:27 #
Thanks for the stack trace. Obviously,
db:path() shouldn't trigger an error. Instead, I guess it should return an empty string. I'll check this out.Quoted text · cmarchand · 68 lines
On Tue, Apr 21, 2015 at 4:23 PM, <cmarchand at oxiane.com> wrote: > > > > > Hello, > > I have this error. According to > http://docs.basex.org/wiki/Database_Module#Database_Nodes, I thought > modify() was transforming a node to a database node > > > > It seems it does not initialize a document name... > > > > Best regards, > > Christophe > > > > Error: > Improper use? Potential bug? Your feedback is welcome: > Contact: basex-talk at mailman.uni-konstanz.de > Version: BaseX 8.1 > Java: Oracle Corporation, 1.8.0_31 > OS: Windows 7, amd64 > Stack Trace: > java.lang.NullPointerException > at org.basex.query.value.item.Str.get(Str.java:49) > at org.basex.query.func.db.DbPath.item(DbPath.java:23) > at org.basex.query.expr.ParseExpr.value(ParseExpr.java:64) > at org.basex.query.QueryContext.value(QueryContext.java:415) > at org.basex.query.up.expr.Transform.value(Transform.java:91) > at org.basex.query.up.expr.Transform.iter(Transform.java:59) > at org.basex.query.up.expr.Transform.iter(Transform.java:25) > at org.basex.query.MainModule.iter(MainModule.java:114) > at org.basex.query.QueryContext.iter(QueryContext.java:343) > at org.basex.query.QueryContext.execute(QueryContext.java:605) > at org.basex.query.QueryProcessor.execute(QueryProcessor.java:98) > at org.basex.core.cmd.AQuery.query(AQuery.java:83) > at org.basex.core.cmd.XQuery.run(XQuery.java:22) > at org.basex.core.Command.run(Command.java:379) > at org.basex.core.Command.execute(Command.java:95) > at org.basex.gui.GUI.exec(GUI.java:466) > at org.basex.gui.GUI.access$400(GUI.java:41) > at org.basex.gui.GUI$7.run(GUI.java:410) > Query: > copy $c := <test/> modify () return db:path($c) > Query plan: > <QueryPlan compiled="true"> > <Transform> > <Let> > <Var name="$c" id="0" as="node()"/> > <CElem> > <QNm value="test" type="xs:QName"/> > </CElem> > </Let> > <Empty size="0"/> > <DbPath name="path(node)"> > <VarRef> > <Var name="$c" id="0" as="node()"/> > </VarRef> > </DbPath> > </Transform> > </QueryPlan>
CG
Christian Grün21 Apr 2015 16:46 #
The bug has been fixed in the latest snapshot [1]. You'll now get an empty string instead (caused by the facts that the in-memory database node neither has a document node nor has a path that could be referenced).
Thanks,
Christian
[1] http://files.basex.org/releases/latest
Quoted text · Christian Grün · 76 lines
On Tue, Apr 21, 2015 at 4:27 PM, Christian Grün <christian.gruen at gmail.com> wrote: > Thanks for the stack trace. Obviously, db:path() shouldn't trigger an > error. Instead, I guess it should return an empty string. I'll check > this out. > > > > On Tue, Apr 21, 2015 at 4:23 PM, <cmarchand at oxiane.com> wrote: >> >> >> >> >> Hello, >> >> I have this error. According to >> http://docs.basex.org/wiki/Database_Module#Database_Nodes, I thought >> modify() was transforming a node to a database node >> >> >> >> It seems it does not initialize a document name... >> >> >> >> Best regards, >> >> Christophe >> >> >> >> Error: >> Improper use? Potential bug? Your feedback is welcome: >> Contact: basex-talk at mailman.uni-konstanz.de >> Version: BaseX 8.1 >> Java: Oracle Corporation, 1.8.0_31 >> OS: Windows 7, amd64 >> Stack Trace: >> java.lang.NullPointerException >> at org.basex.query.value.item.Str.get(Str.java:49) >> at org.basex.query.func.db.DbPath.item(DbPath.java:23) >> at org.basex.query.expr.ParseExpr.value(ParseExpr.java:64) >> at org.basex.query.QueryContext.value(QueryContext.java:415) >> at org.basex.query.up.expr.Transform.value(Transform.java:91) >> at org.basex.query.up.expr.Transform.iter(Transform.java:59) >> at org.basex.query.up.expr.Transform.iter(Transform.java:25) >> at org.basex.query.MainModule.iter(MainModule.java:114) >> at org.basex.query.QueryContext.iter(QueryContext.java:343) >> at org.basex.query.QueryContext.execute(QueryContext.java:605) >> at org.basex.query.QueryProcessor.execute(QueryProcessor.java:98) >> at org.basex.core.cmd.AQuery.query(AQuery.java:83) >> at org.basex.core.cmd.XQuery.run(XQuery.java:22) >> at org.basex.core.Command.run(Command.java:379) >> at org.basex.core.Command.execute(Command.java:95) >> at org.basex.gui.GUI.exec(GUI.java:466) >> at org.basex.gui.GUI.access$400(GUI.java:41) >> at org.basex.gui.GUI$7.run(GUI.java:410) >> Query: >> copy $c := <test/> modify () return db:path($c) >> Query plan: >> <QueryPlan compiled="true"> >> <Transform> >> <Let> >> <Var name="$c" id="0" as="node()"/> >> <CElem> >> <QNm value="test" type="xs:QName"/> >> </CElem> >> </Let> >> <Empty size="0"/> >> <DbPath name="path(node)"> >> <VarRef> >> <Var name="$c" id="0" as="node()"/> >> </VarRef> >> </DbPath> >> </Transform> >> </QueryPlan>
Written for BaseX 8.1. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery