You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by py...@apache.org on 2007/07/17 08:31:04 UTC
svn commit: r556825 [1/10] - in
/harmony/enhanced/classlib/branches/java6/modules:
archive/src/main/java/java/util/jar/ archive/src/main/java/java/util/zip/
archive/src/main/java/org/apache/harmony/archive/internal/nls/
archive/src/main/java/org/apache...
Author: pyang
Date: Mon Jul 16 23:30:22 2007
New Revision: 556825
URL: http://svn.apache.org/viewvc?view=rev&rev=556825
Log:
Merge updates from classlib trunk@556788 since r556012
Added:
harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/BeansUtils.java
- copied unchanged from r556788, harmony/enhanced/classlib/trunk/modules/beans/src/main/java/org/apache/harmony/beans/BeansUtils.java
harmony/enhanced/classlib/branches/java6/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/MockPropertyChangeValidListener.java
- copied unchanged from r556788, harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/MockPropertyChangeValidListener.java
Modified:
harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/jar/Attributes.java
harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/jar/InitManifest.java
harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/jar/JarEntry.java
harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/jar/JarFile.java
harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/jar/JarInputStream.java
harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/jar/JarVerifier.java
harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/jar/Manifest.java
harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/jar/Pack200.java
harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/zip/Adler32.java
harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/zip/CRC32.java
harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/zip/CheckedInputStream.java
harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/zip/CheckedOutputStream.java
harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/zip/Checksum.java
harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/zip/Deflater.java
harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/zip/DeflaterOutputStream.java
harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/zip/GZIPInputStream.java
harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/zip/GZIPOutputStream.java
harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/zip/Inflater.java
harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/zip/InflaterInputStream.java
harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/zip/ZipConstants.java
harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/zip/ZipEntry.java
harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/zip/ZipException.java
harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/zip/ZipFile.java
harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/zip/ZipInputStream.java
harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/zip/ZipOutputStream.java
harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/org/apache/harmony/archive/internal/nls/Messages.java
harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/org/apache/harmony/archive/util/Util.java
harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/image/BufferedImage.java
harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/ParsingTables.cpp
harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/TypeDefinition.cpp
harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/TypeDefinition.h
harmony/enhanced/classlib/branches/java6/modules/awt/src/test/api/java/common/java/awt/image/BufferedImageTest.java
harmony/enhanced/classlib/branches/java6/modules/beans/META-INF/MANIFEST.MF
harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/Beans.java
harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/EventSetDescriptor.java
harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/Introspector.java
harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/PersistenceDelegate.java
harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/PropertyDescriptor.java
harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/PropertyEditorManager.java
harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/XMLDecoder.java
harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_reflect_MethodPersistenceDelegate.java
harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/EventSetDescriptorTest.java
harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PersistenceDelegateTest.java
harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PropertyDescriptorTest.java
harmony/enhanced/classlib/branches/java6/modules/logging/src/main/java/java/util/logging/LogManager.java
harmony/enhanced/classlib/branches/java6/modules/logging/src/main/java/java/util/logging/Logger.java
harmony/enhanced/classlib/branches/java6/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LoggerTest.java
harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/PermissionCollection.java
harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/tests/api/java/security/PermissionCollectionTest.java
harmony/enhanced/classlib/branches/java6/modules/security/src/test/impl/java/org/apache/harmony/security/tests/java/security/PermissionCollection_ImplTest.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/DriverManager.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/SQLException.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/Time.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/Timestamp.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/RowSet.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/BaseRowSet.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/RowSetMetaDataImpl.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/SqlUtil.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/WebRowSet.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/serial/DefaultUDTMap.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/serial/SQLInputImpl.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/serial/SQLOutputImpl.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/serial/SerialArray.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/serial/SerialClob.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/serial/SerialDatalink.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/serial/SerialException.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/serial/SerialJavaObject.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/serial/SerialRef.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/spi/ProviderImpl.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/spi/SyncFactory.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/spi/SyncProvider.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/transaction/xa/XAException.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/org/apache/harmony/sql/internal/nls/Messages.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/BatchUpdateExceptionTest.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/ConnectionTest.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/DataTruncationTest.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/DatabaseMetaDataTest.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/DateTest.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/DriverManagerTest.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/DriverPropertyInfoTest.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/ParameterMetaDataTest.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/ResultSetMetaDataTest.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/ResultSetTest.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/SQLExceptionTest.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/SQLPermissionTest.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/SQLWarningTest.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/StatementTest.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TestHelper_ClassLoader.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TestHelper_Connection1.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TestHelper_Driver1.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TestHelper_Driver2.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TestHelper_Driver3.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TestHelper_Driver4.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TestHelper_Driver5.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TestHelper_DriverManager.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TestMainForDriver.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TimeTest.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TimestampTest.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TypesTest.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/ConnectionEventTest.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/Impl_PooledConnection.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/Impl_RowSet.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/RowSetEventTest.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/BaseRowSetTest.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/MockArray.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/MockBlob.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/MockClob.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/RowSetMetaDataImplTest.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/serial/SQLInputImplTest.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/serial/SQLOutputImplTest.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/serial/SerialArrayTest.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/serial/SerialClobTest.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/serial/SerialExceptionTest.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/serial/SerialJavaObjectTest.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/serial/SerialRefTest.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/transaction/InvalidTransactionExceptionTest.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/transaction/TransactionRequiredExceptionTest.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/transaction/TransactionRolledbackExceptionTest.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/transaction/xa/XAExceptionTest.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/transaction/xa/XAResourceTest.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/transaction/xa/XidTest.java
Modified: harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/jar/Attributes.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/jar/Attributes.java?view=diff&rev=556825&r1=556824&r2=556825
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/jar/Attributes.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/jar/Attributes.java Mon Jul 16 23:30:22 2007
@@ -40,8 +40,7 @@
public static final Name CLASS_PATH = new Name("Class-Path"); //$NON-NLS-1$
- public static final Name MANIFEST_VERSION = new Name(
- "Manifest-Version"); //$NON-NLS-1$
+ public static final Name MANIFEST_VERSION = new Name("Manifest-Version"); //$NON-NLS-1$
public static final Name MAIN_CLASS = new Name("Main-Class"); //$NON-NLS-1$
@@ -137,7 +136,7 @@
*/
@SuppressWarnings("unchecked")
public Attributes(Attributes attrib) {
- map = (Map<Object, Object>)((HashMap) attrib.map).clone();
+ map = (Map<Object, Object>) ((HashMap) attrib.map).clone();
}
/**
@@ -233,9 +232,10 @@
* when key is not an Attributes.Name or value is not a
* String
*/
- @SuppressWarnings("cast") // Require cast to force ClassCastException
+ @SuppressWarnings("cast")
+ // Require cast to force ClassCastException
public Object put(Object key, Object value) {
- return map.put((Name)key, (String)value);
+ return map.put((Name) key, (String) value);
}
/**
Modified: harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/jar/InitManifest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/jar/InitManifest.java?view=diff&rev=556825&r1=556824&r2=556825
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/jar/InitManifest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/jar/InitManifest.java Mon Jul 16 23:30:22 2007
@@ -51,7 +51,8 @@
private final byte[] mainAttributesChunk;
- InitManifest(InputStream is, Attributes main, Map<String, Attributes> entries, Map<String, byte[]> chunks,
+ 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")); //$NON-NLS-1$
@@ -77,14 +78,16 @@
list.clear();
byte[] chunk = null;
- while (chunks == null ? readLines(is, list) : (chunk = nextChunk(is, list)) != null) {
+ while (chunks == null ? readLines(is, list) : (chunk = nextChunk(is,
+ list)) != null) {
if (list.size() == 0) {
continue;
}
it = list.iterator();
String line = it.next();
if (line.length() < 7
- || !Util.toASCIILowerCase(line.substring(0, 5)).equals("name:")) { //$NON-NLS-1$
+ || !Util.toASCIILowerCase(line.substring(0, 5)).equals(
+ "name:")) { //$NON-NLS-1$
throw new IOException(Messages.getString("archive.23")); //$NON-NLS-1$
}
// Name: length required space char
Modified: harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/jar/JarEntry.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/jar/JarEntry.java?view=diff&rev=556825&r1=556824&r2=556825
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/jar/JarEntry.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/jar/JarEntry.java Mon Jul 16 23:30:22 2007
@@ -34,13 +34,13 @@
private Attributes attributes;
JarFile parentJar;
-
+
CodeSigner signers[];
// Cached factory used to build CertPath-s in <code>getCodeSigners()</code>.
private CertificateFactory factory;
- private boolean isFactoryChecked = false;
+ private boolean isFactoryChecked = false;
/**
* Create a new JarEntry named name
@@ -111,7 +111,7 @@
public JarEntry(JarEntry je) {
super(je);
parentJar = je.parentJar;
- attributes = je.attributes;
+ attributes = je.attributes;
signers = je.signers;
}
@@ -137,7 +137,7 @@
}
private CodeSigner[] getCodeSigners(Certificate[] certs) {
- if(null == certs) {
+ if (null == certs) {
return null;
}
Modified: harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/jar/JarFile.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/jar/JarFile.java?view=diff&rev=556825&r1=556824&r2=556825
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/jar/JarFile.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/jar/JarFile.java Mon Jul 16 23:30:22 2007
@@ -232,7 +232,7 @@
public JarEntry nextElement() {
JarEntry je = new JarEntry(ze.nextElement());
- je.parentJar = jf;
+ je.parentJar = jf;
return je;
}
}
@@ -260,7 +260,7 @@
if (manifest != null) {
return manifest;
}
- try {
+ try {
ByteArrayInputStream is = (ByteArrayInputStream) super
.getInputStream(manifestEntry);
if (verifier != null) {
@@ -275,10 +275,10 @@
} finally {
is.close();
}
- manifestEntry = null;
- } catch(NullPointerException e) {
- manifestEntry = null;
- }
+ manifestEntry = null;
+ } catch (NullPointerException e) {
+ manifestEntry = null;
+ }
return manifest;
}
@@ -300,10 +300,14 @@
if (verifier == null) {
break;
}
- } else if (verifier != null && entryName.length() > dirLength
- && (Util.ASCIIIgnoreCaseRegionMatches(entryName, entryName.length() - 3, ".SF", 0 ,3) //$NON-NLS-1$
- || Util.ASCIIIgnoreCaseRegionMatches(entryName, entryName.length() - 4, ".DSA", 0 ,4) //$NON-NLS-1$
- || Util.ASCIIIgnoreCaseRegionMatches(entryName, entryName.length() - 4, ".RSA", 0 ,4))){ //$NON-NLS-1$
+ } else if (verifier != null
+ && entryName.length() > dirLength
+ && (Util.ASCIIIgnoreCaseRegionMatches(entryName,
+ entryName.length() - 3, ".SF", 0, 3) //$NON-NLS-1$
+ || Util.ASCIIIgnoreCaseRegionMatches(entryName,
+ entryName.length() - 4, ".DSA", 0, 4) //$NON-NLS-1$
+ || Util.ASCIIIgnoreCaseRegionMatches(entryName,
+ entryName.length() - 4, ".RSA", 0, 4))) { //$NON-NLS-1$
signed = true;
InputStream is = super.getInputStream(entry);
byte[] buf = new byte[is.available()];
@@ -373,7 +377,7 @@
return ze;
}
JarEntry je = new JarEntry(ze);
- je.parentJar = this;
+ je.parentJar = this;
return je;
}
Modified: harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/jar/JarInputStream.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/jar/JarInputStream.java?view=diff&rev=556825&r1=556824&r2=556825
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/jar/JarInputStream.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/jar/JarInputStream.java Mon Jul 16 23:30:22 2007
@@ -132,9 +132,10 @@
throw e;
}
} else {
- verifier.verifySignatures(
- (JarVerifier.VerifierEntry) verStream,
- jarEntry);
+ verifier
+ .verifySignatures(
+ (JarVerifier.VerifierEntry) verStream,
+ jarEntry);
}
}
} else {
Modified: harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/jar/JarVerifier.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/jar/JarVerifier.java?view=diff&rev=556825&r1=556824&r2=556825
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/jar/JarVerifier.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/jar/JarVerifier.java Mon Jul 16 23:30:22 2007
@@ -40,12 +40,12 @@
import org.apache.harmony.archive.util.Util;
/**
- * Non-public class used by {@link JarFile} and
- * {@link JarInputStream} to manage the verification of signed
- * jars. <code>JarFile</code> and <code>JarInputStream</code> objects will
- * be expected to have a <code>JarVerifier</code> instance member which can be
- * used to carry out the tasks associated with verifying a signed jar. These
- * tasks would typically include:
+ * Non-public class used by {@link JarFile} and {@link JarInputStream} to manage
+ * the verification of signed jars. <code>JarFile</code> and
+ * <code>JarInputStream</code> objects will be expected to have a
+ * <code>JarVerifier</code> instance member which can be used to carry out the
+ * tasks associated with verifying a signed jar. These tasks would typically
+ * include:
* <ul>
* <li>verification of all signed signature files
* <li>confirmation that all signed data was signed only by the party or
@@ -63,14 +63,13 @@
private HashMap<String, byte[]> metaEntries = new HashMap<String, byte[]>(5);
- private final Hashtable<String, HashMap<String, Attributes>> signatures =
- new Hashtable<String, HashMap<String, Attributes>>(5);
+ private final Hashtable<String, HashMap<String, Attributes>> signatures = new Hashtable<String, HashMap<String, Attributes>>(
+ 5);
- private final Hashtable<String, Certificate[]> certificates =
- new Hashtable<String, Certificate[]>(5);
+ private final Hashtable<String, Certificate[]> certificates = new Hashtable<String, Certificate[]>(
+ 5);
- private final Hashtable<String, Certificate[]> verifiedEntries =
- new Hashtable<String, Certificate[]>();
+ private final Hashtable<String, Certificate[]> verifiedEntries = new Hashtable<String, Certificate[]>();
byte[] mainAttributesChunk;
@@ -150,8 +149,8 @@
}
Vector<Certificate> certs = new Vector<Certificate>();
- Iterator<Map.Entry<String, HashMap<String, Attributes>>> it =
- signatures.entrySet().iterator();
+ Iterator<Map.Entry<String, HashMap<String, Attributes>>> it = signatures
+ .entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, HashMap<String, Attributes>> entry = it.next();
HashMap<String, Attributes> hm = entry.getValue();
@@ -275,7 +274,7 @@
new ByteArrayInputStream(sBlockBytes));
/*
* Recursive call in loading security provider related class which
- * is in a signed jar.
+ * is in a signed jar.
*/
if (null == metaEntries) {
return;
@@ -287,8 +286,8 @@
return;
} catch (GeneralSecurityException e) {
/* [MSG "archive.30", "{0} failed verification of {1}"] */
- throw new SecurityException(
- Messages.getString("archive.30", jarName, signatureFile)); //$NON-NLS-1$
+ throw new SecurityException(Messages.getString(
+ "archive.30", jarName, signatureFile)); //$NON-NLS-1$
}
// Verify manifest hash in .sf file
@@ -317,8 +316,8 @@
if (!verify(attributes, digestAttribute, mainAttributesChunk,
false, true)) {
/* [MSG "archive.30", "{0} failed verification of {1}"] */
- throw new SecurityException(
- Messages.getString("archive.30", jarName, signatureFile)); //$NON-NLS-1$
+ throw new SecurityException(Messages.getString(
+ "archive.30", jarName, signatureFile)); //$NON-NLS-1$
}
}
@@ -340,10 +339,14 @@
}
if (!verify(entry.getValue(), "-Digest", chunk, //$NON-NLS-1$
createdBySigntool, false)) {
- /* [MSG "archive.31", "{0} has invalid digest for {1} in {2}"] */
- throw new SecurityException(
- Messages.getString("archive.31", //$NON-NLS-1$
- new Object[] { signatureFile, entry.getKey(), jarName }));
+ /*
+ * [MSG "archive.31", "{0} has invalid digest for {1} in
+ * {2}"]
+ */
+ throw new SecurityException(Messages.getString(
+ "archive.31", //$NON-NLS-1$
+ new Object[] { signatureFile, entry.getKey(),
+ jarName }));
}
}
}
@@ -382,7 +385,8 @@
byte[] digest = entry.digest.digest();
if (!MessageDigest.isEqual(digest, Base64.decode(entry.hash))) {
/* [MSG "archive.31", "{0} has invalid digest for {1} in {2}"] */
- throw new SecurityException(Messages.getString("archive.31", new Object[] { //$NON-NLS-1$
+ throw new SecurityException(Messages.getString(
+ "archive.31", new Object[] { //$NON-NLS-1$
JarFile.MANIFEST_NAME, zipEntry.getName(), jarName }));
}
verifiedEntries.put(zipEntry.getName(), entry.certificates);
Modified: harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/jar/Manifest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/jar/Manifest.java?view=diff&rev=556825&r1=556824&r2=556825
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/jar/Manifest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/jar/Manifest.java Mon Jul 16 23:30:22 2007
@@ -30,7 +30,8 @@
import org.apache.harmony.luni.util.PriviAction;
/**
- * The Manifest class is used to obtain attribute information for a JarFile and its entries.
+ * The Manifest class is used to obtain attribute information for a JarFile and
+ * its entries.
*
*/
public class Manifest implements Cloneable {
@@ -38,7 +39,8 @@
private static final byte[] LINE_SEPARATOR = new byte[] { '\r', '\n' };
- private static final Attributes.Name NAME_ATTRIBUTE = new Attributes.Name("Name"); //$NON-NLS-1$
+ private static final Attributes.Name NAME_ATTRIBUTE = new Attributes.Name(
+ "Name"); //$NON-NLS-1$
private Attributes mainAttributes = new Attributes();
@@ -47,7 +49,8 @@
private HashMap<String, byte[]> chunks;
/**
- * The data chunk of Main Attributes in the manifest is needed in verification.
+ * The data chunk of Main Attributes in the manifest is needed in
+ * verification.
*/
private byte[] mainAttributesChunk;
@@ -61,9 +64,11 @@
/**
* Constructs a new Manifest instance using the attributes obtained from is.
*
- * @param is InputStream to parse for attributes
+ * @param is
+ * InputStream to parse for attributes
*
- * @throws IOException if an IO error occurs while creating this Manifest
+ * @throws IOException
+ * if an IO error occurs while creating this Manifest
*
*/
public Manifest(InputStream is) throws IOException {
@@ -72,15 +77,17 @@
}
/**
- * Constructs a new Manifest instance. The new instance will have the same attributes as
- * those found in the parameter Manifest.
+ * Constructs a new Manifest instance. The new instance will have the same
+ * attributes as those found in the parameter Manifest.
*
- * @param man Manifest instance to obtain attributes from
+ * @param man
+ * Manifest instance to obtain attributes from
*/
@SuppressWarnings("unchecked")
public Manifest(Manifest man) {
mainAttributes = (Attributes) man.mainAttributes.clone();
- entryAttributes = (HashMap<String, Attributes>) man.entryAttributes.clone();
+ entryAttributes = (HashMap<String, Attributes>) man.entryAttributes
+ .clone();
}
Manifest(InputStream is, boolean readChunks) throws IOException {
@@ -91,8 +98,8 @@
}
/**
- * Resets the both the mainAttributes as well as the entry Attributes associated with this
- * Manifest.
+ * Resets the both the mainAttributes as well as the entry Attributes
+ * associated with this Manifest.
*/
public void clear() {
entryAttributes.clear();
@@ -102,7 +109,8 @@
/**
* Returns the Attributes associated with the parameter entry name
*
- * @param name The name of the entry to obtain Attributes for.
+ * @param name
+ * The name of the entry to obtain Attributes for.
* @return The Attributes for the entry or null if the entry does not exist.
*/
public Attributes getAttributes(String name) {
@@ -128,8 +136,8 @@
}
/**
- * Creates a copy of this Manifest. The returned Manifest will equal the Manifest from which
- * it was cloned.
+ * Creates a copy of this Manifest. The returned Manifest will equal the
+ * Manifest from which it was cloned.
*
* @return A copy of the receiver.
*/
@@ -139,26 +147,31 @@
}
/**
- * Writes out the attribute information of the receiver to the specified OutputStream
+ * Writes out the attribute information of the receiver to the specified
+ * OutputStream
*
- * @param os The OutputStream to write to.
+ * @param os
+ * The OutputStream to write to.
*
- * @throws IOException If an error occurs writing the Manifest
+ * @throws IOException
+ * If an error occurs writing the Manifest
*/
public void write(OutputStream os) throws IOException {
write(this, os);
}
/**
- * Constructs a new Manifest instance obtaining Attribute information from the parameter
- * InputStream.
+ * Constructs a new Manifest instance obtaining Attribute information from
+ * the parameter InputStream.
*
- * @param is The InputStream to read from
- * @throws IOException If an error occurs reading the Manifest.
+ * @param is
+ * The InputStream to read from
+ * @throws IOException
+ * If an error occurs reading the Manifest.
*/
public void read(InputStream is) throws IOException {
- InitManifest initManifest = new InitManifest(is, mainAttributes, entryAttributes,
- chunks, null);
+ InitManifest initManifest = new InitManifest(is, mainAttributes,
+ entryAttributes, chunks, null);
mainAttributesChunk = initManifest.getMainAttributesChunk();
}
@@ -173,11 +186,14 @@
}
/**
- * Determines if the receiver is equal to the parameter Object. Two Manifests are equal if
- * they have identical main Attributes as well as identical entry Attributes.
- *
- * @param o The Object to compare against.
- * @return <code>true</code> if the manifests are equal, <code>false</code> otherwise
+ * Determines if the receiver is equal to the parameter Object. Two
+ * Manifests are equal if they have identical main Attributes as well as
+ * identical entry Attributes.
+ *
+ * @param o
+ * The Object to compare against.
+ * @return <code>true</code> if the manifests are equal,
+ * <code>false</code> otherwise
*/
@Override
public boolean equals(Object o) {
@@ -206,31 +222,37 @@
}
/**
- * Writes out the attribute information of the receiver to the specified OutputStream
+ * Writes out the attribute information of the receiver to the specified
+ * OutputStream
*
- * @param manifest the attribute information of the receiver
- * @param out The OutputStream to write to.
+ * @param manifest
+ * the attribute information of the receiver
+ * @param out
+ * The OutputStream to write to.
*
- * @throws IOException If an error occurs writing the Manifest
+ * @throws IOException
+ * If an error occurs writing the Manifest
*/
static void write(Manifest manifest, OutputStream out) throws IOException {
Charset charset = null;
- String encoding = AccessController.doPrivileged(new PriviAction<String>(
- "manifest.write.encoding")); //$NON-NLS-1$
+ String encoding = AccessController
+ .doPrivileged(new PriviAction<String>("manifest.write.encoding")); //$NON-NLS-1$
if (encoding != null) {
if (encoding.length() == 0) {
encoding = "UTF8"; //$NON-NLS-1$
}
charset = Charset.forName(encoding);
}
- String version = manifest.mainAttributes.getValue(Attributes.Name.MANIFEST_VERSION);
+ String version = manifest.mainAttributes
+ .getValue(Attributes.Name.MANIFEST_VERSION);
if (version != null) {
writeEntry(out, charset, Attributes.Name.MANIFEST_VERSION, version);
Iterator<?> entries = manifest.mainAttributes.keySet().iterator();
while (entries.hasNext()) {
Attributes.Name name = (Attributes.Name) entries.next();
if (!name.equals(Attributes.Name.MANIFEST_VERSION)) {
- writeEntry(out, charset, name, manifest.mainAttributes.getValue(name));
+ writeEntry(out, charset, name, manifest.mainAttributes
+ .getValue(name));
}
}
}
@@ -249,8 +271,8 @@
}
}
- private static void writeEntry(OutputStream os, Charset charset, Attributes.Name name,
- String value) throws IOException {
+ private static void writeEntry(OutputStream os, Charset charset,
+ Attributes.Name name, String value) throws IOException {
int offset = 0;
int limit = LINE_LENGTH_LIMIT;
byte[] out = (name.toString() + ": ").getBytes("ISO8859_1"); //$NON-NLS-1$ //$NON-NLS-2$
Modified: harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/jar/Pack200.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/jar/Pack200.java?view=diff&rev=556825&r1=556824&r2=556825
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/jar/Pack200.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/jar/Pack200.java Mon Jul 16 23:30:22 2007
@@ -32,296 +32,296 @@
*/
public abstract class Pack200 {
- private static final String SYSTEM_PROPERTY_PACKER = "java.util.jar.Pack200.Packer"; //$NON-NLS-1$
+ private static final String SYSTEM_PROPERTY_PACKER = "java.util.jar.Pack200.Packer"; //$NON-NLS-1$
- private static final String SYSTEM_PROPERTY_UNPACKER = "java.util.jar.Pack200.Unpacker"; //$NON-NLS-1$
+ private static final String SYSTEM_PROPERTY_UNPACKER = "java.util.jar.Pack200.Unpacker"; //$NON-NLS-1$
/**
* Prevent this class from being instantiated.
*/
- private Pack200(){
- //do nothing
+ private Pack200() {
+ // do nothing
}
- /**
- * The method first read from system property for the classname of a Packer,
- * if such property exists, the class shall be initialized; or the default
- * Packer will be returned
- *
- * @return a instance of Packer
- */
- public static Pack200.Packer newPacker() {
- return (Packer) AccessController
- .doPrivileged(new PrivilegedAction<Object>() {
- public Object run() {
- String className = System
- .getProperty(SYSTEM_PROPERTY_PACKER,
- "org.apache.harmony.archive.internal.pack200.Pack200PackerAdapter"); //$NON-NLS-1$
- try {
- // TODO Not sure if this will cause problems with
- // loading the packer
- return ClassLoader.getSystemClassLoader()
- .loadClass(className).newInstance();
- } catch (Exception e) {
- throw new Error("Can't load class " + className, e);
- }
- }
- });
-
- }
-
- /**
- * The method first read from system property for the classname of a
- * Unpacker, if such property exists, the class shall be initialized; or the
- * default Unpacker will be returned
- *
- * @return a instance of Unpacker
- */
- public static Pack200.Unpacker newUnpacker() {
- return (Unpacker) AccessController
- .doPrivileged(new PrivilegedAction<Object>() {
- public Object run() {
- String className = System
- .getProperty(SYSTEM_PROPERTY_UNPACKER,
- "org.apache.harmony.archive.internal.pack200.Pack200UnpackerAdapter");//$NON-NLS-1$
- try {
- return ClassLoader.getSystemClassLoader()
- .loadClass(className).newInstance();
- } catch (Exception e) {
- throw new Error("Can't load class " + className, e);
- }
- }
- });
- }
-
- /**
- * interface of Packer
- *
- * @see JSR 200 specification
- */
- public static interface Packer {
-
- /**
- * the format of a class attribute name
- */
- static final String CLASS_ATTRIBUTE_PFX = "pack.class.attribute."; //$NON-NLS-1$
-
- /**
- * the format of a code attribute name
- */
- static final String CODE_ATTRIBUTE_PFX = "pack.code.attribute."; //$NON-NLS-1$
-
- /**
- * the deflation hint to set in the output archive
- */
- static final String DEFLATE_HINT = "pack.deflate.hint";//$NON-NLS-1$
-
- /**
- * the indicated amount of effort to use in compressing the archive.
- */
- static final String EFFORT = "pack.effort";//$NON-NLS-1$
-
- /**
- * a String of error
- */
- static final String ERROR = "error";//$NON-NLS-1$
-
- /**
- * a String of false
- */
- static final String FALSE = "false";//$NON-NLS-1$
-
- /**
- * the format of a field attribute name
- */
- static final String FIELD_ATTRIBUTE_PFX = "pack.field.attribute.";//$NON-NLS-1$
-
- /**
- * a String of keep
- */
- static final String KEEP = "keep";//$NON-NLS-1$
-
- /**
- * decide if all elements shall transmit in their original order
- */
- static final String KEEP_FILE_ORDER = "pack.keep.file.order";//$NON-NLS-1$
-
- /**
- * a String of latest
- */
- static final String LATEST = "latest";//$NON-NLS-1$
-
- /**
- * the format of a method attribute name
- */
- static final String METHOD_ATTRIBUTE_PFX = "pack.method.attribute.";//$NON-NLS-1$
-
- /**
- * Packer shall attempt to determine the latest modification time if
- * this is set to LASTEST
- */
- static final String MODIFICATION_TIME = "pack.modification.time";//$NON-NLS-1$
-
- /**
- * a String of pass
- */
- static final String PASS = "pass";//$NON-NLS-1$
-
- /**
- * the file that will not be compressed.
- */
- static final String PASS_FILE_PFX = "pack.pass.file.";//$NON-NLS-1$
-
- /**
- * packer progress as a percentage
- */
- static final String PROGRESS = "pack.progress";//$NON-NLS-1$
-
- /**
- * The number of bytes of each archive segment.
- */
- static final String SEGMENT_LIMIT = "pack.segment.limit";//$NON-NLS-1$
-
- /**
- * a String of strip
- */
- static final String STRIP = "strip";//$NON-NLS-1$
-
- /**
- * a String of true
- */
- static final String TRUE = "true";//$NON-NLS-1$
-
- /**
- * the action to take if an unknown attribute is encountered.
- */
- static final String UNKNOWN_ATTRIBUTE = "pack.unknown.attribute";//$NON-NLS-1$
-
- /**
- *
- * @return the properties of packer
- */
- SortedMap<String, String> properties();
-
- /**
- * Pack jarfile with pack arithmetic
- *
- * @param in
- * jarfile to be compact
- * @param out
- * stream of compact data
- * @throws IOException
- * if I/O exception occurs
- */
- void pack(JarFile in, OutputStream out) throws IOException;
-
- /**
- * Pack jarStream with pack arithmetic
- *
- * @param in
- * stream of uncompact jar data
- * @param out
- * stream of compact data
- * @throws IOException
- * if I/O exception occurs
- */
- void pack(JarInputStream in, OutputStream out) throws IOException;
-
- /**
- * add a listener for PropertyChange events
- *
- * @param listener
- * the listener to listen if PropertyChange events occurs
- */
- void addPropertyChangeListener(PropertyChangeListener listener);
-
- /**
- * remove a listener
- *
- * @param listener
- * listener to remove
- */
- void removePropertyChangeListener(PropertyChangeListener listener);
- }
-
- /**
- * interface of unpacker
- *
- * @see JSR 200 specification
- */
- public static interface Unpacker {
-
- /**
- * The String indicating if the unpacker should ignore all transmitted
- * values,can be replaced by either true or false
- */
- static final String DEFLATE_HINT = "unpack.deflate.hint";//$NON-NLS-1$
-
- /**
- * a String of false
- */
- static final String FALSE = "false";//$NON-NLS-1$
-
- /**
- * a String of keep
- */
- static final String KEEP = "keep";//$NON-NLS-1$
-
- /**
- * the progress as a percentage
- */
- static final String PROGRESS = "unpack.progress";//$NON-NLS-1$
-
- /**
- * a String of true
- */
- static final String TRUE = "true";//$NON-NLS-1$
-
- /**
- *
- * @return the properties of unpacker
- */
- SortedMap<String, String> properties();
-
- /**
- * unpack stream into jarfile with pack arithmetic
- *
- * @param in
- * stream to uncompact
- * @param out
- * jarstream of uncompact data
- * @throws IOException
- * if I/O exception occurs
- */
- void unpack(InputStream in, JarOutputStream out) throws IOException;
-
- /**
- * unpack File into jarfile with pack arithmetic
- *
- * @param in
- * file to be uncompact
- * @param out
- * jarstream of uncompact data
- * @throws IOException
- * if I/O exception occurs
- */
- void unpack(File in, JarOutputStream out) throws IOException;
-
- /**
- * add a listener for PropertyChange events
- *
- * @param listener
- * the listener to listen if PropertyChange events occurs
- */
- void addPropertyChangeListener(PropertyChangeListener listener);
-
- /**
- * remove a listener
- *
- * @param listener
- * listener to remove
- */
- void removePropertyChangeListener(PropertyChangeListener listener);
- }
+ /**
+ * The method first read from system property for the classname of a Packer,
+ * if such property exists, the class shall be initialized; or the default
+ * Packer will be returned
+ *
+ * @return a instance of Packer
+ */
+ public static Pack200.Packer newPacker() {
+ return (Packer) AccessController
+ .doPrivileged(new PrivilegedAction<Object>() {
+ public Object run() {
+ String className = System
+ .getProperty(SYSTEM_PROPERTY_PACKER,
+ "org.apache.harmony.archive.internal.pack200.Pack200PackerAdapter"); //$NON-NLS-1$
+ try {
+ // TODO Not sure if this will cause problems with
+ // loading the packer
+ return ClassLoader.getSystemClassLoader()
+ .loadClass(className).newInstance();
+ } catch (Exception e) {
+ throw new Error("Can't load class " + className, e);
+ }
+ }
+ });
+
+ }
+
+ /**
+ * The method first read from system property for the classname of a
+ * Unpacker, if such property exists, the class shall be initialized; or the
+ * default Unpacker will be returned
+ *
+ * @return a instance of Unpacker
+ */
+ public static Pack200.Unpacker newUnpacker() {
+ return (Unpacker) AccessController
+ .doPrivileged(new PrivilegedAction<Object>() {
+ public Object run() {
+ String className = System
+ .getProperty(SYSTEM_PROPERTY_UNPACKER,
+ "org.apache.harmony.archive.internal.pack200.Pack200UnpackerAdapter");//$NON-NLS-1$
+ try {
+ return ClassLoader.getSystemClassLoader()
+ .loadClass(className).newInstance();
+ } catch (Exception e) {
+ throw new Error("Can't load class " + className, e);
+ }
+ }
+ });
+ }
+
+ /**
+ * interface of Packer
+ *
+ * @see JSR 200 specification
+ */
+ public static interface Packer {
+
+ /**
+ * the format of a class attribute name
+ */
+ static final String CLASS_ATTRIBUTE_PFX = "pack.class.attribute."; //$NON-NLS-1$
+
+ /**
+ * the format of a code attribute name
+ */
+ static final String CODE_ATTRIBUTE_PFX = "pack.code.attribute."; //$NON-NLS-1$
+
+ /**
+ * the deflation hint to set in the output archive
+ */
+ static final String DEFLATE_HINT = "pack.deflate.hint";//$NON-NLS-1$
+
+ /**
+ * the indicated amount of effort to use in compressing the archive.
+ */
+ static final String EFFORT = "pack.effort";//$NON-NLS-1$
+
+ /**
+ * a String of error
+ */
+ static final String ERROR = "error";//$NON-NLS-1$
+
+ /**
+ * a String of false
+ */
+ static final String FALSE = "false";//$NON-NLS-1$
+
+ /**
+ * the format of a field attribute name
+ */
+ static final String FIELD_ATTRIBUTE_PFX = "pack.field.attribute.";//$NON-NLS-1$
+
+ /**
+ * a String of keep
+ */
+ static final String KEEP = "keep";//$NON-NLS-1$
+
+ /**
+ * decide if all elements shall transmit in their original order
+ */
+ static final String KEEP_FILE_ORDER = "pack.keep.file.order";//$NON-NLS-1$
+
+ /**
+ * a String of latest
+ */
+ static final String LATEST = "latest";//$NON-NLS-1$
+
+ /**
+ * the format of a method attribute name
+ */
+ static final String METHOD_ATTRIBUTE_PFX = "pack.method.attribute.";//$NON-NLS-1$
+
+ /**
+ * Packer shall attempt to determine the latest modification time if
+ * this is set to LASTEST
+ */
+ static final String MODIFICATION_TIME = "pack.modification.time";//$NON-NLS-1$
+
+ /**
+ * a String of pass
+ */
+ static final String PASS = "pass";//$NON-NLS-1$
+
+ /**
+ * the file that will not be compressed.
+ */
+ static final String PASS_FILE_PFX = "pack.pass.file.";//$NON-NLS-1$
+
+ /**
+ * packer progress as a percentage
+ */
+ static final String PROGRESS = "pack.progress";//$NON-NLS-1$
+
+ /**
+ * The number of bytes of each archive segment.
+ */
+ static final String SEGMENT_LIMIT = "pack.segment.limit";//$NON-NLS-1$
+
+ /**
+ * a String of strip
+ */
+ static final String STRIP = "strip";//$NON-NLS-1$
+
+ /**
+ * a String of true
+ */
+ static final String TRUE = "true";//$NON-NLS-1$
+
+ /**
+ * the action to take if an unknown attribute is encountered.
+ */
+ static final String UNKNOWN_ATTRIBUTE = "pack.unknown.attribute";//$NON-NLS-1$
+
+ /**
+ *
+ * @return the properties of packer
+ */
+ SortedMap<String, String> properties();
+
+ /**
+ * Pack jarfile with pack arithmetic
+ *
+ * @param in
+ * jarfile to be compact
+ * @param out
+ * stream of compact data
+ * @throws IOException
+ * if I/O exception occurs
+ */
+ void pack(JarFile in, OutputStream out) throws IOException;
+
+ /**
+ * Pack jarStream with pack arithmetic
+ *
+ * @param in
+ * stream of uncompact jar data
+ * @param out
+ * stream of compact data
+ * @throws IOException
+ * if I/O exception occurs
+ */
+ void pack(JarInputStream in, OutputStream out) throws IOException;
+
+ /**
+ * add a listener for PropertyChange events
+ *
+ * @param listener
+ * the listener to listen if PropertyChange events occurs
+ */
+ void addPropertyChangeListener(PropertyChangeListener listener);
+
+ /**
+ * remove a listener
+ *
+ * @param listener
+ * listener to remove
+ */
+ void removePropertyChangeListener(PropertyChangeListener listener);
+ }
+
+ /**
+ * interface of unpacker
+ *
+ * @see JSR 200 specification
+ */
+ public static interface Unpacker {
+
+ /**
+ * The String indicating if the unpacker should ignore all transmitted
+ * values,can be replaced by either true or false
+ */
+ static final String DEFLATE_HINT = "unpack.deflate.hint";//$NON-NLS-1$
+
+ /**
+ * a String of false
+ */
+ static final String FALSE = "false";//$NON-NLS-1$
+
+ /**
+ * a String of keep
+ */
+ static final String KEEP = "keep";//$NON-NLS-1$
+
+ /**
+ * the progress as a percentage
+ */
+ static final String PROGRESS = "unpack.progress";//$NON-NLS-1$
+
+ /**
+ * a String of true
+ */
+ static final String TRUE = "true";//$NON-NLS-1$
+
+ /**
+ *
+ * @return the properties of unpacker
+ */
+ SortedMap<String, String> properties();
+
+ /**
+ * unpack stream into jarfile with pack arithmetic
+ *
+ * @param in
+ * stream to uncompact
+ * @param out
+ * jarstream of uncompact data
+ * @throws IOException
+ * if I/O exception occurs
+ */
+ void unpack(InputStream in, JarOutputStream out) throws IOException;
+
+ /**
+ * unpack File into jarfile with pack arithmetic
+ *
+ * @param in
+ * file to be uncompact
+ * @param out
+ * jarstream of uncompact data
+ * @throws IOException
+ * if I/O exception occurs
+ */
+ void unpack(File in, JarOutputStream out) throws IOException;
+
+ /**
+ * add a listener for PropertyChange events
+ *
+ * @param listener
+ * the listener to listen if PropertyChange events occurs
+ */
+ void addPropertyChangeListener(PropertyChangeListener listener);
+
+ /**
+ * remove a listener
+ *
+ * @param listener
+ * listener to remove
+ */
+ void removePropertyChangeListener(PropertyChangeListener listener);
+ }
}
Modified: harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/zip/Adler32.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/zip/Adler32.java?view=diff&rev=556825&r1=556824&r2=556825
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/zip/Adler32.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/zip/Adler32.java Mon Jul 16 23:30:22 2007
@@ -17,72 +17,71 @@
package java.util.zip;
-
/**
* The Adler32 class is used to compute the Adler32 Checksum from a set of data.
*/
public class Adler32 implements java.util.zip.Checksum {
- private long adler = 1;
+ private long adler = 1;
- /**
- * Returns the Adler32 checksum for all input received
- *
- * @return The checksum for this instance
- */
- public long getValue() {
- return adler;
- }
-
- /**
- * Reset this instance to its initial checksum
- */
- public void reset() {
- adler = 1;
- }
-
- /**
- * Update this Adler32 checksum using val.
- *
- * @param i
- * byte to update checksum with
- */
- public void update(int i) {
- adler = updateByteImpl(i, adler);
- }
-
- /**
- * Update this Adler32 checksum using the contents of buf.
- *
- * @param buf
- * bytes to update checksum with
- */
- public void update(byte[] buf) {
- update(buf, 0, buf.length);
- }
-
- /**
- * Update this Adler32 checksum with the contents of buf, starting from
- * offset and using nbytes of data.
- *
- * @param buf
- * buffer to obtain dat from
- * @param off
- * offset i buf to copy from
- * @param nbytes
- * number of bytes from buf to use
- */
- public void update(byte[] buf, int off, int nbytes) {
- // avoid int overflow, check null buf
- if (off <= buf.length && nbytes >= 0 && off >= 0
- && buf.length - off >= nbytes) {
+ /**
+ * Returns the Adler32 checksum for all input received
+ *
+ * @return The checksum for this instance
+ */
+ public long getValue() {
+ return adler;
+ }
+
+ /**
+ * Reset this instance to its initial checksum
+ */
+ public void reset() {
+ adler = 1;
+ }
+
+ /**
+ * Update this Adler32 checksum using val.
+ *
+ * @param i
+ * byte to update checksum with
+ */
+ public void update(int i) {
+ adler = updateByteImpl(i, adler);
+ }
+
+ /**
+ * Update this Adler32 checksum using the contents of buf.
+ *
+ * @param buf
+ * bytes to update checksum with
+ */
+ public void update(byte[] buf) {
+ update(buf, 0, buf.length);
+ }
+
+ /**
+ * Update this Adler32 checksum with the contents of buf, starting from
+ * offset and using nbytes of data.
+ *
+ * @param buf
+ * buffer to obtain dat from
+ * @param off
+ * offset i buf to copy from
+ * @param nbytes
+ * number of bytes from buf to use
+ */
+ public void update(byte[] buf, int off, int nbytes) {
+ // avoid int overflow, check null buf
+ if (off <= buf.length && nbytes >= 0 && off >= 0
+ && buf.length - off >= nbytes) {
adler = updateImpl(buf, off, nbytes, adler);
} else {
throw new ArrayIndexOutOfBoundsException();
}
- }
+ }
- private native long updateImpl(byte[] buf, int off, int nbytes, long adler1);
+ private native long updateImpl(byte[] buf, int off, int nbytes, long adler1);
- private native long updateByteImpl(int val, long adler1);
+ private native long updateByteImpl(int val, long adler1);
}
Modified: harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/zip/CRC32.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/zip/CRC32.java?view=diff&rev=556825&r1=556824&r2=556825
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/zip/CRC32.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/zip/CRC32.java Mon Jul 16 23:30:22 2007
@@ -17,73 +17,72 @@
package java.util.zip;
-
/**
* The CRC32 class is used to compute a CRC32 Checksum from a set of data.
*/
public class CRC32 implements java.util.zip.Checksum {
- private long crc = 0L;
+ private long crc = 0L;
- long tbytes = 0L;
+ long tbytes = 0L;
- /**
- * Returns the CRC32 Checksum for all input received.
- *
- * @return The checksum for this instance
- */
- public long getValue() {
- return crc;
- }
-
- /**
- * Returns the CRC32 checksum to it initial state.
- */
- public void reset() {
- tbytes = crc = 0;
-
- }
-
- /**
- * Updates this Checksum with value val
- */
- public void update(int val) {
- crc = updateByteImpl((byte) val, crc);
- }
-
- /**
- * Updates this Checksum with the bytes contained in buffer buf.
- *
- * @param buf
- * Buffer to update Checksum
- */
- public void update(byte[] buf) {
- update(buf, 0, buf.length);
- }
-
- /**
- * Updates this Checksum with nbytes of data from buffer buf, starting at
- * offset off.
- *
- * @param buf
- * Buffer to update Checksum
- * @param off
- * Offset in buf to obtain data from
- * @param nbytes
- * Number of bytes to read from buf
- */
- public void update(byte[] buf, int off, int nbytes) {
- // avoid int overflow, check null buf
- if (off <= buf.length && nbytes >= 0 && off >= 0
- && buf.length - off >= nbytes) {
- tbytes += nbytes;
- crc = updateImpl(buf, off, nbytes, crc);
- } else {
+ /**
+ * Returns the CRC32 Checksum for all input received.
+ *
+ * @return The checksum for this instance
+ */
+ public long getValue() {
+ return crc;
+ }
+
+ /**
+ * Returns the CRC32 checksum to it initial state.
+ */
+ public void reset() {
+ tbytes = crc = 0;
+
+ }
+
+ /**
+ * Updates this Checksum with value val
+ */
+ public void update(int val) {
+ crc = updateByteImpl((byte) val, crc);
+ }
+
+ /**
+ * Updates this Checksum with the bytes contained in buffer buf.
+ *
+ * @param buf
+ * Buffer to update Checksum
+ */
+ public void update(byte[] buf) {
+ update(buf, 0, buf.length);
+ }
+
+ /**
+ * Updates this Checksum with nbytes of data from buffer buf, starting at
+ * offset off.
+ *
+ * @param buf
+ * Buffer to update Checksum
+ * @param off
+ * Offset in buf to obtain data from
+ * @param nbytes
+ * Number of bytes to read from buf
+ */
+ public void update(byte[] buf, int off, int nbytes) {
+ // avoid int overflow, check null buf
+ if (off <= buf.length && nbytes >= 0 && off >= 0
+ && buf.length - off >= nbytes) {
+ tbytes += nbytes;
+ crc = updateImpl(buf, off, nbytes, crc);
+ } else {
throw new ArrayIndexOutOfBoundsException();
}
- }
+ }
- private native long updateImpl(byte[] buf, int off, int nbytes, long crc1);
+ private native long updateImpl(byte[] buf, int off, int nbytes, long crc1);
- private native long updateByteImpl(byte val, long crc1);
+ private native long updateByteImpl(byte val, long crc1);
}
Modified: harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/zip/CheckedInputStream.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/zip/CheckedInputStream.java?view=diff&rev=556825&r1=556824&r2=556825
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/zip/CheckedInputStream.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/zip/CheckedInputStream.java Mon Jul 16 23:30:22 2007
@@ -17,7 +17,6 @@
package java.util.zip;
-
import java.io.IOException;
import java.io.InputStream;
@@ -27,86 +26,86 @@
*/
public class CheckedInputStream extends java.io.FilterInputStream {
- private final Checksum check;
+ private final Checksum check;
- /**
- * Constructs a new CheckedInputStream on InputStream is. The Checksum will
- * be calculated using the algorithm implemented by csum.
- *
- * @param is
- * InputStream to calculate checksum from
- * @param csum
- * Type of Checksum to calculate
- */
- public CheckedInputStream(InputStream is, Checksum csum) {
- super(is);
- check = csum;
- }
-
- /**
- * Reads a byte of data from the underlying stream and recomputes the
- * Checksum with the byte data.
- *
- * @return -1 if end of stream, a single byte value otherwise
- */
- @Override
+ /**
+ * Constructs a new CheckedInputStream on InputStream is. The Checksum will
+ * be calculated using the algorithm implemented by csum.
+ *
+ * @param is
+ * InputStream to calculate checksum from
+ * @param csum
+ * Type of Checksum to calculate
+ */
+ public CheckedInputStream(InputStream is, Checksum csum) {
+ super(is);
+ check = csum;
+ }
+
+ /**
+ * Reads a byte of data from the underlying stream and recomputes the
+ * Checksum with the byte data.
+ *
+ * @return -1 if end of stream, a single byte value otherwise
+ */
+ @Override
public int read() throws IOException {
- int x = in.read();
- if (x != -1) {
- check.update(x);
- }
- return x;
- }
-
- /**
- * Reads up to nbytes of data from the underlying stream, storing it in buf,
- * starting at offset off. The Checksum is updated with the bytes read.
- *
- * @return Number of bytes read, -1 if end of stream
- */
- @Override
+ int x = in.read();
+ if (x != -1) {
+ check.update(x);
+ }
+ return x;
+ }
+
+ /**
+ * Reads up to nbytes of data from the underlying stream, storing it in buf,
+ * starting at offset off. The Checksum is updated with the bytes read.
+ *
+ * @return Number of bytes read, -1 if end of stream
+ */
+ @Override
public int read(byte[] buf, int off, int nbytes) throws IOException {
- int x = in.read(buf, off, nbytes);
- if (x != -1) {
+ int x = in.read(buf, off, nbytes);
+ if (x != -1) {
check.update(buf, off, x);
}
- return x;
- }
+ return x;
+ }
- /**
- * Returns the Checksum calculated on the stream thus far.
- *
- * @return A java.util.zip.Checksum
- */
- public Checksum getChecksum() {
- return check;
- }
-
- /**
- * Skip upto nbytes of data on the underlying stream. Any skipped bytes are
- * added to the running Checksum value.
- *
- * @param nbytes
- * long Number of bytes to skip
- * @return Number of bytes skipped
- */
- @Override
+ /**
+ * Returns the Checksum calculated on the stream thus far.
+ *
+ * @return A java.util.zip.Checksum
+ */
+ public Checksum getChecksum() {
+ return check;
+ }
+
+ /**
+ * Skip upto nbytes of data on the underlying stream. Any skipped bytes are
+ * added to the running Checksum value.
+ *
+ * @param nbytes
+ * long Number of bytes to skip
+ * @return Number of bytes skipped
+ */
+ @Override
public long skip(long nbytes) throws IOException {
- if (nbytes < 1) {
- return 0;
- }
- long skipped = 0;
- byte[] b = new byte[2048];
- int x, v;
- while (skipped != nbytes) {
- x = in.read(b, 0,
- (v = (int) (nbytes - skipped)) > b.length ? b.length : v);
- if (x == -1) {
- return skipped;
- }
- check.update(b, 0, x);
- skipped += x;
- }
- return skipped;
- }
+ if (nbytes < 1) {
+ return 0;
+ }
+ long skipped = 0;
+ byte[] b = new byte[2048];
+ int x, v;
+ while (skipped != nbytes) {
+ x = in.read(b, 0,
+ (v = (int) (nbytes - skipped)) > b.length ? b.length : v);
+ if (x == -1) {
+ return skipped;
+ }
+ check.update(b, 0, x);
+ skipped += x;
+ }
+ return skipped;
+ }
}
Modified: harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/zip/CheckedOutputStream.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/zip/CheckedOutputStream.java?view=diff&rev=556825&r1=556824&r2=556825
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/zip/CheckedOutputStream.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/zip/CheckedOutputStream.java Mon Jul 16 23:30:22 2007
@@ -17,7 +17,6 @@
package java.util.zip;
-
import java.io.IOException;
import java.io.OutputStream;
@@ -27,64 +26,64 @@
*/
public class CheckedOutputStream extends java.io.FilterOutputStream {
- private final Checksum check;
+ private final Checksum check;
- /**
- * Constructs a new CheckedOutputStream on OutputStream os. The Checksum
- * will be calculated using the algorithm implemented by csum.
- *
- * @param os
- * OutputStream to calculate checksum from
- * @param cs
- * Type of Checksum to calculate
- */
- public CheckedOutputStream(OutputStream os, Checksum cs) {
- super(os);
- check = cs;
- }
-
- /**
- * Returns the Checksum calculated on the stream thus far.
- *
- * @return A java.util.zip.Checksum
- */
- public Checksum getChecksum() {
- return check;
- }
-
- /**
- * Writes byte value val to the underlying stream. The Checksum is updated
- * with val.
- *
- * @param val
- * Value of the byte to write out
- *
- * @throws IOException
- * if an IO error has occured
- */
- @Override
+ /**
+ * Constructs a new CheckedOutputStream on OutputStream os. The Checksum
+ * will be calculated using the algorithm implemented by csum.
+ *
+ * @param os
+ * OutputStream to calculate checksum from
+ * @param cs
+ * Type of Checksum to calculate
+ */
+ public CheckedOutputStream(OutputStream os, Checksum cs) {
+ super(os);
+ check = cs;
+ }
+
+ /**
+ * Returns the Checksum calculated on the stream thus far.
+ *
+ * @return A java.util.zip.Checksum
+ */
+ public Checksum getChecksum() {
+ return check;
+ }
+
+ /**
+ * Writes byte value val to the underlying stream. The Checksum is updated
+ * with val.
+ *
+ * @param val
+ * Value of the byte to write out
+ *
+ * @throws IOException
+ * if an IO error has occured
+ */
+ @Override
public void write(int val) throws IOException {
- out.write(val);
- check.update(val);
- }
-
- /**
- * Writes nbytes of data from buf starting at offset off to the underlying
- * stream. The Checksum is updated with the bytes written.
- *
- * @param buf
- * data to write out
- * @param off
- * the start offset of the data
- * @param nbytes
- * number of bytes to write out
- *
- * @throws IOException
- * if an IO error has occured
- */
- @Override
+ out.write(val);
+ check.update(val);
+ }
+
+ /**
+ * Writes nbytes of data from buf starting at offset off to the underlying
+ * stream. The Checksum is updated with the bytes written.
+ *
+ * @param buf
+ * data to write out
+ * @param off
+ * the start offset of the data
+ * @param nbytes
+ * number of bytes to write out
+ *
+ * @throws IOException
+ * if an IO error has occured
+ */
+ @Override
public void write(byte[] buf, int off, int nbytes) throws IOException {
- out.write(buf, off, nbytes);
- check.update(buf, off, nbytes);
- }
+ out.write(buf, off, nbytes);
+ check.update(buf, off, nbytes);
+ }
}
Modified: harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/zip/Checksum.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/zip/Checksum.java?view=diff&rev=556825&r1=556824&r2=556825
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/zip/Checksum.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/zip/Checksum.java Mon Jul 16 23:30:22 2007
@@ -17,13 +17,12 @@
package java.util.zip;
-
public interface Checksum {
- public long getValue();
+ public long getValue();
- public void reset();
+ public void reset();
- public void update(int val);
+ public void update(int val);
- public void update(byte[] buf, int off, int nbytes);
+ public void update(byte[] buf, int off, int nbytes);
}