You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jakarta.apache.org by "Sebb (JIRA)" <ji...@apache.org> on 2010/05/23 16:05:19 UTC

[jira] Updated: (BSF-29) ScriptException constructed via chained constructor ScriptException(Exception) always returns String "null" for getMessage()

     [ https://issues.apache.org/jira/browse/BSF-29?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb updated BSF-29:
--------------------

    Fix Version/s: 3.1

> ScriptException constructed via chained constructor ScriptException(Exception) always returns String "null" for getMessage()
> ----------------------------------------------------------------------------------------------------------------------------
>
>                 Key: BSF-29
>                 URL: https://issues.apache.org/jira/browse/BSF-29
>             Project: BSF
>          Issue Type: Bug
>    Affects Versions: BSF-3.0
>            Reporter: Brett Randall
>            Priority: Minor
>             Fix For: 3.1
>
>
> If a ScriptException is constructed via ScriptException(Exception e), the resulting exception always returns the String "null" for getMessage().  This is against the normal chained-exception convention of:
>      * Constructs a new throwable with the specified cause and a detail
>      * message of <tt>(cause==null ? null : cause.toString())</tt> (which
>      * typically contains the class and detail message of <tt>cause</tt>).
> (reference Javadoc for java.lang.Throwable).
> The following unit test, added to BSF ScriptExceptionTest, fails against BSF 3.0 on JDK1.4, but passes against JDK6/JSR-223:
>     public void testException5(){
>     	ScriptException ex = new ScriptException(new Exception("exception message"));
>     	try {
>     		throw ex;
>     	} catch (ScriptException e) {
>     		assertEquals("java.lang.Exception: exception message", ex.getMessage());
>     	}
>     }
> For BSF 3.0, ex.getMessage() returns String "null".
> API clients which wrap/chain detailed error messages, perhaps containing line/column and other details of the nature of the error in the script engine, will find these errors missing in the top-level exception and only accessible via getCause().

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@jakarta.apache.org
For additional commands, e-mail: notifications-help@jakarta.apache.org