camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Willem Jiang (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (CAMEL-6416) ScriptBuilder Some scripting are exception lost
Date Mon, 03 Jun 2013 08:44:20 GMT

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

Willem Jiang resolved CAMEL-6416.
---------------------------------

       Resolution: Fixed
    Fix Version/s: 2.12.0
                   2.11.1
                   2.10.5

Applied the patch into master, camel-2.11.x and camel-2.10.x branches with thanks to Fabien.
                
> ScriptBuilder Some scripting are exception lost 
> ------------------------------------------------
>
>                 Key: CAMEL-6416
>                 URL: https://issues.apache.org/jira/browse/CAMEL-6416
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-script
>    Affects Versions: 2.10.4
>            Reporter: Fabien KOCIK
>            Assignee: Willem Jiang
>            Priority: Minor
>             Fix For: 2.10.5, 2.11.1, 2.12.0
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> Hello, 
> A little bug in *ScriptBuilder* class cause some script errors to be lost and replaced
by a *NullPointerException* : 
> {code:title=Encountered Exception}
> Caused by: java.lang.NullPointerException
> 	at org.apache.camel.builder.script.ScriptBuilder.createScriptEvaluationException(ScriptBuilder.java:418)
> 	at org.apache.camel.builder.script.ScriptBuilder.evaluateScript(ScriptBuilder.java:348)
> 	at org.apache.camel.builder.script.ScriptBuilder.evaluate(ScriptBuilder.java:92)
> 	at org.apache.camel.builder.script.ScriptBuilder.evaluate(ScriptBuilder.java:96)
> {code}
> The problem occurs in *evaluateScript* method (line 336 to 352) :
> {code:title=ScriptBuilder.evaluateScript}
>     protected synchronized Object evaluateScript(Exchange exchange) {
>         try {
>             getScriptContext();
>             populateBindings(getEngine(), exchange);
>             addScriptEngineArguments(getEngine(), exchange);
>             Object result = runScript(exchange);
>             LOG.debug("The script evaluation result is: {}", result);
>             return result;
>         } catch (ScriptException e) {
>             if (LOG.isDebugEnabled()) {
>                 LOG.debug("Script evaluation failed: " + e.getMessage(), e);
>             }
>             throw createScriptEvaluationException(e.getCause());
>         } catch (IOException e) {
>             throw createScriptEvaluationException(e);
>         }
>     }
> {code}
> We can see the following line (348) : 
> {{throw createScriptEvaluationException(e.getCause());}}
> In some cases, the exception cause is null and the error message become very unclear.
> A simple workaround would be to write something like this :
> {code:}
> if (e.getCause() == null) {
>     throw createScriptEvaluationException(e);
> } else {
>     throw createScriptEvaluationException(e.getCause());
> }
> {code}
> I don't have some GIT software, so I could not provide a patch, sorry for that ;-)
> Regards

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message