ASF Bugzilla – Attachment 24991 Details for
Bug 48616
Struts 1.2 and bean:define tag throws jsp 1.1 regression exception
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
2010-02-16_tc7_bug42390_bug48616.patch
2010-02-16_tc7_bug42390_bug48616.patch (text/plain), 12.03 KB, created by
Konstantin Kolinko
on 2010-02-16 03:23:00 UTC
(
hide
)
Description:
2010-02-16_tc7_bug42390_bug48616.patch
Filename:
MIME Type:
Creator:
Konstantin Kolinko
Created:
2010-02-16 03:23:00 UTC
Size:
12.03 KB
patch
obsolete
>Index: java/org/apache/jasper/compiler/Generator.java >=================================================================== >--- java/org/apache/jasper/compiler/Generator.java (revision 910047) >+++ java/org/apache/jasper/compiler/Generator.java (working copy) >@@ -167,26 +167,6 @@ > return b.toString(); > } > >- /** >- * Finds the <jsp:body> subelement of the given parent node. If not >- * found, null is returned. >- */ >- protected static Node.JspBody findJspBody(Node parent) { >- Node.JspBody result = null; >- >- Node.Nodes subelements = parent.getBody(); >- for (int i = 0; (subelements != null) && (i < subelements.size()); i++) { >- Node n = subelements.getNode(i); >- if (n instanceof Node.JspBody) { >- result = (Node.JspBody) n; >- break; >- } >- } >- >- return result; >- } >- >- > private String createJspId() { > if (this.jspIdPrefix == null) { > StringBuilder sb = new StringBuilder(32); >@@ -358,6 +338,9 @@ > > @Override > public void visit(Node.CustomTag n) throws JasperException { >+ // XXX - Actually there is no need to declare those >+ // "_jspx_" + varName + "_" + nestingLevel variables when we are >+ // inside a JspFragment. > > if (n.getCustomNestingLevel() > 0) { > TagVariableInfo[] tagVarInfos = n.getTagVariableInfos(); >@@ -991,6 +974,25 @@ > } > } > >+ /** >+ * Finds the <jsp:body> subelement of the given parent node. If not >+ * found, null is returned. >+ */ >+ private Node.JspBody findJspBody(Node parent) { >+ Node.JspBody result = null; >+ >+ Node.Nodes subelements = parent.getBody(); >+ for (int i = 0; (subelements != null) && (i < subelements.size()); i++) { >+ Node n = subelements.getNode(i); >+ if (n instanceof Node.JspBody) { >+ result = (Node.JspBody) n; >+ break; >+ } >+ } >+ >+ return result; >+ } >+ > @Override > public void visit(Node.ForwardAction n) throws JasperException { > Node.JspAttribute page = n.getPage(); >@@ -2505,11 +2507,16 @@ > } > > private void declareScriptingVars(Node.CustomTag n, int scope) { >+ if (isFragment) { >+ // No need to declare Java variables, if we inside a >+ // JspFragment, because a fragment is always scriptless. >+ return; >+ } > >- Vector<Object> vec = n.getScriptingVars(scope); >+ List<Object> vec = n.getScriptingVars(scope); > if (vec != null) { > for (int i = 0; i < vec.size(); i++) { >- Object elem = vec.elementAt(i); >+ Object elem = vec.get(i); > if (elem instanceof VariableInfo) { > VariableInfo varInfo = (VariableInfo) elem; > if (varInfo.getDeclare()) { >@@ -2552,6 +2559,14 @@ > if (n.getCustomNestingLevel() == 0) { > return; > } >+ if (isFragment) { >+ // No need to declare Java variables, if we inside a >+ // JspFragment, because a fragment is always scriptless. >+ // Thus, there is no need to save/ restore/ sync them. >+ // Note, that JspContextWrapper.syncFoo() methods will take >+ // care of saving/ restoring/ sync'ing of JspContext attributes. >+ return; >+ } > > TagVariableInfo[] tagVarInfos = n.getTagVariableInfos(); > VariableInfo[] varInfos = n.getVariableInfos(); >@@ -2559,13 +2574,15 @@ > return; > } > >+ List<Object> declaredVariables = n.getScriptingVars(scope); >+ > if (varInfos.length > 0) { > for (int i = 0; i < varInfos.length; i++) { > if (varInfos[i].getScope() != scope) > continue; > // If the scripting variable has been declared, skip codes > // for saving and restoring it. >- if (n.getScriptingVars(scope).contains(varInfos[i])) >+ if (declaredVariables.contains(varInfos[i])) > continue; > String varName = varInfos[i].getVarName(); > String tmpVarName = "_jspx_" + varName + "_" >@@ -2581,7 +2598,7 @@ > continue; > // If the scripting variable has been declared, skip codes > // for saving and restoring it. >- if (n.getScriptingVars(scope).contains(tagVarInfos[i])) >+ if (declaredVariables.contains(tagVarInfos[i])) > continue; > String varName = tagVarInfos[i].getNameGiven(); > if (varName == null) { >@@ -2612,6 +2629,14 @@ > if (n.getCustomNestingLevel() == 0) { > return; > } >+ if (isFragment) { >+ // No need to declare Java variables, if we inside a >+ // JspFragment, because a fragment is always scriptless. >+ // Thus, there is no need to save/ restore/ sync them. >+ // Note, that JspContextWrapper.syncFoo() methods will take >+ // care of saving/ restoring/ sync'ing of JspContext attributes. >+ return; >+ } > > TagVariableInfo[] tagVarInfos = n.getTagVariableInfos(); > VariableInfo[] varInfos = n.getVariableInfos(); >@@ -2619,13 +2644,15 @@ > return; > } > >+ List<Object> declaredVariables = n.getScriptingVars(scope); >+ > if (varInfos.length > 0) { > for (int i = 0; i < varInfos.length; i++) { > if (varInfos[i].getScope() != scope) > continue; > // If the scripting variable has been declared, skip codes > // for saving and restoring it. >- if (n.getScriptingVars(scope).contains(varInfos[i])) >+ if (declaredVariables.contains(varInfos[i])) > continue; > String varName = varInfos[i].getVarName(); > String tmpVarName = "_jspx_" + varName + "_" >@@ -2641,7 +2668,7 @@ > continue; > // If the scripting variable has been declared, skip codes > // for saving and restoring it. >- if (n.getScriptingVars(scope).contains(tagVarInfos[i])) >+ if (declaredVariables.contains(tagVarInfos[i])) > continue; > String varName = tagVarInfos[i].getNameGiven(); > if (varName == null) { >@@ -2666,6 +2693,15 @@ > * given scope. > */ > private void syncScriptingVars(Node.CustomTag n, int scope) { >+ if (isFragment) { >+ // No need to declare Java variables, if we inside a >+ // JspFragment, because a fragment is always scriptless. >+ // Thus, there is no need to save/ restore/ sync them. >+ // Note, that JspContextWrapper.syncFoo() methods will take >+ // care of saving/ restoring/ sync'ing of JspContext attributes. >+ return; >+ } >+ > TagVariableInfo[] tagVarInfos = n.getTagVariableInfos(); > VariableInfo[] varInfos = n.getVariableInfos(); > >Index: java/org/apache/jasper/compiler/Node.java >=================================================================== >--- java/org/apache/jasper/compiler/Node.java (revision 910047) >+++ java/org/apache/jasper/compiler/Node.java (working copy) >@@ -1433,11 +1433,11 @@ > > private boolean implementsDynamicAttributes; > >- private Vector<Object> atBeginScriptingVars; >+ private List<Object> atBeginScriptingVars; > >- private Vector<Object> atEndScriptingVars; >+ private List<Object> atEndScriptingVars; > >- private Vector<Object> nestedScriptingVars; >+ private List<Object> nestedScriptingVars; > > private Node.CustomTag customTagParent; > >@@ -1657,7 +1657,7 @@ > return this.numCount; > } > >- public void setScriptingVars(Vector<Object> vec, int scope) { >+ public void setScriptingVars(List<Object> vec, int scope) { > switch (scope) { > case VariableInfo.AT_BEGIN: > this.atBeginScriptingVars = vec; >@@ -1675,8 +1675,8 @@ > * Gets the scripting variables for the given scope that need to be > * declared. > */ >- public Vector<Object> getScriptingVars(int scope) { >- Vector<Object> vec = null; >+ public List<Object> getScriptingVars(int scope) { >+ List<Object> vec = null; > > switch (scope) { > case VariableInfo.AT_BEGIN: >Index: java/org/apache/jasper/compiler/ScriptingVariabler.java >=================================================================== >--- java/org/apache/jasper/compiler/ScriptingVariabler.java (revision 910047) >+++ java/org/apache/jasper/compiler/ScriptingVariabler.java (working copy) >@@ -59,11 +59,11 @@ > static class ScriptingVariableVisitor extends Node.Visitor { > > private ErrorDispatcher err; >- private Hashtable<String,Integer> scriptVars; >- >+ private Map<String, Integer> scriptVars; >+ > public ScriptingVariableVisitor(ErrorDispatcher err) { > this.err = err; >- scriptVars = new Hashtable<String,Integer>(); >+ scriptVars = new HashMap<String,Integer>(); > } > > @Override >@@ -83,7 +83,7 @@ > return; > } > >- Vector<Object> vec = new Vector<Object>(); >+ List<Object> vec = new ArrayList<Object>(); > > Integer ownRange = null; > Node.CustomTag parent = n.getCustomTagParent(); >@@ -107,11 +107,8 @@ > String varName = varInfos[i].getVarName(); > > Integer currentRange = scriptVars.get(varName); >- // If a fragment helper has been used for the parent tag >- // the scripting variables always need to be declared > if (currentRange == null || >- ownRange.compareTo(currentRange) > 0 || >- parent != null && isImplementedAsFragment(parent)) { >+ ownRange.compareTo(currentRange) > 0) { > scriptVars.put(varName, ownRange); > vec.add(varInfos[i]); > } >@@ -134,11 +131,8 @@ > } > > Integer currentRange = scriptVars.get(varName); >- // If a fragment helper has been used for the parent tag >- // the scripting variables always need to be declared > if (currentRange == null || >- ownRange.compareTo(currentRange) > 0 || >- parent != null && isImplementedAsFragment(parent)) { >+ ownRange.compareTo(currentRange) > 0) { > scriptVars.put(varName, ownRange); > vec.add(tagVarInfos[i]); > } >@@ -149,22 +143,6 @@ > } > } > >- private static boolean isImplementedAsFragment(Node.CustomTag n) { >- // Replicates logic from Generator to determine if a fragment >- // helper will be used >- if (n.implementsSimpleTag()) { >- if (Generator.findJspBody(n) == null) { >- if (!n.hasEmptyBody()) { >- return true; >- } >- return false; >- } >- return true; >- } >- return false; >- } >- >- > public static void set(Node.Nodes page, ErrorDispatcher err) > throws JasperException { > page.visit(new CustomTagCounter());
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 48616
:
24890
|
24891
|
24892
|
24893
| 24991 |
24992
|
24993