tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1408776 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/jasper/el/JasperELResolver.java test/org/apache/jasper/el/ test/org/apache/jasper/el/TestJasperELResolver.java
Date Tue, 13 Nov 2012 15:15:52 GMT
Author: markt
Date: Tue Nov 13 15:15:51 2012
New Revision: 1408776

URL: http://svn.apache.org/viewvc?rev=1408776&view=rev
Log:
Optimisation suggested by kkolinko and a test case to make sure it does what it is meant to.
The test case is obvious but I missed something in my first look at the code so wrote the
test case which may as well be kept.

Added:
    tomcat/tc7.0.x/trunk/test/org/apache/jasper/el/
      - copied from r1408774, tomcat/trunk/test/org/apache/jasper/el/
Modified:
    tomcat/tc7.0.x/trunk/   (props changed)
    tomcat/tc7.0.x/trunk/java/org/apache/jasper/el/JasperELResolver.java
    tomcat/tc7.0.x/trunk/test/org/apache/jasper/el/TestJasperELResolver.java

Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
  Merged /tomcat/trunk:r1408774

Modified: tomcat/tc7.0.x/trunk/java/org/apache/jasper/el/JasperELResolver.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/jasper/el/JasperELResolver.java?rev=1408776&r1=1408775&r2=1408776&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/jasper/el/JasperELResolver.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/jasper/el/JasperELResolver.java Tue Nov 13 15:15:51
2012
@@ -44,8 +44,8 @@ public class JasperELResolver extends Co
 
     public JasperELResolver(List<ELResolver> appResolvers) {
         appResolversSize = appResolvers.size();
-        resolvers = new ELResolver[0];
-        size = resolvers.length;
+        resolvers = new ELResolver[appResolversSize + 7];
+        size = 0;
 
         add(new ImplicitObjectELResolver());
         for (ELResolver appResolver : appResolvers) {
@@ -63,11 +63,15 @@ public class JasperELResolver extends Co
     public synchronized void add(ELResolver elResolver) {
         super.add(elResolver);
 
-        ELResolver[] nr = new ELResolver[size + 1];
-        System.arraycopy(resolvers, 0, nr, 0, size);
-        nr[size] = elResolver;
+        if (resolvers.length < size) {
+            resolvers[size] = elResolver;
+        } else {
+            ELResolver[] nr = new ELResolver[size + 1];
+            System.arraycopy(resolvers, 0, nr, 0, size);
+            nr[size] = elResolver;
 
-        resolvers = nr;
+            resolvers = nr;
+        }
         size ++;
     }
 

Modified: tomcat/tc7.0.x/trunk/test/org/apache/jasper/el/TestJasperELResolver.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/jasper/el/TestJasperELResolver.java?rev=1408776&r1=1408774&r2=1408776&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/jasper/el/TestJasperELResolver.java (original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/jasper/el/TestJasperELResolver.java Tue Nov 13 15:15:51
2012
@@ -45,7 +45,7 @@ public class TestJasperELResolver {
 
     private void doTestConstructor(int count) throws Exception {
 
-        List<ELResolver> list = new ArrayList<>();
+        List<ELResolver> list = new ArrayList<ELResolver>();
         for (int i = 0; i < count; i++) {
             list.add(new ImplicitObjectELResolver());
         }



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


Mime
View raw message