tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r656018 - /tomcat/trunk/java/org/apache/jasper/compiler/Validator.java
Date Tue, 13 May 2008 21:19:07 GMT
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


Mime
View raw message