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

Sebb resolved BSF-29.
---------------------

    Resolution: Fixed

Thanks for the report. The problem was that the ScriptException tried to 
maintain its own message rather than leaving it to the super-class.

URL: http://svn.apache.org/viewvc?rev=925045&view=rev
Log:
BSF-29 ScriptException constructed via chained constructor 
ScriptException(Exception) always returns String "null" for getMessage()

Modified:
   jakarta/bsf/branches/bsf3.x/RELEASE_NOTES
   
jakarta/bsf/branches/bsf3.x/bsf-api/src/main/java/javax/script/ScriptException.java
   
jakarta/bsf/branches/bsf3.x/bsf-api/src/test/java/org/apache/bsf/ScriptExceptionTest.java


> 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
>
> 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: bsf-dev-unsubscr...@jakarta.apache.org
For additional commands, e-mail: bsf-dev-h...@jakarta.apache.org

Reply via email to