You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2009/04/08 17:25:05 UTC

svn commit: r763281 - in /tomcat/trunk/java/org/apache/jasper: Constants.java compiler/PageInfo.java xmlparser/ParserUtils.java

Author: markt
Date: Wed Apr  8 15:25:05 2009
New Revision: 763281

URL: http://svn.apache.org/viewvc?rev=763281&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=46986
Find bugs was complaining although these have not been reported as causing issues for any users.

Modified:
    tomcat/trunk/java/org/apache/jasper/Constants.java
    tomcat/trunk/java/org/apache/jasper/compiler/PageInfo.java
    tomcat/trunk/java/org/apache/jasper/xmlparser/ParserUtils.java

Modified: tomcat/trunk/java/org/apache/jasper/Constants.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/Constants.java?rev=763281&r1=763280&r2=763281&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/Constants.java (original)
+++ tomcat/trunk/java/org/apache/jasper/Constants.java Wed Apr  8 15:25:05 2009
@@ -17,6 +17,10 @@
 
 package org.apache.jasper;
 
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
 
 /**
  * Some constants and other global data that are used by the compiler and the runtime.
@@ -51,11 +55,13 @@
      * These classes/packages are automatically imported by the
      * generated code. 
      */
-    public static final String[] STANDARD_IMPORTS = { 
+    private static final String[] PRIVATE_STANDARD_IMPORTS = { 
 	"javax.servlet.*", 
 	"javax.servlet.http.*", 
 	"javax.servlet.jsp.*"
     };
+    public static final List<String> STANDARD_IMPORTS =
+        Collections.unmodifiableList(Arrays.asList(PRIVATE_STANDARD_IMPORTS));
 
     /**
      * ServletContext attribute for classpath. This is tomcat specific. 
@@ -152,18 +158,25 @@
      * an EntityResolver to return the location of the
      * cached copy of a DTD.
      */
-    public static final String[] CACHED_DTD_PUBLIC_IDS = {
+    // TODO Add 2.4, 2.5, 3.0
+    private static final String[] PRIVATE_CACHED_DTD_PUBLIC_IDS = {
 	TAGLIB_DTD_PUBLIC_ID_11,
 	TAGLIB_DTD_PUBLIC_ID_12,
 	WEBAPP_DTD_PUBLIC_ID_22,
 	WEBAPP_DTD_PUBLIC_ID_23,
     };
-    public static final String[] CACHED_DTD_RESOURCE_PATHS = {
+    public static final List<String> CACHED_DTD_PUBLIC_IDS =
+        Collections.unmodifiableList(
+                Arrays.asList(PRIVATE_CACHED_DTD_PUBLIC_IDS));
+    private static final String[] PRIVATE_CACHED_DTD_RESOURCE_PATHS = {
 	TAGLIB_DTD_RESOURCE_PATH_11,
 	TAGLIB_DTD_RESOURCE_PATH_12,
 	WEBAPP_DTD_RESOURCE_PATH_22,
 	WEBAPP_DTD_RESOURCE_PATH_23,
     };
+    public static final List<String> CACHED_DTD_RESOURCE_PATHS =
+        Collections.unmodifiableList(
+                Arrays.asList(PRIVATE_CACHED_DTD_RESOURCE_PATHS));
     
     /**
      * Default URLs to download the pluging for Netscape and IE.

Modified: tomcat/trunk/java/org/apache/jasper/compiler/PageInfo.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/PageInfo.java?rev=763281&r1=763280&r2=763281&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/PageInfo.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/PageInfo.java Wed Apr  8 15:25:05 2009
@@ -110,8 +110,7 @@
         this.prefixes = new HashSet<String>();
 
         // Enter standard imports
-        for(int i = 0; i < Constants.STANDARD_IMPORTS.length; i++)
-            imports.add(Constants.STANDARD_IMPORTS[i]);
+        imports.addAll(Constants.STANDARD_IMPORTS);
     }
 
     /**

Modified: tomcat/trunk/java/org/apache/jasper/xmlparser/ParserUtils.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/xmlparser/ParserUtils.java?rev=763281&r1=763280&r2=763281&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/xmlparser/ParserUtils.java (original)
+++ tomcat/trunk/java/org/apache/jasper/xmlparser/ParserUtils.java Wed Apr  8 15:25:05 2009
@@ -193,10 +193,11 @@
 
     public InputSource resolveEntity(String publicId, String systemId)
             throws SAXException {
-        for (int i = 0; i < Constants.CACHED_DTD_PUBLIC_IDS.length; i++) {
-            String cachedDtdPublicId = Constants.CACHED_DTD_PUBLIC_IDS[i];
+        for (int i = 0; i < Constants.CACHED_DTD_PUBLIC_IDS.size(); i++) {
+            String cachedDtdPublicId = Constants.CACHED_DTD_PUBLIC_IDS.get(i);
             if (cachedDtdPublicId.equals(publicId)) {
-                String resourcePath = Constants.CACHED_DTD_RESOURCE_PATHS[i];
+                String resourcePath =
+                    Constants.CACHED_DTD_RESOURCE_PATHS.get(i);
                 InputStream input = this.getClass().getResourceAsStream(
                         resourcePath);
                 if (input == null) {



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