commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: [SCXML] Class cast due to "bad" test data [was Re: svn commit: r732174 -etc]
Date Wed, 07 Jan 2009 15:59:38 GMT
On 07/01/2009, Rahul Akolkar <rahul.akolkar@gmail.com> wrote:
> On Wed, Jan 7, 2009 at 9:57 AM, sebb <sebbaz@gmail.com> wrote:
>  > On 07/01/2009, Rahul Akolkar <rahul.akolkar@gmail.com> wrote:
>  >> On Wed, Jan 7, 2009 at 12:36 AM, Rahul Akolkar <rahul.akolkar@gmail.com>
wrote:
>  >>  > On Tue, Jan 6, 2009 at 9:46 PM, sebb <sebbaz@gmail.com> wrote:
>  >>
>  >> <snip/>
>  >>
>  >> >>
>  >>  >> By the way, the Exception handling changes have revealed a possible
>  >>  >> bug - a class cast was being swallowed:
>  >>  >>
>  >>  >> testExample01Sample(org.apache.commons.scxml.env.javascript.JSExampleTest)
>  >>  >>  Time elapsed: 0.281 sec  <<< ERROR!
>  >>  >> java.lang.ClassCastException: java.lang.Double cannot be cast to
>  >>  >> org.w3c.dom.Node
>  >>  >>        at org.apache.commons.scxml.env.javascript.JSEvaluator.evalLocation(JSEvaluator.java:195)
>  >>  >>
>  >>  >> This was previously being converted to a SCXMLExpressionException.
>  >>  >>
>  >>  > <snap/>
>  >>  >
>  >>  > I'll take a look now -- thats the package I'm least familiar with so
>  >>  > it'll be good to go through it anyway.
>  >>  >
>  >>
>  >> <snap/>
>  >>
>  >>  Turned out to be an error in the test document, should be fixed.
>  >>
>  >
>  > I see that you have chnaged the test data, and it now passes the test.
>  >
>  > However, what if a user has such a document?
>  > Should it really generate a Class Cast Exception?
>  >
>  > It looks like the error was not being detected previously because the
>  > ClassCast was converted to SCXMLExpressionException which was being
>  > handled by the Assign class.
>  >
>  > Is that the correct behaviour for invalid data?
>  >
>  > I think at the very least the code needs to catch the Class Cast.
>  >
>
> <snip/>
>
>  I see, r731781. Its an authoring error but yes, a CCE is bogus. I
>  think the related catches in r731781 should be for a generic Exception
>  (since theoretically any Java method could be executed as part of the
>  expression evaluation).

So how can one then detect such errors?
Or maybe that is not important?

Either way, ISTM that there should be a test case for such authoring errors.

>  -Rahul
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>  For additional commands, e-mail: dev-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message