tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1384074 - /tomcat/trunk/java/org/apache/jasper/runtime/
Date Wed, 12 Sep 2012 18:24:10 GMT
Author: markt
Date: Wed Sep 12 18:24:09 2012
New Revision: 1384074

URL: http://svn.apache.org/viewvc?rev=1384074&view=rev
Log:
Code clean-up:
 - Java 7 <>
 - UCdetector - use of final

Modified:
    tomcat/trunk/java/org/apache/jasper/runtime/JspApplicationContextImpl.java
    tomcat/trunk/java/org/apache/jasper/runtime/JspContextWrapper.java
    tomcat/trunk/java/org/apache/jasper/runtime/JspFactoryImpl.java
    tomcat/trunk/java/org/apache/jasper/runtime/JspFragmentHelper.java
    tomcat/trunk/java/org/apache/jasper/runtime/JspRuntimeLibrary.java
    tomcat/trunk/java/org/apache/jasper/runtime/JspWriterImpl.java
    tomcat/trunk/java/org/apache/jasper/runtime/PageContextImpl.java
    tomcat/trunk/java/org/apache/jasper/runtime/ProtectedFunctionMapper.java
    tomcat/trunk/java/org/apache/jasper/runtime/ServletResponseWrapperInclude.java

Modified: tomcat/trunk/java/org/apache/jasper/runtime/JspApplicationContextImpl.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/runtime/JspApplicationContextImpl.java?rev=1384074&r1=1384073&r2=1384074&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/runtime/JspApplicationContextImpl.java (original)
+++ tomcat/trunk/java/org/apache/jasper/runtime/JspApplicationContextImpl.java Wed Sep 12
18:24:09 2012
@@ -53,9 +53,9 @@ public class JspApplicationContextImpl i
     private final ExpressionFactory expressionFactory =
             ExpressionFactory.newInstance();
 
-    private final List<ELContextListener> contextListeners = new ArrayList<ELContextListener>();
+    private final List<ELContextListener> contextListeners = new ArrayList<>();
 
-    private final List<ELResolver> resolvers = new ArrayList<ELResolver>();
+    private final List<ELResolver> resolvers = new ArrayList<>();
 
     private boolean instantiated = false;
 

