Author: kkolinko
Date: Tue Apr  9 16:54:44 2013
New Revision: 1466122

URL: http://svn.apache.org/r1466122
Log:
Merged r1464781 r1466106 from tomcat/trunk:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=54802
Provide location information for exceptions thrown by JspDocumentParser

Modified:
    tomcat/tc7.0.x/trunk/   (props changed)
    tomcat/tc7.0.x/trunk/java/org/apache/jasper/compiler/ErrorDispatcher.java
    tomcat/tc7.0.x/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java
    
tomcat/tc7.0.x/trunk/java/org/apache/jasper/resources/LocalStrings.properties
    tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml

Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
  Merged /tomcat/trunk:r1464781,1466106

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/jasper/compiler/ErrorDispatcher.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/jasper/compiler/ErrorDispatcher.java?rev=1466122&r1=1466121&r2=1466122&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/jasper/compiler/ErrorDispatcher.java 
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/jasper/compiler/ErrorDispatcher.java 
Tue Apr  9 16:54:44 2013
@@ -298,6 +298,23 @@ public class ErrorDispatcher {
      * resource bundle for localized error messages, it is used as the error
      * message.
      *
+     * @param where Error location
+     * @param errCode Error code
+     * @param args Arguments for parametric replacement
+     * @param e Parsing exception
+     */
+    public void jspError(Mark where, Exception e, String errCode, String... 
args)
+                throws JasperException {
+        dispatch(where, errCode, args, e);
+    }
+
+    /*
+     * Dispatches the given JSP parse error to the configured error handler.
+     *
+     * The given error code is localized. If it is not found in the
+     * resource bundle for localized error messages, it is used as the error
+     * message.
+     *
      * @param n Node that caused the error
      * @param errCode Error code
      * @param arg Argument for parametric replacement

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java?rev=1466122&r1=1466121&r2=1466122&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java 
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java 
Tue Apr  9 16:54:44 2013
@@ -207,9 +207,9 @@ class JspDocumentParser
             jspDocParser.err.jspError
                 (new Mark(jspDocParser.ctxt, path, e.getLineNumber(),
                           e.getColumnNumber()),
-                 e.getMessage());
+                e, e.getMessage());
         } catch (Exception e) {
-            jspDocParser.err.jspError(e);
+            jspDocParser.err.jspError(e, "jsp.error.data.file.processing", 
path);
         }
 
         return pageNodes;
@@ -1185,8 +1185,9 @@ class JspDocumentParser
         TagInfo tagInfo = tagLibInfo.getTag(localName);
         TagFileInfo tagFileInfo = tagLibInfo.getTagFile(localName);
         if (tagInfo == null && tagFileInfo == null) {
-            throw new SAXException(
-                Localizer.getMessage("jsp.error.xml.bad_tag", localName, uri));
+            throw new SAXParseException(
+                Localizer.getMessage("jsp.error.xml.bad_tag", localName, uri),
+                locator);
         }
         Class<?> tagHandlerClass = null;
         if (tagInfo != null) {
@@ -1195,11 +1196,11 @@ class JspDocumentParser
                 tagHandlerClass =
                     ctxt.getClassLoader().loadClass(handlerClassName);
             } catch (Exception e) {
-                throw new SAXException(
+                throw new SAXParseException(
                     Localizer.getMessage("jsp.error.loadclass.taghandler",
                                          handlerClassName,
                                          qName),
-                    e);
+                    locator, e);
             }
         }
 
@@ -1330,7 +1331,7 @@ class JspDocumentParser
                         Localizer.getMessage(
                             "jsp.error.parse.xml.scripting.invalid.body",
                             elemType);
-                    throw new SAXException(msg);
+                    throw new SAXParseException(msg, locator);
                 }
             }
         }
@@ -1358,7 +1359,7 @@ class JspDocumentParser
                 locator,
                 fnfe);
         } catch (Exception e) {
-            throw new SAXException(e);
+            throw new SAXParseException(e.getMessage(), locator, e);
         }
     }
 

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/jasper/resources/LocalStrings.properties
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/jasper/resources/LocalStrings.properties?rev=1466122&r1=1466121&r2=1466122&view=diff
==============================================================================
--- 
tomcat/tc7.0.x/trunk/java/org/apache/jasper/resources/LocalStrings.properties 
(original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/jasper/resources/LocalStrings.properties 
Tue Apr  9 16:54:44 2013
@@ -449,6 +449,7 @@ jsp.error.function.classnotfound=The cla
 jsp.error.signature.classnotfound=The class {0} specified in the method 
signature in TLD for the function {1} cannot be found. {2}
 jsp.error.text.has_subelement=&lt;jsp:text&gt; must not have any subelements
 jsp.error.data.file.read=Error reading file \"{0}\"
+jsp.error.data.file.processing=Error processing file \"{0}\"
 jsp.error.prefix.refined=Attempt to redefine the prefix {0} to {1}, when it 
was already defined as {2} in the current scope.
 jsp.error.nested_jsproot=Nested &lt;jsp:root&gt;
 jsp.error.unbalanced.endtag=The end tag \"&lt;/{0}\" is unbalanced

Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1466122&r1=1466121&r2=1466122&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Tue Apr  9 16:54:44 2013
@@ -64,6 +64,14 @@
       </update>
     </changelog>
   </subsection>
+  <subsection name="Jasper">
+    <changelog>
+      <fix>
+        <bug>54802</bug>: Provide location information for exceptions thrown
+        by JspDocumentParser. (kkolinko)
+      </fix>
+    </changelog>
+  </subsection>
   <subsection name="jdbc-pool">
     <changelog>
       <update>



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to