I had a go at using this, and it's useful.
However, I can't seem to test the output of the oxf:exception-catcher with a <p:choose>...<p:when> construct, I get another exception... I'd be interested to hear how others have implemented this. -----Original Message----- From: Erik Bruchez [mailto:[hidden email]] On Behalf Of Erik Bruchez Sent: 01 November 2005 23:34 To: [hidden email] Subject: Re: [ops-users] Handling ResourceNotFound or other exceptions non-fatally? Ryan, There is currently no documentation about this, because we feel exception handling in XPL is the way to go. You use this processor as shown below: just hook its "data" input to the output that can cause an exception when reading it, and its "data" output will either contain the document read, or an exception document in the format returned by the exception generator (which you can look at just by producing an exception). -Erik Ryan Puddephatt wrote: > Erik, > Is there any documentation on this exception catcher? How would it be > implemented into a pipeline? > > Thanks > Ryan > > Erik Bruchez wrote: > >> Jeff Jones wrote: >> >>> I'm trying to use the XPath doc() function to request a snippet of >>> XHTML from an external resource (via HTTP) and insert it into an >>> XHTML page I'm generating with OPS 3.0. I can't guarantee, though, >>> that that HTTP request will always succeed. When it fails, I don't >>> want to give up on the page; I just want to ignore the error and >>> deliver the document without the include. How can I do this with >> >> >> >> Ideally, I think, with exception handling in XPL. Currently, there is >> none, but there is a possibility that this will be implemented in the >> future. As a temporary hack, you can use the oxf:exception-catcher >> processor: >> >> <p:processor name="oxf:exception-catcher"> >> <p:input name="data" href="#the-output-of-the-stylesheet"/> >> <p:output name="data" id="ouput-or-exception-document"/> >> </p:processor> >> >>> I can write a separate pipeline to make the request if necessary, or >>> use XInclude if its error handling is more flexible; I'm not wedded >>> to doc(). My first thought was to test with doc-available(), but even >>> if it would work, I see in the Saxon docs that it wasn't implemented >>> until 8.4. Do I have any other options? >> >> >> >> The XInclude processor does not yet implement xi:fallback, but it >> should. When it does, you will be able to use that as an exception >> mechanism to retrieve HTTP resources, although you won't have any >> detail of exactly what went wrong. >> >> -Erik >> >> >> >> >> -- >> You receive this message as a subscriber of the >> [hidden email] mailing list. >> To unsubscribe: mailto:[hidden email] >> For general help: mailto:[hidden email]?subject=help >> ObjectWeb mailing lists service home page: >> >> > > > ------------------------------------------------------------------------ > > > -- > You receive this message as a subscriber of the [hidden email] mailing list. > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > ObjectWeb mailing lists service home page: http://www.objectweb.org/wws -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Administrator
|
Stephen,
We would need more information to help you on this. What is the other exception you are getting? Alex On 11/29/05, Stephen Bayliss <[hidden email]> wrote: > I had a go at using this, and it's useful. > > However, I can't seem to test the output of the oxf:exception-catcher > with a <p:choose>...<p:when> construct, I get another exception... > > I'd be interested to hear how others have implemented this. > > -----Original Message----- > From: Erik Bruchez [mailto:[hidden email]] On Behalf Of Erik Bruchez > Sent: 01 November 2005 23:34 > To: [hidden email] > Subject: Re: [ops-users] Handling ResourceNotFound or other exceptions > non-fatally? > > Ryan, > > There is currently no documentation about this, because we feel > exception handling in XPL is the way to go. > > You use this processor as shown below: just hook its "data" input to the > > output that can cause an exception when reading it, and its "data" > output will either contain the document read, or an exception document > in the format returned by the exception generator (which you can look at > > just by producing an exception). > > -Erik > > Ryan Puddephatt wrote: > > Erik, > > Is there any documentation on this exception catcher? How would it > be > > implemented into a pipeline? > > > > Thanks > > Ryan > > > > Erik Bruchez wrote: > > > >> Jeff Jones wrote: > >> > >>> I'm trying to use the XPath doc() function to request a snippet of > >>> XHTML from an external resource (via HTTP) and insert it into an > >>> XHTML page I'm generating with OPS 3.0. I can't guarantee, though, > >>> that that HTTP request will always succeed. When it fails, I don't > >>> want to give up on the page; I just want to ignore the error and > >>> deliver the document without the include. How can I do this with > OPS? > >> > >> > >> > >> Ideally, I think, with exception handling in XPL. Currently, there is > > >> none, but there is a possibility that this will be implemented in the > > >> future. As a temporary hack, you can use the oxf:exception-catcher > >> processor: > >> > >> <p:processor name="oxf:exception-catcher"> > >> <p:input name="data" href="#the-output-of-the-stylesheet"/> > >> <p:output name="data" id="ouput-or-exception-document"/> > >> </p:processor> > >> > >>> I can write a separate pipeline to make the request if necessary, or > > >>> use XInclude if its error handling is more flexible; I'm not wedded > >>> to doc(). My first thought was to test with doc-available(), but > even > >>> if it would work, I see in the Saxon docs that it wasn't implemented > > >>> until 8.4. Do I have any other options? > >> > >> > >> > >> The XInclude processor does not yet implement xi:fallback, but it > >> should. When it does, you will be able to use that as an exception > >> mechanism to retrieve HTTP resources, although you won't have any > >> detail of exactly what went wrong. > >> > >> -Erik > >> > >> > ------------------------------------------------------------------------ > >> > >> > >> -- > >> You receive this message as a subscriber of the > >> [hidden email] mailing list. > >> To unsubscribe: mailto:[hidden email] > >> For general help: mailto:[hidden email]?subject=help > >> ObjectWeb mailing lists service home page: > http://www.objectweb.org/wws > >> > >> > > > > > > > ------------------------------------------------------------------------ > > > > > > -- > > You receive this message as a subscriber of the > [hidden email] mailing list. > > To unsubscribe: mailto:[hidden email] > > For general help: mailto:[hidden email]?subject=help > > ObjectWeb mailing lists service home page: > http://www.objectweb.org/wws > > > > > > > > -- > You receive this message as a subscriber of the [hidden email] mailing list. > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > ObjectWeb mailing lists service home page: http://www.objectweb.org/wws > > > -- Blog (XML, Web apps, Open Source): http://www.orbeon.com/blog/ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
In reply to this post by Stephen Bayliss
Hi Alex
Trying to produce an example of this has actually narrowed down the circumstances in which I experienced the problem. The exception I get is org.orbeon.oxf.common.OXFException - No state in context. It only occurs when the exception catcher is catching exceptions from an oxf:pipeline call. Furthermore, if no exception was thrown in the called pipeline everything works fine (ie no secondary exception is thrown). If instead of using a <p:choose> construct, I use xslt to pick up the error, then I get org.orbeon.oxf.common.ValidationException - Current processor should be on top of the stack However, in this case if I http-serialize the results (instead of passing to the data output) and call the pipeline as a model (instead of as a view), then this exception is not seen, and data is successfully serialized (though it appears that the exception is still thrown, looking at the logs). I attach my example files (apart from page flow, see below); they are also pasted below. As pasted below, no exception is thrown, data is returned and displayed. To force an exception, modify the input document produced by the oxf:identity processor in exception-example.xpl, eg change the name of the node <childNode>; which means that the document will no longer validate correctly against the schema specified in the subsequent processor. Then you will see the "No state in context" error. To see the exception thrown if xslt is used to process the exception processor output, comment out the <p:choose> in caller.xpl, and uncomment the oxf:xslt processor. Steve ------------------------------------------------------------------------ --- page-flow.xml (fragment) ========================= <page id="exception-example" path-info="/exception-example" view="/exception-error/caller.xpl"/> ------------------------------------------------------------------------ --- caller.xpl ========================= <!-- caller.xpl --> <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline" xmlns:oxf="http://www.orbeon.com/oxf/processors" > <p:param type="output" name="data"/> <!-- call the pipeline --> <p:processor name="oxf:pipeline"> <p:input name="config" href="exception-example.xpl"/> <p:output name="data" id="catch-me"/> </p:processor> <!-- catch any exceptions --> <p:processor name="oxf:exception-catcher"> <p:input name="data" href="#catch-me"/> <p:output name="data" id="caught"/> </p:processor> <!-- look at root note to determine if there was an exception if there was, return some error text, if not, just pass thru --> <p:choose href="#caught"> <p:when test="/exceptions"> <p:processor name="oxf:identity"> <p:input name="data"> <rootNode> <childNode>There was an error</childNode> </rootNode> </p:input> <p:output name="data" id="output"/> </p:processor> </p:when> <p:otherwise> <p:processor name="oxf:identity"> <p:input name="data" href="#caught"/> <p:output name="data" id="output"/> </p:processor> </p:otherwise> </p:choose> <!-- alternative to above: use xslt instead --> <!-- uncomment this, and comment out the p:choose instead --> <!-- <p:processor name="oxf:xslt"> <p:input name="data" href="#caught"/> <p:input name="config"> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns=""> <xsl:template match="/"> <xsl:choose> <xsl:when test="/exceptions"> <rootNode> <childNode>There was an error</childNode> </rootNode> </xsl:when> <xsl:otherwise> <xsl:copy-of select="/"/> </xsl:otherwise> </xsl:choose> </xsl:template> </xsl:stylesheet> </p:input> <p:output name="data" id="output"/> </p:processor> --> <!-- pass the output back --> <p:processor name="oxf:identity"> <p:input name="data" href="#output"/> <p:output name="data" ref="data"/> </p:processor> </p:config> ------------------------------------------------------------------------ --- exception-example.xpl ========================= <!-- exception-example.xpl --> <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline" xmlns:oxf="http://www.orbeon.com/oxf/processors" > <p:param type="output" name="data"/> <!-- dummy input document --> <p:processor name="oxf:identity"> <p:input name="data"> <rootNode> <childNode>sometext</childNode> </rootNode> </p:input> <p:output name="data" id="input-doc"/> </p:processor> <!-- dummy transform, note input is validated --> <p:processor name="oxf:xslt"> <p:input name="data" href="#input-doc" schema-href="/exception-error/schema.rng"/> <p:input name="config"> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns=""> <xsl:template match="/"> <xsl:copy-of select="/"/> </xsl:template> </xsl:stylesheet> </p:input> <p:output name="data" ref="data"/> </p:processor> </p:config> ------------------------------------------------------------------------ --- schema.rng ========================= <grammar xmlns="http://relaxng.org/ns/structure/1.0"> <start> <element name="rootNode"> <element name="childNode"><text/></element> </element> </start> </grammar> ------------------------------------------------------------------------ --- -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Alessandro Vernet Sent: 01 December 2005 23:37 To: [hidden email] Subject: Re: [ops-users] Handling ResourceNotFound or other exceptions non-fatally? Stephen, We would need more information to help you on this. What is the other exception you are getting? Alex On 11/29/05, Stephen Bayliss <[hidden email]> wrote: > I had a go at using this, and it's useful. > > However, I can't seem to test the output of the oxf:exception-catcher > with a <p:choose>...<p:when> construct, I get another exception... > > I'd be interested to hear how others have implemented this. > > -----Original Message----- > From: Erik Bruchez [mailto:[hidden email]] On Behalf Of Erik Bruchez > Sent: 01 November 2005 23:34 > To: [hidden email] > Subject: Re: [ops-users] Handling ResourceNotFound or other exceptions > non-fatally? > > Ryan, > > There is currently no documentation about this, because we feel > exception handling in XPL is the way to go. > > You use this processor as shown below: just hook its "data" input to > > output that can cause an exception when reading it, and its "data" > output will either contain the document read, or an exception document > in the format returned by the exception generator (which you can look > > just by producing an exception). > > -Erik > > Ryan Puddephatt wrote: > > Erik, > > Is there any documentation on this exception catcher? How would it > be > > implemented into a pipeline? > > > > Thanks > > Ryan > > > > Erik Bruchez wrote: > > > >> Jeff Jones wrote: > >> > >>> I'm trying to use the XPath doc() function to request a snippet of > >>> XHTML from an external resource (via HTTP) and insert it into an > >>> XHTML page I'm generating with OPS 3.0. I can't guarantee, though, > >>> that that HTTP request will always succeed. When it fails, I don't > >>> want to give up on the page; I just want to ignore the error and > >>> deliver the document without the include. How can I do this with > OPS? > >> > >> > >> > >> Ideally, I think, with exception handling in XPL. Currently, there > > >> none, but there is a possibility that this will be implemented in > > >> future. As a temporary hack, you can use the oxf:exception-catcher > >> processor: > >> > >> <p:processor name="oxf:exception-catcher"> > >> <p:input name="data" href="#the-output-of-the-stylesheet"/> > >> <p:output name="data" id="ouput-or-exception-document"/> > >> </p:processor> > >> > >>> I can write a separate pipeline to make the request if necessary, > > >>> use XInclude if its error handling is more flexible; I'm not > >>> to doc(). My first thought was to test with doc-available(), but > even > >>> if it would work, I see in the Saxon docs that it wasn't implemented > > >>> until 8.4. Do I have any other options? > >> > >> > >> > >> The XInclude processor does not yet implement xi:fallback, but it > >> should. When it does, you will be able to use that as an exception > >> mechanism to retrieve HTTP resources, although you won't have any > >> detail of exactly what went wrong. > >> > >> -Erik > >> > >> > > >> > >> > >> -- > >> You receive this message as a subscriber of the > >> [hidden email] mailing list. > >> To unsubscribe: mailto:[hidden email] > >> For general help: mailto:[hidden email]?subject=help > >> ObjectWeb mailing lists service home page: > http://www.objectweb.org/wws > >> > >> > > > > > > > > > > > > > -- > > You receive this message as a subscriber of the > [hidden email] mailing list. > > To unsubscribe: mailto:[hidden email] > > For general help: mailto:[hidden email]?subject=help > > ObjectWeb mailing lists service home page: > http://www.objectweb.org/wws > > > > > > > > -- > You receive this message as a subscriber of the > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > ObjectWeb mailing lists service home page: > > > -- Blog (XML, Web apps, Open Source): http://www.orbeon.com/blog/ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws exception-error.zip (2K) Download Attachment |
Administrator
|
Hi Stephen,
Sorry for the delay - I finally got to this and managed to reproduce the problem. It looks like we have investigated a similar problem a long time ago as I see some tracing code in the section of the source where this problem happens. This was added back in early 2004. I have created an entry for this in the bug base and we'll see what we can do. http://forge.objectweb.org/tracker/index.php?func=detail&aid=304365&group_id=168&atid=350207 Alex On 12/6/05, Stephen Bayliss <[hidden email]> wrote: > Hi Alex > > Trying to produce an example of this has actually narrowed down the > circumstances in which I experienced the problem. > > The exception I get is > org.orbeon.oxf.common.OXFException - No state in context. > > It only occurs when the exception catcher is catching exceptions from an > oxf:pipeline call. Furthermore, if no exception was thrown in the > called pipeline everything works fine (ie no secondary exception is > thrown). > > If instead of using a <p:choose> construct, I use xslt to pick up the > error, then I get > org.orbeon.oxf.common.ValidationException - Current processor should be > on top of the stack > However, in this case if I http-serialize the results (instead of > passing to the data output) and call the pipeline as a model (instead of > as a view), then this exception is not seen, and data is successfully > serialized (though it appears that the exception is still thrown, > looking at the logs). > > I attach my example files (apart from page flow, see below); they are > also pasted below. > > As pasted below, no exception is thrown, data is returned and displayed. > > To force an exception, modify the input document produced by the > oxf:identity processor in exception-example.xpl, eg change the name of > the node <childNode>; which means that the document will no longer > validate correctly against the schema specified in the subsequent > processor. > > Then you will see the "No state in context" error. > > To see the exception thrown if xslt is used to process the exception > processor output, comment out the <p:choose> in caller.xpl, and > uncomment the oxf:xslt processor. > > Steve > ------------------------------------------------------------------------ > --- > page-flow.xml (fragment) > ========================= > <page id="exception-example" path-info="/exception-example" > view="/exception-error/caller.xpl"/> > ------------------------------------------------------------------------ > --- > caller.xpl > ========================= > <!-- caller.xpl > --> > <p:config > xmlns:p="http://www.orbeon.com/oxf/pipeline" > xmlns:oxf="http://www.orbeon.com/oxf/processors" > > > <p:param type="output" name="data"/> > > <!-- call the pipeline --> > <p:processor name="oxf:pipeline"> > <p:input name="config" href="exception-example.xpl"/> > <p:output name="data" id="catch-me"/> > </p:processor> > > <!-- catch any exceptions --> > <p:processor name="oxf:exception-catcher"> > <p:input name="data" href="#catch-me"/> > <p:output name="data" id="caught"/> > </p:processor> > > <!-- look at root note to determine if there was an exception > if there was, return some error text, if not, just pass > thru --> > <p:choose href="#caught"> > <p:when test="/exceptions"> > <p:processor name="oxf:identity"> > <p:input name="data"> > <rootNode> > <childNode>There was an error</childNode> > </rootNode> > </p:input> > <p:output name="data" id="output"/> > </p:processor> > </p:when> > <p:otherwise> > <p:processor name="oxf:identity"> > <p:input name="data" href="#caught"/> > <p:output name="data" id="output"/> > </p:processor> > </p:otherwise> > </p:choose> > > <!-- alternative to above: use xslt instead --> > <!-- uncomment this, and comment out the p:choose instead --> > <!-- > <p:processor name="oxf:xslt"> > <p:input name="data" href="#caught"/> > <p:input name="config"> > <xsl:stylesheet version="2.0" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns=""> > <xsl:template match="/"> > <xsl:choose> > <xsl:when test="/exceptions"> > <rootNode> > <childNode>There was an > error</childNode> > </rootNode> > </xsl:when> > <xsl:otherwise> > <xsl:copy-of select="/"/> > </xsl:otherwise> > </xsl:choose> > </xsl:template> > </xsl:stylesheet> > </p:input> > <p:output name="data" id="output"/> > </p:processor> > --> > > <!-- pass the output back --> > <p:processor name="oxf:identity"> > <p:input name="data" href="#output"/> > <p:output name="data" ref="data"/> > </p:processor> > > </p:config> > ------------------------------------------------------------------------ > --- > exception-example.xpl > ========================= > <!-- exception-example.xpl > --> > <p:config > xmlns:p="http://www.orbeon.com/oxf/pipeline" > xmlns:oxf="http://www.orbeon.com/oxf/processors" > > > <p:param type="output" name="data"/> > > <!-- dummy input document --> > <p:processor name="oxf:identity"> > <p:input name="data"> > <rootNode> > <childNode>sometext</childNode> > </rootNode> > </p:input> > <p:output name="data" id="input-doc"/> > </p:processor> > > <!-- dummy transform, note input is validated --> > <p:processor name="oxf:xslt"> > <p:input name="data" href="#input-doc" > schema-href="/exception-error/schema.rng"/> > <p:input name="config"> > <xsl:stylesheet version="2.0" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns=""> > <xsl:template match="/"> > <xsl:copy-of select="/"/> > </xsl:template> > </xsl:stylesheet> > </p:input> > <p:output name="data" ref="data"/> > </p:processor> > > </p:config> > ------------------------------------------------------------------------ > --- > schema.rng > ========================= > <grammar xmlns="http://relaxng.org/ns/structure/1.0"> > <start> > <element name="rootNode"> > <element name="childNode"><text/></element> > </element> > </start> > </grammar> > ------------------------------------------------------------------------ > --- > > -----Original Message----- > From: [hidden email] [mailto:[hidden email]] On Behalf Of > Alessandro Vernet > Sent: 01 December 2005 23:37 > To: [hidden email] > Subject: Re: [ops-users] Handling ResourceNotFound or other exceptions > non-fatally? > > Stephen, > > We would need more information to help you on this. What is the other > exception you are getting? > > Alex > > On 11/29/05, Stephen Bayliss <[hidden email]> wrote: > > I had a go at using this, and it's useful. > > > > However, I can't seem to test the output of the oxf:exception-catcher > > with a <p:choose>...<p:when> construct, I get another exception... > > > > I'd be interested to hear how others have implemented this. > > > > -----Original Message----- > > From: Erik Bruchez [mailto:[hidden email]] On Behalf Of Erik > Bruchez > > Sent: 01 November 2005 23:34 > > To: [hidden email] > > Subject: Re: [ops-users] Handling ResourceNotFound or other exceptions > > non-fatally? > > > > Ryan, > > > > There is currently no documentation about this, because we feel > > exception handling in XPL is the way to go. > > > > You use this processor as shown below: just hook its "data" input to > the > > > > output that can cause an exception when reading it, and its "data" > > output will either contain the document read, or an exception document > > in the format returned by the exception generator (which you can look > at > > > > just by producing an exception). > > > > -Erik > > > > Ryan Puddephatt wrote: > > > Erik, > > > Is there any documentation on this exception catcher? How would > it > > be > > > implemented into a pipeline? > > > > > > Thanks > > > Ryan > > > > > > Erik Bruchez wrote: > > > > > >> Jeff Jones wrote: > > >> > > >>> I'm trying to use the XPath doc() function to request a snippet of > > >>> XHTML from an external resource (via HTTP) and insert it into an > > >>> XHTML page I'm generating with OPS 3.0. I can't guarantee, though, > > >>> that that HTTP request will always succeed. When it fails, I don't > > >>> want to give up on the page; I just want to ignore the error and > > >>> deliver the document without the include. How can I do this with > > OPS? > > >> > > >> > > >> > > >> Ideally, I think, with exception handling in XPL. Currently, there > is > > > > >> none, but there is a possibility that this will be implemented in > the > > > > >> future. As a temporary hack, you can use the oxf:exception-catcher > > >> processor: > > >> > > >> <p:processor name="oxf:exception-catcher"> > > >> <p:input name="data" href="#the-output-of-the-stylesheet"/> > > >> <p:output name="data" id="ouput-or-exception-document"/> > > >> </p:processor> > > >> > > >>> I can write a separate pipeline to make the request if necessary, > or > > > > >>> use XInclude if its error handling is more flexible; I'm not > wedded > > >>> to doc(). My first thought was to test with doc-available(), but > > even > > >>> if it would work, I see in the Saxon docs that it wasn't > implemented > > > > >>> until 8.4. Do I have any other options? > > >> > > >> > > >> > > >> The XInclude processor does not yet implement xi:fallback, but it > > >> should. When it does, you will be able to use that as an exception > > >> mechanism to retrieve HTTP resources, although you won't have any > > >> detail of exactly what went wrong. > > >> > > >> -Erik > > >> > > >> > > > ------------------------------------------------------------------------ > > >> > > >> > > >> -- > > >> You receive this message as a subscriber of the > > >> [hidden email] mailing list. > > >> To unsubscribe: mailto:[hidden email] > > >> For general help: mailto:[hidden email]?subject=help > > >> ObjectWeb mailing lists service home page: > > http://www.objectweb.org/wws > > >> > > >> > > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > > > > -- > > > You receive this message as a subscriber of the > > [hidden email] mailing list. > > > To unsubscribe: mailto:[hidden email] > > > For general help: mailto:[hidden email]?subject=help > > > ObjectWeb mailing lists service home page: > > http://www.objectweb.org/wws > > > > > > > > > > > > > > > > -- > > You receive this message as a subscriber of the > [hidden email] mailing list. > > To unsubscribe: mailto:[hidden email] > > For general help: mailto:[hidden email]?subject=help > > ObjectWeb mailing lists service home page: > http://www.objectweb.org/wws > > > > > > > > > -- > Blog (XML, Web apps, Open Source): http://www.orbeon.com/blog/ > > > > > > -- > You receive this message as a subscriber of the [hidden email] mailing list. > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > ObjectWeb mailing lists service home page: http://www.objectweb.org/wws > > > > -- Blog (XML, Web apps, Open Source): http://www.orbeon.com/blog/ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Administrator
|
Alright! This is fixed, woohoo!
We have not found a bug in the pipeline code, and consequently not modified that code for while. So I was not very optimistic about this one. For that reason I decided to first go for a Hefeweizen, which I think should deserve more credit than me for fixing this bug :). Have a good weekend everyone, Alex On 12/9/05, Alessandro Vernet <[hidden email]> wrote: > Hi Stephen, > > Sorry for the delay - I finally got to this and managed to reproduce > the problem. It looks like we have investigated a similar problem a > long time ago as I see some tracing code in the section of the source > where this problem happens. This was added back in early 2004. I have > created an entry for this in the bug base and we'll see what we can > do. > > http://forge.objectweb.org/tracker/index.php?func=detail&aid=304365&group_id=168&atid=350207 > > Alex > > On 12/6/05, Stephen Bayliss <[hidden email]> wrote: > > Hi Alex > > > > Trying to produce an example of this has actually narrowed down the > > circumstances in which I experienced the problem. > > > > The exception I get is > > org.orbeon.oxf.common.OXFException - No state in context. > > > > It only occurs when the exception catcher is catching exceptions from an > > oxf:pipeline call. Furthermore, if no exception was thrown in the > > called pipeline everything works fine (ie no secondary exception is > > thrown). > > > > If instead of using a <p:choose> construct, I use xslt to pick up the > > error, then I get > > org.orbeon.oxf.common.ValidationException - Current processor should be > > on top of the stack > > However, in this case if I http-serialize the results (instead of > > passing to the data output) and call the pipeline as a model (instead of > > as a view), then this exception is not seen, and data is successfully > > serialized (though it appears that the exception is still thrown, > > looking at the logs). > > > > I attach my example files (apart from page flow, see below); they are > > also pasted below. > > > > As pasted below, no exception is thrown, data is returned and displayed. > > > > To force an exception, modify the input document produced by the > > oxf:identity processor in exception-example.xpl, eg change the name of > > the node <childNode>; which means that the document will no longer > > validate correctly against the schema specified in the subsequent > > processor. > > > > Then you will see the "No state in context" error. > > > > To see the exception thrown if xslt is used to process the exception > > processor output, comment out the <p:choose> in caller.xpl, and > > uncomment the oxf:xslt processor. > > > > Steve > > ------------------------------------------------------------------------ > > --- > > page-flow.xml (fragment) > > ========================= > > <page id="exception-example" path-info="/exception-example" > > view="/exception-error/caller.xpl"/> > > ------------------------------------------------------------------------ > > --- > > caller.xpl > > ========================= > > <!-- caller.xpl > > --> > > <p:config > > xmlns:p="http://www.orbeon.com/oxf/pipeline" > > xmlns:oxf="http://www.orbeon.com/oxf/processors" > > > > > <p:param type="output" name="data"/> > > > > <!-- call the pipeline --> > > <p:processor name="oxf:pipeline"> > > <p:input name="config" href="exception-example.xpl"/> > > <p:output name="data" id="catch-me"/> > > </p:processor> > > > > <!-- catch any exceptions --> > > <p:processor name="oxf:exception-catcher"> > > <p:input name="data" href="#catch-me"/> > > <p:output name="data" id="caught"/> > > </p:processor> > > > > <!-- look at root note to determine if there was an exception > > if there was, return some error text, if not, just pass > > thru --> > > <p:choose href="#caught"> > > <p:when test="/exceptions"> > > <p:processor name="oxf:identity"> > > <p:input name="data"> > > <rootNode> > > <childNode>There was an error</childNode> > > </rootNode> > > </p:input> > > <p:output name="data" id="output"/> > > </p:processor> > > </p:when> > > <p:otherwise> > > <p:processor name="oxf:identity"> > > <p:input name="data" href="#caught"/> > > <p:output name="data" id="output"/> > > </p:processor> > > </p:otherwise> > > </p:choose> > > > > <!-- alternative to above: use xslt instead --> > > <!-- uncomment this, and comment out the p:choose instead --> > > <!-- > > <p:processor name="oxf:xslt"> > > <p:input name="data" href="#caught"/> > > <p:input name="config"> > > <xsl:stylesheet version="2.0" > > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns=""> > > <xsl:template match="/"> > > <xsl:choose> > > <xsl:when test="/exceptions"> > > <rootNode> > > <childNode>There was an > > error</childNode> > > </rootNode> > > </xsl:when> > > <xsl:otherwise> > > <xsl:copy-of select="/"/> > > </xsl:otherwise> > > </xsl:choose> > > </xsl:template> > > </xsl:stylesheet> > > </p:input> > > <p:output name="data" id="output"/> > > </p:processor> > > --> > > > > <!-- pass the output back --> > > <p:processor name="oxf:identity"> > > <p:input name="data" href="#output"/> > > <p:output name="data" ref="data"/> > > </p:processor> > > > > </p:config> > > ------------------------------------------------------------------------ > > --- > > exception-example.xpl > > ========================= > > <!-- exception-example.xpl > > --> > > <p:config > > xmlns:p="http://www.orbeon.com/oxf/pipeline" > > xmlns:oxf="http://www.orbeon.com/oxf/processors" > > > > > <p:param type="output" name="data"/> > > > > <!-- dummy input document --> > > <p:processor name="oxf:identity"> > > <p:input name="data"> > > <rootNode> > > <childNode>sometext</childNode> > > </rootNode> > > </p:input> > > <p:output name="data" id="input-doc"/> > > </p:processor> > > > > <!-- dummy transform, note input is validated --> > > <p:processor name="oxf:xslt"> > > <p:input name="data" href="#input-doc" > > schema-href="/exception-error/schema.rng"/> > > <p:input name="config"> > > <xsl:stylesheet version="2.0" > > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns=""> > > <xsl:template match="/"> > > <xsl:copy-of select="/"/> > > </xsl:template> > > </xsl:stylesheet> > > </p:input> > > <p:output name="data" ref="data"/> > > </p:processor> > > > > </p:config> > > ------------------------------------------------------------------------ > > --- > > schema.rng > > ========================= > > <grammar xmlns="http://relaxng.org/ns/structure/1.0"> > > <start> > > <element name="rootNode"> > > <element name="childNode"><text/></element> > > </element> > > </start> > > </grammar> > > ------------------------------------------------------------------------ > > --- > > > > -----Original Message----- > > From: [hidden email] [mailto:[hidden email]] On Behalf Of > > Alessandro Vernet > > Sent: 01 December 2005 23:37 > > To: [hidden email] > > Subject: Re: [ops-users] Handling ResourceNotFound or other exceptions > > non-fatally? > > > > Stephen, > > > > We would need more information to help you on this. What is the other > > exception you are getting? > > > > Alex > > > > On 11/29/05, Stephen Bayliss <[hidden email]> wrote: > > > I had a go at using this, and it's useful. > > > > > > However, I can't seem to test the output of the oxf:exception-catcher > > > with a <p:choose>...<p:when> construct, I get another exception... > > > > > > I'd be interested to hear how others have implemented this. > > > > > > -----Original Message----- > > > From: Erik Bruchez [mailto:[hidden email]] On Behalf Of Erik > > Bruchez > > > Sent: 01 November 2005 23:34 > > > To: [hidden email] > > > Subject: Re: [ops-users] Handling ResourceNotFound or other exceptions > > > non-fatally? > > > > > > Ryan, > > > > > > There is currently no documentation about this, because we feel > > > exception handling in XPL is the way to go. > > > > > > You use this processor as shown below: just hook its "data" input to > > the > > > > > > output that can cause an exception when reading it, and its "data" > > > output will either contain the document read, or an exception document > > > in the format returned by the exception generator (which you can look > > at > > > > > > just by producing an exception). > > > > > > -Erik > > > > > > Ryan Puddephatt wrote: > > > > Erik, > > > > Is there any documentation on this exception catcher? How would > > it > > > be > > > > implemented into a pipeline? > > > > > > > > Thanks > > > > Ryan > > > > > > > > Erik Bruchez wrote: > > > > > > > >> Jeff Jones wrote: > > > >> > > > >>> I'm trying to use the XPath doc() function to request a snippet of > > > >>> XHTML from an external resource (via HTTP) and insert it into an > > > >>> XHTML page I'm generating with OPS 3.0. I can't guarantee, though, > > > >>> that that HTTP request will always succeed. When it fails, I don't > > > >>> want to give up on the page; I just want to ignore the error and > > > >>> deliver the document without the include. How can I do this with > > > OPS? > > > >> > > > >> > > > >> > > > >> Ideally, I think, with exception handling in XPL. Currently, there > > is > > > > > > >> none, but there is a possibility that this will be implemented in > > the > > > > > > >> future. As a temporary hack, you can use the oxf:exception-catcher > > > >> processor: > > > >> > > > >> <p:processor name="oxf:exception-catcher"> > > > >> <p:input name="data" href="#the-output-of-the-stylesheet"/> > > > >> <p:output name="data" id="ouput-or-exception-document"/> > > > >> </p:processor> > > > >> > > > >>> I can write a separate pipeline to make the request if necessary, > > or > > > > > > >>> use XInclude if its error handling is more flexible; I'm not > > wedded > > > >>> to doc(). My first thought was to test with doc-available(), but > > > even > > > >>> if it would work, I see in the Saxon docs that it wasn't > > implemented > > > > > > >>> until 8.4. Do I have any other options? > > > >> > > > >> > > > >> > > > >> The XInclude processor does not yet implement xi:fallback, but it > > > >> should. When it does, you will be able to use that as an exception > > > >> mechanism to retrieve HTTP resources, although you won't have any > > > >> detail of exactly what went wrong. > > > >> > > > >> -Erik > > > >> > > > >> > > > > > ------------------------------------------------------------------------ > > > >> > > > >> > > > >> -- > > > >> You receive this message as a subscriber of the > > > >> [hidden email] mailing list. > > > >> To unsubscribe: mailto:[hidden email] > > > >> For general help: mailto:[hidden email]?subject=help > > > >> ObjectWeb mailing lists service home page: > > > http://www.objectweb.org/wws > > > >> > > > >> > > > > > > > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > > > > > > > -- > > > > You receive this message as a subscriber of the > > > [hidden email] mailing list. > > > > To unsubscribe: mailto:[hidden email] > > > > For general help: mailto:[hidden email]?subject=help > > > > ObjectWeb mailing lists service home page: > > > http://www.objectweb.org/wws > > > > > > > > > > > > > > > > > > > > > > > > -- > > > You receive this message as a subscriber of the > > [hidden email] mailing list. > > > To unsubscribe: mailto:[hidden email] > > > For general help: mailto:[hidden email]?subject=help > > > ObjectWeb mailing lists service home page: > > http://www.objectweb.org/wws > > > > > > > > > > > > > > > -- > > Blog (XML, Web apps, Open Source): http://www.orbeon.com/blog/ > > > > > > > > > > > > -- > > You receive this message as a subscriber of the [hidden email] mailing list. > > To unsubscribe: mailto:[hidden email] > > For general help: mailto:[hidden email]?subject=help > > ObjectWeb mailing lists service home page: http://www.objectweb.org/wws > > > > > > > > > > > -- > Blog (XML, Web apps, Open Source): http://www.orbeon.com/blog/ > -- Blog (XML, Web apps, Open Source): http://www.orbeon.com/blog/ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
In reply to this post by Stephen Bayliss
Excellent news Alex, Thanks!
Maybe you should put a Paypal link on the site for a beer fund as an alternative to sponsoring new features? ;o) Steve -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Alessandro Vernet Sent: 10 December 2005 03:46 To: [hidden email] Subject: Re: [ops-users] Handling ResourceNotFound or other exceptions non-fatally? Alright! This is fixed, woohoo! We have not found a bug in the pipeline code, and consequently not modified that code for while. So I was not very optimistic about this one. For that reason I decided to first go for a Hefeweizen, which I think should deserve more credit than me for fixing this bug :). Have a good weekend everyone, Alex On 12/9/05, Alessandro Vernet <[hidden email]> wrote: > Hi Stephen, > > Sorry for the delay - I finally got to this and managed to reproduce > the problem. It looks like we have investigated a similar problem a > long time ago as I see some tracing code in the section of the source > where this problem happens. This was added back in early 2004. I have > created an entry for this in the bug base and we'll see what we can > do. > > > > Alex > > On 12/6/05, Stephen Bayliss <[hidden email]> wrote: > > Hi Alex > > > > Trying to produce an example of this has actually narrowed down the > > circumstances in which I experienced the problem. > > > > The exception I get is > > org.orbeon.oxf.common.OXFException - No state in context. > > > > It only occurs when the exception catcher is catching exceptions > > oxf:pipeline call. Furthermore, if no exception was thrown in the > > called pipeline everything works fine (ie no secondary exception is > > thrown). > > > > If instead of using a <p:choose> construct, I use xslt to pick up > > error, then I get > > org.orbeon.oxf.common.ValidationException - Current processor should be > > on top of the stack > > However, in this case if I http-serialize the results (instead of > > passing to the data output) and call the pipeline as a model (instead of > > as a view), then this exception is not seen, and data is successfully > > serialized (though it appears that the exception is still thrown, > > looking at the logs). > > > > I attach my example files (apart from page flow, see below); they are > > also pasted below. > > > > As pasted below, no exception is thrown, data is returned and displayed. > > > > To force an exception, modify the input document produced by the > > oxf:identity processor in exception-example.xpl, eg change the name of > > the node <childNode>; which means that the document will no longer > > validate correctly against the schema specified in the subsequent > > processor. > > > > Then you will see the "No state in context" error. > > > > To see the exception thrown if xslt is used to process the exception > > processor output, comment out the <p:choose> in caller.xpl, and > > uncomment the oxf:xslt processor. > > > > Steve > > > > --- > > page-flow.xml (fragment) > > ========================= > > <page id="exception-example" path-info="/exception-example" > > view="/exception-error/caller.xpl"/> > > > > --- > > caller.xpl > > ========================= > > <!-- caller.xpl > > --> > > <p:config > > xmlns:p="http://www.orbeon.com/oxf/pipeline" > > xmlns:oxf="http://www.orbeon.com/oxf/processors" > > > > > <p:param type="output" name="data"/> > > > > <!-- call the pipeline --> > > <p:processor name="oxf:pipeline"> > > <p:input name="config" href="exception-example.xpl"/> > > <p:output name="data" id="catch-me"/> > > </p:processor> > > > > <!-- catch any exceptions --> > > <p:processor name="oxf:exception-catcher"> > > <p:input name="data" href="#catch-me"/> > > <p:output name="data" id="caught"/> > > </p:processor> > > > > <!-- look at root note to determine if there was an > > if there was, return some error text, if not, just > > thru --> > > <p:choose href="#caught"> > > <p:when test="/exceptions"> > > <p:processor name="oxf:identity"> > > <p:input name="data"> > > <rootNode> > > <childNode>There was an error</childNode> > > </rootNode> > > </p:input> > > <p:output name="data" id="output"/> > > </p:processor> > > </p:when> > > <p:otherwise> > > <p:processor name="oxf:identity"> > > <p:input name="data" href="#caught"/> > > <p:output name="data" id="output"/> > > </p:processor> > > </p:otherwise> > > </p:choose> > > > > <!-- alternative to above: use xslt instead --> > > <!-- uncomment this, and comment out the p:choose instead > > <!-- > > <p:processor name="oxf:xslt"> > > <p:input name="data" href="#caught"/> > > <p:input name="config"> > > <xsl:stylesheet version="2.0" > > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns=""> > > <xsl:template match="/"> > > <xsl:choose> > > <xsl:when test="/exceptions"> > > <rootNode> > > <childNode>There was an > > error</childNode> > > </rootNode> > > </xsl:when> > > <xsl:otherwise> > > <xsl:copy-of select="/"/> > > </xsl:otherwise> > > </xsl:choose> > > </xsl:template> > > </xsl:stylesheet> > > </p:input> > > <p:output name="data" id="output"/> > > </p:processor> > > --> > > > > <!-- pass the output back --> > > <p:processor name="oxf:identity"> > > <p:input name="data" href="#output"/> > > <p:output name="data" ref="data"/> > > </p:processor> > > > > </p:config> > > > > --- > > exception-example.xpl > > ========================= > > <!-- exception-example.xpl > > --> > > <p:config > > xmlns:p="http://www.orbeon.com/oxf/pipeline" > > xmlns:oxf="http://www.orbeon.com/oxf/processors" > > > > > <p:param type="output" name="data"/> > > > > <!-- dummy input document --> > > <p:processor name="oxf:identity"> > > <p:input name="data"> > > <rootNode> > > <childNode>sometext</childNode> > > </rootNode> > > </p:input> > > <p:output name="data" id="input-doc"/> > > </p:processor> > > > > <!-- dummy transform, note input is validated --> > > <p:processor name="oxf:xslt"> > > <p:input name="data" href="#input-doc" > > schema-href="/exception-error/schema.rng"/> > > <p:input name="config"> > > <xsl:stylesheet version="2.0" > > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns=""> > > <xsl:template match="/"> > > <xsl:copy-of select="/"/> > > </xsl:template> > > </xsl:stylesheet> > > </p:input> > > <p:output name="data" ref="data"/> > > </p:processor> > > > > </p:config> > > > > --- > > schema.rng > > ========================= > > <grammar xmlns="http://relaxng.org/ns/structure/1.0"> > > <start> > > <element name="rootNode"> > > <element name="childNode"><text/></element> > > </element> > > </start> > > </grammar> > > > > --- > > > > -----Original Message----- > > From: [hidden email] [mailto:[hidden email]] On Behalf Of > > Alessandro Vernet > > Sent: 01 December 2005 23:37 > > To: [hidden email] > > Subject: Re: [ops-users] Handling ResourceNotFound or other > > non-fatally? > > > > Stephen, > > > > We would need more information to help you on this. What is the other > > exception you are getting? > > > > Alex > > > > On 11/29/05, Stephen Bayliss <[hidden email]> wrote: > > > I had a go at using this, and it's useful. > > > > > > However, I can't seem to test the output of the oxf:exception-catcher > > > with a <p:choose>...<p:when> construct, I get another exception... > > > > > > I'd be interested to hear how others have implemented this. > > > > > > -----Original Message----- > > > From: Erik Bruchez [mailto:[hidden email]] On Behalf Of Erik > > Bruchez > > > Sent: 01 November 2005 23:34 > > > To: [hidden email] > > > Subject: Re: [ops-users] Handling ResourceNotFound or other > > > non-fatally? > > > > > > Ryan, > > > > > > There is currently no documentation about this, because we feel > > > exception handling in XPL is the way to go. > > > > > > You use this processor as shown below: just hook its "data" input > > the > > > > > > output that can cause an exception when reading it, and its "data" > > > output will either contain the document read, or an exception document > > > in the format returned by the exception generator (which you can look > > at > > > > > > just by producing an exception). > > > > > > -Erik > > > > > > Ryan Puddephatt wrote: > > > > Erik, > > > > Is there any documentation on this exception catcher? How would > > it > > > be > > > > implemented into a pipeline? > > > > > > > > Thanks > > > > Ryan > > > > > > > > Erik Bruchez wrote: > > > > > > > >> Jeff Jones wrote: > > > >> > > > >>> I'm trying to use the XPath doc() function to request a > > > >>> XHTML from an external resource (via HTTP) and insert it into > > > >>> XHTML page I'm generating with OPS 3.0. I can't guarantee, though, > > > >>> that that HTTP request will always succeed. When it fails, I don't > > > >>> want to give up on the page; I just want to ignore the error and > > > >>> deliver the document without the include. How can I do this with > > > OPS? > > > >> > > > >> > > > >> > > > >> Ideally, I think, with exception handling in XPL. Currently, there > > is > > > > > > >> none, but there is a possibility that this will be implemented in > > the > > > > > > >> future. As a temporary hack, you can use the oxf:exception-catcher > > > >> processor: > > > >> > > > >> <p:processor name="oxf:exception-catcher"> > > > >> <p:input name="data" href="#the-output-of-the-stylesheet"/> > > > >> <p:output name="data" id="ouput-or-exception-document"/> > > > >> </p:processor> > > > >> > > > >>> I can write a separate pipeline to make the request if necessary, > > or > > > > > > >>> use XInclude if its error handling is more flexible; I'm not > > wedded > > > >>> to doc(). My first thought was to test with doc-available(), but > > > even > > > >>> if it would work, I see in the Saxon docs that it wasn't > > implemented > > > > > > >>> until 8.4. Do I have any other options? > > > >> > > > >> > > > >> > > > >> The XInclude processor does not yet implement xi:fallback, but it > > > >> should. When it does, you will be able to use that as an exception > > > >> mechanism to retrieve HTTP resources, although you won't have any > > > >> detail of exactly what went wrong. > > > >> > > > >> -Erik > > > >> > > > >> > > > > > ------------------------------------------------------------------------ > > > >> > > > >> > > > >> -- > > > >> You receive this message as a subscriber of the > > > >> [hidden email] mailing list. > > > >> To unsubscribe: mailto:[hidden email] > > > >> For general help: mailto:[hidden email]?subject=help > > > >> ObjectWeb mailing lists service home page: > > > http://www.objectweb.org/wws > > > >> > > > >> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > You receive this message as a subscriber of the > > > [hidden email] mailing list. > > > > To unsubscribe: mailto:[hidden email] > > > > For general help: mailto:[hidden email]?subject=help > > > > ObjectWeb mailing lists service home page: > > > http://www.objectweb.org/wws > > > > > > > > > > > > > > > > > > > > > > > > -- > > > You receive this message as a subscriber of the > > [hidden email] mailing list. > > > To unsubscribe: mailto:[hidden email] > > > For general help: mailto:[hidden email]?subject=help > > > ObjectWeb mailing lists service home page: > > http://www.objectweb.org/wws > > > > > > > > > > > > > > > -- > > Blog (XML, Web apps, Open Source): http://www.orbeon.com/blog/ > > > > > > > > > > > > -- > > You receive this message as a subscriber of the > > To unsubscribe: mailto:[hidden email] > > For general help: mailto:[hidden email]?subject=help > > ObjectWeb mailing lists service home page: > > > > > > > > > > > -- > Blog (XML, Web apps, Open Source): http://www.orbeon.com/blog/ > -- Blog (XML, Web apps, Open Source): http://www.orbeon.com/blog/ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Free forum by Nabble | Edit this page |