7143230: fix warnings in java.util.jar, sun.tools.jar, zipfs demo, etc.
authorsmarks
Sun, 12 Feb 2012 21:56:24 -0800
changeset 11841 38a39c748880
parent 11840 dfd8edddd85f
child 11843 95aeecf515eb
7143230: fix warnings in java.util.jar, sun.tools.jar, zipfs demo, etc. Reviewed-by: alanb, chegar, lancea, smarks Contributed-by: Mani Sarkar <sadhak001@gmail.com>, Michael Barker <mikeb01@gmail.com>, Carl Jokl <carl.jokl@gmail.com>, Dinuk Weerasinghe <dinuksw@yahoo.com>, Markus Stoy <markus.stoy@timgroup.com>, Tom Anderson <tom.anderson@timgroup.com>
jdk/src/share/classes/java/util/jar/Attributes.java
jdk/src/share/classes/java/util/jar/JarVerifier.java
jdk/src/share/classes/sun/tools/jar/CommandLine.java
jdk/src/share/classes/sun/tools/jar/Manifest.java
jdk/src/share/classes/sun/tools/jar/SignatureFile.java
jdk/src/share/demo/management/MemoryMonitor/MemoryMonitor.java
jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileStore.java
jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java
jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystemProvider.java
jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipInfo.java
--- a/jdk/src/share/classes/java/util/jar/Attributes.java	Sun Feb 12 21:09:09 2012 +0000
+++ b/jdk/src/share/classes/java/util/jar/Attributes.java	Sun Feb 12 21:56:24 2012 -0800
@@ -71,7 +71,7 @@
      * @param size the initial number of attributes
      */
     public Attributes(int size) {
-        map = new HashMap(size);
+        map = new HashMap<>(size);
     }
 
     /**
@@ -81,7 +81,7 @@
      * @param attr the specified Attributes
      */
     public Attributes(Attributes attr) {
-        map = new HashMap(attr);
+        map = new HashMap<>(attr);
     }
 
 
