Hi Andrew and list, I ran into a similar error with 9.3.3-beta this last week but haven't had a chance to work up a SSCCE. Your report makes me think I need to do so!
Best, Bridger On Sat, Apr 25, 2020, 11:19 AM Andrew Sales <and...@andrewsales.com> wrote: > Hello, > > I'd like to run a transform on multiple documents using a cached > transformer, accumulating any errors that occur. > > This minimal example - > > for $doc in (<a/>,<b/>, <c/>) > return > try{ > xslt:transform( > $doc, > <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > version='2.0'> > <xsl:template match='/'><xsl:sequence select='error()'/></xsl:template> > </xsl:transform>, > map{}, > map{'cache':'true'} > ) > } > catch * {$err:description} > > - results in: > > Error in xsl:sequence/@select on line 1 column 135 of [...]: > FOER0000: Error signalled by application call on error()Improper use? > Potentia > l bug? Your feedback is welcome: > Contact: basex-talk@mailman.uni-konstanz.de > Version: BaseX 9.3.2 > Java: Oracle Corporation, 1.8.0_241 > OS: Windows 7, amd64 > Stack Trace: > java.lang.NullPointerException > at org.basex.io.out.ArrayOutput.write(ArrayOutput.java:32) > at java.io.OutputStream.write(Unknown Source) > at java.io.PrintStream.write(Unknown Source) > at sun.nio.cs.StreamEncoder.writeBytes(Unknown Source) > at sun.nio.cs.StreamEncoder.implFlushBuffer(Unknown Source) > at sun.nio.cs.StreamEncoder.flushBuffer(Unknown Source) > at java.io.OutputStreamWriter.flushBuffer(Unknown Source) > at java.io.PrintStream.write(Unknown Source) > at java.io.PrintStream.print(Unknown Source) > at java.io.PrintStream.println(Unknown Source) > at net.sf.saxon.lib.StandardLogger.println(StandardLogger.java:121) > at net.sf.saxon.lib.Logger.error(Logger.java:45) > at > net.sf.saxon.lib.StandardErrorListener.fatalError(StandardErrorListen > er.java:305) > at net.sf.saxon.Controller.reportFatalError(Controller.java:958) > at net.sf.saxon.Controller.transform(Controller.java:1914) > at > net.sf.saxon.s9api.XsltTransformer.transform(XsltTransformer.java:579 > ) > at > net.sf.saxon.jaxp.TransformerImpl.transform(TransformerImpl.java:185) > > at > org.basex.query.func.xslt.XsltTransform.transform(XsltTransform.java: > 135) > at > org.basex.query.func.xslt.XsltTransform.transform(XsltTransform.java: > 62) > at > org.basex.query.func.xslt.XsltTransform.item(XsltTransform.java:40) > at org.basex.query.expr.ParseExpr.value(ParseExpr.java:51) > at org.basex.query.expr.Try.value(Try.java:94) > at org.basex.query.expr.ParseExpr.iter(ParseExpr.java:46) > at org.basex.query.expr.gflwor.GFLWOR$1.next(GFLWOR.java:72) > at org.basex.query.QueryContext.next(QueryContext.java:353) > at org.basex.query.scope.MainModule$1.next(MainModule.java:104) > at org.basex.core.cmd.AQuery.query(AQuery.java:109) > 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.api.client.LocalSession.execute(LocalSession.java:132) > at org.basex.api.client.Session.execute(Session.java:36) > at org.basex.core.CLI.execute(CLI.java:92) > at org.basex.BaseX.<init>(BaseX.java:107) > at org.basex.BaseX.main(BaseX.java:43) > > The exception does not occur if 'cache' is set to 'false'. > > Relatedly, if I amend the query to this: > > for $doc in (<a/>,<b/>,<c/>) > return > try{ > xslt:transform( > $doc, > <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > xmlns:xs="http://www.w3.org/2001/XMLSchema" version='2.0'> > <xsl:template match='/'> > <xsl:sequence select='if(a) then error(xs:QName("err"), "oops") else > .'/> > </xsl:template> > </xsl:transform>, > map{}, > map{'cache':'true'} > ) > } > catch * {<err>{$err:description}</err>} > > the error message is passed through for the first item in the sequence > (<a/>), but is lost, resulting in <err/> when adjusted to error on > subsequent items (<b/> or <c/>). > > Again, this works as expected if the transformer is not cached. > > Thanks and regards, > Andrew > > > <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> > Virus-free. > www.avast.com > <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> > <#m_-7045194468050368418_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2> >