src/share/classes/java/util/jar/JarFile.java

Print this page
rev 4802 : 7117249: fix warnings in java.util.jar, .logging, .prefs, .zip
Reviewed-by: alanb, dholmes, forax, sherman, smarks
Contributed-by: London Java Community and Michael Barker <mikeb01@gmail.com>

*** 181,191 **** jv = new JarVerifier(b); } } else { man = new Manifest(super.getInputStream(manEntry)); } ! manRef = new SoftReference(man); } } return man; } --- 181,191 ---- jv = new JarVerifier(b); } } else { man = new Manifest(super.getInputStream(manEntry)); } ! manRef = new SoftReference<>(man); } } return man; }
*** 231,247 **** /** * Returns an enumeration of the zip file entries. */ public Enumeration<JarEntry> entries() { ! final Enumeration enum_ = super.entries(); return new Enumeration<JarEntry>() { public boolean hasMoreElements() { return enum_.hasMoreElements(); } public JarFileEntry nextElement() { ! ZipEntry ze = (ZipEntry)enum_.nextElement(); return new JarFileEntry(ze); } }; } --- 231,247 ---- /** * Returns an enumeration of the zip file entries. */ public Enumeration<JarEntry> entries() { ! final Enumeration<? extends ZipEntry> enum_ = super.entries(); return new Enumeration<JarEntry>() { public boolean hasMoreElements() { return enum_.hasMoreElements(); } public JarFileEntry nextElement() { ! ZipEntry ze = enum_.nextElement(); return new JarFileEntry(ze); } }; }
*** 606,626 **** if (jv != null) { return jv.entries2(this, super.entries()); } // screen out entries which are never signed ! final Enumeration enum_ = super.entries(); return new Enumeration<JarEntry>() { ZipEntry entry; public boolean hasMoreElements() { if (entry != null) { return true; } while (enum_.hasMoreElements()) { ! ZipEntry ze = (ZipEntry) enum_.nextElement(); if (JarVerifier.isSigningRelated(ze.getName())) { continue; } entry = ze; return true; --- 606,626 ---- if (jv != null) { return jv.entries2(this, super.entries()); } // screen out entries which are never signed ! final Enumeration<? extends ZipEntry> enum_ = super.entries(); return new Enumeration<JarEntry>() { ZipEntry entry; public boolean hasMoreElements() { if (entry != null) { return true; } while (enum_.hasMoreElements()) { ! ZipEntry ze = enum_.nextElement(); if (JarVerifier.isSigningRelated(ze.getName())) { continue; } entry = ze; return true;
*** 647,666 **** /* * JAR file has no signed content. Is there a non-signing * code source? */ ! Enumeration unsigned = unsignedEntryNames(); if (unsigned.hasMoreElements()) { return new CodeSource[]{JarVerifier.getUnsignedCS(url)}; } else { return null; } } private Enumeration<String> unsignedEntryNames() { ! final Enumeration entries = entries(); return new Enumeration<String>() { String name; /* --- 647,666 ---- /* * JAR file has no signed content. Is there a non-signing * code source? */ ! Enumeration<String> unsigned = unsignedEntryNames(); if (unsigned.hasMoreElements()) { return new CodeSource[]{JarVerifier.getUnsignedCS(url)}; } else { return null; } } private Enumeration<String> unsignedEntryNames() { ! final Enumeration<JarEntry> entries = entries(); return new Enumeration<String>() { String name; /*
*** 671,681 **** if (name != null) { return true; } while (entries.hasMoreElements()) { String value; ! ZipEntry e = (ZipEntry) entries.nextElement(); value = e.getName(); if (e.isDirectory() || JarVerifier.isSigningRelated(value)) { continue; } name = value; --- 671,681 ---- if (name != null) { return true; } while (entries.hasMoreElements()) { String value; ! ZipEntry e = entries.nextElement(); value = e.getName(); if (e.isDirectory() || JarVerifier.isSigningRelated(value)) { continue; } name = value;
*** 724,736 **** if (jv != null) { jv.setEagerValidation(eager); } } ! List getManifestDigests() { ensureInitialization(); if (jv != null) { return jv.getManifestDigests(); } ! return new ArrayList(); } } --- 724,736 ---- if (jv != null) { jv.setEagerValidation(eager); } } ! List<Object> getManifestDigests() { ensureInitialization(); if (jv != null) { return jv.getManifestDigests(); } ! return new ArrayList<Object>(); } }