Index: java/util/zip/ZipOutputStream.java =================================================================== --- java/util/zip/ZipOutputStream.java (revision 450039) +++ java/util/zip/ZipOutputStream.java (working copy) @@ -21,7 +21,7 @@ import java.io.OutputStream; import java.util.Vector; -import org.apache.harmony.luni.util.Msg; +import org.apache.harmony.archive.internal.nls.Messages; /** * ZipOuputStream is used to write ZipEntries to the underlying stream. Output @@ -94,7 +94,7 @@ */ public void closeEntry() throws IOException { if (cDir == null) { - throw new IOException(Msg.getString("K0059")); + throw new IOException(Messages.getString("archive.1E")); //$NON-NLS-1$ } if (currentEntry == null) { return; @@ -106,10 +106,10 @@ // Verify values for STORED types if (currentEntry.getMethod() == STORED) { if (crc.getValue() != currentEntry.crc) { - throw new ZipException(Msg.getString("K0077")); + throw new ZipException(Messages.getString("archive.20")); //$NON-NLS-1$ } if (currentEntry.size != crc.tbytes) { - throw new ZipException(Msg.getString("K00ae")); + throw new ZipException(Messages.getString("archive.21")); //$NON-NLS-1$ } } curOffset = LOCHDR; @@ -180,13 +180,13 @@ @Override public void finish() throws IOException { if (out == null) { - throw new IOException(Msg.getString("K0059")); + throw new IOException(Messages.getString("archive.1E")); //$NON-NLS-1$ } if (cDir == null) { return; } if (entries.size() == 0) { - throw new ZipException(Msg.getString("K00b6")); + throw new ZipException(Messages.getString("archive.28")); //$NON-NLS-1$; } if (currentEntry != null) { closeEntry(); @@ -231,31 +231,31 @@ if (ze.getMethod() == STORED || (compressMethod == STORED && ze.getMethod() == -1)) { if (ze.crc == -1) { - /* [MSG "K0077", "Crc mismatch"] */ - throw new ZipException(Msg.getString("K0077")); + /* [MSG "archive.20", "Crc mismatch"] */ + throw new ZipException(Messages.getString("archive.20")); //$NON-NLS-1$ } if (ze.size == -1 && ze.compressedSize == -1) { - /* [MSG "K00ae", "Size mismatch"] */ - throw new ZipException(Msg.getString("K00ae")); + /* [MSG "archive.21", "Size mismatch"] */ + throw new ZipException(Messages.getString("archive.21")); //$NON-NLS-1$ } if (ze.size != ze.compressedSize && ze.compressedSize != -1 && ze.size != -1) { - /* [MSG "K00ae", "Size mismatch"] */ - throw new ZipException(Msg.getString("K00ae")); + /* [MSG "archive.21", "Size mismatch"] */ + throw new ZipException(Messages.getString("archive.21")); //$NON-NLS-1$ } } - /* [MSG "K0059", "Stream is closed"] */ + /* [MSG "archive.1E", "Stream is closed"] */ if (cDir == null) { - throw new IOException(Msg.getString("K0059")); + throw new IOException(Messages.getString("archive.1E")); //$NON-NLS-1$ } if (entries.contains(ze.name)) { - /* [MSG "K0066", "Entry already exists: {0}"] */ - throw new ZipException(Msg.getString("K0066", ze.name)); + /* [MSG "archive.29", "Entry already exists: {0}"] */ + throw new ZipException(Messages.getString("archive.29", ze.name)); //$NON-NLS-1$ } nameLength = utf8Count(ze.name); if (nameLength > 0xffff) { - /* [MSG "K01a7", "Name too long: {0}"] */ - throw new IllegalArgumentException(Msg.getString("K01a7", ze.name)); + /* [MSG "archive.2A", "Name too long: {0}"] */ + throw new IllegalArgumentException(Messages.getString("archive.2A", ze.name)); //$NON-NLS-1$ } def.setLevel(compressLevel); @@ -308,7 +308,7 @@ */ public void setComment(String comment) { if (comment.length() > 0xFFFF) { - throw new IllegalArgumentException(Msg.getString("K0068")); + throw new IllegalArgumentException(Messages.getString("archive.2B")); //$NON-NLS-1$ } this.comment = comment; } @@ -374,8 +374,8 @@ } if (currentEntry == null) { - /* [MSG "K00ab", "No active entry"] */ - throw new ZipException(Msg.getString("K00ab")); + /* [MSG "archive.2C", "No active entry"] */ + throw new ZipException(Messages.getString("archive.2C")); //$NON-NLS-1$ } if (currentEntry.getMethod() == STORED) { Index: java/util/zip/InflaterInputStream.java =================================================================== --- java/util/zip/InflaterInputStream.java (revision 450039) +++ java/util/zip/InflaterInputStream.java (working copy) @@ -21,7 +21,7 @@ import java.io.IOException; import java.io.InputStream; -import org.apache.harmony.luni.util.Msg; +import org.apache.harmony.archive.internal.nls.Messages; /** * InflaterOuputStream read data which has been compressed using the DEFLATE @@ -121,9 +121,9 @@ */ @Override public int read(byte[] buffer, int off, int nbytes) throws IOException { - /* [MSG "K0059", "Stream is closed"] */ + /* archive.1E=Stream is closed */ if (closed) { - throw new IOException(Msg.getString("K0059")); + throw new IOException(Messages.getString("archive.1E")); //$NON-NLS-1$ } if (null == buffer) { @@ -177,7 +177,7 @@ protected void fill() throws IOException { if (closed) { - throw new IOException(Msg.getString("K0059")); + throw new IOException(Messages.getString("archive.1E")); //$NON-NLS-1$ } if ((len = in.read(buf)) > 0) { inf.setInput(buf, 0, len); @@ -221,7 +221,8 @@ @Override public int available() throws IOException { if (closed) { - throw new IOException(Msg.getString("K0059")); + // archive.1E=Stream is closed + throw new IOException(Messages.getString("archive.1E")); //$NON-NLS-1$ } if (eof) { return 0; Index: java/util/zip/ZipFile.java =================================================================== --- java/util/zip/ZipFile.java (revision 450039) +++ java/util/zip/ZipFile.java (working copy) @@ -25,7 +25,7 @@ import java.util.Enumeration; import java.util.NoSuchElementException; -import org.apache.harmony.luni.util.Msg; +import org.apache.harmony.archive.internal.nls.Messages; import org.apache.harmony.luni.util.Util; /** @@ -114,9 +114,9 @@ if (result != 0) { switch (result) { case 1: - throw new ZipException(Msg.getString("K01c3", fileName)); + throw new ZipException(Messages.getString("archive.24", fileName)); //$NON-NLS-1$ case 2: - throw new ZipException(Msg.getString("K01c4", fileName)); + throw new ZipException(Messages.getString("archive.25", fileName)); //$NON-NLS-1$ default: throw new OutOfMemoryError(); } Index: java/util/zip/Inflater.java =================================================================== --- java/util/zip/Inflater.java (revision 450039) +++ java/util/zip/Inflater.java (working copy) @@ -15,7 +15,7 @@ package java.util.zip; -import org.apache.harmony.luni.util.Msg; +import org.apache.harmony.archive.internal.nls.Messages; /** @@ -174,7 +174,7 @@ needsDictionary = false; int result = inflateImpl(buf, off, nbytes, streamHandle); if (needsDictionary && neededDict) { - throw new DataFormatException(Msg.getString("K0324")); + throw new DataFormatException(Messages.getString("archive.27")); //$NON-NLS-1$ } return result; } Index: java/util/zip/GZIPInputStream.java =================================================================== --- java/util/zip/GZIPInputStream.java (revision 450039) +++ java/util/zip/GZIPInputStream.java (working copy) @@ -20,7 +20,7 @@ import java.io.IOException; import java.io.InputStream; -import org.apache.harmony.luni.util.Msg; +import org.apache.harmony.archive.internal.nls.Messages; /** * The GZIPInputStream class is used to read data stored in the GZIP format. @@ -65,7 +65,7 @@ byte[] header = new byte[10]; readFully(header, 0, header.length); if (getShort(header, 0) != GZIP_MAGIC) { - throw new IOException(Msg.getString("K0020")); + throw new IOException(Messages.getString("archive.1F")); //$NON-NLS-1$; } int flags = header[3]; boolean hcrc = (flags & FHCRC) != 0; @@ -100,7 +100,7 @@ readFully(header, 0, 2); int crc16 = getShort(header, 0); if ((crc.getValue() & 0xffff) != crc16) { - throw new IOException(Msg.getString("K0077")); + throw new IOException(Messages.getString("archive.20")); //$NON-NLS-1$ } crc.reset(); } @@ -155,10 +155,10 @@ } readFully(b, size, b.length - size); if (getLong(b, 0) != crc.getValue()) { - throw new IOException(Msg.getString("K0077")); + throw new IOException(Messages.getString("archive.20")); //$NON-NLS-1$ } if ((int) getLong(b, 4) != inf.getTotalOut()) { - throw new IOException(Msg.getString("K00ae")); + throw new IOException(Messages.getString("archive.21")); //$NON-NLS-1$ } } return val; Index: java/util/zip/DeflaterOutputStream.java =================================================================== --- java/util/zip/DeflaterOutputStream.java (revision 450039) +++ java/util/zip/DeflaterOutputStream.java (working copy) @@ -20,7 +20,7 @@ import java.io.IOException; import java.io.OutputStream; -import org.apache.harmony.luni.util.Msg; +import org.apache.harmony.archive.internal.nls.Messages; /** * The DeflaterOutputStream class implements a stream filter for the writing of @@ -164,7 +164,7 @@ @Override public void write(byte[] buffer, int off, int nbytes) throws IOException { if (done) { - throw new IOException(Msg.getString("K0007")); + throw new IOException(Messages.getString("archive.26")); //$NON-NLS-1$ } // avoid int overflow, check null buf if (off <= buffer.length && nbytes >= 0 && off >= 0 Index: java/util/zip/ZipInputStream.java =================================================================== --- java/util/zip/ZipInputStream.java (revision 450039) +++ java/util/zip/ZipInputStream.java (working copy) @@ -23,7 +23,7 @@ import java.util.jar.Attributes; import java.util.jar.JarEntry; -import org.apache.harmony.luni.util.Msg; +import org.apache.harmony.archive.internal.nls.Messages; import org.apache.harmony.luni.util.Util; /** @@ -91,14 +91,14 @@ */ public void closeEntry() throws IOException { if (zipClosed) { - throw new IOException(Msg.getString("K0059")); + throw new IOException(Messages.getString("archive.1E")); //$NON-NLS-1$ } if (currentEntry == null) { return; } if (currentEntry instanceof java.util.jar.JarEntry) { Attributes temp = ((JarEntry) currentEntry).getAttributes(); - if (temp != null && temp.containsKey("hidden")) { + if (temp != null && temp.containsKey("hidden")) { //$NON-NLS-1$ return; } } @@ -121,17 +121,17 @@ if (hasDD) { in.read(hdrBuf, 0, EXTHDR); if (getLong(hdrBuf, 0) != EXTSIG) { - throw new ZipException(Msg.getString("K0020")); + throw new ZipException(Messages.getString("archive.1F")); //$NON-NLS-1$ } currentEntry.crc = getLong(hdrBuf, EXTCRC); currentEntry.compressedSize = getLong(hdrBuf, EXTSIZ); currentEntry.size = getLong(hdrBuf, EXTLEN); } if (currentEntry.crc != crc.getValue()) { - throw new ZipException(Msg.getString("K0077")); + throw new ZipException(Messages.getString("archive.20")); //$NON-NLS-1$ } if (currentEntry.compressedSize != inB || currentEntry.size != out) { - throw new ZipException(Msg.getString("K00ae")); + throw new ZipException(Messages.getString("archive.21")); //$NON-NLS-1$ } inf.reset(); @@ -177,7 +177,7 @@ } int version = getShort(hdrBuf, 0) & 0xff; if (version > ZIPLocalHeaderVersionNeeded) { - throw new ZipException(Msg.getString("K0008")); + throw new ZipException(Messages.getString("archive.22")); //$NON-NLS-1$ } int flags = getShort(hdrBuf, LOCFLG - LOCVER); hasDD = ((flags & ZIPDataDescriptorFlag) == ZIPDataDescriptorFlag); @@ -192,7 +192,7 @@ } int flen = getShort(hdrBuf, LOCNAM - LOCVER); if (flen == 0) { - throw new ZipException(Msg.getString("K000a")); + throw new ZipException(Messages.getString("archive.23")); //$NON-NLS-1$ } int elen = getShort(hdrBuf, LOCEXT - LOCVER); @@ -248,7 +248,7 @@ @Override public int read(byte[] buffer, int start, int length) throws IOException { if (zipClosed) { - throw new IOException(Msg.getString("K0059")); + throw new IOException(Messages.getString("archive.1E")); //$NON-NLS-1$ } if (inf.finished() || currentEntry == null) { return -1; @@ -332,7 +332,7 @@ @Override public int available() throws IOException { if (zipClosed) { - throw new IOException(Msg.getString("K0059")); + throw new IOException(Messages.getString("archive.1E")); //$NON-NLS-1$ } if (currentEntry == null) { return 1; Index: java/util/jar/Attributes.java =================================================================== --- java/util/jar/Attributes.java (revision 450039) +++ java/util/jar/Attributes.java (working copy) @@ -34,52 +34,52 @@ private int hashCode; - public static final Name CLASS_PATH = new Name("Class-Path", false); + public static final Name CLASS_PATH = new Name("Class-Path", false); //$NON-NLS-1$ public static final Name MANIFEST_VERSION = new Name( - "Manifest-Version", false); + "Manifest-Version", false); //$NON-NLS-1$ - public static final Name MAIN_CLASS = new Name("Main-Class", false); + public static final Name MAIN_CLASS = new Name("Main-Class", false); //$NON-NLS-1$ public static final Name SIGNATURE_VERSION = new Name( - "Signature-Version", false); + "Signature-Version", false); //$NON-NLS-1$ - public static final Name CONTENT_TYPE = new Name("Content-Type", false); + public static final Name CONTENT_TYPE = new Name("Content-Type", false); //$NON-NLS-1$ - public static final Name SEALED = new Name("Sealed", false); + public static final Name SEALED = new Name("Sealed", false); //$NON-NLS-1$ public static final Name IMPLEMENTATION_TITLE = new Name( - "Implementation-Title", false); + "Implementation-Title", false); //$NON-NLS-1$ public static final Name IMPLEMENTATION_VERSION = new Name( - "Implementation-Version", false); + "Implementation-Version", false); //$NON-NLS-1$ public static final Name IMPLEMENTATION_VENDOR = new Name( - "Implementation-Vendor", false); + "Implementation-Vendor", false); //$NON-NLS-1$ public static final Name SPECIFICATION_TITLE = new Name( - "Specification-Title", false); + "Specification-Title", false); //$NON-NLS-1$ public static final Name SPECIFICATION_VERSION = new Name( - "Specification-Version", false); + "Specification-Version", false); //$NON-NLS-1$ public static final Name SPECIFICATION_VENDOR = new Name( - "Specification-Vendor", false); + "Specification-Vendor", false); //$NON-NLS-1$ - public static final Name EXTENSION_LIST = new Name("Extension-List", + public static final Name EXTENSION_LIST = new Name("Extension-List", //$NON-NLS-1$ false); - public static final Name EXTENSION_NAME = new Name("Extension-Name", + public static final Name EXTENSION_NAME = new Name("Extension-Name", //$NON-NLS-1$ false); public static final Name EXTENSION_INSTALLATION = new Name( - "Extension-Installation", false); + "Extension-Installation", false); //$NON-NLS-1$ public static final Name IMPLEMENTATION_VENDOR_ID = new Name( - "Implementation-Vendor-Id", false); + "Implementation-Vendor-Id", false); //$NON-NLS-1$ public static final Name IMPLEMENTATION_URL = new Name( - "Implementation-URL", false); + "Implementation-URL", false); //$NON-NLS-1$ public Name(String s) { int i = s.length(); Index: java/util/jar/Manifest.java =================================================================== --- java/util/jar/Manifest.java (revision 450039) +++ java/util/jar/Manifest.java (working copy) @@ -139,7 +139,7 @@ private static final byte[] sepBuf = new byte[] { '\r', '\n' }; private static final Attributes.Name nameAttribute = new Attributes.Name( - "Name", false); + "Name", false); //$NON-NLS-1$ byte[] oneByte = new byte[1]; @@ -157,7 +157,7 @@ private void writeEntry(Attributes.Name name, String value) throws IOException { int offset = 0, limit = LIMIT; - byte[] out = (name.toString() + ": ").getBytes("ISO8859_1"); + byte[] out = (name.toString() + ": ").getBytes("ISO8859_1"); //$NON-NLS-1$ //$NON-NLS-2$ if (out.length > limit) { while (out.length - offset >= limit) { int len = out.length - offset; @@ -225,10 +225,10 @@ void write(Manifest manifest, OutputStream out) throws IOException { os = out; String encoding = AccessController - .doPrivileged(new PriviAction("manifest.write.encoding")); + .doPrivileged(new PriviAction("manifest.write.encoding")); //$NON-NLS-1$ if (encoding != null) { - if ("".equals(encoding)) { - encoding = "UTF8"; + if ("".equals(encoding)) { //$NON-NLS-1$ + encoding = "UTF8"; //$NON-NLS-1$ } charset = Charset.forName(encoding); } Index: java/util/jar/JarInputStream.java =================================================================== --- java/util/jar/JarInputStream.java (revision 450039) +++ java/util/jar/JarInputStream.java (working copy) @@ -45,7 +45,7 @@ throws IOException { super(stream); if (verify) { - verifier = new JarVerifier("JarInputStream"); + verifier = new JarVerifier("JarInputStream"); //$NON-NLS-1$ } if ((mEntry = getNextJarEntry()) == null) { return; @@ -71,7 +71,7 @@ } else { Attributes temp = new Attributes(3); - temp.map.put("hidden", null); + temp.map.put("hidden", null); //$NON-NLS-1$ mEntry.setAttributes(temp); /* * if not from the first entry, we will not get enough Index: java/util/jar/JarVerifier.java =================================================================== --- java/util/jar/JarVerifier.java (revision 450039) +++ java/util/jar/JarVerifier.java (working copy) @@ -31,8 +31,8 @@ import java.util.Vector; import java.util.zip.ZipEntry; +import org.apache.harmony.archive.internal.nls.Messages; import org.apache.harmony.luni.util.Base64; -import org.apache.harmony.luni.util.Msg; import org.apache.harmony.security.utils.JarUtils; /** @@ -171,20 +171,20 @@ Certificate[] certificatesArray = new Certificate[certs.size()]; certs.toArray(certificatesArray); - String algorithms = attributes.getValue("Digest-Algorithms"); + String algorithms = attributes.getValue("Digest-Algorithms"); //$NON-NLS-1$ if (algorithms == null) { - algorithms = "SHA SHA1"; + algorithms = "SHA SHA1"; //$NON-NLS-1$ } StringTokenizer tokens = new StringTokenizer(algorithms); while (tokens.hasMoreTokens()) { String algorithm = tokens.nextToken(); - String hash = attributes.getValue(algorithm + "-Digest"); + String hash = attributes.getValue(algorithm + "-Digest"); //$NON-NLS-1$ if (hash == null) { continue; } byte[] hashBytes; try { - hashBytes = hash.getBytes("ISO8859_1"); + hashBytes = hash.getBytes("ISO8859_1"); //$NON-NLS-1$ } catch (UnsupportedEncodingException e) { throw new RuntimeException(e.toString()); } @@ -240,7 +240,7 @@ Iterator it = metaEntries.keySet().iterator(); while (it.hasNext()) { String key = it.next(); - if (key.endsWith(".DSA") || key.endsWith(".RSA")) { + if (key.endsWith(".DSA") || key.endsWith(".RSA")) { //$NON-NLS-1$ //$NON-NLS-2$ verifyCertificate(key); // Check for recursive class load if (metaEntries == null) { @@ -258,7 +258,7 @@ private void verifyCertificate(String certFile) { // Found Digital Sig, .SF should already have been read String signatureFile = certFile.substring(0, certFile.lastIndexOf('.')) - + ".SF"; + + ".SF"; //$NON-NLS-1$ byte[] sfBytes = metaEntries.get(signatureFile); if (sfBytes == null) { return; @@ -275,9 +275,9 @@ } catch (IOException e) { return; } catch (GeneralSecurityException e) { - /* [MSG "K00eb", "{0} failed verification of {1}"] */ + /* [MSG "archive.30", "{0} failed verification of {1}"] */ throw new SecurityException( - Msg.getString("K00eb", jarName, signatureFile)); + Messages.getString("archive.30", jarName, signatureFile)); //$NON-NLS-1$ } // Verify manifest hash in .sf file @@ -285,15 +285,15 @@ HashMap hm = new HashMap(); try { new InitManifest(new ByteArrayInputStream(sfBytes), attributes, hm, - null, "Signature-Version"); + null, "Signature-Version"); //$NON-NLS-1$ } catch (IOException e) { return; } boolean createdBySigntool = false; - String createdByValue = attributes.getValue("Created-By"); + String createdByValue = attributes.getValue("Created-By"); //$NON-NLS-1$ if (createdByValue != null) { - createdBySigntool = createdByValue.indexOf("signtool") != -1; + createdBySigntool = createdByValue.indexOf("signtool") != -1; //$NON-NLS-1$ } // Use .SF to verify the mainAttributes of the manifest @@ -302,12 +302,12 @@ // such verification. // FIXME: The meaning of createdBySigntool if (mainAttributesChunk != null && !createdBySigntool) { - String digestAttribute = "-Digest-Manifest-Main-Attributes"; + String digestAttribute = "-Digest-Manifest-Main-Attributes"; //$NON-NLS-1$ if (!verify(attributes, digestAttribute, mainAttributesChunk, false, true)) { - /* [MSG "K00eb", "{0} failed verification of {1}"] */ + /* [MSG "archive.30", "{0} failed verification of {1}"] */ throw new SecurityException( - Msg.getString("K00eb", jarName, signatureFile)); + Messages.getString("archive.30", jarName, signatureFile)); //$NON-NLS-1$ } } @@ -316,8 +316,8 @@ return; } // Use .SF to verify the whole manifest - String digestAttribute = createdBySigntool ? "-Digest" - : "-Digest-Manifest"; + String digestAttribute = createdBySigntool ? "-Digest" //$NON-NLS-1$ + : "-Digest-Manifest"; //$NON-NLS-1$ if (!verify(attributes, digestAttribute, manifest, false, false)) { Iterator> it = hm.entrySet() .iterator(); @@ -327,11 +327,11 @@ if (chunk == null) { return; } - if (!verify(entry.getValue(), "-Digest", chunk, + if (!verify(entry.getValue(), "-Digest", chunk, //$NON-NLS-1$ createdBySigntool, false)) { - /* [MSG "K00ec", "{0} has invalid digest for {1} in {2}"] */ + /* [MSG "archive.31", "{0} has invalid digest for {1} in {2}"] */ throw new SecurityException( - Msg.getString("K00ec", + Messages.getString("archive.31", //$NON-NLS-1$ new Object[] { signatureFile, entry.getKey(), jarName })); } } @@ -370,8 +370,8 @@ void verifySignatures(VerifierEntry entry, ZipEntry zipEntry) { byte[] digest = entry.digest.digest(); if (!MessageDigest.isEqual(digest, Base64.decode(entry.hash))) { - /* [MSG "K00ec", "{0} has invalid digest for {1} in {2}"] */ - throw new SecurityException(Msg.getString("K00ec", new Object[] { + /* [MSG "archive.31", "{0} has invalid digest for {1} in {2}"] */ + throw new SecurityException(Messages.getString("archive.31", new Object[] { //$NON-NLS-1$ JarFile.MANIFEST_NAME, zipEntry.getName(), jarName })); } verifiedEntries.put(zipEntry.getName(), entry.certificates); @@ -393,9 +393,9 @@ private boolean verify(Attributes attributes, String entry, byte[] data, boolean ignoreSecondEndline, boolean ignorable) { - String algorithms = attributes.getValue("Digest-Algorithms"); + String algorithms = attributes.getValue("Digest-Algorithms"); //$NON-NLS-1$ if (algorithms == null) { - algorithms = "SHA SHA1"; + algorithms = "SHA SHA1"; //$NON-NLS-1$ } StringTokenizer tokens = new StringTokenizer(algorithms); while (tokens.hasMoreTokens()) { @@ -420,7 +420,7 @@ byte[] b = md.digest(); byte[] hashBytes; try { - hashBytes = hash.getBytes("ISO8859_1"); + hashBytes = hash.getBytes("ISO8859_1"); //$NON-NLS-1$ } catch (UnsupportedEncodingException e) { throw new RuntimeException(e.toString()); } Index: java/util/jar/InitManifest.java =================================================================== --- java/util/jar/InitManifest.java (revision 450039) +++ java/util/jar/InitManifest.java (working copy) @@ -26,7 +26,7 @@ import java.util.List; import java.util.Map; -import org.apache.harmony.luni.util.Msg; +import org.apache.harmony.archive.internal.nls.Messages; import org.apache.harmony.luni.util.PriviAction; import org.apache.harmony.luni.util.Util; @@ -52,8 +52,8 @@ InitManifest(InputStream is, Attributes main, Map entries, Map chunks, String verString) throws IOException { encoding = AccessController.doPrivileged(new PriviAction( - "manifest.read.encoding")); - if ("".equals(encoding)) { + "manifest.read.encoding")); //$NON-NLS-1$ + if ("".equals(encoding)) { //$NON-NLS-1$ encoding = null; } @@ -70,7 +70,7 @@ // Check for version attribute if (verString != null && main.getValue(verString) == null) { - throw new IOException(Msg.getString("K0009", verString)); + throw new IOException(Messages.getString("archive.2D", verString)); //$NON-NLS-1$ } list.clear(); @@ -80,8 +80,8 @@ it = list.iterator(); String line = it.next(); if (line.length() < 7 - || !line.substring(0, 5).toLowerCase().equals("name:")) { - throw new IOException(Msg.getString("K000a")); + || !line.substring(0, 5).toLowerCase().equals("name:")) { //$NON-NLS-1$ + throw new IOException(Messages.getString("archive.23")); //$NON-NLS-1$ } // Name: length required space char String name = line.substring(6, line.length()); @@ -154,8 +154,8 @@ return out.toByteArray(); } if (inbufCount == inbuf.length && in.available() == 0) { - /* KA000 = "line too long" */ - throw new IOException(Msg.getString("KA000")); + /* archive.2E = "line too long" */ + throw new IOException(Messages.getString("archive.2E")); //$NON-NLS-1$ } inbufPos = 0; } @@ -223,8 +223,8 @@ return lines.size() != 0; } if (inbufCount == inbuf.length && in.available() == 0) { - /* KA000 = "line too long" */ - throw new IOException(Msg.getString("KA000")); + /* archive.2E = "line too long" */ + throw new IOException(Messages.getString("archive.2E")); //$NON-NLS-1$ } inbufPos = 0; } @@ -272,7 +272,7 @@ String header; int hdrIdx = line.indexOf(':'); if (hdrIdx < 1) { - throw new IOException(Msg.getString("K000b", line)); + throw new IOException(Messages.getString("archive.2F", line)); //$NON-NLS-1$ } header = line.substring(0, hdrIdx); Attributes.Name name = attributeNames.get(header); @@ -285,7 +285,7 @@ attributeNames.put(header, name); } if (hdrIdx + 1 >= line.length() || line.charAt(hdrIdx + 1) != ' ') { - throw new IOException(Msg.getString("K000b", line)); + throw new IOException(Messages.getString("archive.2F", line)); //$NON-NLS-1$ } // +2 due to required SPACE char current.put(name, line.substring(hdrIdx + 2, line.length())); Index: java/util/jar/JarFile.java =================================================================== --- java/util/jar/JarFile.java (revision 450039) +++ java/util/jar/JarFile.java (working copy) @@ -33,9 +33,9 @@ */ public class JarFile extends ZipFile { - public static final String MANIFEST_NAME = "META-INF/MANIFEST.MF"; + public static final String MANIFEST_NAME = "META-INF/MANIFEST.MF"; //$NON-NLS-1$ - static final String META_DIR = "META-INF/"; + static final String META_DIR = "META-INF/"; //$NON-NLS-1$ private Manifest manifest; @@ -302,11 +302,11 @@ } else if (verifier != null && entryName.length() > dirLength && (entryName.regionMatches(true, - entryName.length() - 3, ".SF", 0, 3) + entryName.length() - 3, ".SF", 0, 3) //$NON-NLS-1$ || entryName.regionMatches(true, entryName - .length() - 4, ".DSA", 0, 4) || entryName + .length() - 4, ".DSA", 0, 4) || entryName //$NON-NLS-1$ .regionMatches(true, entryName.length() - 4, - ".RSA", 0, 4))) { + ".RSA", 0, 4))) { //$NON-NLS-1$ signed = true; InputStream is = super.getInputStream(entry); byte[] buf = new byte[is.available()]; Index: java/util/jar/JarEntry.java =================================================================== --- java/util/jar/JarEntry.java (revision 450039) +++ java/util/jar/JarEntry.java (working copy) @@ -181,7 +181,7 @@ CertPath certPath = null; if (!isFactoryChecked) { try { - factory = CertificateFactory.getInstance("X.509"); + factory = CertificateFactory.getInstance("X.509"); //$NON-NLS-1$ } catch (CertificateException ex) { // do nothing } finally { Index: org/apache/harmony/archive/internal/pack200/RunCodec.java =================================================================== --- org/apache/harmony/archive/internal/pack200/RunCodec.java (revision 450039) +++ org/apache/harmony/archive/internal/pack200/RunCodec.java (working copy) @@ -19,6 +19,8 @@ import java.io.IOException; import java.io.InputStream; +import org.apache.harmony.archive.internal.nls.Messages; + /** * A run codec is a grouping of two nested codecs; K values are decoded from * the first codec, and the remaining codes are decoded from the remaining @@ -36,9 +38,9 @@ public RunCodec(int k, Codec aCodec, Codec bCodec) throws Pack200Exception { if (k <= 0) - throw new Pack200Exception("Cannot have a RunCodec for a negative number of numbers"); + throw new Pack200Exception(Messages.getString("archive.12")); //$NON-NLS-1$ if (aCodec == null || bCodec == null) - throw new Pack200Exception("Must supply both codecs for a RunCodec"); + throw new Pack200Exception(Messages.getString("archive.13")); //$NON-NLS-1$ this.k = k; this.aCodec = aCodec; this.bCodec = bCodec; @@ -62,6 +64,6 @@ @Override public String toString() { - return "RunCodec[k="+k+";aCodec="+aCodec+"bCodec="+bCodec+"]"; + return "RunCodec[k="+k+";aCodec="+aCodec+"bCodec="+bCodec+"]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ } } Index: org/apache/harmony/archive/internal/pack200/Segment.java =================================================================== --- org/apache/harmony/archive/internal/pack200/Segment.java (revision 450039) +++ org/apache/harmony/archive/internal/pack200/Segment.java (working copy) @@ -23,6 +23,8 @@ import java.util.ArrayList; import java.util.zip.GZIPInputStream; +import org.apache.harmony.archive.internal.nls.Messages; + /** * A Pack200 archive consists of one (or more) segments. Each segment is * standalone, in the sense that every segment has the magic number header; @@ -104,12 +106,12 @@ throws IOException, Pack200Exception { int total = in.read(data); if (total == -1) - throw new EOFException("Failed to read any data from input stream"); + throw new EOFException(Messages.getString("archive.0E")); //$NON-NLS-1$ while (total < data.length) { int delta = in.read(data, total, data.length - total); if (delta == -1) throw new EOFException( - "Failed to read some data from input stream"); + Messages.getString("archive.0D")); //$NON-NLS-1$ total += delta; } } @@ -480,7 +482,7 @@ attributeDefinitionLayout = parseReferences("attr_definition_layout", in, Codec.UNSIGNED5, attributeDefinitionCount, cpUTF8); if (attributeDefinitionCount > 0) - throw new Error("No idea what the adc is for yet"); + throw new Error(Messages.getString("archive.0C")); //$NON-NLS-1$ } private void parseBcBands(InputStream in) { @@ -497,8 +499,7 @@ classAttrCount++; } if (classAttrCount > 0) - throw new Error( - "There are attribute flags, and I don't know what to do with them"); + throw new Error(Messages.getString("archive.0A")); //$NON-NLS-1$ debug("unimplemented class_attr_count"); debug("unimplemented class_attr_indexes"); debug("unimplemented class_attr_calls"); @@ -643,7 +644,7 @@ Codec.UDELTA5, cpDescriptorCount, cpSignature); cpDescriptor = new String[cpDescriptorCount]; for (int i = 0; i < cpDescriptorCount; i++) { - cpDescriptor[i] = cpDescriptorNames[i] + ":" + cpDescriptorTypes[i]; + cpDescriptor[i] = cpDescriptorNames[i] + ":" + cpDescriptorTypes[i]; //$NON-NLS-1$ } } @@ -819,7 +820,7 @@ Pack200Exception { // TODO Update codec.decode -> decodeScalar cpUTF8 = new String[cpUTF8Count]; - cpUTF8[0] = ""; + cpUTF8[0] = ""; //$NON-NLS-1$ int[] prefix = new int[cpUTF8Count]; int[] suffix = new int[cpUTF8Count]; if (cpUTF8Count > 0) { @@ -1106,7 +1107,7 @@ int index = decode[i]; if (index < 0 || index >= reference.length) throw new Pack200Exception( - "Something has gone wrong during parsing references"); + Messages.getString("archive.06")); //$NON-NLS-1$ result[i] = reference[index]; } return result; @@ -1161,7 +1162,7 @@ magic.length); for (int m = 0; m < magic.length; m++) if (word[m] != magic[m]) - throw new Error("Bad header"); + throw new Error(Messages.getString("archive.07")); //$NON-NLS-1$ setMinorVersion((int) decodeScalar("archive_minver", in, Codec.UNSIGNED5)); setMajorVersion((int) decodeScalar("archive_majver", in, @@ -1284,7 +1285,7 @@ */ private void setMajorVersion(int version) throws Pack200Exception { if (version != 150) - throw new Pack200Exception("Invalid segment major version"); + throw new Pack200Exception(Messages.getString("archive.08")); //$NON-NLS-1$ major = version; } @@ -1298,7 +1299,7 @@ */ private void setMinorVersion(int version) throws Pack200Exception { if (version != 7) - throw new Pack200Exception("Invalid segment minor version"); + throw new Pack200Exception(Messages.getString("archive.09")); //$NON-NLS-1$ minor = version; } Index: org/apache/harmony/archive/internal/pack200/CodecEncoding.java =================================================================== --- org/apache/harmony/archive/internal/pack200/CodecEncoding.java (revision 450039) +++ org/apache/harmony/archive/internal/pack200/CodecEncoding.java (working copy) @@ -20,6 +20,8 @@ import java.io.IOException; import java.io.InputStream; +import org.apache.harmony.archive.internal.nls.Messages; + public class CodecEncoding { /** * The canonical encodings are defined to allow a single byte to represent @@ -101,10 +103,10 @@ // Sanity check to make sure that no-one's been buggering with // the canonical codecs, which would really cause havoc if (canonicalCodec.length != 116) - throw new Error("Canonical encodings have been incorrectly modified"); + throw new Error(Messages.getString("archive.00")); //$NON-NLS-1$ if (value < 0) { throw new IllegalArgumentException( - "Encoding cannot be less than zero"); + Messages.getString("archive.01")); //$NON-NLS-1$ } else if (value == 0) { return defaultCodec; } else if (value <= 115) { @@ -112,13 +114,13 @@ } else if (value == 116) { int code = in.read(); if (code == -1) - throw new EOFException("End of buffer read whilst trying to decode codec"); + throw new EOFException(Messages.getString("archive.02")); //$NON-NLS-1$ int d = (code & 0x01); int s = (code >> 1 & 0x03); int b = (code >> 3 & 0x07) + 1; // this might result in an invalid number, but it's checked in the Codec constructor code = in.read(); if (code == -1) - throw new EOFException("End of buffer read whilst trying to decode codec"); + throw new EOFException(Messages.getString("archive.03")); //$NON-NLS-1$ int h = code + 1; // This handles the special cases for invalid combinations of data. return new BHSDCodec(b,h,s,d); @@ -130,7 +132,7 @@ boolean bdef = (offset >> 4 & 1) == 1; // If both A and B use the default encoding, what's the point of having a run of default values followed by default values if (adef && bdef) - throw new Pack200Exception("ADef and BDef should never both be true"); + throw new Pack200Exception(Messages.getString("archive.04")); //$NON-NLS-1$ int kb = (kbflag ? in.read() : 3); int k = (kb+1) * (int)Math.pow(16, kx); Codec aCodec, bCodec; @@ -169,7 +171,7 @@ Codec tCodec = getCodec(in.read(),in,defaultCodec); return new PopulationCodec(fCodec,uCodec,tCodec); } else { - throw new Pack200Exception("Invalid codec encoding byte (" + value + ") found" ); + throw new Pack200Exception(Messages.getString("archive.05", value)); //$NON-NLS-1$ } } } Index: org/apache/harmony/archive/internal/pack200/PopulationCodec.java =================================================================== --- org/apache/harmony/archive/internal/pack200/PopulationCodec.java (revision 450039) +++ org/apache/harmony/archive/internal/pack200/PopulationCodec.java (working copy) @@ -20,6 +20,8 @@ import java.io.IOException; import java.io.InputStream; +import org.apache.harmony.archive.internal.nls.Messages; + public class PopulationCodec extends Codec { private Codec favouredCodec; private Codec tokenCodec; @@ -34,7 +36,7 @@ public PopulationCodec(Codec favouredCodec, int l, Codec unvafouredCodec) { if (l >= 256 || l <=0) - throw new IllegalArgumentException("L must be between 1..255"); + throw new IllegalArgumentException(Messages.getString("archive.0F")); //$NON-NLS-1$ this.favouredCodec = favouredCodec; this.l = l; this.unvafouredCodec = unvafouredCodec; @@ -42,13 +44,13 @@ @Override public long decode(InputStream in) throws IOException, Pack200Exception { - throw new Pack200Exception("Population encoding does not work unless the number of elements are known"); + throw new Pack200Exception(Messages.getString("archive.10")); //$NON-NLS-1$ } @Override public long decode(InputStream in, long last) throws IOException, Pack200Exception { - throw new Pack200Exception("Population encoding does not work unless the number of elements are known"); + throw new Pack200Exception(Messages.getString("archive.10")); //$NON-NLS-1$ } @Override @@ -86,7 +88,7 @@ tokenCodec = codec; } if (tokenCodec == null) - throw new Pack200Exception("Cannot calculate token codec from " + k + " and " + l); + throw new Pack200Exception(Messages.getString("archive.11", new Integer(k), new Integer(l))); //$NON-NLS-1$ } } // read favourites Index: org/apache/harmony/archive/internal/pack200/BHSDCodec.java =================================================================== --- org/apache/harmony/archive/internal/pack200/BHSDCodec.java (revision 450039) +++ org/apache/harmony/archive/internal/pack200/BHSDCodec.java (working copy) @@ -20,6 +20,8 @@ import java.io.IOException; import java.io.InputStream; +import org.apache.harmony.archive.internal.nls.Messages; + /** * TODO Comment -- quite a lot can be nicked from Codec, since this was created * from it @@ -100,17 +102,17 @@ */ public BHSDCodec(int b, int h, int s, int d) { if (b < 1 || b > 5) - throw new IllegalArgumentException("1<=b<=5"); + throw new IllegalArgumentException(Messages.getString("archive.15")); //$NON-NLS-1$ if (h < 1 || h > 256) - throw new IllegalArgumentException("1<=h<=256"); + throw new IllegalArgumentException(Messages.getString("archive.16")); //$NON-NLS-1$ if (s < 0 || s > 2) - throw new IllegalArgumentException("0<=s<=2"); + throw new IllegalArgumentException(Messages.getString("archive.17")); //$NON-NLS-1$ if (d < 0 || d > 1) - throw new IllegalArgumentException("0<=d<=1"); + throw new IllegalArgumentException(Messages.getString("archive.18")); //$NON-NLS-1$ if (b == 1 && h != 256) - throw new IllegalArgumentException("b=1 -> h=256"); + throw new IllegalArgumentException(Messages.getString("archive.19")); //$NON-NLS-1$ if (h == 256 && b == 5) - throw new IllegalArgumentException("h=256 -> b!=5"); + throw new IllegalArgumentException(Messages.getString("archive.1A")); //$NON-NLS-1$ this.b = b; this.h = h; this.s = s; @@ -135,7 +137,7 @@ public long decode(InputStream in) throws IOException, Pack200Exception { if (d != 0) throw new Pack200Exception( - "Delta encoding used without passing in last value; this is a coding error"); + Messages.getString("archive.1B")); //$NON-NLS-1$ return decode(in, 0); } @@ -148,7 +150,7 @@ do { x = in.read(); if (x == -1) - throw new EOFException("End of stream reached whilst decoding"); + throw new EOFException(Messages.getString("archive.1C")); //$NON-NLS-1$ z += x * Math.pow(h, n); } while (++n < b && x >= l); // This looks more complicated than it is @@ -213,7 +215,7 @@ } else if (s == 2) { result = (3L * cardinality()) / 4 - 1; } else { - throw new Error("Unknown s value"); + throw new Error(Messages.getString("archive.1D")); //$NON-NLS-1$ } } return Math.min((s == 0 ? ((long) Integer.MAX_VALUE) << 1 @@ -249,11 +251,11 @@ buffer.append(','); buffer.append(h); if (s != 0 || d != 0) { - buffer.append(","); + buffer.append(","); //$NON-NLS-1$ buffer.append(s); } if (d != 0) { - buffer.append(","); + buffer.append(","); //$NON-NLS-1$ buffer.append(d); } buffer.append(')'); Index: org/apache/harmony/archive/internal/pack200/SegmentOptions.java =================================================================== --- org/apache/harmony/archive/internal/pack200/SegmentOptions.java (revision 450039) +++ org/apache/harmony/archive/internal/pack200/SegmentOptions.java (working copy) @@ -16,6 +16,8 @@ */ package org.apache.harmony.archive.internal.pack200; +import org.apache.harmony.archive.internal.nls.Messages; + /** * Stores the combinations of bit flags that can be used in the segment header * options. Whilst this could be defined in {@link Segment}, it's cleaner to @@ -72,7 +74,7 @@ */ public SegmentOptions(int options) throws Pack200Exception { if ((options & UNUSED) != 0) - throw new Pack200Exception("Some unused flags are non-zero"); + throw new Pack200Exception(Messages.getString("archive.14")); //$NON-NLS-1$ this.options = options; } Index: org/apache/harmony/archive/internal/nls/messages.properties =================================================================== --- org/apache/harmony/archive/internal/nls/messages.properties (revision 450039) +++ org/apache/harmony/archive/internal/nls/messages.properties (working copy) @@ -14,3 +14,53 @@ # # messages for EN locale +archive.00=Canonical encodings have been incorrectly modified +archive.01=Encoding cannot be less than zero +archive.02=End of buffer read whilst trying to decode codec +archive.03=End of buffer read whilst trying to decode codec +archive.04=ADef and BDef should never both be true +archive.05=Invalid codec encoding byte ({0}) found +archive.06=Something has gone wrong during parsing references +archive.07=Bad header +archive.08=Invalid segment major version +archive.09=Invalid segment minor version +archive.0A=There are attribute flags, and I don't know what to do with them +archive.0B=Not yet implemented +archive.0C=No idea what the adc is for yet +archive.0D=Failed to read some data from input stream +archive.0E=Failed to read any data from input stream +archive.0F=L must be between 1..255 +archive.10=Population encoding does not work unless the number of elements are known +archive.11=Cannot calculate token codec from {0} and {1} +archive.12=Cannot have a RunCodec for a negative number of numbers +archive.13=Must supply both codecs for a RunCodec +archive.14=Some unused flags are non-zero +archive.15=1<=b<=5 +archive.16=1<=h<=256 +archive.17=0<=s<=2 +archive.18=0<=d<=1 +archive.19=b=1 -> h=256 +archive.1A=h=256 -> b\!=5 +archive.1B=Delta encoding used without passing in last value; this is a coding error +archive.1C=End of stream reached whilst decoding +archive.1D=Unknown s value +archive.1E=Stream is closed +archive.1F=Unknown format +archive.20=Crc mismatch +archive.21=Size mismatch +archive.22=Cannot read version +archive.23=Entry is not named +archive.24=Unable to open\: {0} +archive.25=Invalid zip file\: {0} +archive.26=attempt to write after finish +archive.27=Needs dictionary +archive.28=No entries +archive.29=Entry already exists: {0} +archive.2A=Name too long: {0} +archive.2B=String is too long +archive.2C=No active entry +archive.2D=Missing version string\: {0} +archive.2E=Line too long +archive.2F=Invalid attribute {0} +archive.30={0} failed verification of {1} +archive.31={0} has invalid digest for {1} in {2}