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 2008/11/23 22:29:47 UTC

svn commit: r720049 [2/2] - in /tomcat/trunk/java/org/apache/jasper: ./ compiler/ runtime/ servlet/ xmlparser/

Modified: tomcat/trunk/java/org/apache/jasper/compiler/TagPluginManager.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/TagPluginManager.java?rev=720049&r1=720048&r2=720049&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/TagPluginManager.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/TagPluginManager.java Sun Nov 23 13:29:46 2008
@@ -38,7 +38,7 @@
     private static final String TAG_PLUGINS_ROOT_ELEM = "tag-plugins";
 
     private boolean initialized = false;
-    private HashMap tagPlugins = null;
+    private HashMap<String, TagPlugin> tagPlugins = null;
     private ServletContext ctxt;
     private PageInfo pageInfo;
 
@@ -85,10 +85,10 @@
 			 TAG_PLUGINS_ROOT_ELEM);
 	}
 
-	tagPlugins = new HashMap();
-	Iterator pluginList = root.findChildren("tag-plugin");
+	tagPlugins = new HashMap<String, TagPlugin>();
+	Iterator<TreeNode> pluginList = root.findChildren("tag-plugin");
 	while (pluginList.hasNext()) {
-	    TreeNode pluginNode = (TreeNode) pluginList.next();
+	    TreeNode pluginNode = pluginList.next();
             TreeNode tagClassNode = pluginNode.findChild("tag-class");
 	    if (tagClassNode == null) {
 		// Error
@@ -104,7 +104,7 @@
 	    String pluginClassStr = pluginClassNode.getBody();
 	    TagPlugin tagPlugin = null;
 	    try {
-		Class pluginClass = Class.forName(pluginClassStr);
+		Class<?> pluginClass = Class.forName(pluginClassStr);
 		tagPlugin = (TagPlugin) pluginClass.newInstance();
 	    } catch (Exception e) {
 		throw new JasperException(e);
@@ -124,8 +124,7 @@
      * The given custom tag node will be manipulated by the plugin.
      */
     private void invokePlugin(Node.CustomTag n) {
-	TagPlugin tagPlugin = (TagPlugin)
-		tagPlugins.get(n.getTagHandlerClass().getName());
+	TagPlugin tagPlugin = tagPlugins.get(n.getTagHandlerClass().getName());
 	if (tagPlugin == null) {
 	    return;
 	}
@@ -139,7 +138,7 @@
 	private Node.CustomTag node;
 	private Node.Nodes curNodes;
 	private PageInfo pageInfo;
-	private HashMap pluginAttributes;
+	private HashMap<String, Object> pluginAttributes;
 
 	TagPluginContextImpl(Node.CustomTag n, PageInfo pageInfo) {
 	    this.node = n;
@@ -149,7 +148,7 @@
 	    curNodes = new Node.Nodes();
 	    n.setAtSTag(curNodes);
 	    n.setUseTagPlugin(true);
-	    pluginAttributes = new HashMap();
+	    pluginAttributes = new HashMap<String, Object>();
         }
 
         public TagPluginContext getParentContext() {

Modified: tomcat/trunk/java/org/apache/jasper/compiler/TldLocationsCache.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/TldLocationsCache.java?rev=720049&r1=720048&r2=720049&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/TldLocationsCache.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/TldLocationsCache.java Sun Nov 23 13:29:46 2008
@@ -101,7 +101,7 @@
      *    [0] The location
      *    [1] If the location is a jar file, this is the location of the tld.
      */
-    private Hashtable mappings;
+    private Hashtable<String, String[]> mappings;
 
     private boolean initialized;
     private ServletContext ctxt;
@@ -178,7 +178,7 @@
     public TldLocationsCache(ServletContext ctxt, boolean redeployMode) {
         this.ctxt = ctxt;
         this.redeployMode = redeployMode;
-        mappings = new Hashtable();
+        mappings = new Hashtable<String, String[]>();
         initialized = false;
     }
 
@@ -218,7 +218,7 @@
         if (!initialized) {
             init();
         }
-        return (String[]) mappings.get(uri);
+        return mappings.get(uri);
     }
 
     /** 
@@ -302,11 +302,11 @@
             if (jspConfig != null) {
                 webtld = jspConfig;
             }
-            Iterator taglibs = webtld.findChildren("taglib");
+            Iterator<TreeNode> taglibs = webtld.findChildren("taglib");
             while (taglibs.hasNext()) {
 
                 // Parse the next <taglib> element
-                TreeNode taglib = (TreeNode) taglibs.next();
+                TreeNode taglib = taglibs.next();
                 String tagUri = null;
                 String tagLoc = null;
                 TreeNode child = taglib.findChild("taglib-uri");
@@ -356,9 +356,9 @@
                 conn.setUseCaches(false);
             }
             jarFile = conn.getJarFile();
-            Enumeration entries = jarFile.entries();
+            Enumeration<JarEntry> entries = jarFile.entries();
             while (entries.hasMoreElements()) {
-                JarEntry entry = (JarEntry) entries.nextElement();
+                JarEntry entry = entries.nextElement();
                 String name = entry.getName();
                 if (!name.startsWith("META-INF/")) continue;
                 if (!name.endsWith(".tld")) continue;
@@ -416,11 +416,11 @@
     private void processTldsInFileSystem(String startPath)
             throws Exception {
 
-        Set dirList = ctxt.getResourcePaths(startPath);
+        Set<String> dirList = ctxt.getResourcePaths(startPath);
         if (dirList != null) {
-            Iterator it = dirList.iterator();
+            Iterator<String> it = dirList.iterator();
             while (it.hasNext()) {
-                String path = (String) it.next();
+                String path = it.next();
                 if (path.endsWith("/")) {
                     processTldsInFileSystem(path);
                 }

Modified: tomcat/trunk/java/org/apache/jasper/compiler/Validator.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/Validator.java?rev=720049&r1=720048&r2=720049&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/Validator.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/Validator.java Sun Nov 23 13:29:46 2008
@@ -1736,8 +1736,8 @@
         StringBuffer errMsg = null;
         ErrorDispatcher errDisp = compiler.getErrorDispatcher();
 
-        for (Iterator iter = compiler.getPageInfo().getTaglibs().iterator(); iter
-                .hasNext();) {
+        for (Iterator<TagLibraryInfo> iter =
+            compiler.getPageInfo().getTaglibs().iterator(); iter.hasNext();) {
 
             Object o = iter.next();
             if (!(o instanceof TagLibraryInfoImpl))

Modified: tomcat/trunk/java/org/apache/jasper/runtime/JspSourceDependent.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/runtime/JspSourceDependent.java?rev=720049&r1=720048&r2=720049&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/runtime/JspSourceDependent.java (original)
+++ tomcat/trunk/java/org/apache/jasper/runtime/JspSourceDependent.java Sun Nov 23 13:29:46 2008
@@ -17,6 +17,8 @@
 
 package org.apache.jasper.runtime;
 
+import java.util.List;
+
 /**
  * Interface for tracking the source files dependencies, for the purpose
  * of compiling out of date pages.  This is used for
@@ -32,8 +34,6 @@
     * Returns a list of files names that the current page has a source
     * dependency on.
     */
-    // FIXME: Type used is Object due to very weird behavior 
-    // with Eclipse JDT 3.1 in Java 5 mode
-    public Object getDependants();
+    public List<String> getDependants();
 
 }

Modified: tomcat/trunk/java/org/apache/jasper/servlet/JspServletWrapper.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/servlet/JspServletWrapper.java?rev=720049&r1=720048&r2=720049&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/servlet/JspServletWrapper.java (original)
+++ tomcat/trunk/java/org/apache/jasper/servlet/JspServletWrapper.java Sun Nov 23 13:29:46 2008
@@ -245,7 +245,7 @@
     /**
      * Get a list of files that the current page has source dependency on.
      */
-    public java.util.List getDependants() {
+    public java.util.List<String> getDependants() {
         try {
             Object target;
             if (isTagFile) {

Modified: tomcat/trunk/java/org/apache/jasper/xmlparser/TreeNode.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/xmlparser/TreeNode.java?rev=720049&r1=720048&r2=720049&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/xmlparser/TreeNode.java (original)
+++ tomcat/trunk/java/org/apache/jasper/xmlparser/TreeNode.java Sun Nov 23 13:29:46 2008
@@ -91,7 +91,7 @@
     /**
      * The children of this node, instantiated only if required.
      */
-    protected ArrayList children = null;
+    protected ArrayList<TreeNode> children = null;
 
 
     /**
@@ -133,7 +133,7 @@
     public void addChild(TreeNode node) {
 
         if (children == null)
-            children = new ArrayList();
+            children = new ArrayList<TreeNode>();
         children.add(node);
 
     }
@@ -194,7 +194,7 @@
      * Return an Iterator of all children of this node.  If there are no
      * children, an empty Iterator is returned.
      */
-    public Iterator findChildren() {
+    public Iterator<TreeNode> findChildren() {
 
         if (children == null)
             return (Collections.EMPTY_LIST.iterator());
@@ -211,15 +211,15 @@
      *
      * @param name Name used to select children
      */
-    public Iterator findChildren(String name) {
+    public Iterator<TreeNode> findChildren(String name) {
 
         if (children == null)
             return (Collections.EMPTY_LIST.iterator());
 
-        ArrayList results = new ArrayList();
-        Iterator items = children.iterator();
+        ArrayList<TreeNode> results = new ArrayList<TreeNode>();
+        Iterator<TreeNode> items = children.iterator();
         while (items.hasNext()) {
-            TreeNode item = (TreeNode) items.next();
+            TreeNode item = items.next();
             if (name.equals(item.getName()))
                 results.add(item);
         }



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