tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rj...@apache.org
Subject svn commit: r696714 - in /tomcat/trunk/java/org/apache/el/lang: ExpressionBuilder.java FunctionMapperImpl.java VariableMapperImpl.java
Date Thu, 18 Sep 2008 17:03:38 GMT
Author: rjung
Date: Thu Sep 18 10:03:38 2008
New Revision: 696714

URL: http://svn.apache.org/viewvc?rev=696714&view=rev
Log:
Use generics to improve type safetyness.

Please check readExternal() in FunctionMapperImpl
and VariableMapperImpl. The type of the persisted
Map has changed. Does this pose a consistency
problem with other components or older, already
persisted Maps?

Modified:
    tomcat/trunk/java/org/apache/el/lang/ExpressionBuilder.java
    tomcat/trunk/java/org/apache/el/lang/FunctionMapperImpl.java
    tomcat/trunk/java/org/apache/el/lang/VariableMapperImpl.java

Modified: tomcat/trunk/java/org/apache/el/lang/ExpressionBuilder.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/el/lang/ExpressionBuilder.java?rev=696714&r1=696713&r2=696714&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/el/lang/ExpressionBuilder.java (original)
+++ tomcat/trunk/java/org/apache/el/lang/ExpressionBuilder.java Thu Sep 18 10:03:38 2008
@@ -50,7 +50,7 @@
  */
 public final class ExpressionBuilder implements NodeVisitor {
 
-    private static final ConcurrentCache cache = new ConcurrentCache(5000);
+    private static final ConcurrentCache<String, Node> cache = new ConcurrentCache<String,
Node>(5000);
 
     private FunctionMapper fnMapper;
 
@@ -87,7 +87,7 @@
             throw new ELException(MessageFactory.get("error.null"));
         }
 
-        Node n = (Node) cache.get(expr);
+        Node n = cache.get(expr);
         if (n == null) {
             try {
                 n = (new ELParser(new StringReader(expr)))

Modified: tomcat/trunk/java/org/apache/el/lang/FunctionMapperImpl.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/el/lang/FunctionMapperImpl.java?rev=696714&r1=696713&r2=696714&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/el/lang/FunctionMapperImpl.java (original)
+++ tomcat/trunk/java/org/apache/el/lang/FunctionMapperImpl.java Thu Sep 18 10:03:38 2008
@@ -39,7 +39,7 @@
 
     private static final long serialVersionUID = 1L;
 
-    protected Map functions = null;
+    protected Map<String, Function> functions = null;
 
     /*
      * (non-Javadoc)
@@ -49,7 +49,7 @@
      */
     public Method resolveFunction(String prefix, String localName) {
         if (this.functions != null) {
-            Function f = (Function) this.functions.get(prefix + ":" + localName);
+            Function f = this.functions.get(prefix + ":" + localName);
             return f.getMethod();
         }
         return null;
@@ -57,7 +57,7 @@
 
     public void addFunction(String prefix, String localName, Method m) {
         if (this.functions == null) {
-            this.functions = new HashMap();
+            this.functions = new HashMap<String, Function>();
         }
         Function f = new Function(prefix, localName, m);
         synchronized (this) {
@@ -81,7 +81,7 @@
      */
     public void readExternal(ObjectInput in) throws IOException,
             ClassNotFoundException {
-        this.functions = (Map) in.readObject();
+        this.functions = (Map<String, Function>) in.readObject();
     }
 
     public static class Function implements Externalizable {

Modified: tomcat/trunk/java/org/apache/el/lang/VariableMapperImpl.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/el/lang/VariableMapperImpl.java?rev=696714&r1=696713&r2=696714&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/el/lang/VariableMapperImpl.java (original)
+++ tomcat/trunk/java/org/apache/el/lang/VariableMapperImpl.java Thu Sep 18 10:03:38 2008
@@ -31,23 +31,23 @@
 
     private static final long serialVersionUID = 1L;
 
-    private Map vars = new HashMap();
+    private Map<String, ValueExpression> vars = new HashMap<String, ValueExpression>();
 
     public VariableMapperImpl() {
         super();
     }
 
     public ValueExpression resolveVariable(String variable) {
-        return (ValueExpression) this.vars.get(variable);
+        return this.vars.get(variable);
     }
 
     public ValueExpression setVariable(String variable,
             ValueExpression expression) {
-        return (ValueExpression) this.vars.put(variable, expression);
+        return this.vars.put(variable, expression);
     }
 
     public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-        this.vars = (Map) in.readObject();
+        this.vars = (Map<String, ValueExpression>) in.readObject();
     }
 
     public void writeExternal(ObjectOutput out) throws IOException {



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message