jakarta-bsf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brett Randall (JIRA)" <j...@apache.org>
Subject [jira] Created: (BSF-29) ScriptException constructed via chained constructor ScriptException(Exception) always returns null for getMessage()
Date Sun, 10 Jan 2010 10:07:56 GMT
ScriptException constructed via chained constructor ScriptException(Exception) always returns
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 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 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-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bsf-dev-help@jakarta.apache.org


Mime
View raw message