You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by te...@apache.org on 2006/10/02 18:24:22 UTC
svn commit: r452109 - in
/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java:
java/util/jar/ java/util/zip/ org/apache/harmony/archive/internal/nls/
org/apache/harmony/archive/internal/pack200/
Author: tellison
Date: Mon Oct 2 09:24:18 2006
New Revision: 452109
URL: http://svn.apache.org/viewvc?view=rev&rev=452109
Log:
Apply patch HARMONY-1327 ([classlib][internationalization]Internationalization of the archive module)
Modified:
incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/Attributes.java
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/JarEntry.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/JarInputStream.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/DeflaterOutputStream.java
incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/GZIPInputStream.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/InflaterInputStream.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/ZipInputStream.java
incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/ZipOutputStream.java
incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/org/apache/harmony/archive/internal/nls/messages.properties
incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/org/apache/harmony/archive/internal/pack200/BHSDCodec.java
incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/org/apache/harmony/archive/internal/pack200/CodecEncoding.java
incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/org/apache/harmony/archive/internal/pack200/PopulationCodec.java
incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/org/apache/harmony/archive/internal/pack200/RunCodec.java
incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/org/apache/harmony/archive/internal/pack200/Segment.java
incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/org/apache/harmony/archive/internal/pack200/SegmentOptions.java
Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/Attributes.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/Attributes.java?view=diff&rev=452109&r1=452108&r2=452109
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/Attributes.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/Attributes.java Mon Oct 2 09:24:18 2006
@@ -36,52 +36,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();
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?view=diff&rev=452109&r1=452108&r2=452109
==============================================================================
--- 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 Mon Oct 2 09:24:18 2006
@@ -28,7 +28,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;
@@ -54,8 +54,8 @@
InitManifest(InputStream is, Attributes main, Map<String, Attributes> entries, Map<String, byte[]> chunks,
String verString) throws IOException {
encoding = AccessController.doPrivileged(new PriviAction<String>(
- "manifest.read.encoding"));
- if ("".equals(encoding)) {
+ "manifest.read.encoding")); //$NON-NLS-1$
+ if ("".equals(encoding)) { //$NON-NLS-1$
encoding = null;
}
@@ -72,7 +72,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();
@@ -82,8 +82,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());
@@ -156,8 +156,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;
}
@@ -225,8 +225,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;
}
@@ -274,7 +274,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);
@@ -287,7 +287,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()));
Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/JarEntry.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/JarEntry.java?view=diff&rev=452109&r1=452108&r2=452109
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/JarEntry.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/JarEntry.java Mon Oct 2 09:24:18 2006
@@ -183,7 +183,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 {
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?view=diff&rev=452109&r1=452108&r2=452109
==============================================================================
--- 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 Mon Oct 2 09:24:18 2006
@@ -35,9 +35,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;
@@ -304,11 +304,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()];
Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/JarInputStream.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/JarInputStream.java?view=diff&rev=452109&r1=452108&r2=452109
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/JarInputStream.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/JarInputStream.java Mon Oct 2 09:24:18 2006
@@ -47,7 +47,7 @@
throws IOException {
super(stream);
if (verify) {
- verifier = new JarVerifier("JarInputStream");
+ verifier = new JarVerifier("JarInputStream"); //$NON-NLS-1$
}
if ((mEntry = getNextJarEntry()) == null) {
return;
@@ -73,7 +73,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
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?view=diff&rev=452109&r1=452108&r2=452109
==============================================================================
--- 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 Mon Oct 2 09:24:18 2006
@@ -33,8 +33,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;
/**
@@ -173,20 +173,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());
}
@@ -242,7 +242,7 @@
Iterator<String> 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) {
@@ -260,7 +260,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;
@@ -277,9 +277,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
@@ -287,15 +287,15 @@
HashMap<String, Attributes> hm = new HashMap<String, Attributes>();
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
@@ -304,12 +304,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$
}
}
@@ -318,8 +318,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<Map.Entry<String, Attributes>> it = hm.entrySet()
.iterator();
@@ -329,11 +329,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 }));
}
}
@@ -372,8 +372,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);
@@ -395,9 +395,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()) {
@@ -422,7 +422,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());
}
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?view=diff&rev=452109&r1=452108&r2=452109
==============================================================================
--- 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 Mon Oct 2 09:24:18 2006
@@ -141,7 +141,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];
@@ -159,7 +159,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;
@@ -227,10 +227,10 @@
void write(Manifest manifest, OutputStream out) throws IOException {
os = out;
String encoding = AccessController
- .doPrivileged(new PriviAction<String>("manifest.write.encoding"));
+ .doPrivileged(new PriviAction<String>("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);
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/DeflaterOutputStream.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/DeflaterOutputStream.java?view=diff&rev=452109&r1=452108&r2=452109
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/DeflaterOutputStream.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/DeflaterOutputStream.java Mon Oct 2 09:24:18 2006
@@ -22,7 +22,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
@@ -166,7 +166,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
Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/GZIPInputStream.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/GZIPInputStream.java?view=diff&rev=452109&r1=452108&r2=452109
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/GZIPInputStream.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/GZIPInputStream.java Mon Oct 2 09:24:18 2006
@@ -22,7 +22,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.
@@ -67,7 +67,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;
@@ -102,7 +102,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();
}
@@ -157,10 +157,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;
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?view=diff&rev=452109&r1=452108&r2=452109
==============================================================================
--- 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 Mon Oct 2 09:24:18 2006
@@ -17,7 +17,7 @@
package java.util.zip;
-import org.apache.harmony.luni.util.Msg;
+import org.apache.harmony.archive.internal.nls.Messages;
/**
@@ -176,7 +176,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;
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/InflaterInputStream.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/InflaterInputStream.java?view=diff&rev=452109&r1=452108&r2=452109
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/InflaterInputStream.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/InflaterInputStream.java Mon Oct 2 09:24:18 2006
@@ -23,7 +23,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
@@ -123,9 +123,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) {
@@ -179,7 +179,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);
@@ -223,7 +223,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;
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?view=diff&rev=452109&r1=452108&r2=452109
==============================================================================
--- 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 Mon Oct 2 09:24:18 2006
@@ -27,7 +27,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;
/**
@@ -116,9 +116,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();
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/ZipInputStream.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/ZipInputStream.java?view=diff&rev=452109&r1=452108&r2=452109
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/ZipInputStream.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/ZipInputStream.java Mon Oct 2 09:24:18 2006
@@ -25,7 +25,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;
/**
@@ -93,14 +93,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;
}
}
@@ -123,17 +123,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();
@@ -179,7 +179,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);
@@ -194,7 +194,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);
@@ -250,7 +250,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;
@@ -334,7 +334,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;
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?view=diff&rev=452109&r1=452108&r2=452109
==============================================================================
--- 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 Mon Oct 2 09:24:18 2006
@@ -23,7 +23,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
@@ -96,7 +96,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;
@@ -108,10 +108,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;
@@ -182,13 +182,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();
@@ -233,31 +233,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);
@@ -310,7 +310,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;
}
@@ -376,8 +376,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) {
Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/org/apache/harmony/archive/internal/nls/messages.properties
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/org/apache/harmony/archive/internal/nls/messages.properties?view=diff&rev=452109&r1=452108&r2=452109
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/org/apache/harmony/archive/internal/nls/messages.properties (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/org/apache/harmony/archive/internal/nls/messages.properties Mon Oct 2 09:24:18 2006
@@ -15,3 +15,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}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/org/apache/harmony/archive/internal/pack200/BHSDCodec.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/org/apache/harmony/archive/internal/pack200/BHSDCodec.java?view=diff&rev=452109&r1=452108&r2=452109
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/org/apache/harmony/archive/internal/pack200/BHSDCodec.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/org/apache/harmony/archive/internal/pack200/BHSDCodec.java Mon Oct 2 09:24:18 2006
@@ -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(')');
Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/org/apache/harmony/archive/internal/pack200/CodecEncoding.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/org/apache/harmony/archive/internal/pack200/CodecEncoding.java?view=diff&rev=452109&r1=452108&r2=452109
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/org/apache/harmony/archive/internal/pack200/CodecEncoding.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/org/apache/harmony/archive/internal/pack200/CodecEncoding.java Mon Oct 2 09:24:18 2006
@@ -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$
}
}
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/org/apache/harmony/archive/internal/pack200/PopulationCodec.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/org/apache/harmony/archive/internal/pack200/PopulationCodec.java?view=diff&rev=452109&r1=452108&r2=452109
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/org/apache/harmony/archive/internal/pack200/PopulationCodec.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/org/apache/harmony/archive/internal/pack200/PopulationCodec.java Mon Oct 2 09:24:18 2006
@@ -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
Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/org/apache/harmony/archive/internal/pack200/RunCodec.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/org/apache/harmony/archive/internal/pack200/RunCodec.java?view=diff&rev=452109&r1=452108&r2=452109
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/org/apache/harmony/archive/internal/pack200/RunCodec.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/org/apache/harmony/archive/internal/pack200/RunCodec.java Mon Oct 2 09:24:18 2006
@@ -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$
}
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/org/apache/harmony/archive/internal/pack200/Segment.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/org/apache/harmony/archive/internal/pack200/Segment.java?view=diff&rev=452109&r1=452108&r2=452109
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/org/apache/harmony/archive/internal/pack200/Segment.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/org/apache/harmony/archive/internal/pack200/Segment.java Mon Oct 2 09:24:18 2006
@@ -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;
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/org/apache/harmony/archive/internal/pack200/SegmentOptions.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/org/apache/harmony/archive/internal/pack200/SegmentOptions.java?view=diff&rev=452109&r1=452108&r2=452109
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/org/apache/harmony/archive/internal/pack200/SegmentOptions.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/org/apache/harmony/archive/internal/pack200/SegmentOptions.java Mon Oct 2 09:24:18 2006
@@ -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;
}