harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r414732 - in /incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util: jar/ zip/
Date Fri, 16 Jun 2006 04:27:37 GMT
Author: ndbeyer
Date: Thu Jun 15 21:27:32 2006
New Revision: 414732

URL: http://svn.apache.org/viewvc?rev=414732&view=rev
Log:
Code cleanup; generification, etc

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/InitManifest.java
    incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/JarFile.java
    incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/JarVerifier.java
    incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/Manifest.java
    incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/Deflater.java
    incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/Inflater.java
    incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/ZipFile.java
    incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/ZipOutputStream.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/InitManifest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/InitManifest.java?rev=414732&r1=414731&r2=414732&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/InitManifest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/InitManifest.java
Thu Jun 15 21:27:32 2006
@@ -49,9 +49,9 @@
 
     private byte[] mainAttributesChunk;
 
-    InitManifest(InputStream is, Attributes main, Map entries, Map chunks,
+    InitManifest(InputStream is, Attributes main, Map<String, Attributes> entries,
Map<String, byte[]> chunks,
             String verString) throws IOException {
-        encoding = (String) AccessController.doPrivileged(new PriviAction(
+        encoding = AccessController.doPrivileged(new PriviAction<String>(
                 "manifest.read.encoding"));
         if ("".equals(encoding)) {
             encoding = null;
@@ -63,9 +63,9 @@
         // Return the chunk of main attributes in the manifest.
         mainAttributesChunk = nextChunk(is, list);
 
-        Iterator it = list.iterator();
+        Iterator<String> it = list.iterator();
         while (it.hasNext()) {
-            addAttribute((String) it.next(), current);
+            addAttribute(it.next(), current);
         }
 
         // Check for version attribute
@@ -78,7 +78,7 @@
         while (chunks == null ? readLines(is, list) : (chunk = nextChunk(is,
                 list)) != null) {
             it = list.iterator();
-            String line = (String) it.next();
+            String line = it.next();
             if (line.length() < 7
                     || !line.substring(0, 5).toLowerCase().equals("name:")) {
                 throw new IOException(Msg.getString("K000a"));
@@ -91,7 +91,7 @@
             }
             entries.put(name, current);
             while (it.hasNext()) {
-                addAttribute((String) it.next(), current);
+                addAttribute(it.next(), current);
             }
             list.clear();
         }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/JarFile.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/JarFile.java?rev=414732&r1=414731&r2=414732&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/JarFile.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/JarFile.java
Thu Jun 15 21:27:32 2006
@@ -209,11 +209,11 @@
      */
     public Enumeration<JarEntry> entries() {
         class JarFileEnumerator implements Enumeration<JarEntry> {
-            Enumeration ze;
+            Enumeration<? extends ZipEntry> ze;
 
             JarFile jf;
 
-            JarFileEnumerator(Enumeration zenum, JarFile jf) {
+            JarFileEnumerator(Enumeration<? extends ZipEntry> zenum, JarFile jf) {
                 ze = zenum;
                 this.jf = jf;
             }
@@ -223,7 +223,7 @@
             }
 
             public JarEntry nextElement() {
-                JarEntry je = new JarEntry((ZipEntry) ze.nextElement());
+                JarEntry je = new JarEntry(ze.nextElement());
                 je.parentJar = jf;
                 if (verifier != null) {
                     je.certificates = verifier.getCertificates(je.getName());

Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/JarVerifier.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/JarVerifier.java?rev=414732&r1=414731&r2=414732&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/JarVerifier.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/JarVerifier.java
Thu Jun 15 21:27:32 2006
@@ -36,8 +36,8 @@
 import org.apache.harmony.security.utils.JarUtils;
 
 /**
- * Non-public class used by {@link java.util.jar.JarFile} and
- * {@link java.util.jar.JarInputStream} to manage the verification of signed
+ * Non-public class used by {@link JarFile} and
+ * {@link JarInputStream} to manage the verification of signed
  * jars. <code>JarFile</code> and <code>JarInputStream</code> objects
will
  * be expected to have a <code>JarVerifier</code> instance member which can be
  * used to carry out the tasks associated with verifying a signed jar. These
@@ -48,7 +48,7 @@
  * parties specified in the signature block data
  * <li>verification that the contents of all signature files (i.e.
  * <code>.SF</code> files) agree with the jar entries information found in the
- * jar maifest.
+ * jar manifest.
  * </ul>
  */
 class JarVerifier {
@@ -235,9 +235,9 @@
         if (metaEntries == null) {
             return false;
         }
-        Iterator it = metaEntries.keySet().iterator();
+        Iterator<String> it = metaEntries.keySet().iterator();
         while (it.hasNext()) {
-            String key = (String) it.next();
+            String key = it.next();
             if (key.endsWith(".DSA") || key.endsWith(".RSA")) {
                 verifyCertificate(key);
                 // Check for recursive class load

Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/Manifest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/Manifest.java?rev=414732&r1=414731&r2=414732&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/Manifest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/Manifest.java
Thu Jun 15 21:27:32 2006
@@ -44,13 +44,14 @@
 	private byte[] mainAttributesChunk;
 	
 	/**
-	 * Contructs a new Manifest instance.
+	 * Constructs a new Manifest instance.
 	 */
 	public Manifest() {
+        super();
 	}
 
 	/**
-	 * Contructs a new Manifest instance using the attributes obtained from is.
+	 * Constructs a new Manifest instance using the attributes obtained from is.
 	 * 
 	 * @param is
 	 *            InputStream to parse for attributes
@@ -64,8 +65,9 @@
 	}
 
 	Manifest(InputStream is, boolean readChunks) throws IOException {
-		if (readChunks)
-			chunks = new HashMap();
+		if (readChunks) {
+			chunks = new HashMap<String, byte[]>();
+        }
 		read(is);
 	}
 
@@ -108,7 +110,7 @@
 	}
 
 	/**
-	 * Contructs a new Manifest instance. The new instance will have the same
+	 * Constructs a new Manifest instance. The new instance will have the same
 	 * attributes as those found in the parameter Manifest.
 	 * 
 	 * @param man
@@ -214,8 +216,8 @@
 		 */
 		void write(Manifest manifest, OutputStream out) throws IOException {
 			os = out;
-			String encoding = (String) AccessController
-					.doPrivileged(new PriviAction("manifest.write.encoding"));
+			String encoding = AccessController
+					.doPrivileged(new PriviAction<String>("manifest.write.encoding"));
 			if (encoding != null) {
 				if ("".equals(encoding))
 					encoding = "UTF8";
@@ -225,7 +227,7 @@
 					.getValue(Attributes.Name.MANIFEST_VERSION);
 			if (version != null) {
 				writeEntry(Attributes.Name.MANIFEST_VERSION, version);
-				Iterator entries = manifest.mainAttributes.keySet().iterator();
+				Iterator<?> entries = manifest.mainAttributes.keySet().iterator();
 				while (entries.hasNext()) {
 					Attributes.Name name = (Attributes.Name) entries.next();
 					if (!name.equals(Attributes.Name.MANIFEST_VERSION))
@@ -233,13 +235,13 @@
 				}
 			}
 			os.write(sepBuf);
-			Iterator i = manifest.entryAttributes.keySet().iterator();
+			Iterator<String> i = manifest.entryAttributes.keySet().iterator();
 			while (i.hasNext()) {
-				String key = (String) i.next();
+				String key = i.next();
 				writeEntry(nameAttribute, key);
 				Attributes attrib = (Attributes) manifest.entryAttributes
 						.get(key);
-				Iterator entries = attrib.keySet().iterator();
+				Iterator<?> entries = attrib.keySet().iterator();
 				while (entries.hasNext()) {
 					Attributes.Name name = (Attributes.Name) entries.next();
 					writeEntry(name, attrib.getValue(name));

Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/Deflater.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/Deflater.java?rev=414732&r1=414731&r2=414732&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/Deflater.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/Deflater.java
Thu Jun 15 21:27:32 2006
@@ -17,7 +17,7 @@
 
 
 /**
- * The Deflater class is used to compress bytes using the DEFLATE compressionn
+ * The Deflater class is used to compress bytes using the DEFLATE compression
  * algorithm. Deflation is performed by the ZLIB compression library.
  * 
  * @see DeflaterOutputStream
@@ -47,9 +47,9 @@
 
 	private int flushParm = Z_NO_FLUSH;
 
-	private boolean noHeader = false;
+	private boolean noHeader;
 
-	private boolean finished = false;
+	private boolean finished;
 
 	int compressLevel = DEFAULT_COMPRESSION;
 
@@ -92,7 +92,7 @@
 	 * @param nbytes
 	 *            number of bytes of compressed data to store in buf
 	 * 
-	 * @return number of bytes of compresed data stored
+	 * @return number of bytes of compressed data stored
 	 * 
 	 */
 	public synchronized int deflate(byte[] buf, int off, int nbytes) {
@@ -111,7 +111,7 @@
 	private synchronized native void endImpl(long handle);
 
 	/**
-	 * Frees all resources held onto by this Deflater. Any unused input or ouput
+	 * Frees all resources held onto by this Deflater. Any unused input or output
 	 * is discarded. This is also called from the finalize method.
 	 * 
 	 * @see #finalize

Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/Inflater.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/Inflater.java?rev=414732&r1=414731&r2=414732&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/Inflater.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/Inflater.java
Thu Jun 15 21:27:32 2006
@@ -46,7 +46,7 @@
 
 	/**
 	 * Release any resources associated with this Inflater. Any unused
-	 * input/ouput is discarded. This is also called by the finalize method.
+	 * input/output is discarded. This is also called by the finalize method.
 	 */
 	public synchronized void end() {
 		if (streamHandle != -1) {
@@ -65,7 +65,7 @@
 	}
 
 	/**
-	 * Indicates if the Inflater has inflated the entire defalted stream. If
+	 * Indicates if the Inflater has inflated the entire deflated stream. If
 	 * deflated bytes remain and needsInput returns true this method will return
 	 * false. This method should be called after all deflated input is supplied
 	 * to the Inflater.
@@ -80,7 +80,7 @@
 	 * Returns the Adler32 checksum of either all bytes inflated, or the
 	 * checksum of the preset dictionary if one has been supplied.
 	 * 
-	 * @return The Adler32 checksum associayted with this Inflater.
+	 * @return The Adler32 checksum associated with this Inflater.
 	 */
 	public synchronized int getAdler() {
 		if (streamHandle == -1)
@@ -94,7 +94,7 @@
 	 * Returns the number of bytes of current input remaining to be read by the
 	 * inflater
 	 * 
-	 * @return Number of bytes of unred input.
+	 * @return Number of bytes of unread input.
 	 */
 	public synchronized int getRemaining() {
 		return inLength - inRead;
@@ -151,7 +151,7 @@
 	 * @param buf
 	 *            Buffer to output inflated bytes
 	 * @param off
-	 *            Offset in buffer into wcih to store inflated bytes
+	 *            Offset in buffer into which to store inflated bytes
 	 * @param nbytes
 	 *            Number of inflated bytes to store
 	 * @exception DataFormatException
@@ -279,7 +279,7 @@
 	 * @param buf
 	 *            input buffer
 	 * @param off
-	 *            offest to read from in buffer
+	 *            offset to read from in buffer
 	 * @param nbytes
 	 *            number of bytes to read
 	 * @see #needsInput

Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/ZipFile.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/ZipFile.java?rev=414732&r1=414731&r2=414732&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/ZipFile.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/ZipFile.java
Thu Jun 15 21:27:32 2006
@@ -150,7 +150,7 @@
 	 * @return an Enumeration of the zip entries
 	 */
 	public Enumeration<? extends ZipEntry> entries() {
-		return new ZFEnum();
+		return new ZFEnum<ZipEntry>();
 	}
 
 	/**
@@ -158,7 +158,7 @@
 	 * 
 	 * @param entryName
 	 *            the name of the entry in the zip file
-	 * @return a ZipEntry or null if the entryname does not exist in the zip
+	 * @return a ZipEntry or null if the entry name does not exist in the zip
 	 *         file
 	 */
 	public ZipEntry getEntry(String entryName) {
@@ -214,7 +214,7 @@
 			return size;
 
 		size = 0;
-		Enumeration e = entries();
+		Enumeration<?> e = entries();
 		while (e.hasMoreElements()) {
 			size++;
 			e.nextElement();

Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/ZipOutputStream.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/ZipOutputStream.java?rev=414732&r1=414731&r2=414732&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/ZipOutputStream.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/ZipOutputStream.java
Thu Jun 15 21:27:32 2006
@@ -43,7 +43,7 @@
 
 	private String comment;
 
-	private Vector entries = new Vector();
+	private Vector<String> entries = new Vector<String>();
 
 	private int compressMethod = DEFLATED;
 
@@ -60,7 +60,7 @@
 	private byte[] nameBytes;
 
 	/**
-	 * Contructs a new ZipOutputStream on p1
+	 * Constructs a new ZipOutputStream on p1
 	 * 
 	 * @param p1
 	 *            OutputStream The InputStream to output to
@@ -163,7 +163,7 @@
 
 	/**
 	 * Indicates that all entries have been written to the stream. Any terminal
-	 * Zipfile information is written to the underlying stream.
+	 * ZipFile information is written to the underlying stream.
 	 * 
 	 * @exception IOException
 	 *                If an error occurs while finishing



Mime
View raw message