[
https://issues.apache.org/jira/browse/SLING-1702?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Carsten Ziegeler resolved SLING-1702.
-------------------------------------
Resolution: Won't Fix
> 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
> Priority: Minor
> 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 was sent by Atlassian Jira
(v8.20.10#820010)