Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=49665
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 28 Sep 2010 17:23:05 +0000 (17:23 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 28 Sep 2010 17:23:05 +0000 (17:23 +0000)
Better handling for missing TLD files. Report JSP filename and location.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1002274 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/jasper/compiler/Generator.java
java/org/apache/jasper/compiler/JspDocumentParser.java
java/org/apache/jasper/compiler/Parser.java
java/org/apache/jasper/compiler/TagLibraryInfoImpl.java
webapps/docs/changelog.xml

index 8b25f5e..8e0ac84 100644 (file)
@@ -1079,8 +1079,10 @@ class Generator {
                         + property
                         + "\")));");
             } else {
-                StringBuilder msg =
-                    new StringBuilder("jsp:getProperty for bean with name '");
+                StringBuilder msg = new StringBuilder();
+                msg.append("file:");
+                msg.append(n.getStart());
+                msg.append(" jsp:getProperty for bean with name '");
                 msg.append(name);
                 msg.append(
                         "'. Name was not previously introduced as per JSP.5.3");
index 6b88cf7..9faa07e 100644 (file)
@@ -1290,7 +1290,8 @@ class JspDocumentParser
                             prefix,
                             uri,
                             location,
-                            err);
+                            err,
+                            null);
                     if (ctxt.getOptions().isCaching()) {
                         ctxt.getOptions().getCache().put(uri, result);
                     }
index 612fb55..fc30d33 100644 (file)
@@ -385,7 +385,8 @@ class Parser implements TagConstants {
                     if (impl == null) {
                         TldLocation location = ctxt.getTldLocation(uri);
                         impl = new TagLibraryInfoImpl(ctxt, parserController,
-                                pageInfo, prefix, uri, location, err);
+                                pageInfo, prefix, uri, location, err,
+                                reader.mark());
                         if (ctxt.getOptions().isCaching()) {
                             ctxt.getOptions().getCache().put(uri, impl);
                         }
index 20a8900..5396299 100644 (file)
@@ -134,8 +134,9 @@ class TagLibraryInfoImpl extends TagLibraryInfo implements TagConstants {
     /**
      * Constructor.
      */
-    public TagLibraryInfoImpl(JspCompilationContext ctxt, ParserController pc, PageInfo pi,
-            String prefix, String uriIn, TldLocation location, ErrorDispatcher err)
+    public TagLibraryInfoImpl(JspCompilationContext ctxt, ParserController pc,
+            PageInfo pi, String prefix, String uriIn, TldLocation location,
+            ErrorDispatcher err, Mark mark)
             throws JasperException {
         super(prefix, uriIn);
 
@@ -162,7 +163,7 @@ class TagLibraryInfoImpl extends TagLibraryInfo implements TagConstants {
                         throw new FileNotFoundException(tldName);
                     }
                 } catch (FileNotFoundException ex) {
-                    err.jspError("jsp.error.file.not.found", tldName);
+                    err.jspError(mark, "jsp.error.file.not.found", tldName);
                 }
 
                 parseTLD(tldName, in, null);
@@ -177,7 +178,7 @@ class TagLibraryInfoImpl extends TagLibraryInfo implements TagConstants {
                     in = jarResource.getEntry(tldName).openStream();
                     parseTLD(jarResource.getUrl(), in, jarResource);
                 } catch (Exception ex) {
-                    err.jspError("jsp.error.tld.unable_to_read", jarResource.getUrl(),
+                    err.jspError(mark, "jsp.error.tld.unable_to_read", jarResource.getUrl(),
                             jarResource.getUrl(), ex.toString());
                 }
             }
index 87fc75c..3133772 100644 (file)
   <subsection name="Jasper">
     <changelog>
       <fix>
+        <bug>49665</bug>: Provide better information including JSP file name and
+        location when a missing file is detected during TLD handling. Patch
+        provided by Ted Leung. (markt)
+      </fix>
+      <fix>
         <bug>49726</bug>: Specifying a default content type via a JSP property
         group should not prevent a page from setting some other content type.
         (markt)