sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r614545 - in /incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp: JspScriptEngineFactory.java JspServletWrapperAdapter.java
Date Wed, 23 Jan 2008 14:29:02 GMT
Author: fmeschbe
Date: Wed Jan 23 06:28:59 2008
New Revision: 614545

URL: http://svn.apache.org/viewvc?rev=614545&view=rev
Log:
SLING-186 Fix exception handling

Modified:
    incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspScriptEngineFactory.java
    incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspServletWrapperAdapter.java

Modified: incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspScriptEngineFactory.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspScriptEngineFactory.java?rev=614545&r1=614544&r2=614545&view=diff
==============================================================================
--- incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspScriptEngineFactory.java
(original)
+++ incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspScriptEngineFactory.java
Wed Jan 23 06:28:59 2008
@@ -117,8 +117,12 @@
         return "2.1";
     }
 
-    private void callJsp(SlingScriptHelper scriptHelper) throws SlingException,
-            IOException {
+    /**
+     * @param scriptHelper
+     * @throws SlingServletException
+     * @throws SlingIOException
+     */
+    private void callJsp(SlingScriptHelper scriptHelper) {
 
         ioProvider.setRequestResourceResolver(scriptHelper.getRequest().getResourceResolver());
         try {
@@ -266,8 +270,6 @@
             if (scriptHelper != null) {
                 try {
                     callJsp(scriptHelper);
-                    // } catch (IOException ioe) {
-                    // } catch (ServletException se) {
                 } catch (Exception e) {
                     throw new ScriptException(e);
                 }

Modified: incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspServletWrapperAdapter.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspServletWrapperAdapter.java?rev=614545&r1=614544&r2=614545&view=diff
==============================================================================
--- incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspServletWrapperAdapter.java
(original)
+++ incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspServletWrapperAdapter.java
Wed Jan 23 06:28:59 2008
@@ -24,6 +24,8 @@
 
 import org.apache.sling.api.SlingException;
 import org.apache.sling.api.SlingHttpServletRequest;
+import org.apache.sling.api.SlingIOException;
+import org.apache.sling.api.SlingServletException;
 import org.apache.sling.api.scripting.SlingScriptHelper;
 import org.apache.sling.scripting.jsp.jasper.Constants;
 import org.apache.sling.scripting.jsp.jasper.JasperException;
@@ -42,19 +44,24 @@
         super(config, options, jspUri, isErrorPage, rctxt);
     }
 
-    public void service(SlingScriptHelper scriptHelper) throws IOException,
-            SlingException {
+    /**
+     * @param scriptHelper
+     * @throws SlingIOException
+     * @throws SlingServletException
+     * @throws IllegalArgumentException if the Jasper Precompile controller
+     *             request parameter has an illegal value.
+     */
+    public void service(SlingScriptHelper scriptHelper) {
         try {
             SlingHttpServletRequest request = scriptHelper.getRequest();
             service(request, scriptHelper.getResponse(), preCompile(request));
         } catch (SlingException se) {
             // rethrow as is
             throw se;
+        } catch (IOException ioe) {
+            throw new SlingIOException(ioe);
         } catch (ServletException se) {
-            if (se.getRootCause() != null) {
-                throw new SlingException(se.getMessage(), se.getRootCause());
-            }
-            throw new SlingException(se);
+            throw new SlingServletException(se);
         }
     }
 
@@ -66,12 +73,12 @@
      * trigger parsing all of the request parameters, and not give a servlet the
      * opportunity to call <code>request.setCharacterEncoding()</code> first.
      * </p>
-     *
+     * 
      * @param request The servlet requset we are processing
-     * @exception ServletException if an invalid parameter value for the
-     *                <code>jsp_precompile</code> parameter name is specified
+     * @throws IllegalArgumentException if an invalid parameter value for the
+     *             <code>jsp_precompile</code> parameter name is specified
      */
-    boolean preCompile(HttpServletRequest request) throws SlingException {
+    boolean preCompile(HttpServletRequest request) {
 
         // assume it is ok to access the parameters here, as we are not a
         // toplevel servlet
@@ -99,7 +106,7 @@
         }
 
         // unexpected value, fail
-        throw new SlingException("Cannot have request parameter "
+        throw new IllegalArgumentException("Cannot have request parameter "
             + Constants.PRECOMPILE + " set to " + jspPrecompile);
     }
 }



Mime
View raw message