kinman 2003/01/27 17:42:57 Modified: jasper2/src/share/org/apache/jasper/compiler Generator.java jasper2/src/share/org/apache/jasper/runtime JspContextWrapper.java Log: - Suppress generation of alias map if there is no aliases. Revision Changes Path 1.155 +33 -10 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java Index: Generator.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java,v retrieving revision 1.154 retrieving revision 1.155 diff -u -r1.154 -r1.155 --- Generator.java 28 Jan 2003 00:13:37 -0000 1.154 +++ Generator.java 28 Jan 2003 01:42:57 -0000 1.155 @@ -2487,7 +2487,7 @@ TagInfo tagInfo = n.getTagInfo(); TagVariableInfo[] tagVars = tagInfo.getTagVariableInfos(); - String aliasMapVar = "null"; + String aliasMapVar = null; boolean aliasSeen = false; for (int i=0; i<tagVars.length; i++) { @@ -2526,9 +2526,14 @@ // Generate alias map String aliasMapVar= generateAliasMap(n, tagHandlerVar); out.printin(tagHandlerVar); - out.print(".setJspContext(pageContext, "); - out.print(aliasMapVar); - out.println(");"); + if (aliasMapVar == null) { + out.print(".setJspContext(pageContext);"); + } + else { + out.print(".setJspContext(pageContext, "); + out.print(aliasMapVar); + out.println(");"); + } } else { out.printin(tagHandlerVar); out.println(".setPageContext(pageContext);"); @@ -3179,10 +3184,24 @@ boolean atBeginSeen = false; boolean atEndSeen = false; - out.printil("public void setJspContext(JspContext ctx, java.util.Map aliasMap) {"); + // Determine if there is any aliases + boolean aliasSeen = false; + TagVariableInfo[] tagVars = tagInfo.getTagVariableInfos(); + for (int i=0; i<tagVars.length; i++) { + if (tagVars[i].getNameFromAttribute() != null) { + aliasSeen = true; + break; + } + } + + if (aliasSeen) { + out.printil("public void setJspContext(JspContext ctx, java.util.Map aliasMap) {"); + } + else { + out.printil("public void setJspContext(JspContext ctx) {"); + } out.pushIndent(); out.printil("super.setJspContext(ctx);"); - TagVariableInfo[] tagVars = tagInfo.getTagVariableInfos(); out.printil("java.util.ArrayList _jspx_nested = null;"); out.printil("java.util.ArrayList _jspx_at_begin = null;"); out.printil("java.util.ArrayList _jspx_at_end = null;"); @@ -3218,7 +3237,11 @@ out.print(quote(tagVars[i].getNameGiven())); out.println(");"); } - out.printil("this.jspContext = new org.apache.jasper.runtime.JspContextWrapper(ctx, _jspx_nested, _jspx_at_begin, _jspx_at_end, aliasMap);"); + if (aliasSeen) { + out.printil("this.jspContext = new org.apache.jasper.runtime.JspContextWrapper(ctx, _jspx_nested, _jspx_at_begin, _jspx_at_end, aliasMap);"); + } else { + out.printil("this.jspContext = new org.apache.jasper.runtime.JspContextWrapper(ctx, _jspx_nested, _jspx_at_begin, _jspx_at_end, null);"); + } out.popIndent(); out.printil("}"); out.println(); 1.12 +6 -3 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/JspContextWrapper.java Index: JspContextWrapper.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/JspContextWrapper.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- JspContextWrapper.java 28 Jan 2003 00:13:39 -0000 1.11 +++ JspContextWrapper.java 28 Jan 2003 01:42:57 -0000 1.12 @@ -438,6 +438,9 @@ */ private String findAlias(String varName) { + if (aliases == null) + return varName; + String alias = (String) aliases.get(varName); if (alias == null) { return varName;
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>