Author: markt Date: Tue Mar 9 15:10:04 2010 New Revision: 920916 URL: http://svn.apache.org/viewvc?rev=920916&view=rev Log: * Additional fixes for https://issues.apache.org/bugzilla/show_bug.cgi?id=48668 (kkolinko)
Modified: tomcat/tc6.0.x/trunk/ (props changed) tomcat/tc6.0.x/trunk/STATUS.txt tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/Compiler.java tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/ELParser.java tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/JspConfig.java tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/Parser.java tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/Validator.java tomcat/tc6.0.x/trunk/java/org/apache/jasper/resources/LocalStrings.properties tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Propchange: tomcat/tc6.0.x/trunk/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Tue Mar 9 15:10:04 2010 @@ -1,2 +1 @@ -/tomcat:883362 -/tomcat/trunk:601180,606992,612607,630314,640888,652744,653247,666232,673796,673820,677910,683969,683982,684001,684081,684234,684269-684270,685177,687503,687645,689402,690781,691392,691805,692748,693378,694992,695053,695311,696780,696782,698012,698227,698236,698613,699427,699634,701355,709294,709811,709816,710063,710066,710125,710205,711126,711600,712461,712467,713953,714002,718360,719119,719124,719602,719626,719628,720046,720069,721040,721286,721708,721886,723404,723738,726052,727303,728032,728768,728947,729057,729567,729569,729571,729681,729809,729815,729934,730250,730590,731651,732859,732863,734734,740675,740684,742677,742697,742714,744160,744238,746321,746384,746425,747834,747863,748344,750258,750291,750921,751286-751287,751289,751295,752323,753039,757335,757774,758249,758365,758596,758616,758664,759074,761601,762868,762929,762936-762937,763166,763183,763193,763228,763262,763298,763302,763325,763599,763611,763654,763681,763706,764985,764997,765662,768335,769979,770716,77 0809,770876,772872,776921,776924,776935,776945,777464,777466,777576,777625,778379,778523-778524,781528,781779,782145,782791,783316,783696,783724,783756,783762,783766,783863,783934,784453,784602,784614,785381,785688,785768,785859,786468,786487,786490,786496,786667,787627,787770,787985,789389,790405,791041,791184,791194,791224,791243,791326,791328,791789,792740,793372,793757,793882,793981,794082,794673,794822,795043,795152,795210,795457,795466,797168,797425,797596,797607,802727,802940,804462,804544,804734,805153,809131,809603,810916,810977,812125,812137,812432,813001,813013,813866,814180,814708,814876,815972,816252,817442,817822,819339,819361,820110,820132,820874,820954,821397,828196,828201,828210,828225,828759,830378-830379,830999,831106,831774,831785,831828,831850,831860,832214,832218,833121,833545,834047,835036,835336,836405,881396,881412,883130,883134,883146,883165,883177,883362,883565,884341,885038,885231,885241,885260,885901,885991,886019,888072,889363,889606,889716,8901 39,890265,890349-890350,890417,891185-891187,891583,892198,892341,892415,892464,892555,892812,892814,892817,892843,892887,893321,893493,894580,894586,894805,894831,895013,895045,895057,895191,895392,895703,896370,896384,897380-897381,897776,898126,898256,898468,898527,898555,898558,898718,898836,898906,899284,899348,899420,899653,899769-899770,899783,899788,899792,899916,899918-899919,899935,899949,903916,905020,905151,905722,905728,905735,907311,907513,907538,907652,907819,907825,907864,908002,908721,908754,908759,909097,909206,909212,909525,909636,909869,909875,909887,910266,910370,910442,910471,910974,915226,915737,915861,916097,916141,916157,916170,917598,917633,918093,918594,918684,918787,918792,918799,918885 +/tomcat/trunk:601180,606992,612607,630314,640888,652744,653247,666232,673796,673820,677910,683969,683982,684001,684081,684234,684269-684270,685177,687503,687645,689402,690781,691392,691805,692748,693378,694992,695053,695311,696780,696782,698012,698227,698236,698613,699427,699634,701355,709294,709811,709816,710063,710066,710125,710205,711126,711600,712461,712467,713953,714002,718360,719119,719124,719602,719626,719628,720046,720069,721040,721286,721708,721886,723404,723738,726052,727303,728032,728768,728947,729057,729567,729569,729571,729681,729809,729815,729934,730250,730590,731651,732859,732863,734734,740675,740684,742677,742697,742714,744160,744238,746321,746384,746425,747834,747863,748344,750258,750291,750921,751286-751287,751289,751295,752323,753039,757335,757774,758249,758365,758596,758616,758664,759074,761601,762868,762929,762936-762937,763166,763183,763193,763228,763262,763298,763302,763325,763599,763611,763654,763681,763706,764985,764997,765662,768335,769979,770716,77 0809,770876,772872,776921,776924,776935,776945,777464,777466,777576,777625,778379,778523-778524,781528,781779,782145,782791,783316,783696,783724,783756,783762,783766,783863,783934,784453,784602,784614,785381,785688,785768,785859,786468,786487,786490,786496,786667,787627,787770,787985,789389,790405,791041,791184,791194,791224,791243,791326,791328,791789,792740,793372,793757,793882,793981,794082,794673,794822,795043,795152,795210,795457,795466,797168,797425,797596,797607,802727,802940,804462,804544,804734,805153,809131,809603,810916,810977,812125,812137,812432,813001,813013,813866,814180,814708,814876,815972,816252,817442,817822,819339,819361,820110,820132,820874,820954,821397,828196,828201,828210,828225,828759,830378-830379,830999,831106,831774,831785,831828,831850,831860,832214,832218,833121,833545,834047,835036,835336,836405,881396,881412,883130,883134,883146,883165,883177,883362,883565,884341,885038,885231,885241,885260,885901,885991,886019,888072,889363,889606,889716,8901 39,890265,890349-890350,890417,891185-891187,891583,892198,892341,892415,892464,892555,892812,892814,892817,892843,892887,893321,893493,894580,894586,894805,894831,895013,895045,895057,895191,895392,895703,896370,896384,897380-897381,897776,898126,898256,898468,898527,898555,898558,898718,898836,898906,899284,899348,899420,899653,899769-899770,899783,899788,899792,899916,899918-899919,899935,899949,903916,905020,905151,905722,905728,905735,907311,907513,907538,907652,907819,907825,907864,908002,908721,908754,908759,909097,909206,909212,909525,909636,909869,909875,909887,910266,910370,910442,910471,910974,915226,915737,915861,916097,916141,916157,916170,917598,917633,918093,918594,918684,918787,918792,918799,918885,919851,919914,920025,920055,920596 Modified: tomcat/tc6.0.x/trunk/STATUS.txt URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=920916&r1=920915&r2=920916&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/STATUS.txt (original) +++ tomcat/tc6.0.x/trunk/STATUS.txt Tue Mar 9 15:10:04 2010 @@ -99,21 +99,6 @@ PATCHES PROPOSED TO BACKPORT: +1: kkolinko, markt -1: -* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=48668 - - 1) Fix for jasper.compiler.Parser - Honor isELIgnored and isDeferredSyntaxAllowed when parsing. - Backport of r919851: - http://people.apache.org/~kkolinko/patches/2010-03-07_tc6_bug48668_r919851.patch - +1: kkolinko, markt, jfclere - -1: - - 2) Fix for jasper.compiler.Validator etc. - http://people.apache.org/~kkolinko/patches/2010-03-09_tc6_bug48668-2.patch - (Backport of r919914,920025,920055,920596) - +1: kkolinko, jfclere, markt - -1: - * Improve log messages when a potential leak is detected by including the name of the offending context http://svn.apache.org/viewvc?view=revision&revision=920298 Modified: tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/Compiler.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/Compiler.java?rev=920916&r1=920915&r2=920916&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/Compiler.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/Compiler.java Tue Mar 9 15:10:04 2010 @@ -139,6 +139,21 @@ public abstract class Compiler { pageInfo.setTrimDirectiveWhitespaces(JspUtil.booleanValue(jspProperty .isTrimDirectiveWhitespaces())); } + if (ctxt.isTagFile()) { + try { + double libraryVersion = Double.parseDouble(ctxt.getTagInfo() + .getTagLibrary().getRequiredVersion()); + if (libraryVersion < 2.0) { + pageInfo.setIsELIgnored("true", null, errDispatcher, true); + } + if (libraryVersion < 2.1) { + pageInfo.setDeferredSyntaxAllowedAsLiteral("true", null, + errDispatcher, true); + } + } catch (NumberFormatException ex) { + errDispatcher.jspError(ex); + } + } ctxt.checkOutputDir(); String javaFileName = ctxt.getServletJavaFileName(); Modified: tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/ELParser.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/ELParser.java?rev=920916&r1=920915&r2=920916&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/ELParser.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/ELParser.java Tue Mar 9 15:10:04 2010 @@ -44,13 +44,16 @@ public class ELParser { private boolean escapeBS; // is '\' an escape char in text outside EL? + private final boolean isDeferredSyntaxAllowedAsLiteral; + private static final String reservedWords[] = { "and", "div", "empty", "eq", "false", "ge", "gt", "instanceof", "le", "lt", "mod", "ne", "not", "null", "or", "true" }; - public ELParser(String expression) { + public ELParser(String expression, boolean isDeferredSyntaxAllowedAsLiteral) { index = 0; this.expression = expression; + this.isDeferredSyntaxAllowedAsLiteral = isDeferredSyntaxAllowedAsLiteral; expr = new ELNode.Nodes(); } @@ -60,10 +63,14 @@ public class ELParser { * @param expression * The input expression string of the form Char* ('${' Char* * '}')* Char* + * @param isDeferredSyntaxAllowedAsLiteral + * Are deferred expressions treated as literals? * @return Parsed EL expression in ELNode.Nodes */ - public static ELNode.Nodes parse(String expression) { - ELParser parser = new ELParser(expression); + public static ELNode.Nodes parse(String expression, + boolean isDeferredSyntaxAllowedAsLiteral) { + ELParser parser = new ELParser(expression, + isDeferredSyntaxAllowedAsLiteral); while (parser.hasNextChar()) { String text = parser.skipUntilEL(); if (text.length() > 0) { @@ -185,11 +192,13 @@ public class ELParser { buf.append('\\'); if (!escapeBS) prev = '\\'; - } else if (ch == '$' || ch == '#') { + } else if (ch == '$' + || (!isDeferredSyntaxAllowedAsLiteral && ch == '#')) { buf.append(ch); } // else error! - } else if (prev == '$' || prev == '#') { + } else if (prev == '$' + || (!isDeferredSyntaxAllowedAsLiteral && prev == '#')) { if (ch == '{') { this.type = prev; prev = 0; @@ -198,7 +207,8 @@ public class ELParser { buf.append(prev); prev = 0; } - if (ch == '\\' || ch == '$' || ch == '#') { + if (ch == '\\' || ch == '$' + || (!isDeferredSyntaxAllowedAsLiteral && ch == '#')) { prev = ch; } else { buf.append(ch); Modified: tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/JspConfig.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/JspConfig.java?rev=920916&r1=920915&r2=920916&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/JspConfig.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/JspConfig.java Tue Mar 9 15:10:04 2010 @@ -50,11 +50,11 @@ public class JspConfig { private ServletContext ctxt; private volatile boolean initialized = false; - private String defaultIsXml = null; // unspecified + private final static String defaultIsXml = null; // unspecified private String defaultIsELIgnored = null; // unspecified - private String defaultIsScriptingInvalid = null; + private final static String defaultIsScriptingInvalid = null; private String defaultDeferedSyntaxAllowedAsLiteral = null; - private String defaultTrimDirectiveWhitespaces = null; + private final static String defaultTrimDirectiveWhitespaces = null; private JspProperty defaultJspProperty; public JspConfig(ServletContext ctxt) { @@ -93,8 +93,12 @@ public class JspConfig { if (webApp == null || getVersion(webApp) < 2.4) { defaultIsELIgnored = "true"; + defaultDeferedSyntaxAllowedAsLiteral = "true"; return; } + if (getVersion(webApp) < 2.5) { + defaultDeferedSyntaxAllowedAsLiteral = "true"; + } TreeNode jspConfig = webApp.findChild("jsp-config"); if (jspConfig == null) { return; @@ -223,7 +227,8 @@ public class JspConfig { defaultJspProperty = new JspProperty(defaultIsXml, defaultIsELIgnored, defaultIsScriptingInvalid, - null, null, null, defaultDeferedSyntaxAllowedAsLiteral, + null, null, null, + defaultDeferedSyntaxAllowedAsLiteral, defaultTrimDirectiveWhitespaces); initialized = true; } Modified: tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/Parser.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/Parser.java?rev=920916&r1=920915&r2=920916&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/Parser.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/Parser.java Tue Mar 9 15:10:04 2010 @@ -1456,9 +1456,11 @@ class Parser implements TagConstants { err.jspError(reader.mark(), "jsp.error.no.scriptlets"); } else if (reader.matches("<jsp:text")) { parseXMLTemplateText(parent); - } else if (reader.matches("${")) { + } else if (!pageInfo.isELIgnored() && reader.matches("${")) { parseELExpression(parent, '$'); - } else if (reader.matches("#{")) { + } else if (!pageInfo.isELIgnored() + && !pageInfo.isDeferredSyntaxAllowedAsLiteral() + && reader.matches("#{")) { parseELExpression(parent, '#'); } else if (reader.matches("<jsp:")) { parseStandardAction(parent); @@ -1507,10 +1509,12 @@ class Parser implements TagConstants { } else if (reader.matches("<jsp:text")) { err.jspError(reader.mark(), "jsp.error.not.in.template", "<jsp:text"); - } else if (reader.matches("${")) { + } else if (!pageInfo.isELIgnored() && reader.matches("${")) { err.jspError(reader.mark(), "jsp.error.not.in.template", "Expression language"); - } else if (reader.matches("#{")) { + } else if (!pageInfo.isELIgnored() + && !pageInfo.isDeferredSyntaxAllowedAsLiteral() + && reader.matches("#{")) { err.jspError(reader.mark(), "jsp.error.not.in.template", "Expression language"); } else if (reader.matches("<jsp:")) { Modified: tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/Validator.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/Validator.java?rev=920916&r1=920915&r2=920916&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/Validator.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/Validator.java Tue Mar 9 15:10:04 2010 @@ -37,7 +37,6 @@ import javax.servlet.jsp.tagext.TagLibra import javax.servlet.jsp.tagext.ValidationMessage; import org.apache.el.lang.ELSupport; -import org.apache.jasper.Constants; import org.apache.jasper.JasperException; import org.apache.jasper.el.ELContextImpl; import org.xml.sax.Attributes; @@ -45,7 +44,7 @@ import org.xml.sax.Attributes; /** * Performs validation on the page elements. Attributes are checked for * mandatory presence, entry value validity, and consistency. As a side effect, - * some page global value (such as those from page direcitves) are stored, for + * some page global value (such as those from page directives) are stored, for * later use. * * @author Kin-man Chung @@ -416,8 +415,6 @@ class Validator { private ErrorDispatcher err; - private TagInfo tagInfo; - private ClassLoader loader; private final StringBuffer buf = new StringBuffer(32); @@ -504,7 +501,6 @@ class Validator { ValidateVisitor(Compiler compiler) { this.pageInfo = compiler.getPageInfo(); this.err = compiler.getErrorDispatcher(); - this.tagInfo = compiler.getCompilationContext().getTagInfo(); this.loader = compiler.getCompilationContext().getClassLoader(); } @@ -706,10 +702,7 @@ class Validator { // JSP.2.2 - '#{' not allowed in template text if (n.getType() == '#') { - if (!pageInfo.isDeferredSyntaxAllowedAsLiteral() - && (tagInfo == null - || ((tagInfo != null) && !(tagInfo.getTagLibrary().getRequiredVersion().equals("2.0") - || tagInfo.getTagLibrary().getRequiredVersion().equals("1.2"))))) { + if (!pageInfo.isDeferredSyntaxAllowedAsLiteral()) { err.jspError(n, "jsp.error.el.template.deferred"); } else { return; @@ -720,7 +713,8 @@ class Validator { StringBuffer expr = this.getBuffer(); expr.append(n.getType()).append('{').append(n.getText()) .append('}'); - ELNode.Nodes el = ELParser.parse(expr.toString()); + ELNode.Nodes el = ELParser.parse(expr.toString(), pageInfo + .isDeferredSyntaxAllowedAsLiteral()); // validate/prepare expression prepareExpression(el, n, expr.toString()); @@ -1051,10 +1045,6 @@ class Validator { TagAttributeInfo[] tldAttrs = tagInfo.getAttributes(); Attributes attrs = n.getAttributes(); - boolean checkDeferred = !pageInfo.isDeferredSyntaxAllowedAsLiteral() - && !(tagInfo.getTagLibrary().getRequiredVersion().equals("2.0") - || tagInfo.getTagLibrary().getRequiredVersion().equals("1.2")); - for (int i = 0; attrs != null && i < attrs.getLength(); i++) { boolean found = false; @@ -1062,54 +1052,60 @@ class Validator { || (!n.getRoot().isXmlSyntax() && attrs.getValue(i).startsWith("<%="))); boolean elExpression = false; boolean deferred = false; - boolean deferredValueIsLiteral = false; + double libraryVersion = Double.parseDouble( + tagInfo.getTagLibrary().getRequiredVersion()); + boolean deferredSyntaxAllowedAsLiteral = + pageInfo.isDeferredSyntaxAllowedAsLiteral() || + libraryVersion < 2.1; ELNode.Nodes el = null; - if (!runtimeExpression) { - el = ELParser.parse(attrs.getValue(i)); + if (!runtimeExpression && !pageInfo.isELIgnored()) { + el = ELParser.parse(attrs.getValue(i), + deferredSyntaxAllowedAsLiteral); Iterator<ELNode> nodes = el.iterator(); while (nodes.hasNext()) { ELNode node = nodes.next(); if (node instanceof ELNode.Root) { if (((ELNode.Root) node).getType() == '$') { + if (elExpression && deferred) { + err.jspError(n, + "jsp.error.attribute.deferredmix"); + } elExpression = true; - } else if (checkDeferred && ((ELNode.Root) node).getType() == '#') { + } else if (((ELNode.Root) node).getType() == '#') { + if (elExpression && !deferred) { + err.jspError(n, + "jsp.error.attribute.deferredmix"); + } elExpression = true; deferred = true; - if (pageInfo.isELIgnored()) { - deferredValueIsLiteral = true; - } } } } } - boolean expression = runtimeExpression - || (elExpression && (!pageInfo.isELIgnored() || (!"true".equalsIgnoreCase(pageInfo.getIsELIgnored()) && checkDeferred && deferred))); - + boolean expression = runtimeExpression || elExpression; + for (int j = 0; tldAttrs != null && j < tldAttrs.length; j++) { if (attrs.getLocalName(i).equals(tldAttrs[j].getName()) && (attrs.getURI(i) == null || attrs.getURI(i).length() == 0 || attrs .getURI(i).equals(n.getURI()))) { - - if (tldAttrs[j].canBeRequestTime() - || tldAttrs[j].isDeferredMethod() || tldAttrs[j].isDeferredValue()) { // JSP 2.1 + + TagAttributeInfo tldAttr = tldAttrs[j]; + if (tldAttr.canBeRequestTime() + || tldAttr.isDeferredMethod() || tldAttr.isDeferredValue()) { // JSP 2.1 if (!expression) { - - if (deferredValueIsLiteral && !pageInfo.isDeferredSyntaxAllowedAsLiteral()) { - err.jspError(n, "jsp.error.attribute.custom.non_rt_with_expr", - tldAttrs[j].getName()); - } - + String expectedType = null; - if (tldAttrs[j].isDeferredMethod()) { + if (tldAttr.isDeferredMethod()) { // The String literal must be castable to what is declared as type // for the attribute - String m = tldAttrs[j].getMethodSignature(); + String m = tldAttr.getMethodSignature(); if (m != null) { - int rti = m.trim().indexOf(' '); + m = m.trim(); + int rti = m.indexOf(' '); if (rti > 0) { expectedType = m.substring(0, rti).trim(); } @@ -1122,13 +1118,13 @@ class Validator { // of void - JSP.2.3.4 err.jspError(n, "jsp.error.literal_with_void", - tldAttrs[j].getName()); + tldAttr.getName()); } } - if (tldAttrs[j].isDeferredValue()) { + if (tldAttr.isDeferredValue()) { // The String litteral must be castable to what is declared as type // for the attribute - expectedType = tldAttrs[j].getExpectedTypeName(); + expectedType = tldAttr.getExpectedTypeName(); } if (expectedType != null) { Class expectedClass = String.class; @@ -1137,7 +1133,7 @@ class Validator { } catch (ClassNotFoundException e) { err.jspError (n, "jsp.error.unknown_attribute_type", - tldAttrs[j].getName(), expectedType); + tldAttr.getName(), expectedType); } // Check casting try { @@ -1145,31 +1141,31 @@ class Validator { } catch (Exception e) { err.jspError (n, "jsp.error.coerce_to_type", - tldAttrs[j].getName(), expectedType, attrs.getValue(i)); + tldAttr.getName(), expectedType, attrs.getValue(i)); } } - jspAttrs[i] = new Node.JspAttribute(tldAttrs[j], + jspAttrs[i] = new Node.JspAttribute(tldAttr, attrs.getQName(i), attrs.getURI(i), attrs .getLocalName(i), attrs.getValue(i), false, null, false); } else { - - if (deferred && !tldAttrs[j].isDeferredMethod() && !tldAttrs[j].isDeferredValue()) { + + if (deferred && !tldAttr.isDeferredMethod() && !tldAttr.isDeferredValue()) { // No deferred expressions allowed for this attribute err.jspError(n, "jsp.error.attribute.custom.non_rt_with_expr", - tldAttrs[j].getName()); + tldAttr.getName()); } - if (!deferred && !tldAttrs[j].canBeRequestTime()) { + if (!deferred && !tldAttr.canBeRequestTime()) { // Only deferred expressions are allowed for this attribute err.jspError(n, "jsp.error.attribute.custom.non_rt_with_expr", - tldAttrs[j].getName()); + tldAttr.getName()); } Class expectedType = String.class; try { - String typeStr = tldAttrs[j].getTypeName(); - if (tldAttrs[j].isFragment()) { + String typeStr = tldAttr.getTypeName(); + if (tldAttr.isFragment()) { expectedType = JspFragment.class; } else if (typeStr != null) { expectedType = JspUtil.toClass(typeStr, @@ -1178,7 +1174,7 @@ class Validator { if (elExpression) { // El expression validateFunctions(el, n); - jspAttrs[i] = new Node.JspAttribute(tldAttrs[j], + jspAttrs[i] = new Node.JspAttribute(tldAttr, attrs.getQName(i), attrs.getURI(i), attrs.getLocalName(i), attrs.getValue(i), false, el, false); @@ -1193,7 +1189,7 @@ class Validator { } } else { // Runtime expression - jspAttrs[i] = getJspAttribute(tldAttrs[j], + jspAttrs[i] = getJspAttribute(tldAttr, attrs.getQName(i), attrs.getURI(i), attrs.getLocalName(i), attrs .getValue(i), expectedType, n, @@ -1202,7 +1198,7 @@ class Validator { } catch (ClassNotFoundException e) { err.jspError (n, "jsp.error.unknown_attribute_type", - tldAttrs[j].getName(), tldAttrs[j].getTypeName()); + tldAttr.getName(), tldAttr.getTypeName()); } } @@ -1211,9 +1207,9 @@ class Validator { // Make sure its value does not contain any. if (expression) { err.jspError(n, "jsp.error.attribute.custom.non_rt_with_expr", - tldAttrs[j].getName()); + tldAttr.getName()); } - jspAttrs[i] = new Node.JspAttribute(tldAttrs[j], + jspAttrs[i] = new Node.JspAttribute(tldAttr, attrs.getQName(i), attrs.getURI(i), attrs .getLocalName(i), attrs.getValue(i), false, null, false); @@ -1334,6 +1330,9 @@ class Validator { result = new Node.JspAttribute(tai, qName, uri, localName, value.substring(3, value.length() - 2), true, null, dynamic); + } else if (pageInfo.isELIgnored()) { + result = new Node.JspAttribute(tai, qName, uri, localName, + value, false, null, dynamic); } else { // The attribute can contain expressions but is not a // scriptlet expression; thus, we want to run it through @@ -1341,22 +1340,10 @@ class Validator { // validate expression syntax if string contains // expression(s) - ELNode.Nodes el = ELParser.parse(value); - - boolean deferred = false; - Iterator<ELNode> nodes = el.iterator(); - while (nodes.hasNext()) { - ELNode node = nodes.next(); - if (node instanceof ELNode.Root) { - if (((ELNode.Root) node).getType() == '#') { - deferred = true; - } - } - } + ELNode.Nodes el = ELParser.parse(value, pageInfo + .isDeferredSyntaxAllowedAsLiteral()); - if (el.containsEL() && !pageInfo.isELIgnored() - && ((!pageInfo.isDeferredSyntaxAllowedAsLiteral() && deferred) - || !deferred)) { + if (el.containsEL()) { validateFunctions(el, n); @@ -1415,7 +1402,8 @@ class Validator { boolean elExpression = false; if (!runtimeExpression && !pageInfo.isELIgnored()) { - Iterator<ELNode> nodes = ELParser.parse(value).iterator(); + Iterator<ELNode> nodes = ELParser.parse(value, + pageInfo.isDeferredSyntaxAllowedAsLiteral()).iterator(); while (nodes.hasNext()) { ELNode node = nodes.next(); if (node instanceof ELNode.Root) { Modified: tomcat/tc6.0.x/trunk/java/org/apache/jasper/resources/LocalStrings.properties URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/jasper/resources/LocalStrings.properties?rev=920916&r1=920915&r2=920916&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/jasper/resources/LocalStrings.properties (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/jasper/resources/LocalStrings.properties Tue Mar 9 15:10:04 2010 @@ -373,6 +373,7 @@ jsp.error.prolog_pagedir_encoding_mismat jsp.error.prolog_config_encoding_mismatch=Page-encoding specified in XML prolog ({0}) is different from that specified in jsp-property-group ({1}) jsp.error.attribute.custom.non_rt_with_expr=According to TLD or attribute directive in tag file, attribute {0} does not accept any expressions jsp.error.attribute.standard.non_rt_with_expr=The {0} attribute of the {1} standard action does not accept any expressions +jsp.error.attribute.deferredmix=Cannot use both ${} and #{} EL expressions in the same attribute value jsp.error.scripting.variable.missing_name=Unable to determine scripting variable name from attribute {0} jasper.error.emptybodycontent.nonempty=According to TLD, tag {0} must be empty, but is not jsp.error.tagfile.nameNotUnique=The value of {0} and the value of {1} in line {2} are the same. Modified: tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml?rev=920916&r1=920915&r2=920916&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Tue Mar 9 15:10:04 2010 @@ -79,6 +79,10 @@ Java 6/7 XML parser bug. (markt/kkolinko) </fix> <fix> + <bug>48668</bug>: Additional fixes to ensure deferred syntax is handled + correctly. (kkolinko) + </fix> + <fix> <bug>48827</bug>: Correct a regression in the fix for <bug>47977</bug> that caused an incorrect non-empty body error to be reported for valid JSP documents. (markt) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org