Stack overflow instead of syntax error

Tuesday, 10 September 2019 · 3 messages · last reply 11 Sep 2019
BK
Buddy Kresge10 Sep 2019 17:26 #
We have some code generation and it produced a syntax error. However, running 9.2.4 in production, the server gave a stack overflow tail recursion instead of "Cannot convert xs:integer to xs:date: 1970." (like the GUI did). Here was the error reported: java.lang.RuntimeException: org.basex.core.BaseXException: Stack Overflow: Try tail recursion? Here is the snippet of code that originally cause the 'stack overflow'. The issue is the date is not in quotes.
function($endDate as xs:date?) as xs:Boolean
{
  let $intervalBeginDate := xs:date(2019-09-30)
 let $intervalEndDate := xs:date(2019-09-30)
 return ($endDate ge $intervalBeginDate) and ($endDate le $intervalEndDate)
};
However, when I fix the code generation, everything is fine (see new code below). Just seems "strange" that this would cause the server to throw a 'stack overflow' error.
function($endDate as xs:date?) as xs:Boolean
{
  let $intervalBeginDate := xs:date('2019-09-30')
 let $intervalEndDate := xs:date('2019-09-30')
 return ($endDate ge $intervalBeginDate) and ($endDate le $intervalEndDate)
};
Buddy
CG
Christian Grün11 Sep 2019 10:24 #
Hi Buddy,
Quoted text · Buddy Kresge · 3 lines
> Here is the snippet of code that originally cause the ‘stack overflow’. The issue is the date is not in quotes. > > function($endDate as xs:date?) as xs:Boolean
There are various syntactical bugs in your example: The "declare" is missing, as well as the function name, and it must be "xs:boolean". Once again, please provide us with an SSCCE ;) …otherwise, I am sorry we cannot give any helpful advice. Thanks Christian
BK
Buddy Kresge11 Sep 2019 13:51 #
Sorry for that - with was actually a definition stored in a map. I will get a SSCCE together for you. Buddy
Quoted text · Christian Grün · 14 lines
-----Original Message----- From: Christian Grün <christian.gruen at gmail.com> Sent: Wednesday, September 11, 2019 4:24 AM To: Buddy Kresge <buddy.kresge at known2u.com> Cc: basex-talk at mailman.uni-konstanz.de Subject: Re: [basex-talk] Stack overflow instead of syntax error Hi Buddy, > Here is the snippet of code that originally cause the ‘stack overflow’. The issue is the date is not in quotes. > > function($endDate as xs:date?) as xs:Boolean There are various syntactical bugs in your example: The "declare" is missing, as well as the function name, and it must be "xs:boolean". Once again, please provide us with an SSCCE ;) …otherwise, I am sorry we cannot give any helpful advice. Thanks Christian

⚡Generated with XQuery