tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r792456 - in /tomcat: container/tc5.5.x/webapps/docs/changelog.xml jasper/tc5.5.x/src/share/org/apache/jasper/compiler/Generator.java jasper/tc5.5.x/src/share/org/apache/jasper/compiler/PageInfo.java
Date Thu, 09 Jul 2009 08:56:05 GMT
Author: markt
Date: Thu Jul  9 08:56:04 2009
New Revision: 792456

URL: http://svn.apache.org/viewvc?rev=792456&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=38797
Reverts previous fix for https://issues.apache.org/bugzilla/show_bug.cgi?id=37933 and implements
an alternative that doesn't have the side effects described in 38797

Modified:
    tomcat/container/tc5.5.x/webapps/docs/changelog.xml
    tomcat/jasper/tc5.5.x/src/share/org/apache/jasper/compiler/Generator.java
    tomcat/jasper/tc5.5.x/src/share/org/apache/jasper/compiler/PageInfo.java

Modified: tomcat/container/tc5.5.x/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/webapps/docs/changelog.xml?rev=792456&r1=792455&r2=792456&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/webapps/docs/changelog.xml (original)
+++ tomcat/container/tc5.5.x/webapps/docs/changelog.xml Thu Jul  9 08:56:04 2009
@@ -231,6 +231,11 @@
         security manager as required by the specification. (markt) 
       </fix>
       <fix>
+        <bug>38797</bug>: Revert previous fix for <bug>37933</bug>
and implement
+        a new fix that does not have the side effects described in
+        <bug>38797</bug>.  
+      </fix>
+      <fix>
         <bug>38897</bug>: Add uri of broken TLD to error message to aid
         debugging. (markt)
       </fix>

Modified: tomcat/jasper/tc5.5.x/src/share/org/apache/jasper/compiler/Generator.java
URL: http://svn.apache.org/viewvc/tomcat/jasper/tc5.5.x/src/share/org/apache/jasper/compiler/Generator.java?rev=792456&r1=792455&r2=792456&view=diff
==============================================================================
--- tomcat/jasper/tc5.5.x/src/share/org/apache/jasper/compiler/Generator.java (original)
+++ tomcat/jasper/tc5.5.x/src/share/org/apache/jasper/compiler/Generator.java Thu Jul  9 08:56:04
2009
@@ -31,6 +31,7 @@
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Set;
 import java.util.Vector;
 
 import javax.servlet.jsp.tagext.TagAttributeInfo;
@@ -70,6 +71,7 @@
     private FragmentHelperClass fragmentHelperClass;
     private ErrorDispatcher err;
     private BeanRepository beanInfo;
+    private Set varInfoNames;
     private JspCompilationContext ctxt;
     private boolean isPoolingEnabled;
     private boolean breakAtLF;
@@ -1028,18 +1030,26 @@
                         + "\"))."
                         + methodName
                         + "())));");
-            } else {
-                // The object could be a custom action with an associated
+            } else if (varInfoNames.contains(name)){
+                // The object is a custom action with an associated
                 // VariableInfo entry for this name.
                 // Get the class name and then introspect at runtime.
                 out.printil(
                     "out.write(org.apache.jasper.runtime.JspRuntimeLibrary.toString"
                         + "(org.apache.jasper.runtime.JspRuntimeLibrary.handleGetProperty"
-                        + "(_jspx_page_context.getAttribute(\""
+                        + "(_jspx_page_context.findAttribute(\""
                         + name
-                        + "\", PageContext.PAGE_SCOPE), \""
+                        + "\"), \""
                         + property
                         + "\")));");
+            } else {
+                StringBuffer msg =
+                    new StringBuffer("jsp:getProperty for bean with name '");
+                msg.append(name);
+                msg.append(
+                        "'. Name was not previously introduced as per JSP.5.3");
+
+                throw new JasperException(msg.toString());
             }
 
             n.setEndJavaLine(out.getJavaLine());
@@ -1737,6 +1747,17 @@
                 // restore previous writer
                 out = outSave;
             }
+
+            // Add the named objects to the lits of 'introduced' names to enable
+            // a later test as per JSP.5.3
+            VariableInfo[] infos = n.getVariableInfos();
+            if (infos != null && infos.length > 0) {
+                for (int i = 0; i < infos.length; i++) {
+                    VariableInfo info = infos[i];
+                    if (info != null && info.getVarName() != null)
+                        pageInfo.getVarInfoNames().add(info.getVarName());
+                }
+            }
         }
 
         private static final String SINGLE_QUOTE = "'";
@@ -3255,6 +3276,7 @@
             isPoolingEnabled = false;
         }
         beanInfo = pageInfo.getBeanRepository();
+        varInfoNames = pageInfo.getVarInfoNames();
         breakAtLF = ctxt.getOptions().getMappedFile();
         if (isPoolingEnabled) {
             tagHandlerPoolNames = new Vector();

Modified: tomcat/jasper/tc5.5.x/src/share/org/apache/jasper/compiler/PageInfo.java
URL: http://svn.apache.org/viewvc/tomcat/jasper/tc5.5.x/src/share/org/apache/jasper/compiler/PageInfo.java?rev=792456&r1=792455&r2=792456&view=diff
==============================================================================
--- tomcat/jasper/tc5.5.x/src/share/org/apache/jasper/compiler/PageInfo.java (original)
+++ tomcat/jasper/tc5.5.x/src/share/org/apache/jasper/compiler/PageInfo.java Thu Jul  9 08:56:04
2009
@@ -21,6 +21,7 @@
 import java.util.HashSet;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.Set;
 import java.util.Vector;
 
 import org.apache.jasper.Constants;
@@ -39,6 +40,7 @@
     private Vector dependants;
 
     private BeanRepository beanRepository;
+    private Set varInfoNames;
     private HashMap taglibsMap;
     private HashMap jspPrefixMapper;
     private HashMap xmlPrefixMapper;
@@ -86,6 +88,7 @@
 
         this.jspFile = jspFile;
         this.beanRepository = beanRepository;
+        this.varInfoNames = new HashSet();
         this.taglibsMap = new HashMap();
         this.jspPrefixMapper = new HashMap();
         this.xmlPrefixMapper = new HashMap();
@@ -626,4 +629,8 @@
     public Mark getNonCustomTagPrefix(String prefix) {
         return (Mark) nonCustomTagPrefixMap.get(prefix);
     }
+    
+    public Set getVarInfoNames() {
+        return varInfoNames;
+    }
 }



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


Mime
View raw message