From 192554e63278ffff52e9eb985e8f9fae33b9638e Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sun, 14 May 2006 20:38:32 +0000 Subject: PR classpath/27514: * gnu/java/net/IndexListParser.java (JAR_INDEX_FILE): Renamed. Now constant. (JAR_INDEX_VERSION_KEY): Likewise. (IndexListParser): Updated. (getVersionInfo): Likewise. * tools/gnu/classpath/tools/jar/Indexer.java: New file. * tools/gnu/classpath/tools/jar/Action.java (run): Now throws OptionException. * tools/gnu/classpath/tools/jar/Main.java (initializeParser): Handle -i. (ModeOption): New constructor. (parsed): Updated. Use setArchiveFile. (setArchiveFile): New method. (run): Handle no-argument case. (main): Emit --help message on option error. * tools/gnu/classpath/tools/jar/Updater.java (inputJar): New field. (createManifest): New method. (run): Updated. Throws OptionException. Correctly copy zip entry. * tools/gnu/classpath/tools/jar/Creator.java (createManifest): New method. (writeManifest): Removed. (outputStream): Now a JarOutputStream. (writeCommandLineEntries): Changed parameters. Updated callers. (run): Throws OptionException. * java/util/jar/JarOutputStream.java (putNextEntry): Typo fix. * java/util/jar/Manifest.java (read): Typo fix. --- gnu/java/net/IndexListParser.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'gnu/java/net/IndexListParser.java') diff --git a/gnu/java/net/IndexListParser.java b/gnu/java/net/IndexListParser.java index 31a6dbbc8..cd4ca556b 100644 --- a/gnu/java/net/IndexListParser.java +++ b/gnu/java/net/IndexListParser.java @@ -63,8 +63,9 @@ import java.util.jar.JarFile; */ public class IndexListParser { - String filePath = "META-INF/INDEX.LIST"; - String versInfo = "JarIndex-Version: "; + public static final String JAR_INDEX_FILE = "META-INF/INDEX.LIST"; + public static final String JAR_INDEX_VERSION_KEY = "JarIndex-Version: "; + double versionNumber; ArrayList headers = new ArrayList(); @@ -80,16 +81,16 @@ public class IndexListParser try { // Parse INDEX.LIST if it exists - if (jarfile.getEntry(filePath) != null) + if (jarfile.getEntry(JAR_INDEX_FILE) != null) { BufferedReader br = new BufferedReader(new InputStreamReader(new URL(baseJarURL, - filePath).openStream())); + JAR_INDEX_FILE).openStream())); // Must start with version info String line = br.readLine(); - if (!line.startsWith(versInfo)) + if (!line.startsWith(JAR_INDEX_VERSION_KEY)) return; - versionNumber = Double.parseDouble(line.substring(versInfo.length()).trim()); + versionNumber = Double.parseDouble(line.substring(JAR_INDEX_VERSION_KEY.length()).trim()); // Blank line must be next line = br.readLine(); @@ -134,7 +135,7 @@ public class IndexListParser */ public String getVersionInfo() { - return versInfo + getVersionNumber(); + return JAR_INDEX_VERSION_KEY + getVersionNumber(); } /** -- cgit v1.2.1