commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r742537 - /commons/sandbox/xml/trunk/src/main/java/org/apache/commons/xml/SerializingContentHandler.java
Date Mon, 09 Feb 2009 14:47:12 GMT
Author: jukka
Date: Mon Feb  9 14:47:12 2009
New Revision: 742537

URL: http://svn.apache.org/viewvc?rev=742537&view=rev
Log:
xml: Upgrade SerializingContentHandler to use Java 5 features internally

Modified:
    commons/sandbox/xml/trunk/src/main/java/org/apache/commons/xml/SerializingContentHandler.java

Modified: commons/sandbox/xml/trunk/src/main/java/org/apache/commons/xml/SerializingContentHandler.java
URL: http://svn.apache.org/viewvc/commons/sandbox/xml/trunk/src/main/java/org/apache/commons/xml/SerializingContentHandler.java?rev=742537&r1=742536&r2=742537&view=diff
==============================================================================
--- commons/sandbox/xml/trunk/src/main/java/org/apache/commons/xml/SerializingContentHandler.java
(original)
+++ commons/sandbox/xml/trunk/src/main/java/org/apache/commons/xml/SerializingContentHandler.java
Mon Feb  9 14:47:12 2009
@@ -21,7 +21,6 @@
 import java.io.Writer;
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
@@ -174,19 +173,19 @@
     /**
      * The prefixes of startPrefixMapping() declarations for the coming element.
      */
-    private List prefixList = new ArrayList();
+    private List<String> prefixList = new ArrayList<String>();
 
     /**
      * The URIs of startPrefixMapping() declarations for the coming element.
      */
-    private List uriList = new ArrayList();
+    private List<String> uriList = new ArrayList<String>();
 
     /**
      * Maps of URI<->prefix mappings. Used to work around a bug in the Xalan
      * serializer.
      */
-    private Map uriToPrefixMap = new HashMap();
-    private Map prefixToUriMap = new HashMap();
+    private Map<String, String> uriToPrefixMap = new HashMap<String, String>();
+    private Map<String, String> prefixToUriMap = new HashMap<String, String>();
 
     /**
      * True if there has been some startPrefixMapping() for the coming element.
@@ -207,7 +206,7 @@
      * @see #checkPrefixMapping(String, String)
      * @see <a href="https://issues.apache.org/jira/browse/JCR-1767">JCR-1767</a>
      */
-    private final List addedPrefixMappings = new ArrayList();
+    private final List<List<String>> addedPrefixMappings = new ArrayList<List<String>>();
 
     private SerializingContentHandler(ContentHandler handler) {
         super(handler);
@@ -280,9 +279,9 @@
             }
 
             int last = addedPrefixMappings.size() - 1;
-            List prefixes = (List) addedPrefixMappings.get(last);
+            List<String> prefixes = addedPrefixMappings.get(last);
             if (prefixes == null) {
-                prefixes = new ArrayList();
+                prefixes = new ArrayList<String>();
                 addedPrefixMappings.set(last, prefixes);
             }
             prefixes.add(prefix);
@@ -386,11 +385,10 @@
 
         // JCR-1767: Generate extra prefix un-mapping calls where needed
         int last = addedPrefixMappings.size() - 1;
-        List prefixes = (List) addedPrefixMappings.remove(last);
+        List<String> prefixes = addedPrefixMappings.remove(last);
         if (prefixes != null) {
-            Iterator iterator = prefixes.iterator();
-            while (iterator.hasNext()) {
-                endPrefixMapping((String) iterator.next());
+            for (String prefix : prefixes) {
+                endPrefixMapping(prefix);
             }
         }
     }



Mime
View raw message