Author: markt
Date: Sat Mar  7 20:39:58 2009
New Revision: 751326

URL: http://svn.apache.org/viewvc?rev=751326&view=rev
Log:
Fix Eclipse warnings in this package

Modified:
    tomcat/trunk/java/org/apache/jasper/xmlparser/TreeNode.java
    tomcat/trunk/java/org/apache/jasper/xmlparser/UTF8Reader.java
    tomcat/trunk/java/org/apache/jasper/xmlparser/XMLEncodingDetector.java

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=751326&r1=751325&r2=751326&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/xmlparser/TreeNode.java (original)
+++ tomcat/trunk/java/org/apache/jasper/xmlparser/TreeNode.java Sat Mar  7 
20:39:58 2009
@@ -20,6 +20,7 @@
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Iterator;
 
 
@@ -79,7 +80,7 @@
      * The attributes of this node, keyed by attribute name,
      * Instantiated only if required.
      */
-    protected HashMap attributes = null;
+    protected HashMap<String,String> attributes = null;
 
 
     /**
@@ -119,7 +120,7 @@
     public void addAttribute(String name, String value) {
 
         if (attributes == null)
-            attributes = new HashMap();
+            attributes = new HashMap<String,String>();
         attributes.put(name, value);
 
     }
@@ -148,9 +149,9 @@
     public String findAttribute(String name) {
 
         if (attributes == null)
-            return (null);
+            return null;
         else
-            return ((String) attributes.get(name));
+            return attributes.get(name);
 
     }
 
@@ -159,12 +160,13 @@
      * Return an Iterator of the attribute names of this node.  If there are
      * no attributes, an empty Iterator is returned.
      */
-    public Iterator findAttributes() {
+    public Iterator<String> findAttributes() {
 
-        if (attributes == null)
-            return (Collections.EMPTY_LIST.iterator());
-        else
-            return (attributes.keySet().iterator());
+        if (attributes == null) {
+            List<String> empty = Collections.emptyList(); 
+            return empty.iterator();
+        } else
+            return attributes.keySet().iterator();
 
     }
 
@@ -179,9 +181,9 @@
 
         if (children == null)
             return (null);
-        Iterator items = children.iterator();
+        Iterator<TreeNode> items = children.iterator();
         while (items.hasNext()) {
-            TreeNode item = (TreeNode) items.next();
+            TreeNode item = items.next();
             if (name.equals(item.getName()))
                 return (item);
         }
@@ -196,10 +198,11 @@
      */
     public Iterator<TreeNode> findChildren() {
 
-        if (children == null)
-            return (Collections.EMPTY_LIST.iterator());
-        else
-            return (children.iterator());
+        if (children == null) {
+            List<TreeNode> empty = Collections.emptyList(); 
+            return empty.iterator();
+        } else
+            return children.iterator();
 
     }
 
@@ -213,8 +216,10 @@
      */
     public Iterator<TreeNode> findChildren(String name) {
 
-        if (children == null)
-            return (Collections.EMPTY_LIST.iterator());
+        if (children == null) {
+            List<TreeNode> empty = Collections.emptyList(); 
+            return empty.iterator();
+        } 
 
         ArrayList<TreeNode> results = new ArrayList<TreeNode>();
         Iterator<TreeNode> items = children.iterator();
@@ -319,10 +324,10 @@
             sb.append(' ');
         sb.append('<');
         sb.append(node.getName());
-        Iterator names = node.findAttributes();
+        Iterator<String> names = node.findAttributes();
         while (names.hasNext()) {
             sb.append(' ');
-            String name = (String) names.next();
+            String name = names.next();
             sb.append(name);
             sb.append("=\"");
             String value = node.findAttribute(name);
@@ -341,9 +346,9 @@
         }
 
         // Reconstruct child nodes with extra indentation
-        Iterator children = node.findChildren();
+        Iterator<TreeNode> children = node.findChildren();
         while (children.hasNext()) {
-            TreeNode child = (TreeNode) children.next();
+            TreeNode child = children.next();
             toString(sb, indent2, child);
         }
 

Modified: tomcat/trunk/java/org/apache/jasper/xmlparser/UTF8Reader.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/xmlparser/UTF8Reader.java?rev=751326&r1=751325&r2=751326&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/xmlparser/UTF8Reader.java (original)
+++ tomcat/trunk/java/org/apache/jasper/xmlparser/UTF8Reader.java Sat Mar  7 
20:39:58 2009
@@ -126,7 +126,7 @@
                     expectedByte(2, 2);
                 }
                 if ((b1 & 0xC0) != 0x80) {
-                    invalidByte(2, 2, b1);
+                    invalidByte(2, 2);
                 }
                 c = ((b0 << 6) & 0x07C0) | (b1 & 0x003F);
             }
@@ -140,7 +140,7 @@
                     expectedByte(2, 3);
                 }
                 if ((b1 & 0xC0) != 0x80) {
-                    invalidByte(2, 3, b1);
+                    invalidByte(2, 3);
                 }
                 int b2 = index == fOffset 
                        ? fInputStream.read() : fBuffer[index++] & 0x00FF;
@@ -148,7 +148,7 @@
                     expectedByte(3, 3);
                 }
                 if ((b2 & 0xC0) != 0x80) {
-                    invalidByte(3, 3, b2);
+                    invalidByte(3, 3);
                 }
                 c = ((b0 << 12) & 0xF000) | ((b1 << 6) & 0x0FC0) |
                     (b2 & 0x003F);
