SLING-8720 HTTP Status 200 returned when JSP Engine fails due to JspFactoryHandler being null
Removed logger statement, removed extra braces from exception message, convert generic exception to RuntimeException
diff --git a/src/main/java/org/apache/sling/scripting/jsp/JspScriptEngineFactory.java b/src/main/java/org/apache/sling/scripting/jsp/JspScriptEngineFactory.java
index 4d78de8..d1a09ec 100644
--- a/src/main/java/org/apache/sling/scripting/jsp/JspScriptEngineFactory.java
+++ b/src/main/java/org/apache/sling/scripting/jsp/JspScriptEngineFactory.java
@@ -256,7 +256,7 @@
private void callErrorPageJsp(final Bindings bindings,
final SlingScriptHelper scriptHelper,
final ScriptContext context,
- final String scriptName) throws Exception {
+ final String scriptName) throws RuntimeException {
final SlingBindings slingBindings = new SlingBindings();
slingBindings.putAll(bindings);
@@ -270,10 +270,8 @@
// abort if JSP Support is shut down concurrently (SLING-2704)
if (io == null || jspfh == null) {
- logger.warn("callJsp: JSP Script Engine seems to be shut down concurrently; not calling {}",
+ throw new RuntimeException("callJsp: JSP Script Engine seems to be shut down concurrently; not calling "+
scriptHelper.getScript().getScriptResource().getPath());
- throw new Exception("callJsp: JSP Script Engine seems to be shut down concurrently; not calling {"+
- scriptHelper.getScript().getScriptResource().getPath()+"}");
}
final ResourceResolver oldResolver = io.setRequestResourceResolver(resolver);
@@ -315,7 +313,7 @@
*/
private void callJsp(final Bindings bindings,
final SlingScriptHelper scriptHelper,
- final ScriptContext context) throws Exception {
+ final ScriptContext context) throws RuntimeException {
ResourceResolver resolver = (ResourceResolver) context.getAttribute(SlingScriptConstants.ATTR_SCRIPT_RESOURCE_RESOLVER,
SlingScriptConstants.SLING_SCOPE);
@@ -326,10 +324,8 @@
final JspFactoryHandler jspfh = this.jspFactoryHandler;
// abort if JSP Support is shut down concurrently (SLING-2704)
if (io == null || jspfh == null) {
- logger.warn("callJsp: JSP Script Engine seems to be shut down concurrently; not calling {}",
+ throw new RuntimeException("callJsp: JSP Script Engine seems to be shut down concurrently; not calling "+
scriptHelper.getScript().getScriptResource().getPath());
- throw new Exception("callJsp: JSP Script Engine seems to be shut down concurrently; not calling {"+
- scriptHelper.getScript().getScriptResource().getPath()+"}");
}
final ResourceResolver oldResolver = io.setRequestResourceResolver(resolver);