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@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