@@ -165,7 +165,7 @@
                     expectedByte(2, 4);
                 }
                 if ((b1 & 0xC0) != 0x80) {
-                    invalidByte(2, 3, b1);
+                    invalidByte(2, 3);
                 }
                 int b2 = index == fOffset 
                        ? fInputStream.read() : fBuffer[index++] & 0x00FF;
@@ -173,7 +173,7 @@
                     expectedByte(3, 4);
                 }
                 if ((b2 & 0xC0) != 0x80) {
-                    invalidByte(3, 3, b2);
+                    invalidByte(3, 3);
                 }
                 int b3 = index == fOffset 
                        ? fInputStream.read() : fBuffer[index++] & 0x00FF;
@@ -181,7 +181,7 @@
                     expectedByte(4, 4);
                 }
                 if ((b3 & 0xC0) != 0x80) {
-                    invalidByte(4, 4, b3);
+                    invalidByte(4, 4);
                 }
                 int uuuuu = ((b0 << 2) & 0x001C) | ((b1 >> 4) & 0x0003);
                 if (uuuuu > 0x10) {
@@ -198,7 +198,7 @@
 
             // error
             else {
-                invalidByte(1, 1, b0);
+                invalidByte(1, 1);
             }
         }
 
@@ -307,7 +307,7 @@
                         fOffset = 2;
                         return out - offset;
                     }
-                    invalidByte(2, 2, b1);
+                    invalidByte(2, 2);
                 }
                 int c = ((b0 << 6) & 0x07C0) | (b1 & 0x003F);
                 ch[out++] = (char)c;
@@ -341,7 +341,7 @@
                         fOffset = 2;
                         return out - offset;
                     }
-                    invalidByte(2, 3, b1);
+                    invalidByte(2, 3);
                 }
                 int b2 = -1;
                 if (++in < total) { 
@@ -368,7 +368,7 @@
                         fOffset = 3;
                         return out - offset;
                     }
-                    invalidByte(3, 3, b2);
+                    invalidByte(3, 3);
                 }
                 int c = ((b0 << 12) & 0xF000) | ((b1 << 6) & 0x0FC0) |
                         (b2 & 0x003F);
@@ -405,7 +405,7 @@
                         fOffset = 2;
                         return out - offset;
                     }
-                    invalidByte(2, 4, b1);
+                    invalidByte(2, 4);
                 }
                 int b2 = -1;
                 if (++in < total) { 
@@ -432,7 +432,7 @@
                         fOffset = 3;
                         return out - offset;
                     }
-                    invalidByte(3, 4, b2);
+                    invalidByte(3, 4);
                 }
                 int b3 = -1;
                 if (++in < total) { 
@@ -461,7 +461,7 @@
                         fOffset = 4;
                         return out - offset;
                     }
-                    invalidByte(4, 4, b2);
+                    invalidByte(4, 4);
                 }
 
                 // decode bytes into surrogate characters
@@ -489,7 +489,7 @@
                 fOffset = 1;
                 return out - offset;
             }
-            invalidByte(1, 1, b0);
+            invalidByte(1, 1);
         }
 
         // return number of characters converted
@@ -612,17 +612,17 @@
                                     Integer.toString(position),
                                     Integer.toString(count)));
 
-    } // expectedByte(int,int,int)
+    }
 
     /** Throws an exception for invalid byte. */
-    private void invalidByte(int position, int count, int c) 
+    private void invalidByte(int position, int count) 
         throws UTFDataFormatException {
 
         throw new UTFDataFormatException(
                 Localizer.getMessage("jsp.error.xml.invalidByte",
                                     Integer.toString(position),
                                     Integer.toString(count)));
-    } // invalidByte(int,int,int,int)
+    }
 
     /** Throws an exception for invalid surrogate bits. */
     private void invalidSurrogate(int uuuuu) throws UTFDataFormatException {
@@ -630,6 +630,6 @@
         throw new UTFDataFormatException(
                 Localizer.getMessage("jsp.error.xml.invalidHighSurrogate",
                                     Integer.toHexString(uuuuu)));
-    } // invalidSurrogate(int)
+    }
 
 } // class UTF8Reader

Modified: tomcat/trunk/java/org/apache/jasper/xmlparser/XMLEncodingDetector.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/xmlparser/XMLEncodingDetector.java?rev=751326&r1=751325&r2=751326&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/xmlparser/XMLEncodingDetector.java 
(original)
+++ tomcat/trunk/java/org/apache/jasper/xmlparser/XMLEncodingDetector.java Sat 
Mar  7 20:39:58 2009
@@ -153,11 +153,11 @@
                isBigEndian = (Boolean)(encodingDesc[1]);
         
         if (encodingDesc.length > 3) {
-            isBomPresent = (Boolean)(encodingDesc[2]);
-            skip = (Integer)(encodingDesc[3]);
+            isBomPresent = ((Boolean)(encodingDesc[2])).booleanValue();
+            skip = ((Integer)(encodingDesc[3])).intValue();
         } else {
             isBomPresent = true;
-            skip = (Integer)(encodingDesc[2]);
+            skip = ((Integer)(encodingDesc[2])).intValue();
         }
 
                stream.reset();



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to