Am 09.08.2018 um 19:54 schrieb Christian Grün:
>> A new snapshot will be available later tonight.
> …which is now.
Installed the new snapshot, all went fine, but later I stumbled upon the
following issue:

Error:
Improper use? Potential bug? Your feedback is welcome:
Contact: basex-talk@mailman.uni-konstanz.de
Version: BaseX 9.1 beta
Java: Oracle Corporation, 9.0.1
OS: Windows 10, amd64
Stack Trace: 
java.util.regex.PatternSyntaxException: Unmatched closing ')' near index 13
([^\:]*)\:\/\/)?(?:([^\:\@]*)(?:\:([^\@]*))?\@)?(?:([^\/\:]*))?(?:\:([0-9]*))?\/(\/[^\?#]*(?=.*?\/)\/)?([^\?#]*)?(?:\?([^#]*))?(?:#(.*))?/
             ^
        at java.base/java.util.regex.Pattern.error(Unknown Source)
        at java.base/java.util.regex.Pattern.compile(Unknown Source)
        at java.base/java.util.regex.Pattern.<init>(Unknown Source)
        at java.base/java.util.regex.Pattern.compile(Unknown Source)
        at 
org.basex.query.util.regex.parse.RegExParser.parse(RegExParser.java:61)
        ...


To me it looks like the Java regex circumvents the BaseX error catcher.
Full error log and test-case attached.

-- 
Goody Bye, Minden jót, Mit freundlichen Grüßen,
Andreas Mixich

Error:
Improper use? Potential bug? Your feedback is welcome:
Contact: basex-talk@mailman.uni-konstanz.de
Version: BaseX 9.1 beta
Java: Oracle Corporation, 9.0.1
OS: Windows 10, amd64
Stack Trace: 
java.util.regex.PatternSyntaxException: Unmatched closing ')' near index 13
([^\:]*)\:\/\/)?(?:([^\:\@]*)(?:\:([^\@]*))?\@)?(?:([^\/\:]*))?(?:\:([0-9]*))?\/(\/[^\?#]*(?=.*?\/)\/)?([^\?#]*)?(?:\?([^#]*))?(?:#(.*))?/
             ^
        at java.base/java.util.regex.Pattern.error(Unknown Source)
        at java.base/java.util.regex.Pattern.compile(Unknown Source)
        at java.base/java.util.regex.Pattern.<init>(Unknown Source)
        at java.base/java.util.regex.Pattern.compile(Unknown Source)
        at 
org.basex.query.util.regex.parse.RegExParser.parse(RegExParser.java:61)
        at org.basex.query.func.fn.RegEx.pattern(RegEx.java:44)
        at org.basex.query.func.fn.FnAnalyzeString.item(FnAnalyzeString.java:34)
        at org.basex.query.expr.ParseExpr.iter(ParseExpr.java:48)
        at org.basex.query.expr.gflwor.GFLWOR$1.next(GFLWOR.java:92)
        at org.basex.query.QueryContext.next(QueryContext.java:397)
        at org.basex.query.scope.MainModule$1.next(MainModule.java:122)
        at org.basex.query.QueryContext.next(QueryContext.java:397)
        at org.basex.query.QueryContext.cache(QueryContext.java:636)
        at org.basex.query.QueryProcessor.cache(QueryProcessor.java:112)
        at org.basex.core.cmd.AQuery.query(AQuery.java:96)
        at org.basex.core.cmd.XQuery.run(XQuery.java:22)
        at org.basex.core.Command.run(Command.java:257)
        at org.basex.core.Command.execute(Command.java:93)
        at org.basex.gui.GUI.exec(GUI.java:430)
        at org.basex.gui.GUI.lambda$4(GUI.java:374)
        at java.base/java.lang.Thread.run(Unknown Source)
Compiling:
- inline $rx_35
- inline local:test3#0
Optimized Query:
for $i_37 in ("http://example.com/batz/mongo/blah/index.html";, ...) return 
analyze-string($i_37, 
"([^\:]*)\:\/\/)?(?:([^\:\@]*)(?:\:([^\@]*))?\@)?(?:([^\/\:]*))?(?:\:([0-9]*))?\/(\/[^\?#]*(?=.*?\/)\/)?([^\?#]*)?(?:\?([^#]*))?(?:#(.*))?/",
 "ij")
Query:
xquery version "3.1"; declare variable $local:uri1 := 
"http://example.com/batz/mongo/blah/index.html";; declare variable $local:uri2 
:= "/batz/mongo/blah/index.html"; declare variable $local:uri3 := 
"batz/mongo/blah/index.html"; declare variable $local:uri4 := "index.html"; 
declare variable $local:uri5 := 
"HTtpS://reGexr.com/more/less/path/foo.php?q=bar&amp;same[12]=xxx&amp;same[11]=#sldns13123nfdwdw";
 declare variable $local:uri6 := 
"https://bartoszmilewski.com/2014/10/28/category-theory-for-programmers-the-preface/";;
 declare variable $local:uri7 := 
"http://bartosz.milewski.com/2014/10/28/category-theory-for-programmers-the-preface/index.html";;
 declare variable $local:uri8 := 
"http://bartosz-milewski.com/2014/10/28/category-theory-for-programmers-the-preface/index.xhtml";;
 declare variable $local:uri9 := "ftp://ftp.is.co.za/rfc/rfc1808.txt";; declare 
variable $local:uri10 := "mailto:john....@example.com";; declare variable 
$local:uri11 := "http://example.comr/batz/mongo/blah/index.html";; declare 
variable $local:uri12 := "ldap://[2001:db8::7]/c=GB?objectClass?one";; declare 
variable $local:uri13 := "news:comp.infosystems.www.servers.unix";; declare 
variable $local:uri14 := "tel:+1-816-555-1212"; declare variable $local:uri15 
:= "telnet://192.0.2.16:80/"; declare variable $local:uri16 := 
"urn:oasis:names:specification:docbook:dtd:xml:4.1.2"; declare variable 
$local:uri17 := "Foo Bar Batz"; declare variable $local:uri18 := "Hi, my name 
is..., my name is..., my name is Slim Shady."; declare variable $local:uri19 := 
"https://foo.bar/barz/index.html?bla=2";; declare variable $local:uri20 := 
"https://u...@foo.bar/barz/index.html?bla=2";; declare variable $local:uri21 := 
"http://user:passw...@example.com:7070/batz/mongo/blah/index.html";; declare 
variable $local:uri22 := "https://foo.bar:5252/barz/index.html?bla=2";; declare 
variable $local:test := ( $local:uri1, $local:uri2, $local:uri3, $local:uri4, 
$local:uri5, $local:uri6, $local:uri7, $local:uri8, $local:uri9, $local:uri10, 
$local:uri11, $local:uri12, $local:uri13, $local:uri14, $local:uri15, 
$local:uri16, $local:uri17, $local:uri18, $local:uri19, $local:uri20, 
$local:uri21, $local:uri22 ); declare function local:testRfc() { let $rx := 
"^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?" for $i in 
$local:test return analyze-string($i, $rx, 'ij') }; declare function 
local:test1() { let $rx := 
'/(?:([^\:]*)\:\/\/)?(?:([^\:\@]*)(?:\:([^\@]*))?\@)?(?:([^\/\:]*)\.(?=[^\.\/\:]*\.[^\.\/\:]*))?([^\.\/\:]*)(?:\.([^\/\.\:]*))?(?:\:([0-9]*))?(\/[^\?#]*(?=.*?\/)\/)?([^\?#]*)?(?:\?([^#]*))?(?:#(.*))?/'
 for $i in $local:test return analyze-string($i, $rx, 'ij') }; declare function 
local:test2($what) { let $scheme := '^(([^:/?#]+):)' let $authority := 
'(//([^/?#]*))' let $path := '([^?#]*)' let $query := '(\?([^#]*))' let 
$fragment := '(#(.*))' let $full := 
'^(([^:/?#]+):)(//([^/?#]*))([^?#]*)(\?([^#]*))(#(.*))' let $userinfo := 
'((.*?)@)(.*?)' return switch ($what) case "scheme" return $local:test ! 
analyze-string(., $scheme, 'j') case "auth" return $local:test ! 
analyze-string(., $authority, 'j') case "path" return $local:test ! 
analyze-string(., $path, 'j') case "query" return $local:test ! 
analyze-string(., $query, 'j') case "frag" return $local:test ! 
analyze-string(., $fragment, 'j') case "full" return $local:test ! 
analyze-string(., $full, 'j') case "user" return $local:test ! 
analyze-string(., $userinfo, 'j') default return "Wrong input." }; declare 
function local:test3() { let $rx := 
'([^\:]*)\:\/\/)?(?:([^\:\@]*)(?:\:([^\@]*))?\@)?(?:([^\/\:]*))?(?:\:([0-9]*))?\/(\/[^\?#]*(?=.*?\/)\/)?([^\?#]*)?(?:\?([^#]*))?(?:#(.*))?/'
 for $i in $local:test return analyze-string($i, $rx, 'ij') }; local:test3()
Query plan:
<QueryPlan compiled="true" updating="false">
  <GFLWOR type="element()+" size="22">
    <For type="xs:string" size="1">
      <Var name="$i" id="37" type="xs:string"/>
      <StrSeq size="22" type="xs:string+">
        <Str 
type="xs:string">http://example.com/batz/mongo/blah/index.html</Str>
        <Str type="xs:string">/batz/mongo/blah/index.html</Str>
        <Str type="xs:string">batz/mongo/blah/index.html</Str>
        <etc/>
      </StrSeq>
    </For>
    <FnAnalyzeString name="analyze-string(input,pattern[,mod])" 
type="element()" size="1">
      <VarRef type="xs:string" size="1">
        <Var name="$i" id="37" type="xs:string"/>
      </VarRef>
      <Str 
type="xs:string">([^\:]*)\:\/\/)?(?:([^\:\@]*)(?:\:([^\@]*))?\@)?(?:([^\/\:]*))?(?:\:([0-9]*))?\/(\/[^\?#]*(?=.*?\/)\/)?([^\?#]*)?(?:\?([^#]*))?(?:#(.*))?/</Str>
      <Str type="xs:string">ij</Str>
    </FnAnalyzeString>
  </GFLWOR>
</QueryPlan>

Attachment: error-j-regex.xq
Description: application/xquery

Reply via email to