> I'm asking because I downloaded it and the error is still there, but now on line 671 instead of the original line 673.
Hm, maybe it was the previous 9.3.3 snapshot you launched?
Feel free to provide me with a minimized query that allows me to
reproduce the bug if it persists. On GitHub, I have referenced a query
that I used for testing [1].
Best,
Christian
[1] https://github.com/BaseXdb/basex/issues/1860
> Unexpected error: Improper use? Potential bug? Your feedback is welcome:
> Contact: basex-talk@mailman.uni-konstanz.de
> Version: BaseX 9.3.3 beta
> Java: Oracle Corporation, 1.8.0_251
> OS: Windows 10, amd64
> Stack Trace:
> java.lang.NullPointerException
> at org.basex.query.expr.path.Path.index(Path.java:671)
> at org.basex.query.expr.path.Path.optimize(Path.java:157)
> at org.basex.query.expr.gflwor.For.addPredicate(For.java:190)
> at org.basex.query.expr.gflwor.For.toPredicate(For.java:218)
> at org.basex.query.expr.gflwor.GFLWOR.optimizeWhere(GFLWOR.java:532)
> at org.basex.query.expr.gflwor.GFLWOR.optimize(GFLWOR.java:109)
> at org.basex.query.expr.gflwor.GFLWOR.compile(GFLWOR.java:100)
> at org.basex.query.expr.Extension.compile(Extension.java:45)
>
>
> Cheers,
> Sebastian.
>
>
> On Mon, May 11, 2020 at 6:15 PM Christian Grün <christian.gruen@gmail.com> wrote:
>>
>> Buenas noticias: The bug is fixed. A new snapshot is waiting for you [1].
>>
>> Cheers,
>> Christian
>>
>> [1] http://files.basex.org/releases/latest/
>>
>>
>>
>> On Mon, May 11, 2020 at 9:47 PM Sebastian Guerrero <chapeti@gmail.com> wrote:
>> >
>> > Hi Christian!, thanks for your reply :-)
>> >
>> > I've just downloaded the latest snapshot [1] and executed the query [2], and yes: the problem is still there.
>> >
>> > Cheers,
>> > Sebastian.
>> >
>> > [1] https://imgur.com/ahgMg7p
>> > [2] https://imgur.com/tDCAtCu
>> >
>> > On Mon, May 11, 2020 at 3:58 PM Christian Grün <christian.gruen@gmail.com> wrote:
>> >>>
>> >>> Maybe it's a newbie issue, but I would like your comments.
>> >>
>> >>
>> >> …definitely something you shouldn't encounter as a newbie either ;) Thanks for reporting it.
>> >>
>> >> Does the exception also occur with the latest snapshot [1]?
>> >>
>> >> Cheers
>> >> Christian
>> >>
>> >> [1] http://files.basex.org/releases/latest/
>> >>
>> >>
>> >>
>> >>
>> >>>
>> >>> I'm writing a RESTXQ method to search among a couple of databases. ( >100 databases )
>> >>>
>> >>> Some databases are split into a couple of parts due to the number of nodes. For example US: it's separated into US00, US01 and US02.
>> >>>
>> >>> So, my problem is:
>> >>>
>> >>> if I replace "for $usPart in ('US00')" by "for $usPart in ('US00','US01',''US02)" in QUERY [A], I get this error:
>> >>>
>> >>> Improper use? Potential bug? Your feedback is welcome:
>> >>> Contact: basex-talk@mailman.uni-konstanz.de
>> >>> Version: BaseX 9.3.2
>> >>> Java: Oracle Corporation, 1.8.0_251
>> >>> OS: Windows 10, amd64
>> >>> Stack Trace:
>> >>> java.lang.NullPointerException
>> >>> at org.basex.query.expr.path.Path.index(Path.java:673)
>> >>> at org.basex.query.expr.path.Path.optimize(Path.java:157)
>> >>> at org.basex.query.expr.gflwor.For.toPredicate(For.java:220)
>> >>> at org.basex.query.expr.gflwor.GFLWOR.optimizeWhere(GFLWOR.java:532)
>> >>> at org.basex.query.expr.gflwor.GFLWOR.optimize(GFLWOR.java:109)
>> >>> at org.basex.query.expr.gflwor.GFLWOR.compile(GFLWOR.java:100)
>> >>> at org.basex.query.expr.Extension.compile(Extension.java:45)
>> >>> at org.basex.query.expr.SwitchGroup.compile(SwitchGroup.java:40)
>> >>> at org.basex.query.expr.Switch.compile(Switch.java:60)
>> >>> at org.basex.query.expr.gflwor.GFLWOR.compile(GFLWOR.java:96)
>> >>> at org.basex.query.expr.gflwor.ForLet.compile(ForLet.java:43)
>> >>> at org.basex.query.expr.gflwor.GFLWOR.compile(GFLWOR.java:90)
>> >>> at org.basex.query.scope.MainModule.comp(MainModule.java:81)
>> >>> at org.basex.query.QueryCompiler.compile(QueryCompiler.java:114)
>> >>> at org.basex.query.QueryCompiler.compile(QueryCompiler.java:105)
>> >>> at org.basex.query.QueryContext.compile(QueryContext.java:312)
>> >>> at org.basex.query.QueryProcessor.compile(QueryProcessor.java:79)
>> >>>
>> >>>
>> >>> Using "for $usPart in ('US00')" it works without any problem. With one element there is no problem, with two or more it fails.
>> >>>
>> >>> Any ideas about what I'm doing wrong?
>> >>>
>> >>> Here is the
>> >>> QUERY [A]
>> >>> -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>> >>> declare namespace gb="http://www.ipo.gov.uk/schemas/tm";
>> >>>
>> >>> let $text:="christian"
>> >>> let $registries:=('GB','US')
>> >>>
>> >>> let $results :=
>> >>> for $registry in $registries
>> >>> return
>> >>> switch ($registry)
>> >>>
>> >>> case "US"
>> >>> return
>> >>> (# db:enforceindex #) {
>> >>> for $usPart in ('US00')
>> >>> for $tmUS in db:open($usPart)/trademark-applications-daily/application-information/file-segments/action-keys/case-file
>> >>> where $tmUS/case-file-header/mark-identification/text() contains text {$text} using stemming
>> >>> return <trademark><ipo>US</ipo><text>{$tmUS/case-file-header/mark-identification/text()}</text></trademark>
>> >>> }
>> >>>
>> >>> case "GB"
>> >>> return
>> >>> (# db:enforceindex #) {
>> >>> for $tmGB in db:open('GB')/gb:MarkLicenceeExportList/gb:TradeMark
>> >>> where $tmGB/gb:WordMarkSpecification/gb:MarkVerbalElementText/text() contains text {$text}
>> >>> return <trademark><ipo>GB</ipo><text>{$tmGB/gb:WordMarkSpecification/gb:MarkVerbalElementText/text()}</text></trademark>
>> >>> }
>> >>>
>> >>> default return ""
>> >>>
>> >>> return
>> >>> <result>
>> >>> <total>{count($results)}</total>
>> >>> <trademarks>
>> >>> {
>> >>> for $result in $results
>> >>> return $result
>> >>> }
>> >>> </trademarks>
>> >>> </result>
>> >>> -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>> >>>
>> >>> Regards,
>> >>> Sebastian