@@ -296,9 +296,9 @@
      * XXX Need to handle UTF8 values and break up lines longer than 72 bytes
      */
      void write(DataOutputStream os) throws IOException {
-        Iterator it = entrySet().iterator();
+        Iterator<Map.Entry<Object, Object>> it = entrySet().iterator();
         while (it.hasNext()) {
-            Map.Entry e = (Map.Entry)it.next();
+            Map.Entry<Object, Object> e = it.next();
             StringBuffer buffer = new StringBuffer(
                                         ((Name)e.getKey()).toString());
             buffer.append(": ");
@@ -340,9 +340,9 @@
 
         // write out all attributes except for the version
         // we wrote out earlier
-        Iterator it = entrySet().iterator();
+        Iterator<Map.Entry<Object, Object>> it = entrySet().iterator();
         while (it.hasNext()) {
-            Map.Entry e = (Map.Entry)it.next();
+            Map.Entry<Object, Object> e = it.next();
             String name = ((Name)e.getKey()).toString();
             if ((version != null) && ! (name.equalsIgnoreCase(vername))) {
 
@@ -499,7 +499,7 @@
          */
         public boolean equals(Object o) {
             if (o instanceof Name) {
-                Comparator c = ASCIICaseInsensitiveComparator.CASE_INSENSITIVE_ORDER;
+                Comparator<String> c = ASCIICaseInsensitiveComparator.CASE_INSENSITIVE_ORDER;
                 return c.compare(name, ((Name)o).name) == 0;
             } else {
                 return false;
--- a/jdk/src/share/classes/java/util/jar/JarVerifier.java	Sun Feb 12 21:09:09 2012 +0000
+++ b/jdk/src/share/classes/java/util/jar/JarVerifier.java	Sun Feb 12 21:56:24 2012 -0800
@@ -48,21 +48,21 @@
 
     /* a table mapping names to code signers, for jar entries that have
        had their actual hashes verified */
-    private Hashtable verifiedSigners;
+    private Hashtable<String, CodeSigner[]> verifiedSigners;
 
     /* a table mapping names to code signers, for jar entries that have
        passed the .SF/.DSA/.EC -> MANIFEST check */
-    private Hashtable sigFileSigners;
+    private Hashtable<String, CodeSigner[]> sigFileSigners;
 
     /* a hash table to hold .SF bytes */
-    private Hashtable sigFileData;
+    private Hashtable<String, byte[]> sigFileData;
 
     /** "queue" of pending PKCS7 blocks that we couldn't parse
      *  until we parsed the .SF file */
-    private ArrayList pendingBlocks;
+    private ArrayList<SignatureFileVerifier> pendingBlocks;
 
     /* cache of CodeSigner objects */
-    private ArrayList signerCache;
+    private ArrayList<CodeSigner[]> signerCache;
 
     /* Are we parsing a block? */
     private boolean parsingBlockOrSF = false;
@@ -94,10 +94,10 @@
 
     public JarVerifier(byte rawBytes[]) {
         manifestRawBytes = rawBytes;
-        sigFileSigners = new Hashtable();
-        verifiedSigners = new Hashtable();
-        sigFileData = new Hashtable(11);
-        pendingBlocks = new ArrayList();
+        sigFileSigners = new Hashtable<>();
+        verifiedSigners = new Hashtable<>();
+        sigFileData = new Hashtable<>(11);
+        pendingBlocks = new ArrayList<>();
         baos = new ByteArrayOutputStream();
         manifestDigests = new ArrayList<>();
     }
@@ -248,10 +248,9 @@
                     sigFileData.put(key, bytes);
                     // check pending blocks, we can now process
                     // anyone waiting for this .SF file
-                    Iterator it = pendingBlocks.iterator();
+                    Iterator<SignatureFileVerifier> it = pendingBlocks.iterator();
                     while (it.hasNext()) {
-                        SignatureFileVerifier sfv =
-                            (SignatureFileVerifier) it.next();
+                        SignatureFileVerifier sfv = it.next();
                         if (sfv.needSignatureFile(key)) {
                             if (debug != null) {
                                 debug.println(
@@ -270,7 +269,7 @@
                 String key = uname.substring(0, uname.lastIndexOf("."));
 
                 if (signerCache == null)
-                    signerCache = new ArrayList();
+                    signerCache = new ArrayList<>();
 
                 if (manDig == null) {
                     synchronized(manifestRawBytes) {
@@ -287,7 +286,7 @@
 
                 if (sfv.needSignatureFileBytes()) {
                     // see if we have already parsed an external .SF file
-                    byte[] bytes = (byte[]) sigFileData.get(key);
+                    byte[] bytes = sigFileData.get(key);
 
                     if (bytes == null) {
                         // put this block on queue for later processing
@@ -343,7 +342,7 @@
      */
     public CodeSigner[] getCodeSigners(String name)
     {
-        return (CodeSigner[])verifiedSigners.get(name);
+        return verifiedSigners.get(name);
     }
 
     public CodeSigner[] getCodeSigners(JarFile jar, JarEntry entry)
@@ -376,15 +375,14 @@
         CodeSigner[] signers) {
 
         if (signers != null) {
-            ArrayList certChains = new ArrayList();
+            ArrayList<java.security.cert.Certificate> certChains = new ArrayList<>();
             for (int i = 0; i < signers.length; i++) {
                 certChains.addAll(
                     signers[i].getSignerCertPath().getCertificates());
             }
 
             // Convert into a Certificate[]
-            return (java.security.cert.Certificate[])
-                certChains.toArray(
+            return certChains.toArray(
                     new java.security.cert.Certificate[certChains.size()]);
         }
         return null;
@@ -418,8 +416,8 @@
         // MANIFEST.MF is always treated as signed and verified,
         // move its signers from sigFileSigners to verifiedSigners.
         if (sigFileSigners.containsKey(JarFile.MANIFEST_NAME)) {
-            verifiedSigners.put(JarFile.MANIFEST_NAME,
-                    sigFileSigners.remove(JarFile.MANIFEST_NAME));
+            CodeSigner[] codeSigners = sigFileSigners.remove(JarFile.MANIFEST_NAME);
+            verifiedSigners.put(JarFile.MANIFEST_NAME, codeSigners);
         }
     }
 
@@ -493,10 +491,10 @@
 
     // Extended JavaUtilJarAccess CodeSource API Support
 
-    private Map urlToCodeSourceMap = new HashMap();
-    private Map signerToCodeSource = new HashMap();
+    private Map<URL, Map<CodeSigner[], CodeSource>> urlToCodeSourceMap = new HashMap<>();
+    private Map<CodeSigner[], CodeSource> signerToCodeSource = new HashMap<>();
     private URL lastURL;
-    private Map lastURLMap;
+    private Map<CodeSigner[], CodeSource> lastURLMap;
 
     /*
      * Create a unique mapping from codeSigner cache entries to CodeSource.
@@ -504,19 +502,19 @@
      * and shared JAR file although in practice there will be a single URL in use.
      */
     private synchronized CodeSource mapSignersToCodeSource(URL url, CodeSigner[] signers) {
-        Map map;
+        Map<CodeSigner[], CodeSource> map;
         if (url == lastURL) {
             map = lastURLMap;
         } else {
-            map = (Map) urlToCodeSourceMap.get(url);
+            map = urlToCodeSourceMap.get(url);
             if (map == null) {
-                map = new HashMap();
+                map = new HashMap<>();
                 urlToCodeSourceMap.put(url, map);
             }
             lastURLMap = map;
             lastURL = url;
         }
-        CodeSource cs = (CodeSource) map.get(signers);
+        CodeSource cs = map.get(signers);
         if (cs == null) {
             cs = new VerifierCodeSource(csdomain, url, signers);
             signerToCodeSource.put(signers, cs);
@@ -524,16 +522,16 @@
         return cs;
     }
 
-    private CodeSource[] mapSignersToCodeSources(URL url, List signers, boolean unsigned) {
-        List sources = new ArrayList();
+    private CodeSource[] mapSignersToCodeSources(URL url, List<CodeSigner[]> signers, boolean unsigned) {
+        List<CodeSource> sources = new ArrayList<>();
 
         for (int i = 0; i < signers.size(); i++) {
-            sources.add(mapSignersToCodeSource(url, (CodeSigner[]) signers.get(i)));
+            sources.add(mapSignersToCodeSource(url, signers.get(i)));
         }
         if (unsigned) {
             sources.add(mapSignersToCodeSource(url, null));
         }
-        return (CodeSource[]) sources.toArray(new CodeSource[sources.size()]);
+        return sources.toArray(new CodeSource[sources.size()]);
     }
     private CodeSigner[] emptySigner = new CodeSigner[0];
 
@@ -553,7 +551,7 @@
          * but this handles a CodeSource of any type, just in case.
          */
         CodeSource[] sources = mapSignersToCodeSources(cs.getLocation(), getJarCodeSigners(), true);
-        List sourceList = new ArrayList();
+        List<CodeSource> sourceList = new ArrayList<>();
         for (int i = 0; i < sources.length; i++) {
             sourceList.add(sources[i]);
         }
@@ -574,6 +572,7 @@
      * signing data that can be compared by object reference identity.
      */
     private static class VerifierCodeSource extends CodeSource {
+        private static final long serialVersionUID = -9047366145967768825L;
 
         URL vlocation;
         CodeSigner[] vsigners;
@@ -641,16 +640,16 @@
             return vcerts;
         }
     }
-    private Map signerMap;
+    private Map<String, CodeSigner[]> signerMap;
 
-    private synchronized Map signerMap() {
+    private synchronized Map<String, CodeSigner[]> signerMap() {
         if (signerMap == null) {
             /*
              * Snapshot signer state so it doesn't change on us. We care
              * only about the asserted signatures. Verification of
              * signature validity happens via the JarEntry apis.
              */
-            signerMap = new HashMap(verifiedSigners.size() + sigFileSigners.size());
+            signerMap = new HashMap<>(verifiedSigners.size() + sigFileSigners.size());
             signerMap.putAll(verifiedSigners);
             signerMap.putAll(sigFileSigners);
         }
@@ -658,15 +657,15 @@
     }
 
     public synchronized Enumeration<String> entryNames(JarFile jar, final CodeSource[] cs) {
-        final Map map = signerMap();
-        final Iterator itor = map.entrySet().iterator();
+        final Map<String, CodeSigner[]> map = signerMap();
+        final Iterator<Map.Entry<String, CodeSigner[]>> itor = map.entrySet().iterator();
         boolean matchUnsigned = false;
 
         /*
          * Grab a single copy of the CodeSigner arrays. Check
          * to see if we can optimize CodeSigner equality test.
          */
-        List req = new ArrayList(cs.length);
+        List<CodeSigner[]> req = new ArrayList<>(cs.length);
         for (int i = 0; i < cs.length; i++) {
             CodeSigner[] match = findMatchingSigners(cs[i]);
             if (match != null) {
@@ -678,8 +677,8 @@
             }
         }
 
-        final List signersReq = req;
-        final Enumeration enum2 = (matchUnsigned) ? unsignedEntryNames(jar) : emptyEnumeration;
+        final List<CodeSigner[]> signersReq = req;
+        final Enumeration<String> enum2 = (matchUnsigned) ? unsignedEntryNames(jar) : emptyEnumeration;
 
         return new Enumeration<String>() {
 
@@ -691,14 +690,14 @@
                 }
 
                 while (itor.hasNext()) {
-                    Map.Entry e = (Map.Entry) itor.next();
-                    if (signersReq.contains((CodeSigner[]) e.getValue())) {
-                        name = (String) e.getKey();
+                    Map.Entry<String, CodeSigner[]> e = itor.next();
+                    if (signersReq.contains(e.getValue())) {
+                        name = e.getKey();
                         return true;
                     }
                 }
                 while (enum2.hasMoreElements()) {
-                    name = (String) enum2.nextElement();
+                    name = enum2.nextElement();
                     return true;
                 }
                 return false;
@@ -719,13 +718,13 @@
      * Like entries() but screens out internal JAR mechanism entries
      * and includes signed entries with no ZIP data.
      */
-    public Enumeration<JarEntry> entries2(final JarFile jar, Enumeration e) {
-        final Map map = new HashMap();
+    public Enumeration<JarEntry> entries2(final JarFile jar, Enumeration<? extends ZipEntry> e) {
+        final Map<String, CodeSigner[]> map = new HashMap<>();
         map.putAll(signerMap());
-        final Enumeration enum_ = e;
+        final Enumeration<? extends ZipEntry> enum_ = e;
         return new Enumeration<JarEntry>() {
 
-            Enumeration signers = null;
+            Enumeration<String> signers = null;
             JarEntry entry;
 
             public boolean hasMoreElements() {
@@ -733,7 +732,7 @@
                     return true;
                 }
                 while (enum_.hasMoreElements()) {
-                    ZipEntry ze = (ZipEntry) enum_.nextElement();
+                    ZipEntry ze = enum_.nextElement();
                     if (JarVerifier.isSigningRelated(ze.getName())) {
                         continue;
                     }
@@ -744,7 +743,7 @@
                     signers = Collections.enumeration(map.keySet());
                 }
                 while (signers.hasMoreElements()) {
-                    String name = (String) signers.nextElement();
+                    String name = signers.nextElement();
                     entry = jar.newEntry(new ZipEntry(name));
                     return true;
                 }
@@ -764,7 +763,7 @@
             }
         };
     }
-    private Enumeration emptyEnumeration = new Enumeration<String>() {
+    private Enumeration<String> emptyEnumeration = new Enumeration<String>() {
 
         public boolean hasMoreElements() {
             return false;
@@ -797,8 +796,8 @@
     }
 
     private Enumeration<String> unsignedEntryNames(JarFile jar) {
-        final Map map = signerMap();
-        final Enumeration entries = jar.entries();
+        final Map<String, CodeSigner[]> map = signerMap();
+        final Enumeration<JarEntry> entries = jar.entries();
         return new Enumeration<String>() {
 
             String name;
@@ -813,7 +812,7 @@
                 }
                 while (entries.hasMoreElements()) {
                     String value;
-                    ZipEntry e = (ZipEntry) entries.nextElement();
+                    ZipEntry e = entries.nextElement();
                     value = e.getName();
                     if (e.isDirectory() || isSigningRelated(value)) {
                         continue;
@@ -836,14 +835,14 @@
             }
         };
     }
-    private List jarCodeSigners;
+    private List<CodeSigner[]> jarCodeSigners;
 
-    private synchronized List getJarCodeSigners() {
+    private synchronized List<CodeSigner[]> getJarCodeSigners() {
         CodeSigner[] signers;
         if (jarCodeSigners == null) {
-            HashSet set = new HashSet();
+            HashSet<CodeSigner[]> set = new HashSet<>();
             set.addAll(signerMap().values());
-            jarCodeSigners = new ArrayList();
+            jarCodeSigners = new ArrayList<>();
             jarCodeSigners.addAll(set);
         }
         return jarCodeSigners;
@@ -858,7 +857,7 @@
     public CodeSource getCodeSource(URL url, String name) {
         CodeSigner[] signers;
 
-        signers = (CodeSigner[]) signerMap().get(name);
+        signers = signerMap().get(name);
         return mapSignersToCodeSource(url, signers);
     }
 
--- a/jdk/src/share/classes/sun/tools/jar/CommandLine.java	Sun Feb 12 21:09:09 2012 +0000
+++ b/jdk/src/share/classes/sun/tools/jar/CommandLine.java	Sun Feb 12 21:56:24 2012 -0800
@@ -55,7 +55,7 @@
     public static String[] parse(String[] args)
         throws IOException
     {
-        ArrayList newArgs = new ArrayList(args.length);
+        List<String> newArgs = new ArrayList<>(args.length);
         for (int i = 0; i < args.length; i++) {
             String arg = args[i];
             if (arg.length() > 1 && arg.charAt(0) == '@') {
@@ -69,10 +69,10 @@
                 newArgs.add(arg);
             }
         }
-        return (String[])newArgs.toArray(new String[newArgs.size()]);
+        return newArgs.toArray(new String[newArgs.size()]);
     }
 
-    private static void loadCmdFile(String name, List args)
+    private static void loadCmdFile(String name, List<String> args)
         throws IOException
     {
         Reader r = new BufferedReader(new FileReader(name));
@@ -83,7 +83,7 @@
         st.commentChar('#');
         st.quoteChar('"');
         st.quoteChar('\'');
-        while (st.nextToken() != st.TT_EOF) {
+        while (st.nextToken() != StreamTokenizer.TT_EOF) {
             args.add(st.sval);
         }
         r.close();
--- a/jdk/src/share/classes/sun/tools/jar/Manifest.java	Sun Feb 12 21:09:09 2012 +0000
+++ b/jdk/src/share/classes/sun/tools/jar/Manifest.java	Sun Feb 12 21:56:24 2012 -0800
@@ -47,10 +47,10 @@
     /* list of headers that all pertain to a particular
      * file in the archive
      */
-    private Vector entries = new Vector();
+    private Vector<MessageHeader> entries = new Vector<>();
     private byte[] tmpbuf = new byte[512];
     /* a hashtable of entries, for fast lookup */
-    private Hashtable tableEntries = new Hashtable();
+    private Hashtable<String, MessageHeader> tableEntries = new Hashtable<>();
 
     static final String[] hashes = {"SHA"};
     static final byte[] EOL = {(byte)'\r', (byte)'\n'};
@@ -115,14 +115,14 @@
     }
 
     public MessageHeader getEntry(String name) {
-        return (MessageHeader) tableEntries.get(name);
+        return tableEntries.get(name);
     }
 
     public MessageHeader entryAt(int i) {
-        return (MessageHeader) entries.elementAt(i);
+        return entries.elementAt(i);
     }
 
-    public Enumeration entries() {
+    public Enumeration<MessageHeader> entries() {
         return entries.elements();
     }
 
@@ -214,7 +214,7 @@
         /* the first header in the file should be the global one.
          * It should say "Manifest-Version: x.x"; if not add it
          */
-        MessageHeader globals = (MessageHeader) entries.elementAt(0);
+        MessageHeader globals = entries.elementAt(0);
 
         if (globals.findValue("Manifest-Version") == null) {
             /* Assume this is a user-defined manifest.  If it has a Name: <..>
@@ -238,7 +238,7 @@
         globals.print(ps);
 
         for (int i = 1; i < entries.size(); ++i) {
-            MessageHeader mh = (MessageHeader) entries.elementAt(i);
+            MessageHeader mh = entries.elementAt(i);
             mh.print(ps);
         }
     }
--- a/jdk/src/share/classes/sun/tools/jar/SignatureFile.java	Sun Feb 12 21:09:09 2012 +0000
+++ b/jdk/src/share/classes/sun/tools/jar/SignatureFile.java	Sun Feb 12 21:56:24 2012 -0800
@@ -47,7 +47,7 @@
  *
  * <p>Each entry section contains the name of an entry (which must
  * have a counterpart in the manifest). Like the manifest it contains
- * a hash, the hash of the manifest section correspondind to the
+ * a hash, the hash of the manifest section corresponding to the
  * name. Since the manifest entry contains the hash of the data, this
  * is equivalent to a signature of the data, plus the attributes of
  * the manifest entry.
@@ -66,7 +66,7 @@
 
     /* list of headers that all pertain to a particular file in the
      * archive */
-    private Vector entries = new Vector();
+    private Vector<MessageHeader> entries = new Vector<>();
 
     /* Right now we only support SHA hashes */
     static final String[] hashes = {"SHA"};
@@ -98,7 +98,7 @@
      * character in length.  */
     private SignatureFile(String name) throws JarException {
 
-        entries = new Vector();
+        entries = new Vector<>();
 
         if (name != null) {
             if (name.length() > 8 || name.indexOf('.') != -1) {
@@ -142,9 +142,9 @@
         this(name, true);
 
         this.manifest = manifest;
-        Enumeration enum_ = manifest.entries();
+        Enumeration<MessageHeader> enum_ = manifest.entries();
         while (enum_.hasMoreElements()) {
-            MessageHeader mh = (MessageHeader)enum_.nextElement();
+            MessageHeader mh = enum_.nextElement();
             String entryName = mh.findValue("Name");
             if (entryName != null) {
                 add(entryName);
@@ -269,9 +269,9 @@
      *the entry does not exist.
      */
     public MessageHeader getEntry(String name) {
-        Enumeration enum_ = entries();
+        Enumeration<MessageHeader> enum_ = entries();
         while(enum_.hasMoreElements()) {
-            MessageHeader mh = (MessageHeader)enum_.nextElement();
+            MessageHeader mh = enum_.nextElement();
             if (name.equals(mh.findValue("Name"))) {
                 return mh;
             }
@@ -282,13 +282,13 @@
     /**
      * Returns the n-th entry. The global header is a entry 0.  */
     public MessageHeader entryAt(int n) {
-        return (MessageHeader) entries.elementAt(n);
+        return entries.elementAt(n);
     }
 
     /**
      * Returns an enumeration of the entries.
      */
-    public Enumeration entries() {
+    public Enumeration<MessageHeader> entries() {
         return entries.elements();
     }
 
@@ -322,11 +322,11 @@
         }
     }
 
-    private Hashtable digests = new Hashtable();
+    private Hashtable<String, MessageDigest> digests = new Hashtable<>();
 
     private MessageDigest getDigest(String algorithm)
     throws NoSuchAlgorithmException {
-        MessageDigest dig = (MessageDigest)digests.get(algorithm);
+        MessageDigest dig = digests.get(algorithm);
         if (dig == null) {
             dig = MessageDigest.getInstance(algorithm);
             digests.put(algorithm, dig);
@@ -344,7 +344,7 @@
         /* the first header in the file should be the global one.
          * It should say "SignatureFile-Version: x.x"; barf if not
          */
-        MessageHeader globals = (MessageHeader) entries.elementAt(0);
+        MessageHeader globals = entries.elementAt(0);
         if (globals.findValue("Signature-Version") == null) {
             throw new JarException("Signature file requires " +
                             "Signature-Version: 1.0 in 1st header");
@@ -354,7 +354,7 @@
         globals.print(ps);
 
         for (int i = 1; i < entries.size(); ++i) {
-            MessageHeader mh = (MessageHeader) entries.elementAt(i);
+            MessageHeader mh = entries.elementAt(i);
             mh.print(ps);
         }
     }
--- a/jdk/src/share/demo/management/MemoryMonitor/MemoryMonitor.java	Sun Feb 12 21:09:09 2012 +0000
+++ b/jdk/src/share/demo/management/MemoryMonitor/MemoryMonitor.java	Sun Feb 12 21:56:24 2012 -0800
@@ -213,10 +213,10 @@
 
             // Calculate remaining size
             float ssH = ascent + descent;
-            float remainingHeight = (float) (y2 - (ssH*2) - 0.5f);
+            float remainingHeight = y2 - (ssH*2) - 0.5f;
             float blockHeight = remainingHeight/10;
             float blockWidth = 20.0f;
-            float remainingWidth = (float) (x2 - blockWidth - 10);
+            float remainingWidth = x2 - blockWidth - 10;
 
             // .. Memory Free ..
             big.setColor(mfColor);
@@ -224,7 +224,7 @@
             int i = 0;
             for ( ; i < MemUsage ; i++) {
                 mfRect.setRect(x1+5,(float) y1+ssH+i*blockHeight,
-                                blockWidth,(float) blockHeight-1);
+                                blockWidth, blockHeight-1);
                 big.fill(mfRect);
             }
 
@@ -232,13 +232,13 @@
             big.setColor(Color.green);
             for ( ; i < 10; i++)  {
                 muRect.setRect(x1+5,(float) y1 + ssH+i*blockHeight,
-                                blockWidth,(float) blockHeight-1);
+                                blockWidth, blockHeight-1);
                 big.fill(muRect);
             }
 
             // .. Draw History Graph ..
             if (remainingWidth <= 30) remainingWidth = (float)30;
-            if (remainingHeight <= ssH) remainingHeight = (float)ssH;
+            if (remainingHeight <= ssH) remainingHeight = ssH;
             big.setColor(graphColor);
             int graphX = x1+30;
             int graphY = y1 + (int) ssH;
@@ -347,8 +347,8 @@
                     big = bimg.createGraphics();
                     big.setFont(font);
                     FontMetrics fm = big.getFontMetrics(font);
-                    ascent = (int) fm.getAscent();
-                    descent = (int) fm.getDescent();
+                    ascent = fm.getAscent();
+                    descent = fm.getDescent();
                 }
                 repaint();
                 try {
--- a/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileStore.java	Sun Feb 12 21:09:09 2012 +0000
+++ b/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileStore.java	Sun Feb 12 21:56:24 2012 -0800
@@ -61,7 +61,7 @@
     private final ZipFileSystem zfs;
 
     ZipFileStore(ZipPath zpath) {
-        this.zfs = (ZipFileSystem)zpath.getFileSystem();
+        this.zfs = zpath.getFileSystem();
     }
 
     @Override
--- a/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java	Sun Feb 12 21:09:09 2012 +0000
+++ b/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java	Sun Feb 12 21:56:24 2012 -0800
@@ -1609,7 +1609,7 @@
         synchronized (inflaters) {
             int size = inflaters.size();
             if (size > 0) {
-                Inflater inf = (Inflater)inflaters.remove(size - 1);
+                Inflater inf = inflaters.remove(size - 1);
                 return inf;
             } else {
                 return new Inflater(true);
@@ -1638,7 +1638,7 @@
         synchronized (deflaters) {
             int size = deflaters.size();
             if (size > 0) {
-                Deflater def = (Deflater)deflaters.remove(size - 1);
+                Deflater def = deflaters.remove(size - 1);
                 return def;
             } else {
                 return new Deflater(Deflater.DEFAULT_COMPRESSION, true);
--- a/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystemProvider.java	Sun Feb 12 21:09:09 2012 +0000
+++ b/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystemProvider.java	Sun Feb 12 21:56:24 2012 -0800
@@ -211,7 +211,7 @@
     public <V extends FileAttributeView> V
         getFileAttributeView(Path path, Class<V> type, LinkOption... options)
     {
-        return (V)ZipFileAttributeView.get(toZipPath(path), type);
+        return ZipFileAttributeView.get(toZipPath(path), type);
     }
 
     @Override
--- a/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipInfo.java	Sun Feb 12 21:09:09 2012 +0000
+++ b/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipInfo.java	Sun Feb 12 21:56:24 2012 -0800
@@ -78,12 +78,12 @@
                 // twice
                 long len = LOCHDR + CENNAM(cen, pos) + CENEXT(cen, pos) + CENHDR;
                 if (zfs.readFullyAt(buf, 0, len, locoff(cen, pos)) != len)
-                    zfs.zerror("read loc header failed");
+                    ZipFileSystem.zerror("read loc header failed");
                 if (LOCEXT(buf) > CENEXT(cen, pos) + CENHDR) {
                     // have to read the second time;
                     len = LOCHDR + LOCNAM(buf) + LOCEXT(buf);
                     if (zfs.readFullyAt(buf, 0, len, locoff(cen, pos)) != len)
-                        zfs.zerror("read loc header failed");
+                        ZipFileSystem.zerror("read loc header failed");
                 }
                 printLOC(buf);
                 pos += CENHDR + CENNAM(cen, pos) + CENEXT(cen, pos) + CENCOM(cen, pos);