Return-Path: Delivered-To: apmail-tomcat-dev-archive@www.apache.org Received: (qmail 35904 invoked from network); 13 May 2008 21:19:34 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 13 May 2008 21:19:34 -0000 Received: (qmail 30530 invoked by uid 500); 13 May 2008 21:19:31 -0000 Delivered-To: apmail-tomcat-dev-archive@tomcat.apache.org Received: (qmail 30262 invoked by uid 500); 13 May 2008 21:19:30 -0000 Mailing-List: contact dev-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Developers List" Delivered-To: mailing list dev@tomcat.apache.org Received: (qmail 30251 invoked by uid 500); 13 May 2008 21:19:30 -0000 Delivered-To: apmail-jakarta-tomcat-dev@jakarta.apache.org Received: (qmail 30248 invoked by uid 99); 13 May 2008 21:19:30 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 May 2008 14:19:30 -0700 X-ASF-Spam-Status: No, hits=-1998.2 required=10.0 tests=ALL_TRUSTED,SUBJECT_DRUG_GAP_L X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 May 2008 21:18:53 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 0FF2623889FE; Tue, 13 May 2008 14:19:08 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r656018 - /tomcat/trunk/java/org/apache/jasper/compiler/Validator.java Date: Tue, 13 May 2008 21:19:07 -0000 To: tomcat-dev@jakarta.apache.org From: markt@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080513211908.0FF2623889FE@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: markt Date: Tue May 13 14:19:07 2008 New Revision: 656018 URL: http://svn.apache.org/viewvc?rev=656018&view=rev Log: Code clean-up. Remove unused code, parameters, etc. Modified: tomcat/trunk/java/org/apache/jasper/compiler/Validator.java Modified: tomcat/trunk/java/org/apache/jasper/compiler/Validator.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/Validator.java?rev=656018&r1=656017&r2=656018&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/jasper/compiler/Validator.java (original) +++ tomcat/trunk/java/org/apache/jasper/compiler/Validator.java Tue May 13 14:19:07 2008 @@ -27,7 +27,6 @@ import javax.el.ExpressionFactory; import javax.el.FunctionMapper; import javax.servlet.jsp.tagext.FunctionInfo; -import javax.servlet.jsp.tagext.JspFragment; import javax.servlet.jsp.tagext.PageData; import javax.servlet.jsp.tagext.TagAttributeInfo; import javax.servlet.jsp.tagext.TagData; @@ -543,8 +542,7 @@ // request-time expression throwErrorIfExpression(n, "name", "jsp:param"); n.setValue(getJspAttribute(null, "value", null, null, n - .getAttributeValue("value"), java.lang.String.class, n, - false)); + .getAttributeValue("value"), n, false)); visitBody(n); } @@ -561,16 +559,14 @@ JspUtil.checkAttributes("Include action", n, includeActionAttrs, err); n.setPage(getJspAttribute(null, "page", null, null, n - .getAttributeValue("page"), java.lang.String.class, n, - false)); + .getAttributeValue("page"), n, false)); visitBody(n); - }; + } public void visit(Node.ForwardAction n) throws JasperException { JspUtil.checkAttributes("Forward", n, forwardActionAttrs, err); n.setPage(getJspAttribute(null, "page", null, null, n - .getAttributeValue("page"), java.lang.String.class, n, - false)); + .getAttributeValue("page"), n, false)); visitBody(n); } @@ -585,7 +581,7 @@ String value = n.getAttributeValue("value"); n.setValue(getJspAttribute(null, "value", null, null, value, - java.lang.Object.class, n, false)); + n, false)); boolean valueSpecified = n.getValue() != null; @@ -620,8 +616,7 @@ err.jspError(n, "jsp.error.usebean.noSession"); Node.JspAttribute jattr = getJspAttribute(null, "beanName", null, - null, n.getAttributeValue("beanName"), - java.lang.String.class, n, false); + null, n.getAttributeValue("beanName"), n, false); n.setBeanName(jattr); if (className != null && jattr != null) err.jspError(n, "jsp.error.usebean.notBoth"); @@ -658,13 +653,11 @@ err.jspError(n, "jsp.error.plugin.nocode"); Node.JspAttribute width = getJspAttribute(null, "width", null, - null, n.getAttributeValue("width"), java.lang.String.class, - n, false); + null, n.getAttributeValue("width"), n, false); n.setWidth(width); Node.JspAttribute height = getJspAttribute(null, "height", null, - null, n.getAttributeValue("height"), - java.lang.String.class, n, false); + null, n.getAttributeValue("height"), n, false); n.setHeight(height); visitBody(n); @@ -739,8 +732,7 @@ for (int i = 0; i < attrSize; i++) { jspAttrs[i] = getJspAttribute(null, attrs.getQName(i), attrs.getURI(i), attrs.getLocalName(i), attrs - .getValue(i), java.lang.Object.class, n, - false); + .getValue(i), n, false); } n.setJspAttributes(jspAttrs); } @@ -860,14 +852,12 @@ if ("name".equals(attrs.getLocalName(i))) { n.setNameAttribute(getJspAttribute(null, attrs.getQName(i), attrs.getURI(i), attrs.getLocalName(i), attrs - .getValue(i), java.lang.String.class, n, - false)); + .getValue(i), n, false)); } else { if (jspAttrIndex < jspAttrSize) { jspAttrs[jspAttrIndex++] = getJspAttribute(null, attrs .getQName(i), attrs.getURI(i), attrs - .getLocalName(i), attrs.getValue(i), - java.lang.Object.class, n, false); + .getLocalName(i), attrs.getValue(i), n, false); } } } @@ -1090,7 +1080,7 @@ expectedType = tldAttrs[j].getExpectedTypeName(); } if (expectedType != null) { - Class expectedClass = String.class; + Class expectedClass = String.class; try { expectedClass = JspUtil.toClass(expectedType, loader); } catch (ClassNotFoundException e) { @@ -1125,43 +1115,28 @@ tldAttrs[j].getName()); } - Class expectedType = String.class; - try { - String typeStr = tldAttrs[j].getTypeName(); - if (tldAttrs[j].isFragment()) { - expectedType = JspFragment.class; - } else if (typeStr != null) { - expectedType = JspUtil.toClass(typeStr, - loader); - } - if (elExpression) { - // El expression - validateFunctions(el, n); - jspAttrs[i] = new Node.JspAttribute(tldAttrs[j], - attrs.getQName(i), attrs.getURI(i), - attrs.getLocalName(i), - attrs.getValue(i), false, el, false); - ELContextImpl ctx = new ELContextImpl(); - ctx.setFunctionMapper(getFunctionMapper(el)); - try { - jspAttrs[i].validateEL(this.pageInfo.getExpressionFactory(), ctx); - } catch (ELException e) { - this.err.jspError(n.getStart(), - "jsp.error.invalid.expression", - attrs.getValue(i), e.toString()); - } - } else { - // Runtime expression - jspAttrs[i] = getJspAttribute(tldAttrs[j], - attrs.getQName(i), attrs.getURI(i), - attrs.getLocalName(i), attrs - .getValue(i), expectedType, n, - false); + if (elExpression) { + // El expression + validateFunctions(el, n); + jspAttrs[i] = new Node.JspAttribute(tldAttrs[j], + attrs.getQName(i), attrs.getURI(i), + attrs.getLocalName(i), + attrs.getValue(i), false, el, false); + ELContextImpl ctx = new ELContextImpl(); + ctx.setFunctionMapper(getFunctionMapper(el)); + try { + jspAttrs[i].validateEL(this.pageInfo.getExpressionFactory(), ctx); + } catch (ELException e) { + this.err.jspError(n.getStart(), + "jsp.error.invalid.expression", + attrs.getValue(i), e.toString()); } - } catch (ClassNotFoundException e) { - err.jspError - (n, "jsp.error.unknown_attribute_type", - tldAttrs[j].getName(), tldAttrs[j].getTypeName()); + } else { + // Runtime expression + jspAttrs[i] = getJspAttribute(tldAttrs[j], + attrs.getQName(i), attrs.getURI(i), + attrs.getLocalName(i), attrs + .getValue(i), n, false); } } @@ -1192,8 +1167,7 @@ if (tagInfo.hasDynamicAttributes()) { jspAttrs[i] = getJspAttribute(null, attrs.getQName(i), attrs.getURI(i), attrs.getLocalName(i), attrs - .getValue(i), java.lang.Object.class, - n, true); + .getValue(i), n, true); } else { err.jspError(n, "jsp.error.bad_attribute", attrs .getQName(i), n.getLocalName()); @@ -1274,7 +1248,7 @@ */ private Node.JspAttribute getJspAttribute(TagAttributeInfo tai, String qName, String uri, String localName, String value, - Class expectedType, Node n, boolean dynamic) + Node n, boolean dynamic) throws JasperException { Node.JspAttribute result = null; @@ -1579,7 +1553,7 @@ } start = p + 1; } - return (String[]) params.toArray(new String[params.size()]); + return params.toArray(new String[params.size()]); } private FunctionMapper getFunctionMapper(ELNode.Nodes el) @@ -1607,7 +1581,7 @@ public void visit(ELNode.Function n) throws JasperException { - Class c = null; + Class c = null; Method method = null; try { c = loader.loadClass(n.getFunctionInfo() @@ -1620,7 +1594,7 @@ } String paramTypes[] = n.getParameters(); int size = paramTypes.length; - Class params[] = new Class[size]; + Class params[] = new Class[size]; int i = 0; try { for (i = 0; i < size; i++) { --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org For additional commands, e-mail: dev-help@tomcat.apache.org