Modified: tomcat/trunk/java/org/apache/jasper/runtime/JspContextWrapper.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/runtime/JspContextWrapper.java?rev=1384074&r1=1384073&r2=1384074&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/runtime/JspContextWrapper.java (original)
+++ tomcat/trunk/java/org/apache/jasper/runtime/JspContextWrapper.java Wed Sep 12 18:24:09
2012
@@ -60,22 +60,22 @@ import org.apache.jasper.compiler.Locali
 public class JspContextWrapper extends PageContext implements VariableResolver {
 
     // Invoking JSP context
-    private PageContext invokingJspCtxt;
+    private final PageContext invokingJspCtxt;
 
-    private transient HashMap<String, Object> pageAttributes;
+    private final transient HashMap<String, Object> pageAttributes;
 
     // ArrayList of NESTED scripting variables
-    private ArrayList<String> nestedVars;
+    private final ArrayList<String> nestedVars;
 
     // ArrayList of AT_BEGIN scripting variables
-    private ArrayList<String> atBeginVars;
+    private final ArrayList<String> atBeginVars;
 
     // ArrayList of AT_END scripting variables
-    private ArrayList<String> atEndVars;
+    private final ArrayList<String> atEndVars;
 
-    private Map<String,String> aliases;
+    private final Map<String,String> aliases;
 
-    private HashMap<String, Object> originalNestedVars;
+    private final HashMap<String, Object> originalNestedVars;
 
     public JspContextWrapper(JspContext jspContext,
             ArrayList<String> nestedVars, ArrayList<String> atBeginVars,
@@ -84,11 +84,13 @@ public class JspContextWrapper extends P
         this.nestedVars = nestedVars;
         this.atBeginVars = atBeginVars;
         this.atEndVars = atEndVars;
-        this.pageAttributes = new HashMap<String, Object>(16);
+        this.pageAttributes = new HashMap<>(16);
         this.aliases = aliases;
 
         if (nestedVars != null) {
-            this.originalNestedVars = new HashMap<String, Object>(nestedVars.size());
+            this.originalNestedVars = new HashMap<>(nestedVars.size());
+        } else {
+            this.originalNestedVars = null;
         }
         syncBeginTagFile();
     }

Modified: tomcat/trunk/java/org/apache/jasper/runtime/JspFactoryImpl.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/runtime/JspFactoryImpl.java?rev=1384074&r1=1384073&r2=1384074&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/runtime/JspFactoryImpl.java (original)
+++ tomcat/trunk/java/org/apache/jasper/runtime/JspFactoryImpl.java Wed Sep 12 18:24:09 2012
@@ -30,8 +30,6 @@ import javax.servlet.jsp.JspFactory;
 import javax.servlet.jsp.PageContext;
 
 import org.apache.jasper.Constants;
-import org.apache.juli.logging.Log;
-import org.apache.juli.logging.LogFactory;
 
 /**
  * Implementation of JspFactory.
@@ -40,16 +38,13 @@ import org.apache.juli.logging.LogFactor
  */
 public class JspFactoryImpl extends JspFactory {
 
-    // Logger
-    private final Log log = LogFactory.getLog(JspFactoryImpl.class);
-
     private static final String SPEC_VERSION = "2.1";
     private static final boolean USE_POOL =
         Boolean.valueOf(System.getProperty("org.apache.jasper.runtime.JspFactoryImpl.USE_POOL",
"true")).booleanValue();
     private static final int POOL_SIZE =
         Integer.valueOf(System.getProperty("org.apache.jasper.runtime.JspFactoryImpl.POOL_SIZE",
"8")).intValue();
 
-    private ThreadLocal<PageContextPool> localPool = new ThreadLocal<PageContextPool>();
+    private final ThreadLocal<PageContextPool> localPool = new ThreadLocal<>();
 
     @Override
     public PageContext getPageContext(Servlet servlet, ServletRequest request,
@@ -181,7 +176,7 @@ public class JspFactoryImpl extends JspF
 
     protected static final class PageContextPool  {
 
-        private PageContext[] pool;
+        private final PageContext[] pool;
 
         private int current = -1;
 

Modified: tomcat/trunk/java/org/apache/jasper/runtime/JspFragmentHelper.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/runtime/JspFragmentHelper.java?rev=1384074&r1=1384073&r2=1384074&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/runtime/JspFragmentHelper.java (original)
+++ tomcat/trunk/java/org/apache/jasper/runtime/JspFragmentHelper.java Wed Sep 12 18:24:09
2012
@@ -33,23 +33,22 @@ import javax.servlet.jsp.tagext.JspTag;
  *
  * @author Mark Roth
  */
-public abstract class JspFragmentHelper
-    extends JspFragment
-{
+public abstract class JspFragmentHelper extends JspFragment {
 
-    protected int discriminator;
-    protected JspContext jspContext;
-    protected PageContext _jspx_page_context;
-    protected JspTag parentTag;
+    protected final int discriminator;
+    protected final JspContext jspContext;
+    protected final PageContext _jspx_page_context;
+    protected final JspTag parentTag;
 
     public JspFragmentHelper( int discriminator, JspContext jspContext,
         JspTag parentTag )
     {
         this.discriminator = discriminator;
         this.jspContext = jspContext;
-        this._jspx_page_context = null;
-        if( jspContext instanceof PageContext ) {
+        if(jspContext instanceof PageContext) {
             _jspx_page_context = (PageContext)jspContext;
+        } else {
+            _jspx_page_context = null;
         }
         this.parentTag = parentTag;
     }

Modified: tomcat/trunk/java/org/apache/jasper/runtime/JspRuntimeLibrary.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/runtime/JspRuntimeLibrary.java?rev=1384074&r1=1384073&r2=1384074&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/runtime/JspRuntimeLibrary.java (original)
+++ tomcat/trunk/java/org/apache/jasper/runtime/JspRuntimeLibrary.java Wed Sep 12 18:24:09
2012
@@ -190,8 +190,11 @@ public class JspRuntimeLibrary {
         } else if (target == Character.class) {
             if (isNullOrEmpty)
                 return Character.valueOf((char) 0);
-            else
-                return Character.valueOf(s.charAt(0));
+            else {
+                @SuppressWarnings("null")
+                Character result = Character.valueOf(s.charAt(0));
+                return result;
+            }
         } else if (target == Double.class) {
             if (isNullOrEmpty)
                 return Double.valueOf(0);
@@ -331,7 +334,7 @@ public class JspRuntimeLibrary {
                     }
                 }
             }
-            if ( method != null ) {
+            if (method != null && type != null) {
                 if (type.isArray()) {
                     if (request == null) {
                         throw new JasperException(

Modified: tomcat/trunk/java/org/apache/jasper/runtime/JspWriterImpl.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/runtime/JspWriterImpl.java?rev=1384074&r1=1384073&r2=1384074&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/runtime/JspWriterImpl.java (original)
+++ tomcat/trunk/java/org/apache/jasper/runtime/JspWriterImpl.java Wed Sep 12 18:24:09 2012
@@ -355,7 +355,7 @@ public class JspWriterImpl extends JspWr
     }
 
 
-    static String lineSeparator = System.getProperty("line.separator");
+    static final String lineSeparator = System.getProperty("line.separator");
 
     /**
      * Write a line separator.  The line separator string is defined by the

Modified: tomcat/trunk/java/org/apache/jasper/runtime/PageContextImpl.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/runtime/PageContextImpl.java?rev=1384074&r1=1384073&r2=1384074&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/runtime/PageContextImpl.java (original)
+++ tomcat/trunk/java/org/apache/jasper/runtime/PageContextImpl.java Wed Sep 12 18:24:09 2012
@@ -112,7 +112,7 @@ public class PageContextImpl extends Pag
      */
     PageContextImpl() {
         this.outs = new BodyContentImpl[0];
-        this.attributes = new HashMap<String, Object>(16);
+        this.attributes = new HashMap<>(16);
         this.depth = -1;
     }
 

Modified: tomcat/trunk/java/org/apache/jasper/runtime/ProtectedFunctionMapper.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/runtime/ProtectedFunctionMapper.java?rev=1384074&r1=1384073&r2=1384074&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/runtime/ProtectedFunctionMapper.java (original)
+++ tomcat/trunk/java/org/apache/jasper/runtime/ProtectedFunctionMapper.java Wed Sep 12 18:24:09
2012
@@ -75,7 +75,7 @@ public final class ProtectedFunctionMapp
         } else {
             funcMapper = new ProtectedFunctionMapper();
         }
-        funcMapper.fnmap = new HashMap<String,Method>();
+        funcMapper.fnmap = new HashMap<>();
         return funcMapper;
     }
 

Modified: tomcat/trunk/java/org/apache/jasper/runtime/ServletResponseWrapperInclude.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/runtime/ServletResponseWrapperInclude.java?rev=1384074&r1=1384073&r2=1384074&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/runtime/ServletResponseWrapperInclude.java (original)
+++ tomcat/trunk/java/org/apache/jasper/runtime/ServletResponseWrapperInclude.java Wed Sep
12 18:24:09 2012
@@ -41,9 +41,9 @@ public class ServletResponseWrapperInclu
     /**
      * PrintWriter which appends to the JspWriter of the including page.
      */
-    private PrintWriter printWriter;
+    private final PrintWriter printWriter;
 
-    private JspWriter jspWriter;
+    private final JspWriter jspWriter;
 
     public ServletResponseWrapperInclude(ServletResponse response,
                                          JspWriter jspWriter) {



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


Mime
View raw message