[ https://issues.apache.org/jira/browse/SLING-1702?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12904018#action_12904018 ]
Mike Müller edited comment on SLING-1702 at 8/29/10 3:25 PM: ------------------------------------------------------------- If we want to implement a workaround for this vm implementation specific problem, we should find a way to do this in AbstractScriptEngineFactory because it affects all implementations of ScriptEngineFactory. was (Author: mykee): If we want to implement a workaround this vm implementation specific problem, we should find a way to do this in AbstractScriptEngineFactory because it affects all implementations of ScriptEngineFactory. > contrib/scripting/velocity VelocityTemplatesScriptEngineFactory needs > workaround in case of engine instantiation errors > ----------------------------------------------------------------------------------------------------------------------- > > Key: SLING-1702 > URL: https://issues.apache.org/jira/browse/SLING-1702 > Project: Sling > Issue Type: Improvement > Components: Scripting > Environment: Felix 1.4, Sling 2.0.7, Apache Velocity 1.6.2 > Reporter: Olaf Otto > Original Estimate: 0.5h > Remaining Estimate: 0.5h > > Affects: Rev. 989119 of > https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/velocity > (2.0.0-SNAPSHOT) > The (terrible!) Sun implementation of javax.script.ScriptEngineManager > silently discards all exceptions thrown when a scripting factory creates an > engine: > ... > private static final boolean DEBUG = false; > ... > } catch (Exception exp) { > if (DEBUG) exp.printStackTrace(); > } > This hides any error with the velocity configuration from the user. Thus the > VelocityTemplatesScriptEngineFactory should provide a log-and-re-throw > workaround, like so: > ... > import org.slf4j.Logger; > import org.slf4j.LoggerFactory; > ... > private final Logger logger = LoggerFactory.getLogger(getClass()); > public ScriptEngine getScriptEngine() { > ScriptEngine engine; > try { > engine = new VelocityTemplatesScriptEngine(this); > } catch (RuntimeException e) { > logger.error("Unable to instantiate the velocity > template engine.", e); > throw e; > } > return engine; > } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.