aboutsummaryrefslogtreecommitdiff
path: root/libjava/classpath/java/util/jar
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/classpath/java/util/jar')
-rw-r--r--libjava/classpath/java/util/jar/Attributes.java96
-rw-r--r--libjava/classpath/java/util/jar/JarEntry.java6
-rw-r--r--libjava/classpath/java/util/jar/JarFile.java194
-rw-r--r--libjava/classpath/java/util/jar/JarInputStream.java22
-rw-r--r--libjava/classpath/java/util/jar/JarOutputStream.java4
-rw-r--r--libjava/classpath/java/util/jar/Manifest.java8
6 files changed, 165 insertions, 165 deletions
diff --git a/libjava/classpath/java/util/jar/Attributes.java b/libjava/classpath/java/util/jar/Attributes.java
index 329fe63..8880029 100644
--- a/libjava/classpath/java/util/jar/Attributes.java
+++ b/libjava/classpath/java/util/jar/Attributes.java
@@ -67,7 +67,7 @@ import java.util.Set;
* @see java.util.jar.Attributes.Name
* @author Mark Wielaard (mark@klomp.org)
*/
-public class Attributes
+public class Attributes
implements Cloneable, Map<Object, Object>
{
@@ -87,16 +87,16 @@ public class Attributes
* know names for the general main attributes, stand alone application
* attributes, applet attributes, extension identification attributes,
* package versioning and sealing attributes, file contents attributes,
- * bean objects attribute and signing attributes. See the
- *
+ * bean objects attribute and signing attributes. See the
+ *
* <p>The characters of a Name must obey the following restrictions:</p>
- *
+ *
* <ul>
* <li>Must contain at least one character</li>
* <li>The first character must be alphanumeric (a-z, A-Z, 0-9)</li>
* <li>All other characters must be alphanumeric, a '-' or a '_'</li>
* </ul>
- *
+ *
* <p>When comparing Names (with <code>equals</code>) all characters are
* converted to lowercase. But you can get the original case sensitive
* string with the <code>toString()</code> method.</p>
@@ -125,13 +125,13 @@ public class Attributes
* the version of this Manifest file.
*/
public static final Name MANIFEST_VERSION = new Name(JarUtils.MANIFEST_VERSION);
-
+
/**
* General main attribute -
* the version of the jar file signature.
*/
public static final Name SIGNATURE_VERSION = new Name(JarUtils.SIGNATURE_VERSION);
-
+
/**
* General main attribute -
* (relative) file paths of the libraries/classpaths that the Classes in
@@ -172,7 +172,7 @@ public class Attributes
* the name if the extension library contained in the jar.
*/
public static final Name EXTENSION_NAME = new Name("Extension-Name");
-
+
/**
* Extension identification attribute -
* synonym for <code>EXTENSTION_NAME</code>.
@@ -180,42 +180,42 @@ public class Attributes
public static final Name EXTENSION_INSTALLATION = EXTENSION_NAME;
// Package versioning and sealing attributes
-
+
/**
* Package versioning -
* name of extension library contained in this jar.
*/
public static final Name IMPLEMENTATION_TITLE
= new Name("Implementation-Title");
-
+
/**
* Package versioning -
* version of the extension library contained in this jar.
*/
public static final Name IMPLEMENTATION_VERSION
= new Name("Implementation-Version");
-
+
/**
* Package versioning -
* name of extension library creator contained in this jar.
*/
public static final Name IMPLEMENTATION_VENDOR
= new Name("Implementation-Vendor");
-
+
/**
* Package versioning -
* unique id of extension library creator.
*/
public static final Name IMPLEMENTATION_VENDOR_ID
= new Name("Implementation-Vendor-Id");
-
+
/**
* Package versioning -
* location where this implementation can be downloaded.
*/
public static final Name IMPLEMENTATION_URL
= new Name("Implementation-URL");
-
+
/**
* Package versioning -
* title of the specification contained in this jar.
@@ -263,7 +263,7 @@ public class Attributes
* Creates a new Name from the given String.
* Throws an IllegalArgumentException if the given String is empty or
* contains any illegal Name characters.
- *
+ *
* @param name the name of the new Name
* @exception IllegalArgumentException if name isn't a valid String
* representation of a Name
@@ -278,28 +278,28 @@ public class Attributes
// there must be at least one character
if (chars.length == 0)
- throw new
- IllegalArgumentException
- ("There must be at least one character in a name");
+ throw new
+ IllegalArgumentException
+ ("There must be at least one character in a name");
// first character must be alphanum
char c = chars[0];
if (!((c >= 'a' && c <= 'z') ||
- (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9')))
- throw new
- IllegalArgumentException("First character must be alphanum");
+ (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9')))
+ throw new
+ IllegalArgumentException("First character must be alphanum");
// all other characters must be alphanums, '-' or '_'
for (int i = 1; i < chars.length; i++)
- {
- c = chars[i];
- if (!((c >= 'a' && c <= 'z') ||
- (c >= 'A' && c <= 'Z') ||
- (c >= '0' && c <= '9') || (c == '-') || (c == '_')))
- throw new
- IllegalArgumentException
- ("Characters must be alphanums, '-' or '_'");
- }
+ {
+ c = chars[i];
+ if (!((c >= 'a' && c <= 'z') ||
+ (c >= 'A' && c <= 'Z') ||
+ (c >= '0' && c <= '9') || (c == '-') || (c == '_')))
+ throw new
+ IllegalArgumentException
+ ("Characters must be alphanums, '-' or '_'");
+ }
// Still here? Then convert to lower case and be done.
// Store the original name for toString();
@@ -325,23 +325,23 @@ public class Attributes
{
// Quick and dirty check
if (name == o)
- return true;
+ return true;
try
- {
- // Note that the constructor already converts the strings to
- // lowercase.
- String otherName = ((Name) o).name;
- return name.equals(otherName);
- }
+ {
+ // Note that the constructor already converts the strings to
+ // lowercase.
+ String otherName = ((Name) o).name;
+ return name.equals(otherName);
+ }
catch (ClassCastException cce)
- {
- return false;
- }
+ {
+ return false;
+ }
catch (NullPointerException npe)
- {
- return false;
- }
+ {
+ return false;
+ }
}
/**
@@ -514,15 +514,15 @@ public class Attributes
try
{
- return map.equals(((Attributes) o).map);
+ return map.equals(((Attributes) o).map);
}
catch (ClassCastException cce)
{
- return false;
+ return false;
}
catch (NullPointerException npe)
{
- return false;
+ return false;
}
}
@@ -591,8 +591,8 @@ public class Attributes
{
if (!(attr instanceof Attributes))
{
- throw new
- ClassCastException("Supplied Map is not an instance of Attributes");
+ throw new
+ ClassCastException("Supplied Map is not an instance of Attributes");
}
map.putAll(attr);
}
diff --git a/libjava/classpath/java/util/jar/JarEntry.java b/libjava/classpath/java/util/jar/JarEntry.java
index 515b45f..52cb2c3 100644
--- a/libjava/classpath/java/util/jar/JarEntry.java
+++ b/libjava/classpath/java/util/jar/JarEntry.java
@@ -108,7 +108,7 @@ public class JarEntry extends ZipEntry
super(entry);
try
{
- attr = entry.getAttributes();
+ attr = entry.getAttributes();
}
catch (IOException _)
{
@@ -130,11 +130,11 @@ public class JarEntry extends ZipEntry
{
if (attr != null)
{
- return (Attributes) attr.clone();
+ return (Attributes) attr.clone();
}
else
{
- return null;
+ return null;
}
}
diff --git a/libjava/classpath/java/util/jar/JarFile.java b/libjava/classpath/java/util/jar/JarFile.java
index 6807736..b67c953 100644
--- a/libjava/classpath/java/util/jar/JarFile.java
+++ b/libjava/classpath/java/util/jar/JarFile.java
@@ -199,8 +199,8 @@ public class JarFile extends ZipFile
super(fileName);
if (verify)
{
- manifest = readManifest();
- verify();
+ manifest = readManifest();
+ verify();
}
}
@@ -236,8 +236,8 @@ public class JarFile extends ZipFile
super(file);
if (verify)
{
- manifest = readManifest();
- verify();
+ manifest = readManifest();
+ verify();
}
}
@@ -256,7 +256,7 @@ public class JarFile extends ZipFile
* @exception FileNotFoundException if the file does not exist
* @exception IOException if another IO exception occurs while reading
* @exception IllegalArgumentException when given an illegal mode
- *
+ *
* @since 1.3
*/
public JarFile(File file, boolean verify, int mode) throws
@@ -265,8 +265,8 @@ public class JarFile extends ZipFile
super(file, mode);
if (verify)
{
- manifest = readManifest();
- verify();
+ manifest = readManifest();
+ verify();
}
}
@@ -280,8 +280,8 @@ public class JarFile extends ZipFile
// only check if manifest is not null
if (manifest == null)
{
- verify = false;
- return;
+ verify = false;
+ return;
}
verify = true;
@@ -295,23 +295,23 @@ public class JarFile extends ZipFile
{
try
{
- ZipEntry manEntry = super.getEntry(MANIFEST_NAME);
- if (manEntry != null)
- {
- InputStream in = super.getInputStream(manEntry);
- manifestRead = true;
- return new Manifest(in);
- }
- else
- {
- manifestRead = true;
- return null;
- }
+ ZipEntry manEntry = super.getEntry(MANIFEST_NAME);
+ if (manEntry != null)
+ {
+ InputStream in = super.getInputStream(manEntry);
+ manifestRead = true;
+ return new Manifest(in);
+ }
+ else
+ {
+ manifestRead = true;
+ return null;
+ }
}
catch (IOException ioe)
{
- manifestRead = true;
- return null;
+ manifestRead = true;
+ return null;
}
}
@@ -353,36 +353,36 @@ public class JarFile extends ZipFile
JarEntry jar = new JarEntry(zip);
Manifest manifest;
try
- {
- manifest = jarfile.getManifest();
- }
+ {
+ manifest = jarfile.getManifest();
+ }
catch (IOException ioe)
- {
- manifest = null;
- }
+ {
+ manifest = null;
+ }
if (manifest != null)
- {
- jar.attr = manifest.getAttributes(jar.getName());
- }
+ {
+ jar.attr = manifest.getAttributes(jar.getName());
+ }
synchronized(jarfile)
- {
- if (jarfile.verify && !jarfile.signaturesRead)
- try
- {
- jarfile.readSignatures();
- }
- catch (IOException ioe)
- {
- if (JarFile.DEBUG)
- {
- JarFile.debug(ioe);
- ioe.printStackTrace();
- }
- jarfile.signaturesRead = true; // fudge it.
- }
- }
+ {
+ if (jarfile.verify && !jarfile.signaturesRead)
+ try
+ {
+ jarfile.readSignatures();
+ }
+ catch (IOException ioe)
+ {
+ if (JarFile.DEBUG)
+ {
+ JarFile.debug(ioe);
+ ioe.printStackTrace();
+ }
+ jarfile.signaturesRead = true; // fudge it.
+ }
+ }
jar.jarfile = jarfile;
return jar;
}
@@ -398,38 +398,38 @@ public class JarFile extends ZipFile
ZipEntry entry = super.getEntry(name);
if (entry != null)
{
- JarEntry jarEntry = new JarEntry(entry);
- Manifest manifest;
- try
- {
- manifest = getManifest();
- }
- catch (IOException ioe)
- {
- manifest = null;
- }
-
- if (manifest != null)
- {
- jarEntry.attr = manifest.getAttributes(name);
+ JarEntry jarEntry = new JarEntry(entry);
+ Manifest manifest;
+ try
+ {
+ manifest = getManifest();
+ }
+ catch (IOException ioe)
+ {
+ manifest = null;
}
- if (verify && !signaturesRead)
- try
- {
- readSignatures();
- }
- catch (IOException ioe)
- {
- if (DEBUG)
- {
- debug(ioe);
- ioe.printStackTrace();
- }
- signaturesRead = true;
- }
+ if (manifest != null)
+ {
+ jarEntry.attr = manifest.getAttributes(name);
+ }
+
+ if (verify && !signaturesRead)
+ try
+ {
+ readSignatures();
+ }
+ catch (IOException ioe)
+ {
+ if (DEBUG)
+ {
+ debug(ioe);
+ ioe.printStackTrace();
+ }
+ signaturesRead = true;
+ }
jarEntry.jarfile = this;
- return jarEntry;
+ return jarEntry;
}
return null;
}
@@ -734,11 +734,11 @@ public class JarFile extends ZipFile
/**
* Verifies that the digest(s) in a signature file were, in fact, made over
* the manifest entry for ENTRY.
- *
+ *
* @param entry The entry name.
* @param attr The attributes from the signature file to verify.
* @param hmManifestEntries Mappings of Jar file entry names to their manifest
- * entry text; i.e. the base-64 encoding of their
+ * entry text; i.e. the base-64 encoding of their
*/
private boolean verifyHashes(String entry, Attributes attr,
HashMap hmManifestEntries)
@@ -820,8 +820,8 @@ public class JarFile extends ZipFile
private boolean checked;
EntryInputStream(final ZipEntry entry,
- final InputStream in,
- final JarFile jar)
+ final InputStream in,
+ final JarFile jar)
throws IOException
{
super(in);
@@ -835,9 +835,9 @@ public class JarFile extends ZipFile
Attributes attr;
Manifest manifest = jarfile.getManifest();
if (manifest != null)
- attr = manifest.getAttributes(entry.getName());
+ attr = manifest.getAttributes(entry.getName());
else
- attr = null;
+ attr = null;
if (DEBUG)
debug("verifying entry " + entry + " attr=" + attr);
if (attr == null)
@@ -958,24 +958,24 @@ public class JarFile extends ZipFile
+ " comp=" + new java.math.BigInteger(hash).toString(16));
if (!Arrays.equals(hash, hashes[i]))
{
- synchronized(jarfile)
- {
- if (DEBUG)
- debug(entry + " could NOT be verified");
- jarfile.verified.put(entry.getName(), Boolean.FALSE);
- }
- return;
- // XXX ??? what do we do here?
- // throw new ZipException("message digest mismatch");
+ synchronized(jarfile)
+ {
+ if (DEBUG)
+ debug(entry + " could NOT be verified");
+ jarfile.verified.put(entry.getName(), Boolean.FALSE);
+ }
+ return;
+ // XXX ??? what do we do here?
+ // throw new ZipException("message digest mismatch");
}
}
synchronized(jarfile)
- {
- if (DEBUG)
- debug(entry + " has been VERIFIED");
- jarfile.verified.put(entry.getName(), Boolean.TRUE);
- }
+ {
+ if (DEBUG)
+ debug(entry + " has been VERIFIED");
+ jarfile.verified.put(entry.getName(), Boolean.TRUE);
+ }
}
}
}
diff --git a/libjava/classpath/java/util/jar/JarInputStream.java b/libjava/classpath/java/util/jar/JarInputStream.java
index 1788af6..4de6609 100644
--- a/libjava/classpath/java/util/jar/JarInputStream.java
+++ b/libjava/classpath/java/util/jar/JarInputStream.java
@@ -108,18 +108,18 @@ public class JarInputStream extends ZipInputStream
{
firstEntry = (JarEntry) super.getNextEntry();
while ((firstEntry != null) &&
- firstEntry.getName().startsWith("META-INF/"))
+ firstEntry.getName().startsWith("META-INF/"))
{
- if (firstEntry.getName().equals(JarFile.MANIFEST_NAME))
- {
- manifest = new Manifest(this);
- }
- firstEntry = (JarEntry) super.getNextEntry();
+ if (firstEntry.getName().equals(JarFile.MANIFEST_NAME))
+ {
+ manifest = new Manifest(this);
+ }
+ firstEntry = (JarEntry) super.getNextEntry();
}
if (verify)
{
- // XXX
+ // XXX
}
}
@@ -136,7 +136,7 @@ public class JarInputStream extends ZipInputStream
JarEntry jarEntry = new JarEntry(zipEntry);
if (manifest != null)
{
- jarEntry.attr = manifest.getAttributes(name);
+ jarEntry.attr = manifest.getAttributes(name);
}
return jarEntry;
}
@@ -163,12 +163,12 @@ public class JarInputStream extends ZipInputStream
ZipEntry entry;
if (firstEntry != null)
{
- entry = firstEntry;
- firstEntry = null;
+ entry = firstEntry;
+ firstEntry = null;
}
else
{
- entry = super.getNextEntry();
+ entry = super.getNextEntry();
}
return entry;
}
diff --git a/libjava/classpath/java/util/jar/JarOutputStream.java b/libjava/classpath/java/util/jar/JarOutputStream.java
index 46c71b3..0ba6002 100644
--- a/libjava/classpath/java/util/jar/JarOutputStream.java
+++ b/libjava/classpath/java/util/jar/JarOutputStream.java
@@ -100,7 +100,7 @@ public class JarOutputStream extends ZipOutputStream
}
/**
- * Prepares the JarOutputStream for writing the next entry.
+ * Prepares the JarOutputStream for writing the next entry.
* This implementation just calls <code>super.putNextEntry()</code>.
*
* @param entry The information for the next entry
@@ -108,6 +108,6 @@ public class JarOutputStream extends ZipOutputStream
*/
public void putNextEntry(ZipEntry entry) throws IOException
{
- super.putNextEntry(entry); // XXX
+ super.putNextEntry(entry); // XXX
}
}
diff --git a/libjava/classpath/java/util/jar/Manifest.java b/libjava/classpath/java/util/jar/Manifest.java
index 980cfc6..f266d82 100644
--- a/libjava/classpath/java/util/jar/Manifest.java
+++ b/libjava/classpath/java/util/jar/Manifest.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package java.util.jar;
import gnu.java.util.jar.JarUtils;
-
+
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -48,7 +48,7 @@ import java.util.Map;
/**
* Reads, writes and manipulaties jar manifest files.
* XXX
- *
+ *
* @since 1.2
* @author Mark Wielaard (mark@klomp.org)
*/
@@ -153,7 +153,7 @@ public class Manifest implements Cloneable
/**
* Read and merge a <code>Manifest</code> from the designated input stream.
- *
+ *
* @param in the input stream to read from.
* @throws IOException if an I/O related exception occurs during the process.
*/
@@ -166,7 +166,7 @@ public class Manifest implements Cloneable
* Writes the contents of this <code>Manifest</code> to the designated
* output stream. Line-endings are platform-independent and consist of the
* 2-codepoint sequence <code>0x0D</code> and <code>0x0A</code>.
- *
+ *
* @param out the output stream to write this <code>Manifest</code> to.
* @throws IOException if an I/O related exception occurs during the process.
*/