Author: markt
Date: Wed Feb 13 22:47:39 2013
New Revision: 1445964

URL: http://svn.apache.org/r1445964
Log:
UCdetector
Reduce visibility, make fields final, remove unused code.

Modified:
    tomcat/trunk/java/org/apache/jasper/compiler/JavacErrorDetail.java
    tomcat/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java
    tomcat/trunk/java/org/apache/jasper/compiler/JspReader.java
    tomcat/trunk/java/org/apache/jasper/compiler/JspRuntimeContext.java
    tomcat/trunk/java/org/apache/jasper/compiler/JspUtil.java
    tomcat/trunk/java/org/apache/jasper/compiler/Localizer.java
    tomcat/trunk/java/org/apache/jasper/compiler/Mark.java
    tomcat/trunk/java/org/apache/jasper/compiler/Node.java

Modified: tomcat/trunk/java/org/apache/jasper/compiler/JavacErrorDetail.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/JavacErrorDetail.java?rev=1445964&r1=1445963&r2=1445964&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/JavacErrorDetail.java 
(original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/JavacErrorDetail.java Wed Feb 
13 22:47:39 2013
@@ -36,11 +36,11 @@ import org.apache.jasper.JspCompilationC
  */
 public class JavacErrorDetail {
 
-    private String javaFileName;
-    private int javaLineNum;
-    private String jspFileName;
+    private final String javaFileName;
+    private final int javaLineNum;
+    private final String jspFileName;
     private int jspBeginLineNum;
-    private StringBuilder errMsg;
+    private final StringBuilder errMsg;
     private String jspExtract = null;
 
     /**
@@ -55,10 +55,7 @@ public class JavacErrorDetail {
                             int javaLineNum,
                             StringBuilder errMsg) {
 
-        this.javaFileName = javaFileName;
-        this.javaLineNum = javaLineNum;
-        this.errMsg = errMsg;
-        this.jspBeginLineNum = -1;
+        this(javaFileName, javaLineNum, null, -1, errMsg, null);
     }
 
     /**
@@ -81,9 +78,10 @@ public class JavacErrorDetail {
             StringBuilder errMsg,
             JspCompilationContext ctxt) {
 
-        this(javaFileName, javaLineNum, errMsg);
+        this.javaFileName = javaFileName;
+        this.javaLineNum = javaLineNum;
+        this.errMsg = errMsg;
         this.jspFileName = jspFileName;
-        this.jspBeginLineNum = jspBeginLineNum;
 
         if (jspBeginLineNum > 0 && ctxt != null) {
             InputStream is = null;
@@ -114,7 +112,7 @@ public class JavacErrorDetail {
                     for (int i=jspBeginLineNum-1; i<jspLines.length; i++) {
                         if (jspLines[i].indexOf(javaLine) != -1) {
                             // Update jsp line number
-                            this.jspBeginLineNum = i+1;
+                            jspBeginLineNum = i+1;
                             break;
                         }
                     }
@@ -153,6 +151,7 @@ public class JavacErrorDetail {
                 }
             }
         }
+        this.jspBeginLineNum = jspBeginLineNum;
     }
 
     /**

Modified: tomcat/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java?rev=1445964&r1=1445963&r2=1445964&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java 
(original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java Wed Feb 
13 22:47:39 2013
@@ -58,10 +58,10 @@ class JspDocumentParser
         "http://xml.org/sax/properties/lexical-handler";;
     private static final String JSP_URI = "http://java.sun.com/JSP/Page";;
 
-    private ParserController parserController;
-    private JspCompilationContext ctxt;
-    private PageInfo pageInfo;
-    private String path;
+    private final ParserController parserController;
+    private final JspCompilationContext ctxt;
+    private final PageInfo pageInfo;
+    private final String path;
     private StringBuilder charBuffer;
 
     // Node representing the XML element currently being parsed
@@ -93,9 +93,9 @@ class JspDocumentParser
 
     private boolean isValidating;
 
-    private ErrorDispatcher err;
-    private boolean isTagFile;
-    private boolean directivesOnly;
+    private final ErrorDispatcher err;
+    private final boolean isTagFile;
+    private final boolean directivesOnly;
     private boolean isTop;
 
     // Nesting level of Tag dependent bodies

Modified: tomcat/trunk/java/org/apache/jasper/compiler/JspReader.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/JspReader.java?rev=1445964&r1=1445963&r2=1445964&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/JspReader.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/JspReader.java Wed Feb 13 
22:47:39 2013
@@ -67,7 +67,7 @@ class JspReader {
     /**
      * The list of source files.
      */
-    private List<String> sourceFiles;
+    private final List<String> sourceFiles;
 
     /**
      * The current file ID (-1 indicates an error or no file).
@@ -77,12 +77,12 @@ class JspReader {
     /**
      * The compilation context.
      */
-    private JspCompilationContext context;
+    private final JspCompilationContext context;
 
     /**
      * The Jasper error dispatcher.
      */
-    private ErrorDispatcher err;
+    private final ErrorDispatcher err;
 
     /**
      * Set to true when using the JspReader on a single file where we read up

Modified: tomcat/trunk/java/org/apache/jasper/compiler/JspRuntimeContext.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/JspRuntimeContext.java?rev=1445964&r1=1445963&r2=1445964&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/JspRuntimeContext.java 
(original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/JspRuntimeContext.java Wed Feb 
13 22:47:39 2013
@@ -67,12 +67,12 @@ public final class JspRuntimeContext {
     /*
      * Counts how many times the webapp's JSPs have been reloaded.
      */
-    private AtomicInteger jspReloadCount = new AtomicInteger(0);
+    private final AtomicInteger jspReloadCount = new AtomicInteger(0);
 
     /*
      * Counts how many times JSPs have been unloaded in this webapp.
      */
-    private AtomicInteger jspUnloadCount = new AtomicInteger(0);
+    private final AtomicInteger jspUnloadCount = new AtomicInteger(0);
 
     /**
      * Preload classes required at runtime by a JSP servlet so that
@@ -192,7 +192,8 @@ public final class JspRuntimeContext {
     /**
      * Maps JSP pages to their JspServletWrapper's
      */
-    private Map<String, JspServletWrapper> jsps = new ConcurrentHashMap<>();
+    private final Map<String, JspServletWrapper> jsps =
+            new ConcurrentHashMap<>();
 
     /**
      * Keeps JSP pages ordered by last access.
@@ -357,13 +358,6 @@ public final class JspRuntimeContext {
     }
 
     /**
-     * Increments the JSP unload counter.
-     */
-    public void incrementJspUnloadCount() {
-        jspUnloadCount.incrementAndGet();
-    }
-
-    /**
      * Gets the number of JSPs that have been unloaded.
      *
      * @return The number of JSPs (in the webapp with which this JspServlet is

Modified: tomcat/trunk/java/org/apache/jasper/compiler/JspUtil.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/JspUtil.java?rev=1445964&r1=1445963&r2=1445964&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/JspUtil.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/JspUtil.java Wed Feb 13 
22:47:39 2013
@@ -232,36 +232,10 @@ public class JspUtil {
         return sb.toString();
     }
 
-    /**
-     * Replaces any occurrences of the character <tt>replace</tt> with the
-     * string <tt>with</tt>.
-     */
-    public static String replace(String name, char replace, String with) {
-        StringBuilder buf = new StringBuilder();
-        int begin = 0;
-        int end;
-        int last = name.length();
-
-        while (true) {
-            end = name.indexOf(replace, begin);
-            if (end < 0) {
-                end = last;
-            }
-            buf.append(name.substring(begin, end));
-            if (end == last) {
-                break;
-            }
-            buf.append(with);
-            begin = end + 1;
-        }
-
-        return buf.toString();
-    }
-
     public static class ValidAttribute {
-        String name;
 
-        boolean mandatory;
+        private final String name;
+        private final boolean mandatory;
 
         public ValidAttribute(String name, boolean mandatory) {
             this.name = name;
@@ -907,31 +881,6 @@ public class JspUtil {
         return false;
     }
 
-    public static boolean isJavaIdentifier(String key) {
-        // Should not be the case but check to be sure
-        if (key == null || key.length() == 0) {
-            return false;
-        }
-
-        if (isJavaKeyword(key)) {
-            return false;
-        }
-
-        // Check the start character that has more restrictions
-        if (!Character.isJavaIdentifierStart(key.charAt(0))) {
-            return false;
-        }
-
-        // Check each remaining character used is permitted
-        for (int idx = 1; idx < key.length(); idx++) {
-            if (!Character.isJavaIdentifierPart(key.charAt(idx))) {
-                return false;
-            }
-        }
-
-        return true;
-    }
-
     static InputStreamReader getReader(String fname, String encoding,
             JarFile jarFile, JspCompilationContext ctxt, ErrorDispatcher err)
             throws JasperException, IOException {

Modified: tomcat/trunk/java/org/apache/jasper/compiler/Localizer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/Localizer.java?rev=1445964&r1=1445963&r2=1445964&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/Localizer.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/Localizer.java Wed Feb 13 
22:47:39 2013
@@ -31,12 +31,12 @@ import org.apache.jasper.util.ExceptionU
  */
 public class Localizer {
 
-    private static ResourceBundle bundle = null;
+    private static ResourceBundle bundle;
 
     static {
         try {
-        bundle = ResourceBundle.getBundle(
-            "org.apache.jasper.resources.LocalStrings");
+            bundle = ResourceBundle.getBundle(
+                    "org.apache.jasper.resources.LocalStrings");
         } catch (Throwable t) {
             ExceptionUtils.handleThrowable(t);
             t.printStackTrace();

Modified: tomcat/trunk/java/org/apache/jasper/compiler/Mark.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/Mark.java?rev=1445964&r1=1445963&r2=1445964&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/Mark.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/Mark.java Wed Feb 13 22:47:39 
2013
@@ -198,8 +198,6 @@ final class Mark {
     }
 
 
-    // -------------------- Locator interface --------------------
-
     public int getLineNumber() {
         return line;
     }
@@ -208,14 +206,6 @@ final class Mark {
         return col;
     }
 
-    public String getSystemId() {
-        return getFile();
-    }
-
-    public String getPublicId() {
-        return null;
-    }
-
     @Override
     public String toString() {
         return getFile()+"("+line+","+col+")";
@@ -267,12 +257,12 @@ final class Mark {
      * included file. In other words, it's the parser's continuation to be
      * reinstalled after the included file parsing is done.
      */
-    class IncludeState {
-        int cursor, line, col;
-        int fileId;
-        String fileName;
-        String baseDir;
-        char[] stream = null;
+    private class IncludeState {
+        private final int cursor, line, col;
+        private final int fileId;
+        private final String fileName;
+        private final String baseDir;
+        private final char[] stream;
 
         IncludeState(int inCursor, int inLine, int inCol, int inFileId,
                      String name, String inBaseDir, String inEncoding,

Modified: tomcat/trunk/java/org/apache/jasper/compiler/Node.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/Node.java?rev=1445964&r1=1445963&r2=1445964&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/Node.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/Node.java Wed Feb 13 22:47:39 
2013
@@ -93,13 +93,11 @@ abstract class Node implements TagConsta
      */
     protected String innerClassName;
 
-    private boolean isDummy;
 
     /**
      * Zero-arg Constructor.
      */
     public Node() {
-        this.isDummy = true;
     }
 
     /**
@@ -112,7 +110,6 @@ abstract class Node implements TagConsta
      */
     public Node(Mark start, Node parent) {
         this.startMark = start;
-        this.isDummy = (start == null);
         addToParent(parent);
     }
 
@@ -136,7 +133,6 @@ abstract class Node implements TagConsta
         this.localName = localName;
         this.attrs = attrs;
         this.startMark = start;
-        this.isDummy = (start == null);
         addToParent(parent);
     }
 
@@ -168,7 +164,6 @@ abstract class Node implements TagConsta
         this.nonTaglibXmlnsAttrs = nonTaglibXmlnsAttrs;
         this.taglibAttrs = taglibAttrs;
         this.startMark = start;
-        this.isDummy = (start == null);
         addToParent(parent);
     }
 
@@ -185,7 +180,6 @@ abstract class Node implements TagConsta
         this.localName = localName;
         this.text = text;
         this.startMark = start;
-        this.isDummy = (start == null);
         addToParent(parent);
     }
 
@@ -357,10 +351,6 @@ abstract class Node implements TagConsta
         endJavaLine = end;
     }
 
-    public boolean isDummy() {
-        return isDummy;
-    }
-
     public Node.Root getRoot() {
         Node n = this;
         while (!(n instanceof Node.Root)) {
@@ -413,9 +403,9 @@ abstract class Node implements TagConsta
      */
     public static class Root extends Node {
 
-        private Root parentRoot;
+        private final Root parentRoot;
 
-        private boolean isXmlSyntax;
+        private final boolean isXmlSyntax;
 
         // Source encoding of the page containing this Root
         private String pageEnc;
@@ -528,14 +518,6 @@ abstract class Node implements TagConsta
         }
 
         /**
-         * @return The enclosing root to this Root. Usually represents the page
-         *         that includes this one.
-         */
-        public Root getParentRoot() {
-            return parentRoot;
-        }
-
-        /**
          * Generates a new temporary variable name.
          */
         public String nextTemporaryVariableName() {
@@ -571,7 +553,7 @@ abstract class Node implements TagConsta
      */
     public static class PageDirective extends Node {
 
-        private Vector<String> imports;
+        private final Vector<String> imports;
 
         public PageDirective(Attributes attrs, Mark start, Node parent) {
             this(JSP_PAGE_DIRECTIVE_ACTION, attrs, null, null, start, parent);
@@ -660,7 +642,7 @@ abstract class Node implements TagConsta
      * Represents a tag directive
      */
     public static class TagDirective extends Node {
-        private Vector<String> imports;
+        private final Vector<String> imports;
 
         public TagDirective(Attributes attrs, Mark start, Node parent) {
             this(JSP_TAG_DIRECTIVE_ACTION, attrs, null, null, start, parent);
@@ -972,7 +954,7 @@ abstract class Node implements TagConsta
      */
     public static class ParamAction extends Node {
 
-        JspAttribute value;
+        private JspAttribute value;
 
         public ParamAction(Attributes attrs, Mark start, Node parent) {
             this(JSP_PARAM_ACTION, attrs, null, null, start, parent);
@@ -1164,7 +1146,7 @@ abstract class Node implements TagConsta
      */
     public static class UseBean extends Node {
 
-        JspAttribute beanName;
+        private JspAttribute beanName;
 
         public UseBean(Attributes attrs, Mark start, Node parent) {
             this(JSP_USE_BEAN_ACTION, attrs, null, null, start, parent);
@@ -1399,9 +1381,9 @@ abstract class Node implements TagConsta
      */
     public static class CustomTag extends Node {
 
-        private String uri;
+        private final String uri;
 
-        private String prefix;
+        private final String prefix;
 
         private JspAttribute[] jspAttrs;
 
@@ -1409,29 +1391,29 @@ abstract class Node implements TagConsta
 
         private String tagHandlerPoolName;
 
-        private TagInfo tagInfo;
+        private final TagInfo tagInfo;
 
-        private TagFileInfo tagFileInfo;
+        private final TagFileInfo tagFileInfo;
 
         private Class<?> tagHandlerClass;
 
         private VariableInfo[] varInfos;
 
-        private int customNestingLevel;
+        private final int customNestingLevel;
 
-        private ChildInfo childInfo;
+        private final ChildInfo childInfo;
 
-        private boolean implementsIterationTag;
+        private final boolean implementsIterationTag;
 
-        private boolean implementsBodyTag;
+        private final boolean implementsBodyTag;
 
-        private boolean implementsTryCatchFinally;
+        private final boolean implementsTryCatchFinally;
 
-        private boolean implementsJspIdConsumer;
+        private final boolean implementsJspIdConsumer;
 
-        private boolean implementsSimpleTag;
+        private final boolean implementsSimpleTag;
 
-        private boolean implementsDynamicAttributes;
+        private final boolean implementsDynamicAttributes;
 
         private List<Object> atBeginScriptingVars;
 
@@ -1480,6 +1462,7 @@ abstract class Node implements TagConsta
             this.uri = uri;
             this.prefix = prefix;
             this.tagInfo = tagInfo;
+            this.tagFileInfo = null;
             this.tagHandlerClass = tagHandlerClass;
             this.customNestingLevel = makeCustomNestingLevel();
             this.childInfo = new ChildInfo();
@@ -1812,9 +1795,9 @@ abstract class Node implements TagConsta
      * attribute (used by the tag plugin machinery only).
      */
     public static class AttributeGenerator extends Node {
-        String name; // name of the attribute
+        private String name; // name of the attribute
 
-        CustomTag tag; // The tag this attribute belongs to
+        private CustomTag tag; // The tag this attribute belongs to
 
         public AttributeGenerator(Mark start, String name, CustomTag tag) {
             super(start, null);
@@ -1868,9 +1851,9 @@ abstract class Node implements TagConsta
         // used with a <jsp:element>, otherwise false
         private JspAttribute omit;
 
-        private ChildInfo childInfo;
+        private final ChildInfo childInfo;
 
-        private String name;
+        private final String name;
 
         private String localName;
 
@@ -1957,7 +1940,7 @@ abstract class Node implements TagConsta
         public String getText() {
 
             class AttributeVisitor extends Visitor {
-                String attrValue = null;
+                private String attrValue = null;
 
                 @Override
                 public void visit(TemplateText txt) {
@@ -1991,7 +1974,7 @@ abstract class Node implements TagConsta
      */
     public static class JspBody extends Node {
 
-        private ChildInfo childInfo;
+        private final ChildInfo childInfo;
 
         public JspBody(Mark start, Node parent) {
             this(JSP_BODY_ACTION, null, null, start, parent);
@@ -2104,27 +2087,27 @@ abstract class Node implements TagConsta
 
     public static class JspAttribute {
 
-        private String qName;
+        private final String qName;
 
-        private String uri;
+        private final String uri;
 
-        private String localName;
+        private final String localName;
 
-        private String value;
+        private final String value;
 
-        private boolean expression;
+        private final boolean expression;
 
-        private boolean dynamic;
+        private final boolean dynamic;
 
         private final ELNode.Nodes el;
 
         private final TagAttributeInfo tai;
 
         // If true, this JspAttribute represents a <jsp:attribute>
-        private boolean namedAttribute;
+        private final boolean namedAttribute;
 
         // The node in the parse tree for the NamedAttribute
-        private NamedAttribute namedAttributeNode;
+        private final NamedAttribute namedAttributeNode;
 
         JspAttribute(TagAttributeInfo tai, String qName, String uri,
                 String localName, String value, boolean expr, ELNode.Nodes el,
@@ -2171,6 +2154,7 @@ abstract class Node implements TagConsta
             this.dynamic = dyn;
             this.namedAttribute = true;
             this.tai = tai;
+            this.uri = null;
         }
 
         /**
@@ -2326,7 +2310,7 @@ abstract class Node implements TagConsta
      */
     public static class Nodes {
 
-        private List<Node> list;
+        private final List<Node> list;
 
         private Node.Root root; // null if this is not a page
 



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

Reply via email to