Indirect evaluation with xquery eval or invoke on closed collection

Thursday, 21 February 2013 · 2 messages · last reply 22 Feb 2013
AV
Arto Viitanen21 Feb 2013 08:06 #
Following error comes from BaseX version 7.5, but it seems to exist also on 7.6: We have a query that uses collection: ("suuryritys" stands for "big company"): collection('suuryritys_com/suuryritys.com/data/ou')//*[@cat='production'] When evaluated on basexgui (or via C# api), the query evaluates, i.e. the database is opened, document (/suuryritys.com/data/ou) is opened ,data fetched and database closed. But, when we try to evaluate the query using either xquery:eval or xquery:invoke
xquery:eval("collection('suuryritys_com/suuryritys.com/data/ou')//*[@cat='production']")
instead of result, we get error message: Error: Improper use? Potential bug? Your feedback is welcome: Contact: basex-talk at mailman.uni-konstanz.de Version: BaseX 7.5 Java: Oracle Corporation, 1.7.0_02 OS: Linux, i386 Stack Trace: java.lang.ArrayIndexOutOfBoundsException: 57 org.basex.util.Compress.pull(Compress.java:139) org.basex.util.Compress.unpack(Compress.java:113) org.basex.data.DiskData.txt(DiskData.java:268) org.basex.data.DiskData.text(DiskData.java:235) org.basex.io.serial.Serializer.node(Serializer.java:389) org.basex.io.serial.Serializer.serialize(Serializer.java:99) org.basex.io.serial.Serializer.serialize(Serializer.java:84) org.basex.query.iter.ValueBuilder.serialize(ValueBuilder.java:80) org.basex.query.iter.ValueBuilder.serialize(ValueBuilder.java:75) org.basex.core.cmd.AQuery.query(AQuery.java:91) org.basex.core.cmd.XQuery.run(XQuery.java:22) org.basex.core.Command.run(Command.java:342) org.basex.core.Command.exec(Command.java:321) org.basex.core.Command.execute(Command.java:78) org.basex.gui.GUI.exec(GUI.java:389) org.basex.gui.GUI$6.run(GUI.java:343)
Query: xquery:invoke("invoke-file.xq")
Query plan:
<QueryPlan>
   <FNXQuery name="invoke(string[,bindings])">
     <Str value="invoke-file.xq" type="xs:string"/>
   </FNXQuery>
</QueryPlan>
Same error comes, when the query is on a text file, and it is evaluated with xquery:invoke. The funny part is, if the database (suuryritys_com) is opened by hand (on BaseXGui's command line with "open suuryritys_com"), the query returns the result. It also seems, that if I first open some other database, then close it, and then open the database suuryritys_com, I get the same error.
-- Arto Viitanen Microteam Oy Finland
ML
Marco Lettere22 Feb 2013 09:00 #
This looks like the same stacktrace reported here: https://mailman.uni-konstanz.de/pipermail/basex-talk/2013-February/004683.html BTW, I got also a major corruption of the DB. Your DB remains coherent when this happens? M.
Quoted text · Arto Viitanen · 78 lines
On 02/21/2013 08:06 AM, Arto Viitanen wrote: > Following error comes from BaseX version 7.5, but it seems to exist > also on 7.6: > > We have a query that uses collection: ("suuryritys" stands for "big > company"): > > collection('suuryritys_com/suuryritys.com/data/ou')//*[@cat='production'] > > When evaluated on basexgui (or via C# api), the query evaluates, i.e. > the database is opened, document (/suuryritys.com/data/ou) is opened > ,data > fetched and database closed. > > But, when we try to evaluate the query using either xquery:eval or > xquery:invoke > > xquery:eval("collection('suuryritys_com/suuryritys.com/data/ou')//*[@cat='production']") > > > instead of result, we get error message: > > > Error: Improper use? Potential bug? Your feedback is welcome: > Contact: basex-talk at mailman.uni-konstanz.de > Version: BaseX 7.5 > Java: Oracle Corporation, 1.7.0_02 > OS: Linux, i386 > Stack Trace: > java.lang.ArrayIndexOutOfBoundsException: 57 > org.basex.util.Compress.pull(Compress.java:139) > org.basex.util.Compress.unpack(Compress.java:113) > org.basex.data.DiskData.txt(DiskData.java:268) > org.basex.data.DiskData.text(DiskData.java:235) > org.basex.io.serial.Serializer.node(Serializer.java:389) > org.basex.io.serial.Serializer.serialize(Serializer.java:99) > org.basex.io.serial.Serializer.serialize(Serializer.java:84) > org.basex.query.iter.ValueBuilder.serialize(ValueBuilder.java:80) > org.basex.query.iter.ValueBuilder.serialize(ValueBuilder.java:75) > org.basex.core.cmd.AQuery.query(AQuery.java:91) > org.basex.core.cmd.XQuery.run(XQuery.java:22) > org.basex.core.Command.run(Command.java:342) > org.basex.core.Command.exec(Command.java:321) > org.basex.core.Command.execute(Command.java:78) > org.basex.gui.GUI.exec(GUI.java:389) > org.basex.gui.GUI$6.run(GUI.java:343) > > > Query: xquery:invoke("invoke-file.xq") > Query plan: > <QueryPlan> > <FNXQuery name="invoke(string[,bindings])"> > <Str value="invoke-file.xq" type="xs:string"/> > </FNXQuery> > </QueryPlan> > > Same error comes, when the query is on a text file, and it is > evaluated with xquery:invoke. > > The funny part is, if the database (suuryritys_com) is opened by hand > (on BaseXGui's command line with "open suuryritys_com"), the query > returns the > result. It also seems, that if I first open some other database, then > close it, and then open the database suuryritys_com, I get the same > error. > > -- > Arto Viitanen > Microteam Oy > Finland > > > > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk

⚡Generated with XQuery