summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--luni/src/main/java/java/io/BufferedInputStream.java7
-rw-r--r--luni/src/main/java/java/io/BufferedReader.java3
-rw-r--r--luni/src/main/java/java/io/ByteArrayInputStream.java3
-rw-r--r--luni/src/main/java/java/io/CharArrayWriter.java7
-rw-r--r--luni/src/main/java/java/io/File.java10
-rw-r--r--luni/src/main/java/java/io/FileDescriptor.java5
-rw-r--r--luni/src/main/java/java/io/FileFilter.java4
-rw-r--r--luni/src/main/java/java/io/FilterOutputStream.java3
-rw-r--r--luni/src/main/java/java/io/FilterWriter.java3
-rw-r--r--luni/src/main/java/java/io/InputStream.java3
-rw-r--r--luni/src/main/java/java/io/InputStreamReader.java2
-rw-r--r--luni/src/main/java/java/io/ObjectInputStream.java28
-rw-r--r--luni/src/main/java/java/io/ObjectOutputStream.java5
-rw-r--r--luni/src/main/java/java/io/ObjectStreamField.java2
-rw-r--r--luni/src/main/java/java/io/OutputStream.java3
-rw-r--r--luni/src/main/java/java/io/PipedOutputStream.java6
-rw-r--r--luni/src/main/java/java/io/PrintWriter.java9
-rw-r--r--luni/src/main/java/java/io/Reader.java9
-rw-r--r--luni/src/main/java/java/io/Writer.java9
-rw-r--r--luni/src/main/java/java/lang/AbstractStringBuilder.java6
-rw-r--r--luni/src/main/java/java/lang/Character.java12
-rw-r--r--luni/src/main/java/java/lang/Class.java2
-rw-r--r--luni/src/main/java/java/lang/ClassLoader.java13
-rw-r--r--luni/src/main/java/java/lang/InheritableThreadLocal.java2
-rw-r--r--luni/src/main/java/java/lang/Runtime.java3
-rw-r--r--luni/src/main/java/java/lang/SecurityManager.java2
-rw-r--r--luni/src/main/java/java/lang/StackTraceElement.java4
-rw-r--r--luni/src/main/java/java/lang/String.java17
-rw-r--r--luni/src/main/java/java/lang/ref/ReferenceQueue.java4
-rw-r--r--luni/src/main/java/java/lang/reflect/Field.java2
-rw-r--r--luni/src/main/java/java/lang/reflect/Proxy.java24
-rw-r--r--luni/src/main/java/java/math/BigDecimal.java15
-rw-r--r--luni/src/main/java/java/math/BigInteger.java6
-rw-r--r--luni/src/main/java/java/math/MathContext.java2
-rw-r--r--luni/src/main/java/java/math/Multiplication.java3
-rw-r--r--luni/src/main/java/java/math/Primality.java6
-rw-r--r--luni/src/main/java/java/nio/FileChannelImpl.java2
-rw-r--r--luni/src/main/java/java/nio/IntBuffer.java2
-rw-r--r--luni/src/main/java/java/nio/LongBuffer.java2
-rw-r--r--luni/src/main/java/java/nio/SocketChannelImpl.java7
-rw-r--r--luni/src/main/java/java/security/AccessControlContext.java2
-rw-r--r--luni/src/main/java/java/security/KeyStore.java59
-rw-r--r--luni/src/main/java/java/security/Provider.java16
-rw-r--r--luni/src/main/java/java/security/cert/CertPath.java5
-rw-r--r--luni/src/main/java/java/security/cert/PKIXCertPathChecker.java2
-rw-r--r--luni/src/main/java/java/security/cert/PKIXCertPathValidatorResult.java2
-rw-r--r--luni/src/main/java/java/security/cert/PKIXParameters.java2
-rw-r--r--luni/src/main/java/java/security/cert/X509CertSelector.java2
-rw-r--r--luni/src/main/java/java/sql/DriverManager.java14
-rw-r--r--luni/src/main/java/java/text/AttributedString.java8
-rw-r--r--luni/src/main/java/java/text/BreakIterator.java2
-rw-r--r--luni/src/main/java/java/text/Collator.java2
-rw-r--r--luni/src/main/java/java/text/DecimalFormat.java42
-rw-r--r--luni/src/main/java/java/text/Format.java2
-rw-r--r--luni/src/main/java/java/text/MessageFormat.java13
-rw-r--r--luni/src/main/java/java/text/NumberFormat.java2
-rw-r--r--luni/src/main/java/java/text/StringCharacterIterator.java2
-rw-r--r--luni/src/main/java/java/util/ArrayList.java4
-rw-r--r--luni/src/main/java/java/util/Arrays.java91
-rw-r--r--luni/src/main/java/java/util/BitSet.java2
-rw-r--r--luni/src/main/java/java/util/Calendar.java2
-rw-r--r--luni/src/main/java/java/util/Collections.java3
-rw-r--r--luni/src/main/java/java/util/Date.java7
-rw-r--r--luni/src/main/java/java/util/EnumMap.java2
-rw-r--r--luni/src/main/java/java/util/EnumSet.java6
-rw-r--r--luni/src/main/java/java/util/GregorianCalendar.java2
-rw-r--r--luni/src/main/java/java/util/HashMap.java4
-rw-r--r--luni/src/main/java/java/util/HashSet.java2
-rw-r--r--luni/src/main/java/java/util/Hashtable.java4
-rw-r--r--luni/src/main/java/java/util/HugeEnumSet.java4
-rw-r--r--luni/src/main/java/java/util/IdentityHashMap.java8
-rw-r--r--luni/src/main/java/java/util/LinkedHashMap.java4
-rw-r--r--luni/src/main/java/java/util/LinkedList.java2
-rw-r--r--luni/src/main/java/java/util/MapEntry.java2
-rw-r--r--luni/src/main/java/java/util/MiniEnumSet.java4
-rw-r--r--luni/src/main/java/java/util/Scanner.java18
-rw-r--r--luni/src/main/java/java/util/SimpleTimeZone.java91
-rw-r--r--luni/src/main/java/java/util/TreeSet.java2
-rw-r--r--luni/src/main/java/java/util/Vector.java2
-rw-r--r--luni/src/main/java/java/util/jar/Attributes.java2
-rw-r--r--luni/src/main/java/java/util/logging/Level.java2
-rw-r--r--luni/src/main/java/java/util/logging/LogManager.java8
-rw-r--r--luni/src/main/java/java/util/logging/LogRecord.java12
-rw-r--r--luni/src/main/java/java/util/logging/Logger.java26
-rw-r--r--luni/src/main/java/java/util/prefs/XMLParser.java14
-rw-r--r--luni/src/main/java/java/util/regex/PatternSyntaxException.java4
-rw-r--r--luni/src/main/java/java/util/zip/Inflater.java2
-rw-r--r--luni/src/main/java/java/util/zip/InflaterInputStream.java6
-rw-r--r--luni/src/main/java/java/util/zip/ZipFile.java4
-rw-r--r--luni/src/main/java/java/util/zip/ZipOutputStream.java3
-rw-r--r--luni/src/main/java/javax/crypto/SealedObject.java2
-rw-r--r--luni/src/main/java/javax/crypto/spec/SecretKeySpec.java2
-rw-r--r--luni/src/main/java/javax/net/ssl/SSLSocketFactory.java8
-rw-r--r--luni/src/main/java/libcore/icu/CharsetDecoderICU.java10
-rw-r--r--luni/src/main/java/libcore/icu/CharsetEncoderICU.java34
-rw-r--r--luni/src/main/java/libcore/icu/CollationElementIteratorICU.java2
-rw-r--r--luni/src/main/java/org/apache/harmony/luni/platform/IFileSystem.java11
-rw-r--r--luni/src/main/java/org/apache/harmony/luni/platform/INetworkSystem.java4
-rw-r--r--luni/src/main/java/org/apache/harmony/luni/platform/OSFileSystem.java4
-rw-r--r--luni/src/main/java/org/apache/harmony/luni/util/DeleteOnExit.java2
-rw-r--r--luni/src/main/java/org/apache/harmony/security/asn1/ASN1Integer.java2
-rw-r--r--luni/src/main/java/org/apache/harmony/security/asn1/ObjectIdentifier.java2
-rw-r--r--luni/src/main/java/org/apache/harmony/security/fortress/Services.java10
-rw-r--r--luni/src/main/java/org/apache/harmony/security/pkcs7/SignerInfo.java2
-rw-r--r--luni/src/main/java/org/apache/harmony/security/provider/cert/Cache.java21
-rw-r--r--luni/src/main/java/org/apache/harmony/security/provider/crypto/RandomBitsSupplier.java34
-rw-r--r--luni/src/main/java/org/apache/harmony/security/utils/AlgNameMapper.java2
-rw-r--r--luni/src/main/java/org/apache/harmony/security/utils/JarUtils.java14
-rw-r--r--luni/src/main/java/org/apache/harmony/security/x501/AttributeTypeAndValue.java4
-rw-r--r--luni/src/main/java/org/apache/harmony/security/x509/GeneralName.java2
-rw-r--r--luni/src/main/java/org/apache/harmony/xnet/provider/jsse/ClientHandshakeImpl.java12
-rw-r--r--luni/src/main/java/org/apache/harmony/xnet/provider/jsse/KeyManagerImpl.java4
-rw-r--r--luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLSocketImpl.java8
-rw-r--r--luni/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLContextImpl.java5
-rw-r--r--luni/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLInputStream.java2
-rw-r--r--luni/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLParametersImpl.java22
-rw-r--r--luni/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLSessionImpl.java2
-rw-r--r--luni/src/main/java/org/apache/harmony/xnet/provider/jsse/ServerHandshakeImpl.java6
-rw-r--r--luni/src/main/java/org/apache/harmony/xnet/provider/jsse/TrustManagerFactoryImpl.java10
-rw-r--r--luni/src/main/java/org/xml/sax/ext/Attributes2Impl.java12
120 files changed, 129 insertions, 909 deletions
diff --git a/luni/src/main/java/java/io/BufferedInputStream.java b/luni/src/main/java/java/io/BufferedInputStream.java
index bfd18cf..d45595b 100644
--- a/luni/src/main/java/java/io/BufferedInputStream.java
+++ b/luni/src/main/java/java/io/BufferedInputStream.java
@@ -343,19 +343,12 @@ public class BufferedInputStream extends FilterInputStream {
*/
@Override
public synchronized void reset() throws IOException {
- // BEGIN android-changed
- /*
- * These exceptions get thrown in some "normalish" circumstances,
- * so it is preferable to avoid loading up the whole big set of
- * messages just for these cases.
- */
if (buf == null) {
throw new IOException("Stream is closed");
}
if (-1 == markpos) {
throw new IOException("Mark has been invalidated.");
}
- // END android-changed
pos = markpos;
}
diff --git a/luni/src/main/java/java/io/BufferedReader.java b/luni/src/main/java/java/io/BufferedReader.java
index 0d77735..bc6b9a6 100644
--- a/luni/src/main/java/java/io/BufferedReader.java
+++ b/luni/src/main/java/java/io/BufferedReader.java
@@ -359,9 +359,6 @@ public class BufferedReader extends Reader {
}
for (int charPos = pos; charPos < end; charPos++) {
char ch = buf[charPos];
- // BEGIN android-note
- // a switch statement may be more efficient
- // END android-note
if (ch > '\r') {
continue;
}
diff --git a/luni/src/main/java/java/io/ByteArrayInputStream.java b/luni/src/main/java/java/io/ByteArrayInputStream.java
index 642ba01..0a8c453 100644
--- a/luni/src/main/java/java/io/ByteArrayInputStream.java
+++ b/luni/src/main/java/java/io/ByteArrayInputStream.java
@@ -73,9 +73,6 @@ public class ByteArrayInputStream extends InputStream {
* the number of bytes available for streaming.
*/
public ByteArrayInputStream(byte[] buf, int offset, int length) {
- // BEGIN android-note
- // changed array notation to be consistent with the rest of harmony
- // END android-note
this.buf = buf;
pos = offset;
mark = offset;
diff --git a/luni/src/main/java/java/io/CharArrayWriter.java b/luni/src/main/java/java/io/CharArrayWriter.java
index ea5e10e..eda56f7 100644
--- a/luni/src/main/java/java/io/CharArrayWriter.java
+++ b/luni/src/main/java/java/io/CharArrayWriter.java
@@ -206,16 +206,9 @@ public class CharArrayWriter extends Writer {
if (str == null) {
throw new NullPointerException("str == null");
}
- // avoid int overflow
- // BEGIN android-changed
- // Exception priorities (in case of multiple errors) differ from
- // RI, but are spec-compliant.
- // removed redundant check, used (offset | count) < 0
- // instead of (offset < 0) || (count < 0) to safe one operation
if ((offset | count) < 0 || offset > str.length() - count) {
throw new StringIndexOutOfBoundsException(str, offset, count);
}
- // END android-changed
synchronized (lock) {
expand(count);
str.getChars(offset, offset + count, buf, this.count);
diff --git a/luni/src/main/java/java/io/File.java b/luni/src/main/java/java/io/File.java
index 88af6d8..a026214 100644
--- a/luni/src/main/java/java/io/File.java
+++ b/luni/src/main/java/java/io/File.java
@@ -15,16 +15,6 @@
* limitations under the License.
*/
-// BEGIN android-note
-// We've dropped Windows support, except where it's exposed: we still support
-// non-Unix separators in serialized File objects, for example, but we don't
-// have any code for UNC paths or case-insensitivity.
-// We've also changed the JNI interface to better match what the Java actually wants.
-// (The JNI implementation is also much simpler.)
-// Some methods have been rewritten to reduce unnecessary allocation.
-// Some duplication has been factored out.
-// END android-note
-
package java.io;
import java.net.URI;
diff --git a/luni/src/main/java/java/io/FileDescriptor.java b/luni/src/main/java/java/io/FileDescriptor.java
index cfda96f..e118a3e 100644
--- a/luni/src/main/java/java/io/FileDescriptor.java
+++ b/luni/src/main/java/java/io/FileDescriptor.java
@@ -52,14 +52,11 @@ public final class FileDescriptor {
*/
public static final FileDescriptor err = new FileDescriptor();
- // BEGIN android-changed
- // file descriptors are only int on android
/**
- * Represents a link to any underlying OS resources for this FileDescriptor.
+ * The Unix file descriptor backing this FileDescriptor.
* A value of -1 indicates that this FileDescriptor is invalid.
*/
int descriptor = -1;
- // END android-changed
boolean readOnly = false;
diff --git a/luni/src/main/java/java/io/FileFilter.java b/luni/src/main/java/java/io/FileFilter.java
index 5638dd9..da36fa8 100644
--- a/luni/src/main/java/java/io/FileFilter.java
+++ b/luni/src/main/java/java/io/FileFilter.java
@@ -15,10 +15,6 @@
* limitations under the License.
*/
-// BEGIN android-note
-// the abstract modifier of the interface was removed.
-// END android-note
-
package java.io;
/**
diff --git a/luni/src/main/java/java/io/FilterOutputStream.java b/luni/src/main/java/java/io/FilterOutputStream.java
index 24adf87..5f293b1 100644
--- a/luni/src/main/java/java/io/FilterOutputStream.java
+++ b/luni/src/main/java/java/io/FilterOutputStream.java
@@ -100,9 +100,6 @@ public class FilterOutputStream extends OutputStream {
*/
@Override
public void write(byte[] buffer) throws IOException {
- // BEGIN android-note
- // changed array notation to be consistent with the rest of harmony
- // END android-note
write(buffer, 0, buffer.length);
}
diff --git a/luni/src/main/java/java/io/FilterWriter.java b/luni/src/main/java/java/io/FilterWriter.java
index cd48f64..820fe4f 100644
--- a/luni/src/main/java/java/io/FilterWriter.java
+++ b/luni/src/main/java/java/io/FilterWriter.java
@@ -88,9 +88,6 @@ public abstract class FilterWriter extends Writer {
*/
@Override
public void write(char[] buffer, int offset, int count) throws IOException {
- // BEGIN android-note
- // changed array notation to be consistent with the rest of harmony
- // END android-note
synchronized (lock) {
out.write(buffer, offset, count);
}
diff --git a/luni/src/main/java/java/io/InputStream.java b/luni/src/main/java/java/io/InputStream.java
index 182bf95..f2b4bfa 100644
--- a/luni/src/main/java/java/io/InputStream.java
+++ b/luni/src/main/java/java/io/InputStream.java
@@ -152,9 +152,6 @@ public abstract class InputStream extends Object implements Closeable {
* if this stream is closed or another IOException occurs.
*/
public int read(byte[] b) throws IOException {
- // BEGIN android-note
- // changed array notation to be consistent with the rest of harmony
- // END android-note
return read(b, 0, b.length);
}
diff --git a/luni/src/main/java/java/io/InputStreamReader.java b/luni/src/main/java/java/io/InputStreamReader.java
index 28091e3..e691713 100644
--- a/luni/src/main/java/java/io/InputStreamReader.java
+++ b/luni/src/main/java/java/io/InputStreamReader.java
@@ -138,11 +138,9 @@ public class InputStreamReader extends Reader {
@Override
public void close() throws IOException {
synchronized (lock) {
- // BEGIN android-added
if (decoder != null) {
decoder.reset();
}
- // END android-added
decoder = null;
if (in != null) {
in.close();
diff --git a/luni/src/main/java/java/io/ObjectInputStream.java b/luni/src/main/java/java/io/ObjectInputStream.java
index ede02ac..38b7db6 100644
--- a/luni/src/main/java/java/io/ObjectInputStream.java
+++ b/luni/src/main/java/java/io/ObjectInputStream.java
@@ -17,11 +17,6 @@
package java.io;
-// BEGIN android-note
-// Harmony uses ObjectAccessors to access fields through JNI. Android has not
-// yet migrated that API. As a consequence, there's a lot of changes here...
-// END android-note
-
import dalvik.system.VMStack;
import java.io.EmulatedFields.ObjectSlot;
import java.lang.reflect.Array;
@@ -51,9 +46,7 @@ import libcore.base.EmptyArray;
*/
public class ObjectInputStream extends InputStream implements ObjectInput, ObjectStreamConstants {
- // BEGIN android-note
- // this is non-static to avoid sync contention. Would static be faster?
- // END android-note
+ // TODO: this is non-static to avoid sync contention. Would static be faster?
private InputStream emptyStream = new ByteArrayInputStream(EmptyArray.BYTE);
// To put into objectsRead when reading unsharedObject
@@ -124,10 +117,6 @@ public class ObjectInputStream extends InputStream implements ObjectInput, Objec
PRIMITIVE_CLASSES.put("void", void.class);
}
- // BEGIN android-removed
- // private ObjectAccessor accessor = AccessorFactory.getObjectAccessor();
- // END android-removed
-
// Internal type used to keep track of validators & corresponding priority
static class InputValidationDesc {
ObjectInputValidation validator;
@@ -1165,13 +1154,11 @@ public class ObjectInputStream extends InputStream implements ObjectInput, Objec
}
if (fieldDesc != null) {
if (toSet != null) {
- // BEGIN android-changed
// Get the field type from the local field rather than
// from the stream's supplied data. That's the field
// we'll be setting, so that's the one that needs to be
// validated.
Class<?> fieldType = localFieldDesc.getTypeInternal();
- // END android-added
Class<?> valueType = toSet.getClass();
if (!fieldType.isAssignableFrom(valueType)) {
throw new ClassCastException(classDesc.getName() + "." + fieldName + " - " + fieldType + " not compatible with " + valueType);
@@ -1786,10 +1773,7 @@ public class ObjectInputStream extends InputStream implements ObjectInput, Objec
throws IOException, ClassNotFoundException {
// TODO: This method is opportunity for performance enhancement
// We can cache the classloader and recently used interfaces.
- // BEGIN android-changed
- // ClassLoader loader = VM.getNonBootstrapClassLoader();
ClassLoader loader = ClassLoader.getSystemClassLoader();
- // END android-changed
Class<?>[] interfaces = new Class<?>[interfaceNames.length];
for (int i = 0; i < interfaceNames.length; i++) {
interfaces[i] = Class.forName(interfaceNames[i], false, loader);
@@ -2026,9 +2010,7 @@ public class ObjectInputStream extends InputStream implements ObjectInput, Objec
// original/outside caller
if (++nestedLevels == 1) {
// Remember the caller's class loader
- // BEGIN android-changed
callerClassLoader = getClosestUserClassLoader();
- // END android-changed
}
result = readNonPrimitiveContent(unshared);
@@ -2065,11 +2047,8 @@ public class ObjectInputStream extends InputStream implements ObjectInput, Objec
return result;
}
- // BEGIN android-added
- private static final ClassLoader bootstrapLoader
- = Object.class.getClassLoader();
- private static final ClassLoader systemLoader
- = ClassLoader.getSystemClassLoader();
+ private static final ClassLoader bootstrapLoader = Object.class.getClassLoader();
+ private static final ClassLoader systemLoader = ClassLoader.getSystemClassLoader();
/**
* Searches up the call stack to find the closest user-defined class loader.
@@ -2087,7 +2066,6 @@ public class ObjectInputStream extends InputStream implements ObjectInput, Objec
}
return null;
}
- // END android-added
/**
* Method to be overridden by subclasses to read the next object from the
diff --git a/luni/src/main/java/java/io/ObjectOutputStream.java b/luni/src/main/java/java/io/ObjectOutputStream.java
index 3337e6e..30a4c9e 100644
--- a/luni/src/main/java/java/io/ObjectOutputStream.java
+++ b/luni/src/main/java/java/io/ObjectOutputStream.java
@@ -114,11 +114,6 @@ public class ObjectOutputStream extends OutputStream implements ObjectOutput, Ob
*/
private boolean subclassOverridingImplementation;
-
- // BEGIN android-removed
- // private ObjectAccessor accessor = AccessorFactory.getObjectAccessor();
- // END android-removed
-
/*
* Descriptor for java.lang.reflect.Proxy
*/
diff --git a/luni/src/main/java/java/io/ObjectStreamField.java b/luni/src/main/java/java/io/ObjectStreamField.java
index 3ae34e6..3b389d1 100644
--- a/luni/src/main/java/java/io/ObjectStreamField.java
+++ b/luni/src/main/java/java/io/ObjectStreamField.java
@@ -159,9 +159,7 @@ public class ObjectStreamField implements Comparable<Object> {
*
* @return A Class object representing the type of the field
*/
- // BEGIN android-note
// Changed from private to default visibility for usage in ObjectStreamClass
- // END android-note
/* package */ Class<?> getTypeInternal() {
if (type instanceof WeakReference) {
return (Class<?>) ((WeakReference<?>) type).get();
diff --git a/luni/src/main/java/java/io/OutputStream.java b/luni/src/main/java/java/io/OutputStream.java
index 95f6102..5b40b44 100644
--- a/luni/src/main/java/java/io/OutputStream.java
+++ b/luni/src/main/java/java/io/OutputStream.java
@@ -76,9 +76,6 @@ public abstract class OutputStream implements Closeable, Flushable {
* if an error occurs while writing to this stream.
*/
public void write(byte[] buffer) throws IOException {
- // BEGIN android-note
- // changed array notation to be consistent with the rest of harmony
- // END android-note
write(buffer, 0, buffer.length);
}
diff --git a/luni/src/main/java/java/io/PipedOutputStream.java b/luni/src/main/java/java/io/PipedOutputStream.java
index 6df3fa2..4fa70fa 100644
--- a/luni/src/main/java/java/io/PipedOutputStream.java
+++ b/luni/src/main/java/java/io/PipedOutputStream.java
@@ -15,12 +15,6 @@
* limitations under the License.
*/
-// BEGIN android-note
-// We've made several changes including:
-// - avoid shallow concurrency problems
-// - improved consistency with PipedWriter
-// END android-note
-
package java.io;
/**
diff --git a/luni/src/main/java/java/io/PrintWriter.java b/luni/src/main/java/java/io/PrintWriter.java
index bd0fd20..0c9c8fb 100644
--- a/luni/src/main/java/java/io/PrintWriter.java
+++ b/luni/src/main/java/java/io/PrintWriter.java
@@ -619,9 +619,6 @@ public class PrintWriter extends Writer {
*/
@Override
public void write(char[] buf) {
- // BEGIN android-note
- // changed array notation to be consistent with the rest of harmony
- // END android-note
write(buf, 0, buf.length);
}
@@ -644,9 +641,6 @@ public class PrintWriter extends Writer {
*/
@Override
public void write(char[] buf, int offset, int count) {
- // BEGIN android-note
- // changed array notation to be consistent with the rest of harmony
- // END android-note
doWrite(buf, offset, count);
}
@@ -666,9 +660,6 @@ public class PrintWriter extends Writer {
}
private final void doWrite(char[] buf, int offset, int count) {
- // BEGIN android-note
- // changed array notation to be consistent with the rest of harmony
- // END android-note
synchronized (lock) {
if (out != null) {
try {
diff --git a/luni/src/main/java/java/io/Reader.java b/luni/src/main/java/java/io/Reader.java
index 82f3ac5..8c37436 100644
--- a/luni/src/main/java/java/io/Reader.java
+++ b/luni/src/main/java/java/io/Reader.java
@@ -143,9 +143,6 @@ public abstract class Reader implements Readable, Closeable {
* if this reader is closed or some other I/O error occurs.
*/
public int read(char[] buf) throws IOException {
- // BEGIN android-note
- // changed array notation to be consistent with the rest of harmony
- // END android-note
return read(buf, 0, buf.length);
}
@@ -167,11 +164,7 @@ public abstract class Reader implements Readable, Closeable {
* @throws IOException
* if this reader is closed or some other I/O error occurs.
*/
- public abstract int read(char[] buf, int offset, int count)
- throws IOException;
- // BEGIN android-note
- // changed array notation to be consistent with the rest of harmony
- // END android-note
+ public abstract int read(char[] buf, int offset, int count) throws IOException;
/**
* Indicates whether this reader is ready to be read without blocking.
diff --git a/luni/src/main/java/java/io/Writer.java b/luni/src/main/java/java/io/Writer.java
index d1ff429..a766137 100644
--- a/luni/src/main/java/java/io/Writer.java
+++ b/luni/src/main/java/java/io/Writer.java
@@ -92,9 +92,6 @@ public abstract class Writer implements Appendable, Closeable, Flushable {
* if this writer is closed or another I/O error occurs.
*/
public void write(char[] buf) throws IOException {
- // BEGIN android-note
- // changed array notation to be consistent with the rest of harmony
- // END android-note
write(buf, 0, buf.length);
}
@@ -114,11 +111,7 @@ public abstract class Writer implements Appendable, Closeable, Flushable {
* @throws IOException
* if this writer is closed or another I/O error occurs.
*/
- public abstract void write(char[] buf, int offset, int count)
- throws IOException;
- // BEGIN android-note
- // changed array notation to be consistent with the rest of harmony
- // END android-note
+ public abstract void write(char[] buf, int offset, int count) throws IOException;
/**
* Writes one character to the target. Only the two least significant bytes
diff --git a/luni/src/main/java/java/lang/AbstractStringBuilder.java b/luni/src/main/java/java/lang/AbstractStringBuilder.java
index 5fe059f..b711342 100644
--- a/luni/src/main/java/java/lang/AbstractStringBuilder.java
+++ b/luni/src/main/java/java/lang/AbstractStringBuilder.java
@@ -86,9 +86,7 @@ abstract class AbstractStringBuilder {
count = string.length();
shared = false;
value = new char[count + INITIAL_CAPACITY];
- // BEGIN android-changed
string._getChars(0, count, value, 0);
- // END android-changed
}
private void enlargeBuffer(int min) {
@@ -355,9 +353,7 @@ abstract class AbstractStringBuilder {
int min = string.length();
if (min != 0) {
move(min, index);
- // BEGIN android-changed
string._getChars(0, min, value, index);
- // END android-changed
count += min;
}
} else {
@@ -434,9 +430,7 @@ abstract class AbstractStringBuilder {
value = value.clone();
shared = false;
}
- // BEGIN android-changed
string._getChars(0, stringLength, value, start);
- // END android-changed
count -= diff;
return;
}
diff --git a/luni/src/main/java/java/lang/Character.java b/luni/src/main/java/java/lang/Character.java
index 0caabba..f7701c8 100644
--- a/luni/src/main/java/java/lang/Character.java
+++ b/luni/src/main/java/java/lang/Character.java
@@ -2694,9 +2694,7 @@ public final class Character implements Serializable, Comparable<Character> {
* {@code false} otherwise.
*/
public static boolean isJavaIdentifierPart(char c) {
- // BEGIN android-changed
return isJavaIdentifierPart((int) c);
- // END android-changed
}
/**
@@ -2709,8 +2707,7 @@ public final class Character implements Serializable, Comparable<Character> {
* {@code false} otherwise.
*/
public static boolean isJavaIdentifierPart(int codePoint) {
- // BEGIN android-changed: use precomputed bitmasks for the ASCII range.
- // Optimized case for ASCII
+ // Use precomputed bitmasks to optimize the ASCII range.
if (codePoint < 64) {
return (0x3ff00100fffc1ffL & (1L << codePoint)) != 0;
} else if (codePoint < 128) {
@@ -2723,7 +2720,6 @@ public final class Character implements Serializable, Comparable<Character> {
|| type == COMBINING_SPACING_MARK || type == NON_SPACING_MARK
|| (codePoint >= 0 && codePoint <= 8) || (codePoint >= 0xe && codePoint <= 0x1b)
|| (codePoint >= 0x7f && codePoint <= 0x9f) || type == FORMAT;
- // END android-changed
}
/**
@@ -2736,9 +2732,7 @@ public final class Character implements Serializable, Comparable<Character> {
* identifier; {@code false} otherwise.
*/
public static boolean isJavaIdentifierStart(char c) {
- // BEGIN android-changed
return isJavaIdentifierStart((int) c);
- // END android-changed
}
/**
@@ -2751,8 +2745,7 @@ public final class Character implements Serializable, Comparable<Character> {
* identifier; {@code false} otherwise.
*/
public static boolean isJavaIdentifierStart(int codePoint) {
- // BEGIN android-changed: use precomputed bitmasks for the ASCII range.
- // Optimized case for ASCII
+ // Use precomputed bitmasks to optimize the ASCII range.
if (codePoint < 64) {
return (codePoint == '$'); // There's only one character in this range.
} else if (codePoint < 128) {
@@ -2761,7 +2754,6 @@ public final class Character implements Serializable, Comparable<Character> {
int type = getType(codePoint);
return (type >= UPPERCASE_LETTER && type <= OTHER_LETTER) || type == CURRENCY_SYMBOL
|| type == CONNECTOR_PUNCTUATION || type == LETTER_NUMBER;
- // END android-changed
}
/**
diff --git a/luni/src/main/java/java/lang/Class.java b/luni/src/main/java/java/lang/Class.java
index 95266a8..0182370 100644
--- a/luni/src/main/java/java/lang/Class.java
+++ b/luni/src/main/java/java/lang/Class.java
@@ -574,7 +574,6 @@ public final class Class<T> implements Serializable, AnnotatedElement, GenericDe
}
}
- // BEGIN android-changed
StringBuilder sb = new StringBuilder();
sb.append(getSimpleName());
sb.append('(');
@@ -590,7 +589,6 @@ public final class Class<T> implements Serializable, AnnotatedElement, GenericDe
}
sb.append(')');
throw new NoSuchMethodException(sb.toString());
- // END android-changed
}
/**
diff --git a/luni/src/main/java/java/lang/ClassLoader.java b/luni/src/main/java/java/lang/ClassLoader.java
index c7278e2..01d7198 100644
--- a/luni/src/main/java/java/lang/ClassLoader.java
+++ b/luni/src/main/java/java/lang/ClassLoader.java
@@ -64,19 +64,16 @@ import java.util.Map;
*/
public abstract class ClassLoader {
- // BEGIN android-note
- /*
+ /**
+ * The 'System' ClassLoader - the one that is responsible for loading
+ * classes from the classpath. It is not equal to the bootstrap class loader -
+ * that one handles the built-in classes.
+ *
* Because of a potential class initialization race between ClassLoader and
* java.lang.System, reproducible when using JDWP with "suspend=y", we defer
* creation of the system class loader until first use. We use a static
* inner class to get synchronization at init time without having to sync on
* every access.
- */
- // END android-note
- /**
- * The 'System' ClassLoader - the one that is responsible for loading
- * classes from the classpath. It is not equal to the bootstrap class loader -
- * that one handles the built-in classes.
*
* @see #getSystemClassLoader()
*/
diff --git a/luni/src/main/java/java/lang/InheritableThreadLocal.java b/luni/src/main/java/java/lang/InheritableThreadLocal.java
index 7e12ac2..772c61b 100644
--- a/luni/src/main/java/java/lang/InheritableThreadLocal.java
+++ b/luni/src/main/java/java/lang/InheritableThreadLocal.java
@@ -51,7 +51,6 @@ public class InheritableThreadLocal<T> extends ThreadLocal<T> {
return parentValue;
}
- // BEGIN android-added
@Override
Values values(Thread current) {
return current.inheritableValues;
@@ -61,5 +60,4 @@ public class InheritableThreadLocal<T> extends ThreadLocal<T> {
Values initializeValues(Thread current) {
return current.inheritableValues = new Values();
}
- // END android-added
}
diff --git a/luni/src/main/java/java/lang/Runtime.java b/luni/src/main/java/java/lang/Runtime.java
index 5729d75..893ebfb 100644
--- a/luni/src/main/java/java/lang/Runtime.java
+++ b/luni/src/main/java/java/lang/Runtime.java
@@ -169,9 +169,8 @@ public class Runtime {
* if the requested program can not be executed.
*/
public Process exec(String[] progArray, String[] envp, File directory) throws IOException {
- // BEGIN android-changed: push responsibility for argument checking into ProcessManager
+ // ProcessManager is responsible for all argument checking.
return ProcessManager.getInstance().exec(progArray, envp, directory, false);
- // END android-changed
}
/**
diff --git a/luni/src/main/java/java/lang/SecurityManager.java b/luni/src/main/java/java/lang/SecurityManager.java
index 1db0b7f..9b85514 100644
--- a/luni/src/main/java/java/lang/SecurityManager.java
+++ b/luni/src/main/java/java/lang/SecurityManager.java
@@ -17,8 +17,6 @@
package java.lang;
-// BEGIN android-added
-
import dalvik.system.VMStack;
import java.io.File;
import java.io.FileDescriptor;
diff --git a/luni/src/main/java/java/lang/StackTraceElement.java b/luni/src/main/java/java/lang/StackTraceElement.java
index a899a92..78579f8 100644
--- a/luni/src/main/java/java/lang/StackTraceElement.java
+++ b/luni/src/main/java/java/lang/StackTraceElement.java
@@ -30,9 +30,7 @@ public final class StackTraceElement implements Serializable {
private static final long serialVersionUID = 6992337162326171013L;
- // BEGIN android-added
private static final int NATIVE_LINE_NUMBER = -2;
- // END android-added
String declaringClass;
@@ -200,9 +198,7 @@ public final class StackTraceElement implements Serializable {
* executing is a native method; {@code false} otherwise.
*/
public boolean isNativeMethod() {
- // BEGIN android-changed
return lineNumber == NATIVE_LINE_NUMBER;
- // END android-changed
}
@Override
diff --git a/luni/src/main/java/java/lang/String.java b/luni/src/main/java/java/lang/String.java
index 3e4464c..517e481 100644
--- a/luni/src/main/java/java/lang/String.java
+++ b/luni/src/main/java/java/lang/String.java
@@ -772,11 +772,9 @@ outer:
}
if (object instanceof String) {
String s = (String) object;
- // BEGIN android-changed
int hashCode1 = hashCode;
int hashCode2 = s.hashCode;
- if (count != s.count
- || (hashCode1 != hashCode2 && hashCode1 != 0 && hashCode2 != 0)) {
+ if (count != s.count || (hashCode1 != hashCode2 && hashCode1 != 0 && hashCode2 != 0)) {
return false;
}
// inline 'return regionMatches(0, s, 0, count)'
@@ -790,7 +788,6 @@ outer:
}
}
return true;
- // END android-changed
}
return false;
}
@@ -1009,7 +1006,6 @@ outer:
}
private int fastIndexOf(int c, int start) {
- // BEGIN android-changed
int _count = count;
if (start < _count) {
if (start < 0) {
@@ -1025,7 +1021,6 @@ outer:
}
}
return -1;
- // END android-changed
}
private int indexOfSupplementary(int c, int start) {
@@ -1050,7 +1045,6 @@ outer:
* if {@code string} is {@code null}.
*/
public int indexOf(String string) {
- // BEGIN android-changed
int start = 0;
int subCount = string.count;
int _count = count;
@@ -1079,7 +1073,6 @@ outer:
}
}
return start < _count ? start : _count;
- // END android-changed
}
/**
@@ -1097,7 +1090,6 @@ outer:
* if {@code subString} is {@code null}.
*/
public int indexOf(String subString, int start) {
- // BEGIN android-changed
if (start < 0) {
start = 0;
}
@@ -1128,7 +1120,6 @@ outer:
}
}
return start < _count ? start : _count;
- // END android-changed
}
/**
@@ -1164,7 +1155,6 @@ outer:
if (c > 0xffff) {
return lastIndexOfSupplementary(c, Integer.MAX_VALUE);
}
- // BEGIN android-changed
int _count = count;
int _offset = offset;
char[] _value = value;
@@ -1174,7 +1164,6 @@ outer:
}
}
return -1;
- // END android-changed
}
/**
@@ -1193,7 +1182,6 @@ outer:
if (c > 0xffff) {
return lastIndexOfSupplementary(c, start);
}
- // BEGIN android-changed
int _count = count;
int _offset = offset;
char[] _value = value;
@@ -1208,7 +1196,6 @@ outer:
}
}
return -1;
- // END android-changed
}
private int lastIndexOfSupplementary(int c, int start) {
@@ -1324,7 +1311,6 @@ outer:
return true;
}
int o1 = offset + thisStart, o2 = string.offset + start;
- // BEGIN android-changed
char[] value1 = value;
char[] value2 = string.value;
for (int i = 0; i < length; ++i) {
@@ -1332,7 +1318,6 @@ outer:
return false;
}
}
- // END android-changed
return true;
}
diff --git a/luni/src/main/java/java/lang/ref/ReferenceQueue.java b/luni/src/main/java/java/lang/ref/ReferenceQueue.java
index ac6d695..b59d4f5 100644
--- a/luni/src/main/java/java/lang/ref/ReferenceQueue.java
+++ b/luni/src/main/java/java/lang/ref/ReferenceQueue.java
@@ -15,10 +15,6 @@
* limitations under the License.
*/
-// BEGIN android-note
-// This implementation is quite different from Harmony. Changes are not marked.
-// END android-note
-
package java.lang.ref;
/**
diff --git a/luni/src/main/java/java/lang/reflect/Field.java b/luni/src/main/java/java/lang/reflect/Field.java
index 1d2726c..8877cc5 100644
--- a/luni/src/main/java/java/lang/reflect/Field.java
+++ b/luni/src/main/java/java/lang/reflect/Field.java
@@ -517,9 +517,7 @@ public final class Field extends AccessibleObject implements Member {
*/
@Override
public int hashCode() {
- // BEGIN android-changed
return name.hashCode() ^ getDeclaringClass().getName().hashCode();
- // END android-changed
}
/**
diff --git a/luni/src/main/java/java/lang/reflect/Proxy.java b/luni/src/main/java/java/lang/reflect/Proxy.java
index 92b04f6..a24514d 100644
--- a/luni/src/main/java/java/lang/reflect/Proxy.java
+++ b/luni/src/main/java/java/lang/reflect/Proxy.java
@@ -23,10 +23,6 @@ import java.util.HashMap;
import java.util.Map;
import java.util.WeakHashMap;
-// BEGIN android-removed
-// import org.apache.harmony.luni.internal.reflect.ProxyClassFile;
-// END android-removed
-
/**
* {@code Proxy} defines methods for creating dynamic proxy classes and instances.
* A proxy class implements a declared set of interfaces and delegates method
@@ -91,9 +87,6 @@ public class Proxy implements Serializable {
*/
public static Class<?> getProxyClass(ClassLoader loader,
Class<?>... interfaces) throws IllegalArgumentException {
- // BEGIN android-note
- // Changed parameter to be closer to the RI
- // END android-note
// check that interfaces are a valid array of visible interfaces
if (interfaces == null) {
throw new NullPointerException();
@@ -165,21 +158,13 @@ public class Proxy implements Serializable {
if (commonPackageName != null && commonPackageName.length() > 0) {
nextClassName = commonPackageName + "." + nextClassName;
}
- // BEGIN android-changed
- // byte[] classFileBytes = ProxyClassFile.generateBytes(
- // nextClassName, interfaces);
- // newClass = defineClassImpl(loader, nextClassName.replace('.',
- // '/'), classFileBytes);
if (loader == null) {
loader = ClassLoader.getSystemClassLoader();
}
- newClass = generateProxy(nextClassName.replace('.', '/'),
- interfaces, loader);
- // END android-changed
+ newClass = generateProxy(nextClassName.replace('.', '/'), interfaces, loader);
// Need a weak reference to the class so it can
// be unloaded if the class loader is discarded
- interfaceCache.put(interfaceKey, new WeakReference<Class<?>>(
- newClass));
+ interfaceCache.put(interfaceKey, new WeakReference<Class<?>>(newClass));
synchronized (proxyCache) {
// the value is unused
proxyCache.put(newClass, "");
@@ -282,9 +267,6 @@ public class Proxy implements Serializable {
throw new IllegalArgumentException("not a proxy instance");
}
- // BEGIN android-changed
- //private static native Class<?> defineClassImpl(ClassLoader classLoader,
- // String className, byte[] classFileBytes);
native private static Class generateProxy(String name, Class[] interfaces,
ClassLoader loader);
@@ -293,6 +275,4 @@ public class Proxy implements Serializable {
* There is no implementation.
*/
native private static void constructorPrototype(InvocationHandler h);
- // END android-changed
-
}
diff --git a/luni/src/main/java/java/math/BigDecimal.java b/luni/src/main/java/java/math/BigDecimal.java
index dd3fb84..0ef3bf5 100644
--- a/luni/src/main/java/java/math/BigDecimal.java
+++ b/luni/src/main/java/java/math/BigDecimal.java
@@ -514,12 +514,10 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
if(bitLength < 64) {
smallValue = mantissa << (-scale);
} else {
- // BEGIN android-changed
BigInt bi = new BigInt();
bi.putLongInt(mantissa);
bi.shift(-scale);
intVal = new BigInteger(bi);
- // END android-changed
}
scale = 0;
} else if (scale > 0) {
@@ -809,7 +807,6 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
}
private static BigDecimal addAndMult10(BigDecimal thisValue,BigDecimal augend, int diffScale) {
- // BEGIN android-changed
if(diffScale < MathUtils.LONG_POWERS_OF_TEN.length &&
Math.max(thisValue.bitLength,augend.bitLength+LONG_POWERS_OF_TEN_BIT_LENGTH[diffScale])+1<64) {
return valueOf(thisValue.smallValue+augend.smallValue*MathUtils.LONG_POWERS_OF_TEN[diffScale],thisValue.scale);
@@ -818,7 +815,6 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
bi.add(thisValue.getUnscaledValue().getBigInt());
return new BigDecimal(new BigInteger(bi), thisValue.scale);
}
- // END android-changed
}
/**
@@ -1742,11 +1738,9 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
* @return {@code abs(this)}
*/
public BigDecimal abs(MathContext mc) {
- // BEGIN android-changed
BigDecimal result = abs();
result.inplaceRound(mc);
return result;
- // END android-changed
}
/**
@@ -1771,11 +1765,9 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
* @return {@code -this}
*/
public BigDecimal negate(MathContext mc) {
- // BEGIN android-changed
BigDecimal result = negate();
result.inplaceRound(mc);
return result;
- // END android-changed
}
/**
@@ -2100,10 +2092,9 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
long newScale = scale;
if (isZero()) {
- // BEGIN android-changed: preserve RI compatibility, so BigDecimal.equals (which checks
+ // Preserve RI compatibility, so BigDecimal.equals (which checks
// value *and* scale) continues to work.
return this;
- // END android-changed
}
BigInteger strippedBI = getUnscaledValue();
BigInteger[] quotAndRem;
@@ -2751,11 +2742,9 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
*/
private void inplaceRound(MathContext mc) {
int mcPrecision = mc.getPrecision();
- // BEGIN android-changed
if (approxPrecision() < mcPrecision || mcPrecision == 0) {
return;
}
- // END android-changed
int discardedPrecision = precision() - mcPrecision;
// If no rounding is necessary it returns immediately
if ((discardedPrecision <= 0)) {
@@ -2925,11 +2914,9 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
* @return an approximation of {@code precision()} value
*/
private int approxPrecision() {
- // BEGIN android-changed
return precision > 0
? precision
: (int) ((this.bitLength - 1) * LOG10_2) + 1;
- // END android-changed
}
private static int safeLongToInt(long longValue) {
diff --git a/luni/src/main/java/java/math/BigInteger.java b/luni/src/main/java/java/math/BigInteger.java
index e75c8f2..cd56afa 100644
--- a/luni/src/main/java/java/math/BigInteger.java
+++ b/luni/src/main/java/java/math/BigInteger.java
@@ -15,12 +15,6 @@
* limitations under the License.
*/
-// BEGIN android-note
-// Since the original Harmony Code of the BigInteger class was strongly modified,
-// in order to use the more efficient OpenSSL BIGNUM implementation,
-// no android-modification-tags were placed, at all.
-// END android-note
-
package java.math;
import java.io.IOException;
diff --git a/luni/src/main/java/java/math/MathContext.java b/luni/src/main/java/java/math/MathContext.java
index e07ba97..1455b5c 100644
--- a/luni/src/main/java/java/math/MathContext.java
+++ b/luni/src/main/java/java/math/MathContext.java
@@ -173,9 +173,7 @@ public final class MathContext implements Serializable {
if (digit == -1) {
throw new IllegalArgumentException("Bad string format");
}
- // BEGIN android-changed
this.precision = digit;
- // END android-changed
i++;
do {
diff --git a/luni/src/main/java/java/math/Multiplication.java b/luni/src/main/java/java/math/Multiplication.java
index babca06..98cabee 100644
--- a/luni/src/main/java/java/math/Multiplication.java
+++ b/luni/src/main/java/java/math/Multiplication.java
@@ -79,8 +79,7 @@ class Multiplication {
}
}
- // BEGIN android-note
- // The method multiply has been removed in favor of using OpenSSL BIGNUM
+ // BEGIN android-note: multiply has been removed in favor of using OpenSSL BIGNUM
// END android-note
/**
diff --git a/luni/src/main/java/java/math/Primality.java b/luni/src/main/java/java/math/Primality.java
index fa7e67a..eacc893 100644
--- a/luni/src/main/java/java/math/Primality.java
+++ b/luni/src/main/java/java/math/Primality.java
@@ -15,12 +15,6 @@
* limitations under the License.
*/
-// BEGIN android-note
-// Since the original Harmony Code of the BigInteger class was strongly modified,
-// in order to use the more efficient OpenSSL BIGNUM implementation,
-// no android-modification-tags were placed, at all.
-// END android-note
-
package java.math;
import java.util.Arrays;
diff --git a/luni/src/main/java/java/nio/FileChannelImpl.java b/luni/src/main/java/java/nio/FileChannelImpl.java
index c8efc97..3bca1b1 100644
--- a/luni/src/main/java/java/nio/FileChannelImpl.java
+++ b/luni/src/main/java/java/nio/FileChannelImpl.java
@@ -514,7 +514,6 @@ abstract class FileChannelImpl extends FileChannel {
int[] handles = new int[length];
int[] offsets = new int[length];
int[] lengths = new int[length];
- // BEGIN android-changed
// list of allocated direct ByteBuffers to prevent them from being GC-ed
ByteBuffer[] allocatedBufs = new ByteBuffer[length];
@@ -534,7 +533,6 @@ abstract class FileChannelImpl extends FileChannel {
handles[i] = NioUtils.getDirectBufferAddress(buffer);
lengths[i] = buffer.remaining();
}
- // END android-changed
long bytesWritten = 0;
boolean completed = false;
diff --git a/luni/src/main/java/java/nio/IntBuffer.java b/luni/src/main/java/java/nio/IntBuffer.java
index 3e1d9a3..9cc05ff 100644
--- a/luni/src/main/java/java/nio/IntBuffer.java
+++ b/luni/src/main/java/java/nio/IntBuffer.java
@@ -146,7 +146,6 @@ public abstract class IntBuffer extends Buffer implements Comparable<IntBuffer>
: otherBuffer.remaining();
int thisPos = position;
int otherPos = otherBuffer.position;
- // BEGIN android-changed
int thisInt, otherInt;
while (compareRemaining > 0) {
thisInt = get(thisPos);
@@ -158,7 +157,6 @@ public abstract class IntBuffer extends Buffer implements Comparable<IntBuffer>
otherPos++;
compareRemaining--;
}
- // END android-changed
return remaining() - otherBuffer.remaining();
}
diff --git a/luni/src/main/java/java/nio/LongBuffer.java b/luni/src/main/java/java/nio/LongBuffer.java
index 3b4be66..27edd2e 100644
--- a/luni/src/main/java/java/nio/LongBuffer.java
+++ b/luni/src/main/java/java/nio/LongBuffer.java
@@ -148,7 +148,6 @@ public abstract class LongBuffer extends Buffer implements
: otherBuffer.remaining();
int thisPos = position;
int otherPos = otherBuffer.position;
- // BEGIN android-changed
long thisLong, otherLong;
while (compareRemaining > 0) {
thisLong = get(thisPos);
@@ -160,7 +159,6 @@ public abstract class LongBuffer extends Buffer implements
otherPos++;
compareRemaining--;
}
- // END android-changed
return remaining() - otherBuffer.remaining();
}
diff --git a/luni/src/main/java/java/nio/SocketChannelImpl.java b/luni/src/main/java/java/nio/SocketChannelImpl.java
index 560f17d..0a8b8b4 100644
--- a/luni/src/main/java/java/nio/SocketChannelImpl.java
+++ b/luni/src/main/java/java/nio/SocketChannelImpl.java
@@ -346,11 +346,8 @@ class SocketChannelImpl extends SocketChannel implements FileDescriptorHandler {
int offset = target.position();
int length = target.remaining();
if (target.isDirect()) {
- // BEGIN android-changed
- // changed address from long to int
int address = NioUtils.getDirectBufferAddress(target);
readCount = Platform.NETWORK.readDirect(fd, address + offset, length);
- // END android-changed
} else {
// target is assured to have array.
byte[] array = target.array();
@@ -711,9 +708,7 @@ class SocketChannelImpl extends SocketChannel implements FileDescriptorHandler {
}
ByteBuffer buf = ByteBuffer.allocate(1);
int result = channel.read(buf);
- // BEGIN android-changed: input was already consumed
- return (-1 == result) ? result : buf.get(0) & 0xFF;
- // END android-changed
+ return (result == -1) ? result : (buf.get(0) & 0xff);
}
@Override
diff --git a/luni/src/main/java/java/security/AccessControlContext.java b/luni/src/main/java/java/security/AccessControlContext.java
index 288bc2c..0da6fd5 100644
--- a/luni/src/main/java/java/security/AccessControlContext.java
+++ b/luni/src/main/java/java/security/AccessControlContext.java
@@ -171,12 +171,10 @@ public final class AccessControlContext {
.matchSubset(that.context, context))) {
return false;
}
- // BEGIN android-changed
if (combiner != null) {
return combiner.equals(that.combiner);
}
return that.combiner == null;
- // END android-changed
}
return false;
}
diff --git a/luni/src/main/java/java/security/KeyStore.java b/luni/src/main/java/java/security/KeyStore.java
index 29c88a0..7e91083 100644
--- a/luni/src/main/java/java/security/KeyStore.java
+++ b/luni/src/main/java/java/security/KeyStore.java
@@ -247,9 +247,7 @@ public class KeyStore {
throws KeyStoreException, NoSuchAlgorithmException,
UnrecoverableKeyException {
if (!isInit) {
- // BEGIN android-changed
throwNotInitialized();
- // END android-changed
}
return implSpi.engineGetKey(alias, password);
}
@@ -264,12 +262,9 @@ public class KeyStore {
* @throws KeyStoreException
* if this {@code KeyStore} is not initialized.
*/
- public final Certificate[] getCertificateChain(String alias)
- throws KeyStoreException {
+ public final Certificate[] getCertificateChain(String alias) throws KeyStoreException {
if (!isInit) {
- // BEGIN android-changed
throwNotInitialized();
- // END android-changed
}
return implSpi.engineGetCertificateChain(alias);
}
@@ -284,12 +279,9 @@ public class KeyStore {
* @throws KeyStoreException
* if this {@code KeyStore} is not initialized.
*/
- public final Certificate getCertificate(String alias)
- throws KeyStoreException {
+ public final Certificate getCertificate(String alias) throws KeyStoreException {
if (!isInit) {
- // BEGIN android-changed
throwNotInitialized();
- // END android-changed
}
return implSpi.engineGetCertificate(alias);
}
@@ -306,9 +298,7 @@ public class KeyStore {
*/
public final Date getCreationDate(String alias) throws KeyStoreException {
if (!isInit) {
- // BEGIN android-changed
throwNotInitialized();
- // END android-changed
}
return implSpi.engineGetCreationDate(alias);
}
@@ -337,9 +327,7 @@ public class KeyStore {
public final void setKeyEntry(String alias, Key key, char[] password,
Certificate[] chain) throws KeyStoreException {
if (!isInit) {
- // BEGIN android-changed
throwNotInitialized();
- // END android-changed
}
// Certificate chain is required for PrivateKey
@@ -376,9 +364,7 @@ public class KeyStore {
public final void setKeyEntry(String alias, byte[] key, Certificate[] chain)
throws KeyStoreException {
if (!isInit) {
- // BEGIN android-changed
throwNotInitialized();
- // END android-changed
}
implSpi.engineSetKeyEntry(alias, key, chain);
}
@@ -399,12 +385,9 @@ public class KeyStore {
* @throws NullPointerException
* if {@code alias} is {@code null}.
*/
- public final void setCertificateEntry(String alias, Certificate cert)
- throws KeyStoreException {
+ public final void setCertificateEntry(String alias, Certificate cert) throws KeyStoreException {
if (!isInit) {
- // BEGIN android-changed
throwNotInitialized();
- // END android-changed
}
implSpi.engineSetCertificateEntry(alias, cert);
}
@@ -421,9 +404,7 @@ public class KeyStore {
*/
public final void deleteEntry(String alias) throws KeyStoreException {
if (!isInit) {
- // BEGIN android-changed
throwNotInitialized();
- // END android-changed
}
implSpi.engineDeleteEntry(alias);
}
@@ -439,9 +420,7 @@ public class KeyStore {
*/
public final Enumeration<String> aliases() throws KeyStoreException {
if (!isInit) {
- // BEGIN android-changed
throwNotInitialized();
- // END android-changed
}
return implSpi.engineAliases();
}
@@ -457,9 +436,7 @@ public class KeyStore {
*/
public final boolean containsAlias(String alias) throws KeyStoreException {
if (!isInit) {
- // BEGIN android-changed
throwNotInitialized();
- // END android-changed
}
return implSpi.engineContainsAlias(alias);
}
@@ -473,9 +450,7 @@ public class KeyStore {
*/
public final int size() throws KeyStoreException {
if (!isInit) {
- // BEGIN android-changed
throwNotInitialized();
- // END android-changed
}
return implSpi.engineSize();
}
@@ -492,9 +467,7 @@ public class KeyStore {
*/
public final boolean isKeyEntry(String alias) throws KeyStoreException {
if (!isInit) {
- // BEGIN android-changed
throwNotInitialized();
- // END android-changed
}
return implSpi.engineIsKeyEntry(alias);
}
@@ -510,12 +483,9 @@ public class KeyStore {
* @throws KeyStoreException
* if this {@code KeyStore} is not initialized.
*/
- public final boolean isCertificateEntry(String alias)
- throws KeyStoreException {
+ public final boolean isCertificateEntry(String alias) throws KeyStoreException {
if (!isInit) {
- // BEGIN android-changed
throwNotInitialized();
- // END android-changed
}
return implSpi.engineIsCertificateEntry(alias);
}
@@ -531,12 +501,9 @@ public class KeyStore {
* @throws KeyStoreException
* if this {@code KeyStore} is not initialized.
*/
- public final String getCertificateAlias(Certificate cert)
- throws KeyStoreException {
+ public final String getCertificateAlias(Certificate cert) throws KeyStoreException {
if (!isInit) {
- // BEGIN android-changed
throwNotInitialized();
- // END android-changed
}
return implSpi.engineGetCertificateAlias(cert);
}
@@ -561,12 +528,9 @@ public class KeyStore {
* this {@code KeyStore}.
*/
public final void store(OutputStream stream, char[] password)
- throws KeyStoreException, IOException, NoSuchAlgorithmException,
- CertificateException {
+ throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException {
if (!isInit) {
- // BEGIN android-changed
throwNotInitialized();
- // END android-changed
}
//Just delegate stream and password to implSpi
@@ -595,9 +559,7 @@ public class KeyStore {
public final void store(LoadStoreParameter param) throws KeyStoreException,
IOException, NoSuchAlgorithmException, CertificateException {
if (!isInit) {
- // BEGIN android-changed
throwNotInitialized();
- // END android-changed
}
implSpi.engineStore(param);
}
@@ -672,15 +634,12 @@ public class KeyStore {
* if {@code alias} is {@code null}.
*/
public final Entry getEntry(String alias, ProtectionParameter param)
- throws NoSuchAlgorithmException, UnrecoverableEntryException,
- KeyStoreException {
+ throws NoSuchAlgorithmException, UnrecoverableEntryException, KeyStoreException {
if (alias == null) {
throw new NullPointerException("alias == null");
}
if (!isInit) {
- // BEGIN android-changed
throwNotInitialized();
- // END android-changed
}
return implSpi.engineGetEntry(alias, param);
}
@@ -707,9 +666,7 @@ public class KeyStore {
public final void setEntry(String alias, Entry entry,
ProtectionParameter param) throws KeyStoreException {
if (!isInit) {
- // BEGIN android-changed
throwNotInitialized();
- // END android-changed
}
if (alias == null) {
throw new NullPointerException("alias == null");
@@ -744,9 +701,7 @@ public class KeyStore {
}
if (!isInit) {
- // BEGIN android-changed
throwNotInitialized();
- // END android-changed
}
return implSpi.engineEntryInstanceOf(alias, entryClass);
}
diff --git a/luni/src/main/java/java/security/Provider.java b/luni/src/main/java/java/security/Provider.java
index 5016858..2de3751 100644
--- a/luni/src/main/java/java/security/Provider.java
+++ b/luni/src/main/java/java/security/Provider.java
@@ -165,9 +165,7 @@ public abstract class Provider extends Properties {
if (propertyAliasTable != null) {
propertyAliasTable.clear();
}
- // BEGIN android-changed
changedProperties = null;
- // END android-changed
putProviderInfo();
if (providerNumber != -1) {
// if registered then refresh Services
@@ -287,11 +285,9 @@ public abstract class Provider extends Properties {
}
if (changedProperties != null && changedProperties.remove(key) == null) {
removeFromPropertyServiceTable(key);
- // BEGIN android-added
if (changedProperties.size() == 0) {
changedProperties = null;
}
- // END android-added
}
return super.remove(key);
}
@@ -680,9 +676,7 @@ public abstract class Provider extends Properties {
}
if (o != null) {
s = (Provider.Service) o;
- // BEGIN android-changed
s.addAlias(aliasName);
- // END android-changed
if (propertyAliasTable == null) {
propertyAliasTable = new TwoKeyHashMap<String, String, Service>(256);
}
@@ -721,11 +715,9 @@ public abstract class Provider extends Properties {
s = (Provider.Service) o;
s.className = value;
} else {
- // BEGIN android-changed
s = new Provider.Service(this, serviceName, algorithm,
value, Collections.<String>emptyList(),
Collections.<String,String>emptyMap());
- // END android-changed
if (propertyServiceTable == null) {
propertyServiceTable = new TwoKeyHashMap<String, String, Service>(128);
}
@@ -745,9 +737,7 @@ public abstract class Provider extends Properties {
}
if (o != null) {
s = (Provider.Service) o;
- // BEGIN android-changed
s.putAttribute(attribute, value);
- // END android-changed
} else {
String className = (String) changedProperties
.get(serviceName + "." + algorithm);
@@ -765,9 +755,7 @@ public abstract class Provider extends Properties {
}
}
servicesChanged();
- // BEGIN android-changed
changedProperties = null;
- // END android-changed
}
private void servicesChanged() {
@@ -869,16 +857,13 @@ public abstract class Provider extends Properties {
this.type = type;
this.algorithm = algorithm;
this.className = className;
- // BEGIN android-changed
this.aliases = ((aliases != null) && (aliases.size() == 0))
? Collections.<String>emptyList() : aliases;
this.attributes =
((attributes != null) && (attributes.size() == 0))
? Collections.<String,String>emptyMap() : attributes;
- // END android-changed
}
- // BEGIN android-added
/**
* Adds an alias.
*
@@ -903,7 +888,6 @@ public abstract class Provider extends Properties {
}
attributes.put(name, value);
}
- // END android-added
/**
* Returns the type of this {@code Service}. For example {@code
diff --git a/luni/src/main/java/java/security/cert/CertPath.java b/luni/src/main/java/java/security/cert/CertPath.java
index dda778f..4e6bef4 100644
--- a/luni/src/main/java/java/security/cert/CertPath.java
+++ b/luni/src/main/java/java/security/cert/CertPath.java
@@ -116,15 +116,12 @@ public abstract class CertPath implements Serializable {
sb.append(getCertificates().size());
sb.append(": [\n");
int n=1;
- // BEGIN android-changed
- for (Iterator<? extends Certificate> i=getCertificates().iterator();
- i.hasNext(); n++) {
+ for (Iterator<? extends Certificate> i=getCertificates().iterator(); i.hasNext(); n++) {
sb.append("---------------certificate ");
sb.append(n);
sb.append("---------------\n");
sb.append(((Certificate)i.next()).toString());
}
- // END android-changed
sb.append("\n]");
return sb.toString();
}
diff --git a/luni/src/main/java/java/security/cert/PKIXCertPathChecker.java b/luni/src/main/java/java/security/cert/PKIXCertPathChecker.java
index 0991cd5..869efb5 100644
--- a/luni/src/main/java/java/security/cert/PKIXCertPathChecker.java
+++ b/luni/src/main/java/java/security/cert/PKIXCertPathChecker.java
@@ -55,7 +55,7 @@ public abstract class PKIXCertPathChecker implements Cloneable {
try {
return super.clone();
} catch (CloneNotSupportedException e) {
- throw new AssertionError(e); // android-changed
+ throw new AssertionError(e);
}
}
diff --git a/luni/src/main/java/java/security/cert/PKIXCertPathValidatorResult.java b/luni/src/main/java/java/security/cert/PKIXCertPathValidatorResult.java
index e3bdca6..99f26a2 100644
--- a/luni/src/main/java/java/security/cert/PKIXCertPathValidatorResult.java
+++ b/luni/src/main/java/java/security/cert/PKIXCertPathValidatorResult.java
@@ -96,7 +96,7 @@ public class PKIXCertPathValidatorResult implements CertPathValidatorResult {
try {
return super.clone();
} catch (CloneNotSupportedException e) {
- throw new AssertionError(e); // android-changed
+ throw new AssertionError(e);
}
}
diff --git a/luni/src/main/java/java/security/cert/PKIXParameters.java b/luni/src/main/java/java/security/cert/PKIXParameters.java
index 2e9d4a2..7ca9443 100644
--- a/luni/src/main/java/java/security/cert/PKIXParameters.java
+++ b/luni/src/main/java/java/security/cert/PKIXParameters.java
@@ -534,7 +534,7 @@ public class PKIXParameters implements CertPathParameters {
}
return ret;
} catch (CloneNotSupportedException e) {
- throw new AssertionError(e); // android-changed
+ throw new AssertionError(e);
}
}
diff --git a/luni/src/main/java/java/security/cert/X509CertSelector.java b/luni/src/main/java/java/security/cert/X509CertSelector.java
index 144e213..2571715 100644
--- a/luni/src/main/java/java/security/cert/X509CertSelector.java
+++ b/luni/src/main/java/java/security/cert/X509CertSelector.java
@@ -756,7 +756,7 @@ public class X509CertSelector implements CertSelector {
System.arraycopy(arr_neim, 0, neim, 0, arr_neim.length);
}
List list = new ArrayList(2);
- list.add(Integer.valueOf(tag)); // android-changed
+ list.add(tag);
list.add(neim);
result.add(list);
}
diff --git a/luni/src/main/java/java/sql/DriverManager.java b/luni/src/main/java/java/sql/DriverManager.java
index c3bef62..3dc0ed3 100644
--- a/luni/src/main/java/java/sql/DriverManager.java
+++ b/luni/src/main/java/java/sql/DriverManager.java
@@ -221,23 +221,17 @@ public class DriverManager {
* if there is any kind of problem accessing the database.
*/
public static Driver getDriver(String url) throws SQLException {
- // BEGIN android-changed
ClassLoader callerClassLoader = VMStack.getCallingClassLoader();
- // END android-changed
-
synchronized (theDrivers) {
/*
* Loop over the drivers in the DriverSet checking to see if one
* does understand the supplied URL - return the first driver which
* does understand the URL
*/
- Iterator<Driver> theIterator = theDrivers.iterator();
- while (theIterator.hasNext()) {
- Driver theDriver = theIterator.next();
- if (theDriver.acceptsURL(url)
- && DriverManager.isClassFromClassLoader(theDriver,
- callerClassLoader)) {
- return theDriver;
+ for (Driver driver : theDrivers) {
+ if (driver.acceptsURL(url) &&
+ DriverManager.isClassFromClassLoader(driver, callerClassLoader)) {
+ return driver;
}
}
}
diff --git a/luni/src/main/java/java/text/AttributedString.java b/luni/src/main/java/java/text/AttributedString.java
index 1495dc5..1335067 100644
--- a/luni/src/main/java/java/text/AttributedString.java
+++ b/luni/src/main/java/java/text/AttributedString.java
@@ -105,7 +105,7 @@ public class AttributedString {
}
return clone;
} catch (CloneNotSupportedException e) {
- throw new AssertionError(e); // android-changed
+ throw new AssertionError(e);
}
}
@@ -506,15 +506,9 @@ public class AttributedString {
*/
public AttributedString(AttributedCharacterIterator iterator, int start,
int end, AttributedCharacterIterator.Attribute[] attributes) {
- // BEGIN android-removed
- // this(iterator, start, end, new HashSet<Attribute>(Arrays
- // .asList(attributes)));
- // END android-removed
- // BEGIN android-added
this(iterator, start, end, (attributes == null
? new HashSet<Attribute>()
: new HashSet<Attribute>(Arrays.asList(attributes))));
- // END android-added
}
/**
diff --git a/luni/src/main/java/java/text/BreakIterator.java b/luni/src/main/java/java/text/BreakIterator.java
index ccc484c..4d10b51 100644
--- a/luni/src/main/java/java/text/BreakIterator.java
+++ b/luni/src/main/java/java/text/BreakIterator.java
@@ -490,7 +490,7 @@ public abstract class BreakIterator implements Cloneable {
cloned.wrapped = (NativeBreakIterator) wrapped.clone();
return cloned;
} catch (CloneNotSupportedException e) {
- throw new AssertionError(e); // android-changed
+ throw new AssertionError(e);
}
}
}
diff --git a/luni/src/main/java/java/text/Collator.java b/luni/src/main/java/java/text/Collator.java
index 689fcb7..0fa8c71 100644
--- a/luni/src/main/java/java/text/Collator.java
+++ b/luni/src/main/java/java/text/Collator.java
@@ -172,7 +172,7 @@ public abstract class Collator implements Comparator<Object>, Cloneable {
clone.icuColl = (RuleBasedCollatorICU) icuColl.clone();
return clone;
} catch (CloneNotSupportedException e) {
- throw new AssertionError(e); // android-changed
+ throw new AssertionError(e);
}
}
diff --git a/luni/src/main/java/java/text/DecimalFormat.java b/luni/src/main/java/java/text/DecimalFormat.java
index a837b42..32c2bb6 100644
--- a/luni/src/main/java/java/text/DecimalFormat.java
+++ b/luni/src/main/java/java/text/DecimalFormat.java
@@ -884,30 +884,6 @@ public class DecimalFormat extends NumberFormat {
if (number == null) {
return null;
}
- // BEGIN android-removed
- // if (this.isParseBigDecimal()) {
- // if (number instanceof Long) {
- // return new BigDecimal(number.longValue());
- // }
- // if ((number instanceof Double) && !((Double) number).isInfinite()
- // && !((Double) number).isNaN()) {
- //
- // return new BigDecimal(number.doubleValue());
- // }
- // if (number instanceof BigInteger) {
- // return new BigDecimal(number.doubleValue());
- // }
- // if (number instanceof com.ibm.icu.math.BigDecimal) {
- // return new BigDecimal(number.toString());
- // }
- // return number;
- // }
- // if ((number instanceof com.ibm.icu.math.BigDecimal)
- // || (number instanceof BigInteger)) {
- // return new Double(number.doubleValue());
- // }
- // END android-removed
- // BEGIN android-added
if (this.isParseBigDecimal()) {
if (number instanceof Long) {
return new BigDecimal(number.longValue());
@@ -925,10 +901,8 @@ public class DecimalFormat extends NumberFormat {
if ((number instanceof BigDecimal) || (number instanceof BigInteger)) {
return new Double(number.doubleValue());
}
- // END android-added
-
if (this.isParseIntegerOnly() && number.equals(NEGATIVE_ZERO_DOUBLE)) {
- return Long.valueOf(0); // android-changed
+ return Long.valueOf(0);
}
return number;
@@ -942,10 +916,9 @@ public class DecimalFormat extends NumberFormat {
*/
public void setDecimalFormatSymbols(DecimalFormatSymbols value) {
if (value != null) {
- // BEGIN android-changed: the Java object is canonical, and we copy down to native code.
+ // The Java object is canonical, and we copy down to native code.
this.symbols = (DecimalFormatSymbols) value.clone();
dform.setDecimalFormatSymbols(this.symbols);
- // END android-changed
}
}
@@ -959,9 +932,7 @@ public class DecimalFormat extends NumberFormat {
*/
@Override
public void setCurrency(Currency currency) {
- // BEGIN android-changed
dform.setCurrency(Currency.getInstance(currency.getCurrencyCode()));
- // END android-changed
symbols.setCurrency(currency);
}
@@ -1195,11 +1166,8 @@ public class DecimalFormat extends NumberFormat {
fields.put("negSuffixPattern", (String) null);
fields.put("multiplier", dform.getMultiplier());
fields.put("groupingSize", (byte) dform.getGroupingSize());
- // BEGIN android-added
fields.put("groupingUsed", dform.isGroupingUsed());
- // END android-added
- fields.put("decimalSeparatorAlwaysShown", dform
- .isDecimalSeparatorAlwaysShown());
+ fields.put("decimalSeparatorAlwaysShown", dform.isDecimalSeparatorAlwaysShown());
fields.put("parseBigDecimal", dform.isParseBigDecimal());
fields.put("roundingMode", roundingMode);
fields.put("symbols", symbols);
@@ -1225,7 +1193,6 @@ public class DecimalFormat extends NumberFormat {
* if some class of serialized objects or fields cannot be found
*/
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
- // BEGIN android-changed
ObjectInputStream.GetField fields = stream.readFields();
this.symbols = (DecimalFormatSymbols) fields.get("symbols", null);
@@ -1245,7 +1212,7 @@ public class DecimalFormat extends NumberFormat {
final int minimumIntegerDigits = fields.get("minimumIntegerDigits", 309);
final int maximumFractionDigits = fields.get("maximumFractionDigits", 340);
final int minimumFractionDigits = fields.get("minimumFractionDigits", 340);
- // BEGIN android-changed: tell ICU what we want, then ask it what we can have, and then
+ // Tell ICU what we want, then ask it what we can have, and then
// set that in our Java object. This isn't RI-compatible, but then very little of our
// behavior in this area is, and it's not obvious how we can second-guess ICU (or tell
// it to just do exactly what we ask). We only need to do this with maximumIntegerDigits
@@ -1264,7 +1231,6 @@ public class DecimalFormat extends NumberFormat {
setMaximumFractionDigits(super.getMaximumFractionDigits());
setMinimumFractionDigits(super.getMinimumFractionDigits());
}
- // END android-changed
}
/**
diff --git a/luni/src/main/java/java/text/Format.java b/luni/src/main/java/java/text/Format.java
index 65c4363..e83b060 100644
--- a/luni/src/main/java/java/text/Format.java
+++ b/luni/src/main/java/java/text/Format.java
@@ -76,7 +76,7 @@ public abstract class Format implements Serializable, Cloneable {
try {
return super.clone();
} catch (CloneNotSupportedException e) {
- throw new AssertionError(e); // android-changed
+ throw new AssertionError(e);
}
}
diff --git a/luni/src/main/java/java/text/MessageFormat.java b/luni/src/main/java/java/text/MessageFormat.java
index 0ea22bc..6295233 100644
--- a/luni/src/main/java/java/text/MessageFormat.java
+++ b/luni/src/main/java/java/text/MessageFormat.java
@@ -1004,9 +1004,7 @@ public class MessageFormat extends Format {
.getTimeInstance(dateStyle, locale);
case 2: // number
if (ch == '}') {
- // BEGIN android-changed
return NumberFormat.getInstance(locale);
- // END android-changed
}
int numberStyle = match(string, position, true,
new String[] { "currency", "percent", "integer" });
@@ -1072,16 +1070,6 @@ public class MessageFormat extends Format {
this.locale = locale;
for (int i = 0; i <= maxOffset; i++) {
Format format = formats[i];
- // BEGIN android-removed
- //if (format instanceof DecimalFormat) {
- // formats[i] = new DecimalFormat(((DecimalFormat) format)
- // .toPattern(), new DecimalFormatSymbols(locale));
- //} else if (format instanceof SimpleDateFormat) {
- // formats[i] = new SimpleDateFormat(((SimpleDateFormat) format)
- // .toPattern(), locale);
- //}
- // END android-removed
- // BEGIN android-added
// java specification undefined for null argument, change into
// a more tolerant implementation
if (format instanceof DecimalFormat) {
@@ -1099,7 +1087,6 @@ public class MessageFormat extends Format {
formats[i] = null;
}
}
- // END android-added
}
}
diff --git a/luni/src/main/java/java/text/NumberFormat.java b/luni/src/main/java/java/text/NumberFormat.java
index 3b64224..7f16e5d 100644
--- a/luni/src/main/java/java/text/NumberFormat.java
+++ b/luni/src/main/java/java/text/NumberFormat.java
@@ -403,11 +403,9 @@ public abstract class NumberFormat extends Format {
return getNumberInstance(locale);
}
- // BEGIN android-added
private static NumberFormat getInstance(String pattern, Locale locale) {
return new DecimalFormat(pattern, locale);
}
- // END android-added
/**
* Returns the maximum number of fraction digits that are printed when
diff --git a/luni/src/main/java/java/text/StringCharacterIterator.java b/luni/src/main/java/java/text/StringCharacterIterator.java
index 8b0e2b7..13c3543 100644
--- a/luni/src/main/java/java/text/StringCharacterIterator.java
+++ b/luni/src/main/java/java/text/StringCharacterIterator.java
@@ -105,7 +105,7 @@ public final class StringCharacterIterator implements CharacterIterator {
try {
return super.clone();
} catch (CloneNotSupportedException e) {
- throw new AssertionError(e); // android-changed
+ throw new AssertionError(e);
}
}
diff --git a/luni/src/main/java/java/util/ArrayList.java b/luni/src/main/java/java/util/ArrayList.java
index f632077..70a88bf 100644
--- a/luni/src/main/java/java/util/ArrayList.java
+++ b/luni/src/main/java/java/util/ArrayList.java
@@ -15,10 +15,6 @@
* limitations under the License.
*/
-// BEGIN android-note
-// New implementation: simpler and faster than Harmony implementation.
-// BEGIN android-note
-
package java.util;
import java.io.IOException;
diff --git a/luni/src/main/java/java/util/Arrays.java b/luni/src/main/java/java/util/Arrays.java
index 8d27f49..481afa0 100644
--- a/luni/src/main/java/java/util/Arrays.java
+++ b/luni/src/main/java/java/util/Arrays.java
@@ -26,15 +26,6 @@ import java.lang.reflect.Array;
* @since 1.2
*/
public class Arrays {
- // BEGIN android-changed
- // Replaced Bentely-McIlroy-based sort w/ DualPivotQuicksort
- // BEGIN android-changed
-
- // BEGIN android-removed
- /* Specifies when to switch to insertion sort */
- // private static final int SIMPLE_LENGTH = 7;
- // END android-removed
-
private static class ArrayList<E> extends AbstractList<E> implements
List<E>, Serializable, RandomAccess {
@@ -1944,7 +1935,7 @@ public class Arrays {
* {@code ((Comparable)first).compareTo(Second)}.
* If not, you are better off deleting ComparableTimSort to eliminate the
* code duplication. In other words, the commented out code below
- * is the preferable implementation for sorting arrays of comparbles if it
+ * is the preferable implementation for sorting arrays of Comparables if it
* offers sufficient performance.
*/
@@ -1952,10 +1943,9 @@ public class Arrays {
// * A comparator that implements the natural order of a group of
// * mutually comparable elements. Using this comparator saves us
// * from duplicating most of the code in this file (one version for
-// * commparables, one for explicit comparators).
+// * Comparables, one for explicit comparators).
// */
-// private static final Comparator<Object> NATURAL_ORDER =
-// new Comparator<Object>() {
+// private static final Comparator<Object> NATURAL_ORDER = new Comparator<Object>() {
// @SuppressWarnings("unchecked")
// public int compare(Object first, Object second) {
// return ((Comparable<Object>)first).compareTo(second);
@@ -1983,9 +1973,7 @@ public class Arrays {
* @see #sort(Object[], int, int)
*/
public static void sort(Object[] array) {
- // BEGIN android-changed
ComparableTimSort.sort(array);
- // END android-changed
}
/**
@@ -2009,54 +1997,8 @@ public class Arrays {
* if {@code start < 0} or {@code end > array.length}.
*/
public static void sort(Object[] array, int start, int end) {
- // BEGIN android-changed
ComparableTimSort.sort(array, start, end);
- // END android-changed
- }
-
- // BEGIN android-removed
- /*
- private static void sort(int start, int end, Object[] array) {
- ...
- }
- private static void swap(int a, int b, Object[] arr) {
- ...
- }
- private static void mergeSort(Object[] in, Object[] out, int start,
- int end) {
- ...
- }
- private static void mergeSort(Object[] in, Object[] out, int start,
- int end, Comparator c) {
- ...
}
- private static int find(Object[] arr, Comparable val, int bnd, int l, int r) {
- ...
- }
- private static int find(Object[] arr, Object val, int bnd, int l, int r,
- Comparator c) {
- ...
- }
- private static int medChar(int a, int b, int c, String[] arr, int id) {
- ...
- }
- private static int charAt(String str, int i) {
- ...
- }
- private static void copySwap(Object[] src, int from, Object[] dst, int to,
- int len) {
- ...
- }
- private static void stableStringSort(String[] arr, int start,
- int end) {
- ...
- }
- private static void stableStringSort(String[] arr, String[] src,
- String[] dst, int start, int end, int chId) {
- ...
- }
- */
- // END android-removed
/**
* Sorts the specified range in the array using the specified {@code Comparator}.
@@ -2079,11 +2021,8 @@ public class Arrays {
* @throws ArrayIndexOutOfBoundsException
* if {@code start < 0} or {@code end > array.length}.
*/
- public static <T> void sort(T[] array, int start, int end,
- Comparator<? super T> comparator) {
- // BEGIN android-changed
+ public static <T> void sort(T[] array, int start, int end, Comparator<? super T> comparator) {
TimSort.sort(array, start, end, comparator);
- // END android-changed
}
/**
@@ -2099,9 +2038,7 @@ public class Arrays {
* using the {@code Comparator}.
*/
public static <T> void sort(T[] array, Comparator<? super T> comparator) {
- // BEGIN android-changed
TimSort.sort(array, comparator);
- // END android-changed
}
/**
@@ -2123,7 +2060,7 @@ public class Arrays {
if (array.length == 0) {
return "[]";
}
- StringBuilder sb = new StringBuilder(array.length * 7); // android-changed
+ StringBuilder sb = new StringBuilder(array.length * 7);
sb.append('[');
sb.append(array[0]);
for (int i = 1; i < array.length; i++) {
@@ -2153,7 +2090,7 @@ public class Arrays {
if (array.length == 0) {
return "[]";
}
- StringBuilder sb = new StringBuilder(array.length * 6); // android-changed
+ StringBuilder sb = new StringBuilder(array.length * 6);
sb.append('[');
sb.append(array[0]);
for (int i = 1; i < array.length; i++) {
@@ -2183,7 +2120,7 @@ public class Arrays {
if (array.length == 0) {
return "[]";
}
- StringBuilder sb = new StringBuilder(array.length * 3); // android-changed
+ StringBuilder sb = new StringBuilder(array.length * 3);
sb.append('[');
sb.append(array[0]);
for (int i = 1; i < array.length; i++) {
@@ -2213,7 +2150,7 @@ public class Arrays {
if (array.length == 0) {
return "[]";
}
- StringBuilder sb = new StringBuilder(array.length * 7); // android-changed
+ StringBuilder sb = new StringBuilder(array.length * 7);
sb.append('[');
sb.append(array[0]);
for (int i = 1; i < array.length; i++) {
@@ -2243,7 +2180,7 @@ public class Arrays {
if (array.length == 0) {
return "[]";
}
- StringBuilder sb = new StringBuilder(array.length * 7); // android-changed
+ StringBuilder sb = new StringBuilder(array.length * 7);
sb.append('[');
sb.append(array[0]);
for (int i = 1; i < array.length; i++) {
@@ -2273,7 +2210,7 @@ public class Arrays {
if (array.length == 0) {
return "[]";
}
- StringBuilder sb = new StringBuilder(array.length * 6); // android-changed
+ StringBuilder sb = new StringBuilder(array.length * 6);
sb.append('[');
sb.append(array[0]);
for (int i = 1; i < array.length; i++) {
@@ -2303,7 +2240,7 @@ public class Arrays {
if (array.length == 0) {
return "[]";
}
- StringBuilder sb = new StringBuilder(array.length * 6); // android-changed
+ StringBuilder sb = new StringBuilder(array.length * 6);
sb.append('[');
sb.append(array[0]);
for (int i = 1; i < array.length; i++) {
@@ -2333,7 +2270,7 @@ public class Arrays {
if (array.length == 0) {
return "[]";
}
- StringBuilder sb = new StringBuilder(array.length * 6); // android-changed
+ StringBuilder sb = new StringBuilder(array.length * 6);
sb.append('[');
sb.append(array[0]);
for (int i = 1; i < array.length; i++) {
@@ -2363,7 +2300,7 @@ public class Arrays {
if (array.length == 0) {
return "[]";
}
- StringBuilder sb = new StringBuilder(array.length * 7); // android-changed
+ StringBuilder sb = new StringBuilder(array.length * 7);
sb.append('[');
sb.append(array[0]);
for (int i = 1; i < array.length; i++) {
@@ -2397,7 +2334,7 @@ public class Arrays {
return "null";
}
// delegate this to the recursive method
- StringBuilder buf = new StringBuilder(array.length * 9); // android-changed
+ StringBuilder buf = new StringBuilder(array.length * 9);
deepToStringImpl(array, new Object[] { array }, buf);
return buf.toString();
}
diff --git a/luni/src/main/java/java/util/BitSet.java b/luni/src/main/java/java/util/BitSet.java
index bc76b80..1651b7e 100644
--- a/luni/src/main/java/java/util/BitSet.java
+++ b/luni/src/main/java/java/util/BitSet.java
@@ -128,7 +128,7 @@ public class BitSet implements Serializable, Cloneable {
clone.bits = bits.clone();
return clone;
} catch (CloneNotSupportedException e) {
- throw new AssertionError(e); // android-changed
+ throw new AssertionError(e);
}
}
diff --git a/luni/src/main/java/java/util/Calendar.java b/luni/src/main/java/java/util/Calendar.java
index 4809c26..e375d18 100644
--- a/luni/src/main/java/java/util/Calendar.java
+++ b/luni/src/main/java/java/util/Calendar.java
@@ -818,7 +818,7 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
clone.zone = (TimeZone) zone.clone();
return clone;
} catch (CloneNotSupportedException e) {
- throw new AssertionError(e); // android-changed
+ throw new AssertionError(e);
}
}
diff --git a/luni/src/main/java/java/util/Collections.java b/luni/src/main/java/java/util/Collections.java
index 38005ad..e54ae1b 100644
--- a/luni/src/main/java/java/util/Collections.java
+++ b/luni/src/main/java/java/util/Collections.java
@@ -1535,9 +1535,6 @@ public class Collections {
* be compared to each other using the comparator.
*/
@SuppressWarnings("unchecked")
- // BEGIN android-note
- // removed "@param <T> The element type", which is rejected by apicheck
- // END android-note
public static <T> int binarySearch(List<? extends T> list, T object,
Comparator<? super T> comparator) {
if (comparator == null) {
diff --git a/luni/src/main/java/java/util/Date.java b/luni/src/main/java/java/util/Date.java
index c2aa04d..d1cc4c1 100644
--- a/luni/src/main/java/java/util/Date.java
+++ b/luni/src/main/java/java/util/Date.java
@@ -184,7 +184,7 @@ public class Date implements Serializable, Cloneable, Comparable<Date> {
try {
return super.clone();
} catch (CloneNotSupportedException e) {
- throw new AssertionError(e); // android-changed
+ throw new AssertionError(e);
}
}
@@ -698,9 +698,7 @@ public class Date implements Serializable, Cloneable, Comparable<Date> {
*/
@Override
public String toString() {
- // BEGIN android-changed: fixed to use time zone display names ("PST")
- // rather than ids ("America/Los_Angeles").
- // Equivalent to the following one-liner, though that's currently 8x slower
+ // TODO: equivalent to the following one-liner, though that's currently 8x slower
// at 1655us versus 195us...
// return new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy").format(d);
Calendar cal = new GregorianCalendar(milliseconds);
@@ -709,7 +707,6 @@ public class Date implements Serializable, Cloneable, Comparable<Date> {
+ " " + toTwoDigits(cal.get(Calendar.DAY_OF_MONTH)) + " " + toTwoDigits(cal.get(Calendar.HOUR_OF_DAY))
+ ":" + toTwoDigits(cal.get(Calendar.MINUTE)) + ":" + toTwoDigits(cal.get(Calendar.SECOND))
+ " " + tz.getDisplayName(tz.inDaylightTime(this), TimeZone.SHORT) + " " + cal.get(Calendar.YEAR);
- // END android-changed
}
private static final String[] dayOfWeekNames =
{ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
diff --git a/luni/src/main/java/java/util/EnumMap.java b/luni/src/main/java/java/util/EnumMap.java
index 5da3b86..482a063 100644
--- a/luni/src/main/java/java/util/EnumMap.java
+++ b/luni/src/main/java/java/util/EnumMap.java
@@ -477,7 +477,7 @@ public class EnumMap<K extends Enum<K>, V> extends AbstractMap<K, V> implements
enumMap.initialization(this);
return enumMap;
} catch (CloneNotSupportedException e) {
- throw new AssertionError(e); // android-changed
+ throw new AssertionError(e);
}
}
diff --git a/luni/src/main/java/java/util/EnumSet.java b/luni/src/main/java/java/util/EnumSet.java
index 1b4723e..1a305c8 100644
--- a/luni/src/main/java/java/util/EnumSet.java
+++ b/luni/src/main/java/java/util/EnumSet.java
@@ -15,8 +15,6 @@
*/
package java.util;
-// BEGIN android-added
-
import java.io.Serializable;
import org.apache.harmony.kernel.vm.LangAccess;
@@ -25,14 +23,12 @@ import org.apache.harmony.kernel.vm.LangAccess;
*/
public abstract class EnumSet<E extends Enum<E>> extends AbstractSet<E>
implements Cloneable, Serializable {
- // BEGIN android-added
/*
* null-ok; package access to {@code java.lang}, set during
* first need. This shouldn't be used directly. Instead, use {@link
* SpecialAccess#LANG}, which is guaranteed to be initialized.
*/
static /*package*/ LangAccess LANG_BOOTSTRAP = null;
- // END android-added
private static final long serialVersionUID = 1009687484059888093L;
@@ -57,13 +53,11 @@ public abstract class EnumSet<E extends Enum<E>> extends AbstractSet<E>
if (!elementType.isEnum()) {
throw new ClassCastException(elementType.getClass().getName() + " is not an Enum");
}
- // BEGIN android-changed
E[] enums = SpecialAccess.LANG.getEnumValuesInOrder(elementType);
if (enums.length <= 64) {
return new MiniEnumSet<E>(elementType, enums);
}
return new HugeEnumSet<E>(elementType, enums);
- // END android-changed
}
/**
diff --git a/luni/src/main/java/java/util/GregorianCalendar.java b/luni/src/main/java/java/util/GregorianCalendar.java
index a240708..478e236 100644
--- a/luni/src/main/java/java/util/GregorianCalendar.java
+++ b/luni/src/main/java/java/util/GregorianCalendar.java
@@ -640,9 +640,7 @@ public class GregorianCalendar extends Calendar {
// FIXME: this has to be wrong; useDaylightTime doesn't mean what they think it means!
long newTimeAdjusted = newTime;
if (timeZone.useDaylightTime()) {
- // BEGIN android-changed: removed unnecessary cast
int dstSavings = timeZone.getDSTSavings();
- // END android-changed
newTimeAdjusted += (dstOffset == 0) ? dstSavings : -dstSavings;
}
diff --git a/luni/src/main/java/java/util/HashMap.java b/luni/src/main/java/java/util/HashMap.java
index 4a4e6f6..87ed131 100644
--- a/luni/src/main/java/java/util/HashMap.java
+++ b/luni/src/main/java/java/util/HashMap.java
@@ -15,10 +15,6 @@
* limitations under the License.
*/
-// BEGIN android-note
-// Completely different implementation from harmony. Runs much faster.
-// BEGIN android-note
-
package java.util;
import java.io.IOException;
diff --git a/luni/src/main/java/java/util/HashSet.java b/luni/src/main/java/java/util/HashSet.java
index 2df5299..a35fd56 100644
--- a/luni/src/main/java/java/util/HashSet.java
+++ b/luni/src/main/java/java/util/HashSet.java
@@ -121,7 +121,7 @@ public class HashSet<E> extends AbstractSet<E> implements Set<E>, Cloneable,
clone.backingMap = (HashMap<E, HashSet<E>>) backingMap.clone();
return clone;
} catch (CloneNotSupportedException e) {
- throw new AssertionError(e); // android-changed
+ throw new AssertionError(e);
}
}
diff --git a/luni/src/main/java/java/util/Hashtable.java b/luni/src/main/java/java/util/Hashtable.java
index 03e80a9..e2358c2 100644
--- a/luni/src/main/java/java/util/Hashtable.java
+++ b/luni/src/main/java/java/util/Hashtable.java
@@ -15,10 +15,6 @@
* limitations under the License.
*/
-// BEGIN android-note
-// Completely different implementation from harmony. Runs much faster.
-// BEGIN android-note
-
package java.util;
import java.io.IOException;
diff --git a/luni/src/main/java/java/util/HugeEnumSet.java b/luni/src/main/java/java/util/HugeEnumSet.java
index 2c6395f..b854372 100644
--- a/luni/src/main/java/java/util/HugeEnumSet.java
+++ b/luni/src/main/java/java/util/HugeEnumSet.java
@@ -31,12 +31,11 @@ final class HugeEnumSet<E extends Enum<E>> extends EnumSet<E> {
private int size;
- // BEGIN android-changed
/**
* Constructs an instance.
*
* @param elementType non-null; type of the elements
- * @param enums non-null; prepopulated array of constants in ordinal
+ * @param enums non-null; pre-populated array of constants in ordinal
* order
*/
HugeEnumSet(Class<E> elementType, E[] enums) {
@@ -44,7 +43,6 @@ final class HugeEnumSet<E extends Enum<E>> extends EnumSet<E> {
this.enums = enums;
bits = new long[(enums.length + BIT_IN_LONG - 1) / BIT_IN_LONG];
}
- // END android-changed
private class HugeEnumSetIterator implements Iterator<E> {
diff --git a/luni/src/main/java/java/util/IdentityHashMap.java b/luni/src/main/java/java/util/IdentityHashMap.java
index 827ffcf..e693f7d 100644
--- a/luni/src/main/java/java/util/IdentityHashMap.java
+++ b/luni/src/main/java/java/util/IdentityHashMap.java
@@ -761,14 +761,12 @@ public class IdentityHashMap<K, V> extends AbstractMap<K, V> implements
@Override
public Object clone() {
try {
- IdentityHashMap<K, V> cloneHashMap = (IdentityHashMap<K, V>) super
- .clone();
+ IdentityHashMap<K, V> cloneHashMap = (IdentityHashMap<K, V>) super.clone();
cloneHashMap.elementData = newElementArray(elementData.length);
- System.arraycopy(elementData, 0, cloneHashMap.elementData, 0,
- elementData.length);
+ System.arraycopy(elementData, 0, cloneHashMap.elementData, 0, elementData.length);
return cloneHashMap;
} catch (CloneNotSupportedException e) {
- throw new AssertionError(e); // android-changed
+ throw new AssertionError(e);
}
}
diff --git a/luni/src/main/java/java/util/LinkedHashMap.java b/luni/src/main/java/java/util/LinkedHashMap.java
index 47d532f..5ee8fae 100644
--- a/luni/src/main/java/java/util/LinkedHashMap.java
+++ b/luni/src/main/java/java/util/LinkedHashMap.java
@@ -15,10 +15,6 @@
* limitations under the License.
*/
-// BEGIN android-note
-// Completely different implementation from harmony. Runs much faster.
-// BEGIN android-note
-
package java.util;
/**
diff --git a/luni/src/main/java/java/util/LinkedList.java b/luni/src/main/java/java/util/LinkedList.java
index 2d264c2..e54438a 100644
--- a/luni/src/main/java/java/util/LinkedList.java
+++ b/luni/src/main/java/java/util/LinkedList.java
@@ -469,7 +469,7 @@ public class LinkedList<E> extends AbstractSequentialList<E> implements
l.addAll(this);
return l;
} catch (CloneNotSupportedException e) {
- throw new AssertionError(e); // android-changed
+ throw new AssertionError(e);
}
}
diff --git a/luni/src/main/java/java/util/MapEntry.java b/luni/src/main/java/java/util/MapEntry.java
index b84697b..519b1cd 100644
--- a/luni/src/main/java/java/util/MapEntry.java
+++ b/luni/src/main/java/java/util/MapEntry.java
@@ -43,7 +43,7 @@ class MapEntry<K, V> implements Map.Entry<K, V>, Cloneable {
try {
return super.clone();
} catch (CloneNotSupportedException e) {
- throw new AssertionError(e); // android-changed
+ throw new AssertionError(e);
}
}
diff --git a/luni/src/main/java/java/util/MiniEnumSet.java b/luni/src/main/java/java/util/MiniEnumSet.java
index c4c7364..3876160 100644
--- a/luni/src/main/java/java/util/MiniEnumSet.java
+++ b/luni/src/main/java/java/util/MiniEnumSet.java
@@ -30,19 +30,17 @@ final class MiniEnumSet<E extends Enum<E>> extends EnumSet<E> {
private long bits;
- // BEGIN android-changed
/**
* Constructs an instance.
*
* @param elementType non-null; type of the elements
- * @param enums non-null; prepopulated array of constants in ordinal
+ * @param enums non-null; pre-populated array of constants in ordinal
* order
*/
MiniEnumSet(Class<E> elementType, E[] enums) {
super(elementType);
this.enums = enums;
}
- // END android-changed
private class MiniEnumSetIterator implements Iterator<E> {
diff --git a/luni/src/main/java/java/util/Scanner.java b/luni/src/main/java/java/util/Scanner.java
index 85de1e7..8f889b3 100644
--- a/luni/src/main/java/java/util/Scanner.java
+++ b/luni/src/main/java/java/util/Scanner.java
@@ -79,20 +79,10 @@ public final class Scanner implements Iterator<String> {
private static final Pattern LINE_PATTERN;
static {
- String terminator = "\n|\r\n|\r|\u0085|\u2028|\u2029";
-
- LINE_TERMINATOR = Pattern.compile(terminator);
-
- // BEGIN android-note
- // consider plain old string concatenation for better performance
- // END android-note
- StringBuilder multiTerminator = new StringBuilder();
- MULTI_LINE_TERMINATOR = Pattern.compile(multiTerminator.append("(")
- .append(terminator).append(")+").toString());
- StringBuilder line = new StringBuilder();
- LINE_PATTERN = Pattern.compile(line.append(".*(")
- .append(terminator).append(")|.+(")
- .append(terminator).append(")?").toString());
+ String NL = "\n|\r\n|\r|\u0085|\u2028|\u2029";
+ LINE_TERMINATOR = Pattern.compile(NL);
+ MULTI_LINE_TERMINATOR = Pattern.compile("(" + NL + ")+");
+ LINE_PATTERN = Pattern.compile(".*(" + NL + ")|.+(" + NL + ")?");
}
// The pattern matches anything.
diff --git a/luni/src/main/java/java/util/SimpleTimeZone.java b/luni/src/main/java/java/util/SimpleTimeZone.java
index a57ab9a..704fdbd 100644
--- a/luni/src/main/java/java/util/SimpleTimeZone.java
+++ b/luni/src/main/java/java/util/SimpleTimeZone.java
@@ -74,12 +74,6 @@ public class SimpleTimeZone extends TimeZone {
private int dstSavings = 3600000;
- // BEGIN android-removed
- // private final transient com.ibm.icu.util.TimeZone icuTZ;
- //
- // private final transient boolean isSimple;
- // END android-removed
-
/**
* Constructs a {@code SimpleTimeZone} with the given base time zone offset from GMT
* and time zone ID. Timezone IDs can be obtained from
@@ -95,16 +89,6 @@ public class SimpleTimeZone extends TimeZone {
public SimpleTimeZone(int offset, final String name) {
setID(name);
rawOffset = offset;
- // BEGIN android-removed
- // icuTZ = getICUTimeZone(name);
- // if (icuTZ instanceof com.ibm.icu.util.SimpleTimeZone) {
- // isSimple = true;
- // icuTZ.setRawOffset(offset);
- // } else {
- // isSimple = false;
- // }
- // useDaylight = icuTZ.useDaylightTime();
- // END android-removed
}
/**
@@ -228,33 +212,15 @@ public class SimpleTimeZone extends TimeZone {
public SimpleTimeZone(int offset, String name, int startMonth,
int startDay, int startDayOfWeek, int startTime, int endMonth,
int endDay, int endDayOfWeek, int endTime, int daylightSavings) {
- // BEGIN android-changed
- // icuTZ = getICUTimeZone(name);
- // if (icuTZ instanceof com.ibm.icu.util.SimpleTimeZone) {
- // isSimple = true;
- // com.ibm.icu.util.SimpleTimeZone tz = (com.ibm.icu.util.SimpleTimeZone)icuTZ;
- // tz.setRawOffset(offset);
- // tz.setStartRule(startMonth, startDay, startDayOfWeek, startTime);
- // tz.setEndRule(endMonth, endDay, endDayOfWeek, endTime);
- // tz.setDSTSavings(daylightSavings);
- // } else {
- // isSimple = false;
- // }
- // setID(name);
- // rawOffset = offset;
this(offset, name);
- // END android-changed
if (daylightSavings <= 0) {
throw new IllegalArgumentException("Invalid daylightSavings: " + daylightSavings);
}
dstSavings = daylightSavings;
+ // TODO: do we need to set useDaylight is dstSavings != 0?
setStartRule(startMonth, startDay, startDayOfWeek, startTime);
setEndRule(endMonth, endDay, endDayOfWeek, endTime);
-
- // BEGIN android-removed
- // useDaylight = daylightSavings > 0 || icuTZ.useDaylightTime();
- // END android-removed
}
/**
@@ -375,8 +341,6 @@ public class SimpleTimeZone extends TimeZone {
checkDay(month, day);
}
- // BEGIN android-changed
- // return icuTZ.getOffset(era, year, month, day, dayOfWeek, time);
if (!useDaylightTime() || era != GregorianCalendar.AD || year < startYear) {
return rawOffset;
}
@@ -495,19 +459,17 @@ public class SimpleTimeZone extends TimeZone {
}
}
return rawOffset + dstSavings;
- // END android-changed
}
@Override
public int getOffset(long time) {
- // BEGIN android-changed: simplified variant of the ICU4J code.
+ // Simplified variant of the ICU4J code.
if (!useDaylightTime()) {
return rawOffset;
}
int[] fields = Grego.timeToFields(time + rawOffset, null);
return getOffset(GregorianCalendar.AD, fields[0], fields[1], fields[2],
fields[3], fields[5]);
- // END android-changed
}
@Override
@@ -556,9 +518,7 @@ public class SimpleTimeZone extends TimeZone {
@Override
public boolean inDaylightTime(Date time) {
- // BEGIN android-changed: reuse getOffset.
return useDaylightTime() && getOffset(time.getTime()) != rawOffset;
- // END android-changed
}
private boolean isLeapYear(int year) {
@@ -568,12 +528,10 @@ public class SimpleTimeZone extends TimeZone {
return year % 4 == 0;
}
- // BEGIN android-added
private int mod7(int num1) {
int rem = num1 % 7;
return (num1 < 0 && rem < 0) ? 7 + rem : rem;
}
- // END android-added
/**
* Sets the daylight savings offset in milliseconds for this {@code SimpleTimeZone}.
@@ -656,12 +614,6 @@ public class SimpleTimeZone extends TimeZone {
endDayOfWeek = 0; // Initialize this value for hasSameRules()
endTime = time;
setEndMode();
- // BEGIN android-removed
- // if (isSimple) {
- // ((com.ibm.icu.util.SimpleTimeZone) icuTZ).setEndRule(month,
- // dayOfMonth, time);
- // }
- // END android-removed
}
/**
@@ -685,12 +637,6 @@ public class SimpleTimeZone extends TimeZone {
endDayOfWeek = dayOfWeek;
endTime = time;
setEndMode();
- // BEGIN android-removed
- // if (isSimple) {
- // ((com.ibm.icu.util.SimpleTimeZone) icuTZ).setEndRule(month, day,
- // dayOfWeek, time);
- // }
- // END android-removed
}
/**
@@ -709,19 +655,12 @@ public class SimpleTimeZone extends TimeZone {
* @param after
* selects the day after or before the day of month.
*/
- public void setEndRule(int month, int day, int dayOfWeek, int time,
- boolean after) {
+ public void setEndRule(int month, int day, int dayOfWeek, int time, boolean after) {
endMonth = month;
endDay = after ? day : -day;
endDayOfWeek = -dayOfWeek;
endTime = time;
setEndMode();
- // BEGIN android-removed
- // if (isSimple) {
- // ((com.ibm.icu.util.SimpleTimeZone) icuTZ).setEndRule(month, day,
- // dayOfWeek, time, after);
- // }
- // END android-removed
}
/**
@@ -733,9 +672,6 @@ public class SimpleTimeZone extends TimeZone {
@Override
public void setRawOffset(int offset) {
rawOffset = offset;
- // BEGIN android-removed
- // icuTZ.setRawOffset(offset);
- // END android-removed
}
private void setStartMode() {
@@ -787,12 +723,6 @@ public class SimpleTimeZone extends TimeZone {
startDayOfWeek = 0; // Initialize this value for hasSameRules()
startTime = time;
setStartMode();
- // BEGIN android-removed
- // if (isSimple) {
- // ((com.ibm.icu.util.SimpleTimeZone) icuTZ).setStartRule(month,
- // dayOfMonth, time);
- // }
- // END android-removed
}
/**
@@ -816,12 +746,6 @@ public class SimpleTimeZone extends TimeZone {
startDayOfWeek = dayOfWeek;
startTime = time;
setStartMode();
- // BEGIN android-removed
- // if (isSimple) {
- // ((com.ibm.icu.util.SimpleTimeZone) icuTZ).setStartRule(month, day,
- // dayOfWeek, time);
- // }
- // END android-removed
}
/**
@@ -840,19 +764,12 @@ public class SimpleTimeZone extends TimeZone {
* @param after
* selects the day after or before the day of month.
*/
- public void setStartRule(int month, int day, int dayOfWeek, int time,
- boolean after) {
+ public void setStartRule(int month, int day, int dayOfWeek, int time, boolean after) {
startMonth = month;
startDay = after ? day : -day;
startDayOfWeek = -dayOfWeek;
startTime = time;
setStartMode();
- // BEGIN android-removed
- // if (isSimple) {
- // ((com.ibm.icu.util.SimpleTimeZone) icuTZ).setStartRule(month, day,
- // dayOfWeek, time, after);
- // }
- // END android-removed
}
/**
diff --git a/luni/src/main/java/java/util/TreeSet.java b/luni/src/main/java/java/util/TreeSet.java
index e4f2136..63a51c9 100644
--- a/luni/src/main/java/java/util/TreeSet.java
+++ b/luni/src/main/java/java/util/TreeSet.java
@@ -163,7 +163,7 @@ public class TreeSet<E> extends AbstractSet<E> implements NavigableSet<E>,
}
return clone;
} catch (CloneNotSupportedException e) {
- throw new AssertionError(e); // android-changed
+ throw new AssertionError(e);
}
}
diff --git a/luni/src/main/java/java/util/Vector.java b/luni/src/main/java/java/util/Vector.java
index dcd19f2..5a4224f 100644
--- a/luni/src/main/java/java/util/Vector.java
+++ b/luni/src/main/java/java/util/Vector.java
@@ -262,7 +262,7 @@ public class Vector<E> extends AbstractList<E> implements List<E>,
vector.elementData = elementData.clone();
return vector;
} catch (CloneNotSupportedException e) {
- throw new AssertionError(e); // android-changed
+ throw new AssertionError(e);
}
}
diff --git a/luni/src/main/java/java/util/jar/Attributes.java b/luni/src/main/java/java/util/jar/Attributes.java
index 9041c26..8f2f9ba 100644
--- a/luni/src/main/java/java/util/jar/Attributes.java
+++ b/luni/src/main/java/java/util/jar/Attributes.java
@@ -432,7 +432,7 @@ public class Attributes implements Cloneable, Map<Object, Object> {
try {
clone = (Attributes) super.clone();
} catch (CloneNotSupportedException e) {
- throw new AssertionError(e); // android-changed
+ throw new AssertionError(e);
}
clone.map = (Map<Object, Object>) ((HashMap) map).clone();
return clone;
diff --git a/luni/src/main/java/java/util/logging/Level.java b/luni/src/main/java/java/util/logging/Level.java
index ee65166..0818590 100644
--- a/luni/src/main/java/java/util/logging/Level.java
+++ b/luni/src/main/java/java/util/logging/Level.java
@@ -209,9 +209,7 @@ public class Level implements Serializable {
if (resourceBundleName != null) {
try {
rb = ResourceBundle.getBundle(resourceBundleName,
- // BEGIN android-changed
Locale.getDefault(), VMStack.getCallingClassLoader());
- // BEGIN android-changed
} catch (MissingResourceException e) {
rb = null;
}
diff --git a/luni/src/main/java/java/util/logging/LogManager.java b/luni/src/main/java/java/util/logging/LogManager.java
index 375d865..0abc697 100644
--- a/luni/src/main/java/java/util/logging/LogManager.java
+++ b/luni/src/main/java/java/util/logging/LogManager.java
@@ -17,12 +17,6 @@
package java.util.logging;
-// BEGIN android-note
-// this file contains cleaned up documentation and style for contribution
-// upstream.
-// javax.management support (MBeans) has been dropped.
-// END android-note
-
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.BufferedInputStream;
@@ -511,7 +505,7 @@ public class LogManager {
setLevelRecursively(logger, null);
}
newParent.children.add(logger);
- logger.updateDalvikLogHandler(); // android-only
+ logger.updateDalvikLogHandler();
}
/**
diff --git a/luni/src/main/java/java/util/logging/LogRecord.java b/luni/src/main/java/java/util/logging/LogRecord.java
index fd34eb4..66cabcc 100644
--- a/luni/src/main/java/java/util/logging/LogRecord.java
+++ b/luni/src/main/java/java/util/logging/LogRecord.java
@@ -135,7 +135,7 @@ public class LogRecord implements Serializable {
private transient Object[] parameters;
// If the source method and source class has been initialized
- private transient boolean sourceInited;
+ private transient boolean sourceInitialized;
/**
* Constructs a {@code LogRecord} object using the supplied the logging
@@ -360,8 +360,7 @@ public class LogRecord implements Serializable {
* Init the sourceClass and sourceMethod fields.
*/
private void initSource() {
- // BEGIN android-changed
- if (sourceInited) {
+ if (sourceInitialized) {
return;
}
@@ -377,8 +376,7 @@ public class LogRecord implements Serializable {
}
}
- sourceInited = true;
- // END android-changed
+ sourceInitialized = true;
}
/**
@@ -389,7 +387,7 @@ public class LogRecord implements Serializable {
* {@code null}.
*/
public void setSourceClassName(String sourceClassName) {
- sourceInited = true;
+ sourceInitialized = true;
this.sourceClassName = sourceClassName;
}
@@ -411,7 +409,7 @@ public class LogRecord implements Serializable {
* {@code null}.
*/
public void setSourceMethodName(String sourceMethodName) {
- sourceInited = true;
+ sourceInitialized = true;
this.sourceMethodName = sourceMethodName;
}
diff --git a/luni/src/main/java/java/util/logging/Logger.java b/luni/src/main/java/java/util/logging/Logger.java
index 54e3a1d..fb4f5d0 100644
--- a/luni/src/main/java/java/util/logging/Logger.java
+++ b/luni/src/main/java/java/util/logging/Logger.java
@@ -17,13 +17,6 @@
package java.util.logging;
-// BEGIN android-note
-// this file contains cleaned up documentation and style for contribution
-// upstream
-// It also contains Android-specific optimizations that aren't appropriate for
-// general purpose platforms
-// END android-note
-
import dalvik.system.DalvikLogHandler;
import dalvik.system.DalvikLogging;
import java.util.ArrayList;
@@ -79,7 +72,6 @@ import java.util.concurrent.CopyOnWriteArrayList;
*/
public class Logger {
- // BEGIN android-only
/** A handler for use when no handler optimization is possible. */
private static final DalvikLogHandler GENERAL_LOG_HANDLER = new DalvikLogHandler() {
public void publish(Logger source, String tag, Level level, String message) {
@@ -89,7 +81,6 @@ public class Logger {
source.log(record);
}
};
- // END android-only
/**
* The name of the global logger. Before using this, see the discussion of how to use
@@ -168,7 +159,6 @@ public class Logger {
*/
final List<Logger> children = new ArrayList<Logger>();
- // BEGIN android-only
/** the tag used for optimized logging. Derived from the logger name. */
private final String androidTag;
@@ -243,7 +233,6 @@ public class Logger {
logger.updateDalvikLogHandler();
}
}
- // END android-only
/**
* Constructs a {@code Logger} object with the supplied name and resource
@@ -263,10 +252,8 @@ public class Logger {
protected Logger(String name, String resourceBundleName) {
this.name = name;
initResourceBundle(resourceBundleName);
- // BEGIN android-only
this.androidTag = DalvikLogging.loggerNameToTag(name);
updateDalvikLogHandler();
- // END android-only
}
/**
@@ -430,7 +417,7 @@ public class Logger {
LogManager.getLogManager().checkAccess();
}
this.handlers.add(handler);
- updateDalvikLogHandler(); // android-only
+ updateDalvikLogHandler();
}
/**
@@ -476,7 +463,7 @@ public class Logger {
}
}
- updateDalvikLogHandler(); // android-only
+ updateDalvikLogHandler();
}
/**
@@ -504,7 +491,7 @@ public class Logger {
return;
}
this.handlers.remove(handler);
- updateDalvikLogHandler(); // android-only
+ updateDalvikLogHandler();
}
/**
@@ -581,7 +568,7 @@ public class Logger {
LogManager.getLogManager().checkAccess();
}
this.notifyParentHandlers = notifyParentHandlers;
- updateDalvikLogHandler(); // android-only
+ updateDalvikLogHandler();
}
/**
@@ -942,10 +929,7 @@ public class Logger {
if (!internalIsLoggable(logLevel)) {
return;
}
-
- // BEGIN android-only
dalvikLogHandler.publish(this, androidTag, logLevel, msg);
- // END android-only
}
/**
@@ -1364,6 +1348,6 @@ public class Logger {
}
}
- updateDalvikLogHandler(); // android-only
+ updateDalvikLogHandler();
}
}
diff --git a/luni/src/main/java/java/util/prefs/XMLParser.java b/luni/src/main/java/java/util/prefs/XMLParser.java
index 625a004..938340b 100644
--- a/luni/src/main/java/java/util/prefs/XMLParser.java
+++ b/luni/src/main/java/java/util/prefs/XMLParser.java
@@ -109,9 +109,7 @@ class XMLParser {
*/
static {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- // BEGIN android-changed
factory.setValidating(false);
- // END android-changed
try {
builder = factory.newDocumentBuilder();
} catch (ParserConfigurationException e) {
@@ -368,22 +366,12 @@ class XMLParser {
} catch (SAXException e) {
throw new InvalidPreferencesFormatException(e);
}
- // BEGIN android-removed
- // catch (TransformerException e) {
- // throw new InvalidPreferencesFormatException(e);
- // }
- // END android-removed
}
private static void loadNode(Preferences prefs, Element node) {
- // BEGIN android-note
- // removed throw clause for TransformerException
- // END android-note
// load preferences
- // BEGIN android-changed
NodeList children = selectNodeList(node, "node");
NodeList entries = selectNodeList(node, "map/entry");
- // END android-changed
int childNumber = children.getLength();
Preferences[] prefChildren = new Preferences[childNumber];
int entryNumber = entries.getLength();
@@ -411,7 +399,6 @@ class XMLParser {
}
}
- // BEGIN android-added
// TODO dirty implementation of a method from javax.xml.xpath
// should be replaced with a call to a good impl of this method
private static NodeList selectNodeList(Element documentElement, String string) {
@@ -458,7 +445,6 @@ class XMLParser {
return result;
}
- // END android-added
/***************************************************************************
* utilities for FilePreferencesImpl, which is default implementation of Linux platform
diff --git a/luni/src/main/java/java/util/regex/PatternSyntaxException.java b/luni/src/main/java/java/util/regex/PatternSyntaxException.java
index 2bbdb46..a8dec47 100644
--- a/luni/src/main/java/java/util/regex/PatternSyntaxException.java
+++ b/luni/src/main/java/java/util/regex/PatternSyntaxException.java
@@ -82,13 +82,12 @@ public class PatternSyntaxException extends IllegalArgumentException {
/**
* Returns a detailed error message for the exception. The message is
* potentially multi-line, and it might include a detailed description, the
- * original regular expression, and the index at which the error occured.
+ * original regular expression, and the index at which the error occurred.
*
* @return the error message.
*/
@Override
public String getMessage() {
- // BEGIN android-changed
StringBuilder builder = new StringBuilder("Syntax error");
if (desc != null) {
@@ -114,7 +113,6 @@ public class PatternSyntaxException extends IllegalArgumentException {
}
return builder.toString();
- // END android-changed
}
/**
diff --git a/luni/src/main/java/java/util/zip/Inflater.java b/luni/src/main/java/java/util/zip/Inflater.java
index 9f430a8..ee10aa7 100644
--- a/luni/src/main/java/java/util/zip/Inflater.java
+++ b/luni/src/main/java/java/util/zip/Inflater.java
@@ -309,7 +309,6 @@ public class Inflater {
private native void setInputImpl(byte[] buf, int offset, int byteCount, long handle);
- // BEGIN android-only
synchronized int setFileInput(FileDescriptor fd, long offset, int byteCount) {
checkOpen();
inRead = 0;
@@ -318,7 +317,6 @@ public class Inflater {
}
private native int setFileInputImpl(FileDescriptor fd, long offset, int byteCount, long handle);
- // END android-only
private void checkOpen() {
if (streamHandle == -1) {
diff --git a/luni/src/main/java/java/util/zip/InflaterInputStream.java b/luni/src/main/java/java/util/zip/InflaterInputStream.java
index d40ab6a..242e538 100644
--- a/luni/src/main/java/java/util/zip/InflaterInputStream.java
+++ b/luni/src/main/java/java/util/zip/InflaterInputStream.java
@@ -62,7 +62,7 @@ public class InflaterInputStream extends FilterInputStream {
static final int BUF_SIZE = 512;
- int nativeEndBufSize = 0; // android-only
+ int nativeEndBufSize = 0;
/**
* This is the most basic constructor. You only need to pass the {@code
@@ -110,13 +110,11 @@ public class InflaterInputStream extends FilterInputStream {
throw new IllegalArgumentException();
}
this.inf = inflater;
- // BEGIN android-only
if (is instanceof ZipFile.RAFStream) {
nativeEndBufSize = bsize;
} else {
buf = new byte[bsize];
}
- // END android-only
}
/**
@@ -193,7 +191,6 @@ public class InflaterInputStream extends FilterInputStream {
*/
protected void fill() throws IOException {
checkClosed();
- // BEGIN android-only
if (nativeEndBufSize > 0) {
ZipFile.RAFStream is = (ZipFile.RAFStream)in;
synchronized (is.mSharedRaf) {
@@ -207,7 +204,6 @@ public class InflaterInputStream extends FilterInputStream {
inf.setInput(buf, 0, len);
}
}
- // END android-only
}
/**
diff --git a/luni/src/main/java/java/util/zip/ZipFile.java b/luni/src/main/java/java/util/zip/ZipFile.java
index 7abd6eb..9d389da 100644
--- a/luni/src/main/java/java/util/zip/ZipFile.java
+++ b/luni/src/main/java/java/util/zip/ZipFile.java
@@ -58,7 +58,7 @@ public class ZipFile implements ZipConstants {
* versions of PKZIP recognize this bit for any
* compression method.)
*/
- static final int GPBF_DATA_DESCRIPTOR_FLAG = 1 << 3; // android-added
+ static final int GPBF_DATA_DESCRIPTOR_FLAG = 1 << 3;
/**
* General Purpose Bit Flags, Bit 11.
@@ -66,7 +66,7 @@ public class ZipFile implements ZipConstants {
* the filename and comment fields for this file
* must be encoded using UTF-8.
*/
- static final int GPBF_UTF8_FLAG = 1 << 11; // android-added
+ static final int GPBF_UTF8_FLAG = 1 << 11;
/**
* Open ZIP file for read.
diff --git a/luni/src/main/java/java/util/zip/ZipOutputStream.java b/luni/src/main/java/java/util/zip/ZipOutputStream.java
index d420372..f0c79b2 100644
--- a/luni/src/main/java/java/util/zip/ZipOutputStream.java
+++ b/luni/src/main/java/java/util/zip/ZipOutputStream.java
@@ -292,7 +292,7 @@ public class ZipOutputStream extends DeflaterOutputStream implements ZipConstant
if (currentEntry.getMethod() == -1) {
currentEntry.setMethod(compressMethod);
}
- // BEGIN android-changed
+
// Local file header.
// http://www.pkware.com/documents/casestudies/APPNOTE.TXT
int flags = currentEntry.getMethod() == STORED ? 0 : ZipFile.GPBF_DATA_DESCRIPTOR_FLAG;
@@ -308,7 +308,6 @@ public class ZipOutputStream extends DeflaterOutputStream implements ZipConstant
}
writeShort(out, currentEntry.time);
writeShort(out, currentEntry.modDate);
- // END android-changed
if (currentEntry.getMethod() == STORED) {
if (currentEntry.size == -1) {
diff --git a/luni/src/main/java/javax/crypto/SealedObject.java b/luni/src/main/java/javax/crypto/SealedObject.java
index c6f8221..c9c1534 100644
--- a/luni/src/main/java/javax/crypto/SealedObject.java
+++ b/luni/src/main/java/javax/crypto/SealedObject.java
@@ -146,11 +146,9 @@ public class SealedObject implements Serializable {
public final Object getObject(Key key)
throws IOException, ClassNotFoundException,
NoSuchAlgorithmException, InvalidKeyException {
- // BEGIN android-added
if (key == null) {
throw new InvalidKeyException("key == null");
}
- // END android-added
try {
Cipher cipher = Cipher.getInstance(sealAlg);
if ((paramsAlg != null) && (paramsAlg.length() != 0)) {
diff --git a/luni/src/main/java/javax/crypto/spec/SecretKeySpec.java b/luni/src/main/java/javax/crypto/spec/SecretKeySpec.java
index 99701ff..cb70643 100644
--- a/luni/src/main/java/javax/crypto/spec/SecretKeySpec.java
+++ b/luni/src/main/java/javax/crypto/spec/SecretKeySpec.java
@@ -98,11 +98,9 @@ public class SecretKeySpec implements SecretKey, KeySpec, Serializable {
if (key.length == 0) {
throw new IllegalArgumentException("key.length == 0");
}
- // BEGIN android-changed
if (len < 0 || offset < 0) {
throw new ArrayIndexOutOfBoundsException("len < 0 || offset < 0");
}
- // END android-changed
if (key.length - offset < len) {
throw new IllegalArgumentException("key too short");
}
diff --git a/luni/src/main/java/javax/net/ssl/SSLSocketFactory.java b/luni/src/main/java/javax/net/ssl/SSLSocketFactory.java
index 75f918e..1f3aa42 100644
--- a/luni/src/main/java/javax/net/ssl/SSLSocketFactory.java
+++ b/luni/src/main/java/javax/net/ssl/SSLSocketFactory.java
@@ -44,9 +44,6 @@ public abstract class SSLSocketFactory extends SocketFactory {
*/
public static synchronized SocketFactory getDefault() {
if (defaultSocketFactory != null) {
- // BEGIN android-added
- // log("SSLSocketFactory", "Using factory " + defaultSocketFactory, null);
- // END android-added
return defaultSocketFactory;
}
if (defaultName == null) {
@@ -80,18 +77,13 @@ public abstract class SSLSocketFactory extends SocketFactory {
// Use internal implementation
defaultSocketFactory = new DefaultSSLSocketFactory("No SSLSocketFactory installed");
}
- // BEGIN android-added
- // log("SSLSocketFactory", "Using factory " + defaultSocketFactory, null);
- // END android-added
return defaultSocketFactory;
}
- // BEGIN android-added
@SuppressWarnings("unchecked")
private static void log(String tag, String msg, Throwable throwable) {
Logger.getLogger(tag).log(Level.INFO, msg, throwable);
}
- // END android-added
/**
* Creates a new {@code SSLSocketFactory}.
diff --git a/luni/src/main/java/libcore/icu/CharsetDecoderICU.java b/luni/src/main/java/libcore/icu/CharsetDecoderICU.java
index 86ba13b..59c46c5 100644
--- a/luni/src/main/java/libcore/icu/CharsetDecoderICU.java
+++ b/luni/src/main/java/libcore/icu/CharsetDecoderICU.java
@@ -42,10 +42,8 @@ public final class CharsetDecoderICU extends CharsetDecoder {
private byte[] input = null;
private char[] output= null;
- // BEGIN android-added
private byte[] allocatedInput = null;
private char[] allocatedOutput = null;
- // END android-added
// These instance variables are always assigned in the methods before being used. This class
// is inherently thread-unsafe so we don't have to worry about synchronization.
@@ -245,19 +243,15 @@ public final class CharsetDecoderICU extends CharsetDecoder {
private int getArray(CharBuffer out) {
if (out.hasArray()) {
- // BEGIN android-changed: take arrayOffset into account
output = out.array();
outEnd = out.arrayOffset() + out.limit();
return out.arrayOffset() + out.position();
- // END android-changed
} else {
outEnd = out.remaining();
- // BEGIN android-added
if (allocatedOutput == null || (outEnd > allocatedOutput.length)) {
allocatedOutput = new char[outEnd];
}
output = allocatedOutput;
- // END android-added
//since the new
// buffer start position
// is 0
@@ -267,19 +261,15 @@ public final class CharsetDecoderICU extends CharsetDecoder {
private int getArray(ByteBuffer in) {
if (in.hasArray()) {
- // BEGIN android-changed: take arrayOffset into account
input = in.array();
inEnd = in.arrayOffset() + in.limit();
return in.arrayOffset() + in.position() + savedInputHeldLen;/*exclude the number fo bytes held in previous conversion*/
- // END android-changed
} else {
inEnd = in.remaining();
- // BEGIN android-added
if (allocatedInput == null || (inEnd > allocatedInput.length)) {
allocatedInput = new byte[inEnd];
}
input = allocatedInput;
- // END android-added
// save the current position
int pos = in.position();
in.get(input,0,inEnd);
diff --git a/luni/src/main/java/libcore/icu/CharsetEncoderICU.java b/luni/src/main/java/libcore/icu/CharsetEncoderICU.java
index 2855a4c..3b42f85 100644
--- a/luni/src/main/java/libcore/icu/CharsetEncoderICU.java
+++ b/luni/src/main/java/libcore/icu/CharsetEncoderICU.java
@@ -56,10 +56,8 @@ public final class CharsetEncoderICU extends CharsetEncoder {
private char[] input = null;
private byte[] output = null;
- // BEGIN android-added
private char[] allocatedInput = null;
private byte[] allocatedOutput = null;
- // END android-added
// These instance variables are always assigned in the methods before being used. This class
// is inherently thread-unsafe so we don't have to worry about synchronization.
@@ -212,9 +210,7 @@ public final class CharsetEncoderICU extends CharsetEncoder {
data[INPUT_OFFSET] = getArray(in);
data[OUTPUT_OFFSET]= getArray(out);
data[INPUT_HELD] = 0;
- // BEGIN android-added
data[INVALID_CHARS] = 0; // Make sure we don't see earlier errors.
- // END android added
try {
/* do the conversion */
@@ -272,19 +268,15 @@ public final class CharsetEncoderICU extends CharsetEncoder {
//------------------------------------------
private int getArray(ByteBuffer out) {
if (out.hasArray()) {
- // BEGIN android-changed: take arrayOffset into account
output = out.array();
outEnd = out.arrayOffset() + out.limit();
return out.arrayOffset() + out.position();
- // END android-changed
} else {
outEnd = out.remaining();
- // BEGIN android-added
if (allocatedOutput == null || (outEnd > allocatedOutput.length)) {
allocatedOutput = new byte[outEnd];
}
output = allocatedOutput;
- // END android-added
//since the new
// buffer start position
// is 0
@@ -294,19 +286,15 @@ public final class CharsetEncoderICU extends CharsetEncoder {
private int getArray(CharBuffer in) {
if (in.hasArray()) {
- // BEGIN android-changed: take arrayOffset into account
input = in.array();
inEnd = in.arrayOffset() + in.limit();
return in.arrayOffset() + in.position() + savedInputHeldLen;/*exclude the number fo bytes held in previous conversion*/
- // END android-changed
} else {
inEnd = in.remaining();
- // BEGIN android-added
if (allocatedInput == null || (inEnd > allocatedInput.length)) {
allocatedInput = new char[inEnd];
}
input = allocatedInput;
- // END android-added
// save the current position
int pos = in.position();
in.get(input,0,inEnd);
@@ -326,34 +314,15 @@ public final class CharsetEncoderICU extends CharsetEncoder {
// array backing the buffer directly and wrote to
// it, so just just set the position and return.
// This is done to avoid the creation of temp array.
- // BEGIN android-changed: take arrayOffset into account
out.position(out.position() + data[OUTPUT_OFFSET] - out.arrayOffset());
- // END android-changed
} else {
out.put(output, 0, data[OUTPUT_OFFSET]);
}
- // BEGIN android-added
// release reference to output array, which may not be ours
output = null;
- // END android-added
}
private void setPosition(CharBuffer in){
-// BEGIN android-removed
-// // was there input held in the previous invocation of encodeLoop
-// // that resulted in output in this invocation?
-// if(data[OUTPUT_OFFSET]>0 && savedInputHeldLen>0){
-// int len = in.position() + data[INPUT_OFFSET] + savedInputHeldLen;
-// in.position(len);
-// savedInputHeldLen = data[INPUT_HELD];
-// }else{
-// in.position(in.position() + data[INPUT_OFFSET] + savedInputHeldLen);
-// savedInputHeldLen = data[INPUT_HELD];
-// in.position(in.position() - savedInputHeldLen);
-// }
-// END android-removed
-
-// BEGIN android-added
// Slightly rewired original code to make it cleaner. Also
// added a fix for the problem where input characters got
// lost when invalid characters were encountered. Not sure
@@ -368,11 +337,8 @@ public final class CharsetEncoderICU extends CharsetEncoder {
if(!(data[OUTPUT_OFFSET]>0 && savedInputHeldLen>0)){
in.position(in.position() - savedInputHeldLen);
}
-// END android-added
- // BEGIN android-added
// release reference to input array, which may not be ours
input = null;
- // END android-added
}
}
diff --git a/luni/src/main/java/libcore/icu/CollationElementIteratorICU.java b/luni/src/main/java/libcore/icu/CollationElementIteratorICU.java
index 6d85718..05caa0b 100644
--- a/luni/src/main/java/libcore/icu/CollationElementIteratorICU.java
+++ b/luni/src/main/java/libcore/icu/CollationElementIteratorICU.java
@@ -99,11 +99,9 @@ public final class CollationElementIteratorICU {
NativeCollation.setText(address, source);
}
- // BEGIN android-added
public void setText(CharacterIterator source) {
NativeCollation.setText(address, source.toString());
}
- // END android-added
/**
* Get the offset of the current source character.
diff --git a/luni/src/main/java/org/apache/harmony/luni/platform/IFileSystem.java b/luni/src/main/java/org/apache/harmony/luni/platform/IFileSystem.java
index 2100cef..51b7980 100644
--- a/luni/src/main/java/org/apache/harmony/luni/platform/IFileSystem.java
+++ b/luni/src/main/java/org/apache/harmony/luni/platform/IFileSystem.java
@@ -15,10 +15,6 @@
* limitations under the License.
*/
-// BEGIN android-note
-// address length was changed from long to int for performance reasons.
-// END android-note
-
package org.apache.harmony.luni.platform;
import java.io.FileDescriptor;
@@ -105,13 +101,6 @@ public interface IFileSystem {
public long transfer(int fileHandler, FileDescriptor socketDescriptor,
long offset, long count) throws IOException;
- // BEGIN android-deleted
- // public long ttyAvailable() throws IOException;
- // public long ttyRead(byte[] bytes, int offset, int length) throws IOException;
- // END android-deleted
-
- // BEGIN android-added
public int ioctlAvailable(FileDescriptor fileDescriptor) throws IOException;
- // END android-added
}
diff --git a/luni/src/main/java/org/apache/harmony/luni/platform/INetworkSystem.java b/luni/src/main/java/org/apache/harmony/luni/platform/INetworkSystem.java
index 682ec3a..c073c41 100644
--- a/luni/src/main/java/org/apache/harmony/luni/platform/INetworkSystem.java
+++ b/luni/src/main/java/org/apache/harmony/luni/platform/INetworkSystem.java
@@ -15,10 +15,6 @@
* limitations under the License.
*/
-// BEGIN android-note
-// address length was changed from long to int for performance reasons.
-// END android-note
-
package org.apache.harmony.luni.platform;
import java.io.FileDescriptor;
diff --git a/luni/src/main/java/org/apache/harmony/luni/platform/OSFileSystem.java b/luni/src/main/java/org/apache/harmony/luni/platform/OSFileSystem.java
index 254cf74..03b3352 100644
--- a/luni/src/main/java/org/apache/harmony/luni/platform/OSFileSystem.java
+++ b/luni/src/main/java/org/apache/harmony/luni/platform/OSFileSystem.java
@@ -15,10 +15,6 @@
* limitations under the License.
*/
-// BEGIN android-note
-// address length was changed from long to int for performance reasons.
-// END android-note
-
package org.apache.harmony.luni.platform;
import java.io.FileDescriptor;
diff --git a/luni/src/main/java/org/apache/harmony/luni/util/DeleteOnExit.java b/luni/src/main/java/org/apache/harmony/luni/util/DeleteOnExit.java
index ac3275e..8fa04fd 100644
--- a/luni/src/main/java/org/apache/harmony/luni/util/DeleteOnExit.java
+++ b/luni/src/main/java/org/apache/harmony/luni/util/DeleteOnExit.java
@@ -22,7 +22,6 @@ import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
-// BEGIN android-changed
/**
* Implements the actual DeleteOnExit mechanism. Is registered as a shutdown
* hook in the Runtime, once it is actually being used.
@@ -77,4 +76,3 @@ public class DeleteOnExit extends Thread {
}
}
}
-// END android-changed
diff --git a/luni/src/main/java/org/apache/harmony/security/asn1/ASN1Integer.java b/luni/src/main/java/org/apache/harmony/security/asn1/ASN1Integer.java
index 9230bbd..f1f7b7e 100644
--- a/luni/src/main/java/org/apache/harmony/security/asn1/ASN1Integer.java
+++ b/luni/src/main/java/org/apache/harmony/security/asn1/ASN1Integer.java
@@ -103,7 +103,6 @@ public class ASN1Integer extends ASN1Primitive {
out.length = ((byte[]) out.content).length;
}
-// BEGIN android-changed
/**
* Converts decoded ASN.1 Integer to int value.
* If the object represents an integer value
@@ -125,7 +124,6 @@ public class ASN1Integer extends ASN1Primitive {
public static BigInteger toBigIntegerValue(Object decoded) {
return new BigInteger((byte[]) decoded);//FIXME optimize
}
-// END android-changed
/**
* Converts primitive int value to a form most suitable for encoding.
diff --git a/luni/src/main/java/org/apache/harmony/security/asn1/ObjectIdentifier.java b/luni/src/main/java/org/apache/harmony/security/asn1/ObjectIdentifier.java
index 199f30c..aac75ad 100644
--- a/luni/src/main/java/org/apache/harmony/security/asn1/ObjectIdentifier.java
+++ b/luni/src/main/java/org/apache/harmony/security/asn1/ObjectIdentifier.java
@@ -247,7 +247,6 @@ public final class ObjectIdentifier {
return sb.toString();
}
- // BEGIN android-changed
/**
* Gets ObjectIdentifier (OID) from string representation.
*
@@ -368,5 +367,4 @@ public final class ObjectIdentifier {
return oid;
}
- // END android-changed
}
diff --git a/luni/src/main/java/org/apache/harmony/security/fortress/Services.java b/luni/src/main/java/org/apache/harmony/security/fortress/Services.java
index 8a2a7dd..d97e0f4 100644
--- a/luni/src/main/java/org/apache/harmony/security/fortress/Services.java
+++ b/luni/src/main/java/org/apache/harmony/security/fortress/Services.java
@@ -40,16 +40,14 @@ import java.util.Map;
public class Services {
// The HashMap that contains information about preferred implementations for
- // all serviceName.algName in the registered providers
- // BEGIN android-changed
- // set the initial size to 600 so we don't grow to 1024 by default because
+ // all serviceName.algName in the registered providers.
+ // Set the initial size to 600 so we don't grow to 1024 by default because
// initialization adds a few entries more than the growth threshold.
private static final Map<String, Provider.Service> services
= new HashMap<String, Provider.Service>(600);
- // save default SecureRandom service as well.
- // avoids similar provider/services iteration in SecureRandom constructor
+ // Save default SecureRandom service as well.
+ // Avoids similar provider/services iteration in SecureRandom constructor
private static Provider.Service secureRandom;
- // END android-changed
// Need refresh flag
private static boolean needRefresh; // = false;
diff --git a/luni/src/main/java/org/apache/harmony/security/pkcs7/SignerInfo.java b/luni/src/main/java/org/apache/harmony/security/pkcs7/SignerInfo.java
index aa40fdd..f9eda25 100644
--- a/luni/src/main/java/org/apache/harmony/security/pkcs7/SignerInfo.java
+++ b/luni/src/main/java/org/apache/harmony/security/pkcs7/SignerInfo.java
@@ -77,9 +77,7 @@ public class SignerInfo {
) {
this.version = version;
this.issuer = ((Name)issuerAndSerialNumber[0]).getX500Principal();
- // BEGIN android-changed
this.serialNumber = ASN1Integer.toBigIntegerValue(issuerAndSerialNumber[1]);
- // END android-changed
this.digestAlgorithm = digestAlgorithm;
this.authenticatedAttributes = authenticatedAttributes;
this.digestEncryptionAlgorithm = digestEncryptionAlgorithm;
diff --git a/luni/src/main/java/org/apache/harmony/security/provider/cert/Cache.java b/luni/src/main/java/org/apache/harmony/security/provider/cert/Cache.java
index f3dd402..a2c5b4c 100644
--- a/luni/src/main/java/org/apache/harmony/security/provider/cert/Cache.java
+++ b/luni/src/main/java/org/apache/harmony/security/provider/cert/Cache.java
@@ -138,25 +138,6 @@ public class Cache {
cache = new Object[cache_size];
}
- // BEGIN android-removed
- // /**
- // * Creates the Cache object of size of 900.
- // * @param pref_size specifies how many leading/trailing bytes of object's
- // * encoded form will be used for hash computation
- // */
- // public Cache(int pref_size) {
- // this(pref_size, 900);
- // }
- //
- // /**
- // * Creates the Cache object of size of 900.
- // */
- // public Cache() {
- // this(28, 900);
- // }
- // END android-removed
-
- // BEGIN android-added
/**
* Creates the Cache object of size of 9.
* @param pref_size specifies how many leading/trailing bytes of object's
@@ -172,7 +153,6 @@ public class Cache {
public Cache() {
this(28, 9);
}
- // END android-added
/**
* Returns the hash code for the array. This code is used to
@@ -342,4 +322,3 @@ public class Cache {
}
}
-
diff --git a/luni/src/main/java/org/apache/harmony/security/provider/crypto/RandomBitsSupplier.java b/luni/src/main/java/org/apache/harmony/security/provider/crypto/RandomBitsSupplier.java
index 002a513..3862132 100644
--- a/luni/src/main/java/org/apache/harmony/security/provider/crypto/RandomBitsSupplier.java
+++ b/luni/src/main/java/org/apache/harmony/security/provider/crypto/RandomBitsSupplier.java
@@ -39,19 +39,20 @@ public class RandomBitsSupplier implements SHA1_Data {
/**
- * BufferedInputStream to read from device
+ * InputStream to read from device
+ *
+ * Using a BufferedInputStream leads to problems
+ * on Android in rare cases, since the
+ * BufferedInputStream's available() issues an
+ * ioctl(), and the pseudo device doesn't seem
+ * to like that. Since we're reading bigger
+ * chunks and not single bytes, the FileInputStream
+ * shouldn't be slower, so we use that. Same might
+ * apply to other Linux platforms.
+ *
+ * TODO: the above doesn't sound true.
*/
- // BEGIN android-changed
- // Using a BufferedInputStream leads to problems
- // on Android in rare cases, since the
- // BufferedInputStream's available() issues an
- // iotcl(), and the pseudo device doesn't seem
- // to like that. Since we're reading bigger
- // chunks and not single bytes, the FileInputStream
- // shouldn't be slower, so we use that. Same might
- // apply to other Linux platforms.
- private static FileInputStream bis = null;
- // END android-changed
+ private static FileInputStream fis = null;
/**
* File to connect to device
@@ -73,9 +74,7 @@ public class RandomBitsSupplier implements SHA1_Data {
try {
File file = new File(deviceName);
if (file.canRead()) {
- // BEGIN android-modified
- bis = new FileInputStream(file);
- // END android-modified
+ fis = new FileInputStream(file);
randomFile = file;
serviceAvailable = true;
}
@@ -109,7 +108,7 @@ public class RandomBitsSupplier implements SHA1_Data {
try {
for ( ; ; ) {
- bytesRead = bis.read(bytes, offset, numBytes-total);
+ bytesRead = fis.read(bytes, offset, numBytes-total);
// the below case should not occur because /dev/random or /dev/urandom is a special file
@@ -147,7 +146,6 @@ public class RandomBitsSupplier implements SHA1_Data {
* InvalidArgumentException - if numBytes <= 0
*/
public static byte[] getRandomBits(int numBytes) {
-
if (numBytes <= 0) {
throw new IllegalArgumentException(Integer.toString(numBytes));
}
@@ -158,8 +156,6 @@ public class RandomBitsSupplier implements SHA1_Data {
throw new ProviderException("ATTENTION: service is not available : no random devices");
}
- // BEGIN android-changed
return getUnixDeviceRandom(numBytes);
- // END android-changed
}
}
diff --git a/luni/src/main/java/org/apache/harmony/security/utils/AlgNameMapper.java b/luni/src/main/java/org/apache/harmony/security/utils/AlgNameMapper.java
index c818d1d..9ad5373 100644
--- a/luni/src/main/java/org/apache/harmony/security/utils/AlgNameMapper.java
+++ b/luni/src/main/java/org/apache/harmony/security/utils/AlgNameMapper.java
@@ -187,9 +187,7 @@ public class AlgNameMapper {
* @return 'true' if parameter represents OID
*/
public static boolean isOID(String alias) {
- // BEGIN android-changed
return ObjectIdentifier.isOID(normalize(alias));
- // END android-changed
}
/**
diff --git a/luni/src/main/java/org/apache/harmony/security/utils/JarUtils.java b/luni/src/main/java/org/apache/harmony/security/utils/JarUtils.java
index 9013eba..35f69c9 100644
--- a/luni/src/main/java/org/apache/harmony/security/utils/JarUtils.java
+++ b/luni/src/main/java/org/apache/harmony/security/utils/JarUtils.java
@@ -120,13 +120,8 @@ public class JarUtils {
String alg = null;
if (da != null && dea != null) {
alg = da + "with" + dea;
- try{
- // BEGIN android-removed
- // sig = OpenSSLSignature.getInstance(alg);
- // END android-removed
- // BEGIN android-added
+ try {
sig = OpenSSLSignature.getInstance(alg);
- // END android-removed
} catch (NoSuchAlgorithmException e) {}
}
if (sig == null) {
@@ -134,13 +129,8 @@ public class JarUtils {
if (alg == null) {
return null;
}
- try{
- // BEGIN android-removed
- // sig = OpenSSLSignature.getInstance(alg);
- // END android-removed
- // BEGIN android-added
+ try {
sig = OpenSSLSignature.getInstance(alg);
- // END android-removed
} catch (NoSuchAlgorithmException e) {
return null;
}
diff --git a/luni/src/main/java/org/apache/harmony/security/x501/AttributeTypeAndValue.java b/luni/src/main/java/org/apache/harmony/security/x501/AttributeTypeAndValue.java
index fc1f23b..eca8817 100644
--- a/luni/src/main/java/org/apache/harmony/security/x501/AttributeTypeAndValue.java
+++ b/luni/src/main/java/org/apache/harmony/security/x501/AttributeTypeAndValue.java
@@ -325,15 +325,13 @@ public class AttributeTypeAndValue {
if (X500Principal.CANONICAL.equals(attrFormat)) {
// only PrintableString and UTF8String in string format
// all others are output in hex format
- // BEGIN android-changed
- // no hex for teletex; see bug 2102191
+ // no hex for teletex; see http://b/2102191
int tag = value.getTag();
if (!ASN1StringType.UTF8STRING.checkTag(tag)
&& !ASN1StringType.PRINTABLESTRING.checkTag(tag)
&& !ASN1StringType.TELETEXSTRING.checkTag(tag)) {
hexFormat = true;
}
- // END android-changed
}
} else {
diff --git a/luni/src/main/java/org/apache/harmony/security/x509/GeneralName.java b/luni/src/main/java/org/apache/harmony/security/x509/GeneralName.java
index d52fe89..5bd6a24 100644
--- a/luni/src/main/java/org/apache/harmony/security/x509/GeneralName.java
+++ b/luni/src/main/java/org/apache/harmony/security/x509/GeneralName.java
@@ -459,7 +459,7 @@ public class GeneralName {
*/
public List getAsList() {
ArrayList result = new ArrayList();
- result.add(Integer.valueOf(tag)); // android-changed
+ result.add(tag);
switch (tag) {
case OTHER_NAME:
result.add(((OtherName) name).getEncoded());
diff --git a/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/ClientHandshakeImpl.java b/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/ClientHandshakeImpl.java
index a09914e..1f1d789 100644
--- a/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/ClientHandshakeImpl.java
+++ b/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/ClientHandshakeImpl.java
@@ -86,13 +86,11 @@ public class ClientHandshakeImpl extends HandshakeProtocol {
} else if (parameters.getEnableSessionCreation()){
isResuming = false;
session = new SSLSessionImpl(parameters.getSecureRandom());
- // BEGIN android-added
if (engineOwner != null) {
session.setPeer(engineOwner.getPeerHost(), engineOwner.getPeerPort());
} else {
session.setPeer(socketOwner.getInetAddress().getHostName(), socketOwner.getPort());
}
- // END android-added
session.protocol = ProtocolVersion.getLatestVersion(parameters.getEnabledProtocols());
recordProtocol.setVersion(session.protocol.version);
} else {
@@ -109,13 +107,11 @@ public class ClientHandshakeImpl extends HandshakeProtocol {
if (parameters.getEnableSessionCreation()){
isResuming = false;
session = new SSLSessionImpl(parameters.getSecureRandom());
- // BEGIN android-added
if (engineOwner != null) {
session.setPeer(engineOwner.getPeerHost(), engineOwner.getPeerPort());
} else {
session.setPeer(socketOwner.getInetAddress().getHostName(), socketOwner.getPort());
}
- // END android-added
session.protocol = ProtocolVersion.getLatestVersion(parameters.getEnabledProtocols());
recordProtocol.setVersion(session.protocol.version);
startSession();
@@ -133,9 +129,7 @@ public class ClientHandshakeImpl extends HandshakeProtocol {
if (isResuming) {
cipher_suites = new CipherSuite[] { session.cipherSuite };
} else {
- // BEGIN android-changed
cipher_suites = parameters.getEnabledCipherSuitesMember();
- // END android-changed
}
clientHello = new ClientHello(parameters.getSecureRandom(),
session.protocol.version, session.id, cipher_suites);
@@ -215,9 +209,7 @@ public class ClientHandshakeImpl extends HandshakeProtocol {
}
//check cipher_suite
- // BEGIN android-changed
CipherSuite[] enabledSuites = parameters.getEnabledCipherSuitesMember();
- // END android-changed
find: {
for (int i = 0; i < enabledSuites.length; i++) {
if (serverHello.cipher_suite.equals(enabledSuites[i])) {
@@ -304,9 +296,7 @@ public class ClientHandshakeImpl extends HandshakeProtocol {
serverFinished = new Finished(io_stream, length);
verifyFinished(serverFinished.getData());
session.lastAccessedTime = System.currentTimeMillis();
- // BEGIN android-added
session.context = parameters.getClientSessionContext();
- // END android-added
parameters.getClientSessionContext().putSession(session);
if (isResuming) {
sendChangeCipherSpec();
@@ -578,7 +568,6 @@ public class ClientHandshakeImpl extends HandshakeProtocol {
return null; // starts new session
}
- // BEGIN android-changed
ClientSessionContext context = parameters.getClientSessionContext();
SSLSessionImpl session
= (SSLSessionImpl) context.getSession(host, port);
@@ -586,7 +575,6 @@ public class ClientHandshakeImpl extends HandshakeProtocol {
session = (SSLSessionImpl) session.clone();
}
return session;
- // END android-changed
}
}
diff --git a/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/KeyManagerImpl.java b/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/KeyManagerImpl.java
index 8278ae9..830fd77 100644
--- a/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/KeyManagerImpl.java
+++ b/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/KeyManagerImpl.java
@@ -96,11 +96,9 @@ public class KeyManagerImpl extends X509ExtendedKeyManager {
}
public X509Certificate[] getCertificateChain(String alias) {
- // BEGIN android-changed
if (alias == null) {
return null;
}
- // END android-changed
if (hash.containsKey(alias)) {
Certificate[] certs = hash.get(alias).getCertificateChain();
if (certs[0] instanceof X509Certificate) {
@@ -124,11 +122,9 @@ public class KeyManagerImpl extends X509ExtendedKeyManager {
}
public PrivateKey getPrivateKey(String alias) {
- // BEGIN android-changed
if (alias == null) {
return null;
}
- // END android-changed
if (hash.containsKey(alias)) {
return hash.get(alias).getPrivateKey();
}
diff --git a/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLSocketImpl.java b/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLSocketImpl.java
index edad7dc..dfad63e 100644
--- a/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLSocketImpl.java
+++ b/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLSocketImpl.java
@@ -100,9 +100,7 @@ public class OpenSSLSocketImpl
*/
private int timeoutMilliseconds = 0;
- // BEGIN android-added
private int handshakeTimeoutMilliseconds = -1; // -1 = same as timeout; 0 = infinite
- // END android-added
private String wrappedHost;
private int wrappedPort;
@@ -472,13 +470,11 @@ public class OpenSSLSocketImpl
NativeCrypto.SSL_MODE_HANDSHAKE_CUTTHROUGH);
}
- // BEGIN android-added
// Temporarily use a different timeout for the handshake process
int savedTimeoutMilliseconds = getSoTimeout();
if (handshakeTimeoutMilliseconds >= 0) {
setSoTimeout(handshakeTimeoutMilliseconds);
}
- // END android-added
int sslSessionNativePointer;
try {
@@ -524,12 +520,10 @@ public class OpenSSLSocketImpl
+ getInetAddress().getHostName() + ".");
}
- // BEGIN android-added
// Restore the original timeout now that the handshake is complete
if (handshakeTimeoutMilliseconds >= 0) {
setSoTimeout(savedTimeoutMilliseconds);
}
- // END android-added
// if not, notifyHandshakeCompletedListeners later in handshakeCompleted() callback
if (handshakeCompleted) {
@@ -1184,7 +1178,6 @@ public class OpenSSLSocketImpl
return timeoutMilliseconds;
}
- // BEGIN android-added
/**
* Set the handshake timeout on this socket. This timeout is specified in
* milliseconds and will be used only during the handshake process.
@@ -1194,7 +1187,6 @@ public class OpenSSLSocketImpl
public void setHandshakeTimeout(int timeoutMilliseconds) throws SocketException {
this.handshakeTimeoutMilliseconds = timeoutMilliseconds;
}
- // END android-added
/**
* Closes the SSL socket. Once closed, a socket is not available for further
diff --git a/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLContextImpl.java b/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLContextImpl.java
index e09230b..0e1e130 100644
--- a/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLContextImpl.java
+++ b/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLContextImpl.java
@@ -28,11 +28,6 @@ import javax.net.ssl.SSLServerSocketFactory;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;
-// BEGIN android-note
-// Modified heavily during SSLSessionContext refactoring. Added support for
-// persistent session caches.
-// END android-note
-
/**
* Implementation of SSLContext service provider interface.
*/
diff --git a/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLInputStream.java b/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLInputStream.java
index 2e62e44..2a6c5d6 100644
--- a/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLInputStream.java
+++ b/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLInputStream.java
@@ -78,11 +78,9 @@ public abstract class SSLInputStream extends InputStream {
* Reads and returns uint64 value.
*/
public long readUint64() throws IOException {
- // BEGIN android-changed
long hi = readUint32();
long lo = readUint32();
return (hi << 32) | lo;
- // END android-changed
}
/**
diff --git a/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLParametersImpl.java b/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLParametersImpl.java
index 405e5dd..fdad872 100644
--- a/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLParametersImpl.java
+++ b/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLParametersImpl.java
@@ -33,7 +33,7 @@ import javax.net.ssl.X509KeyManager;
import javax.net.ssl.X509TrustManager;
/**
- * The instances of this class incapsulate all the info
+ * The instances of this class encapsulate all the info
* about enabled cipher suites and protocols,
* as well as the information about client/server mode of
* ssl socket, whether it require/want client authentication or not,
@@ -53,12 +53,10 @@ public class SSLParametersImpl implements Cloneable {
// client session context contains the set of reusable
// client-side SSL sessions
-// BEGIN android-changed
private final ClientSessionContext clientSessionContext;
// server session context contains the set of reusable
// server-side SSL sessions
private final ServerSessionContext serverSessionContext;
-// END android-changed
// source of authentication keys
private X509KeyManager keyManager;
// source of authentication trust decisions
@@ -67,9 +65,7 @@ public class SSLParametersImpl implements Cloneable {
private SecureRandom secureRandom;
// cipher suites available for SSL connection
- // BEGIN android-changed
private CipherSuite[] enabledCipherSuites;
- // END android-changed
// string representations of available cipher suites
private String[] enabledCipherSuiteNames = null;
@@ -85,14 +81,12 @@ public class SSLParametersImpl implements Cloneable {
// if the peer with this parameters allowed to cteate new SSL session
private boolean enable_session_creation = true;
-// BEGIN android-changed
protected CipherSuite[] getEnabledCipherSuitesMember() {
if (enabledCipherSuites == null) {
this.enabledCipherSuites = CipherSuite.DEFAULT_CIPHER_SUITES;
}
return enabledCipherSuites;
}
-// END android-changed
/**
* Initializes the parameters. Naturally this constructor is used
@@ -103,13 +97,11 @@ public class SSLParametersImpl implements Cloneable {
* SecureRandom)} for more information
*/
protected SSLParametersImpl(KeyManager[] kms, TrustManager[] tms,
-// BEGIN android-changed
SecureRandom sr, ClientSessionContext clientSessionContext,
ServerSessionContext serverSessionContext)
throws KeyManagementException {
this.serverSessionContext = serverSessionContext;
this.clientSessionContext = clientSessionContext;
-// END android-changed
// It's not described by the spec of SSLContext what should happen
// if the arrays of length 0 are specified. This implementation
@@ -150,7 +142,7 @@ public class SSLParametersImpl implements Cloneable {
// null, we don't replace it by a new instance. The native code below
// then directly accesses /dev/urandom. Not the most elegant solution,
// but faster than going through the SecureRandom object.
- secureRandom = sr;
+ secureRandom = sr;
// END android-added
}
@@ -170,18 +162,14 @@ public class SSLParametersImpl implements Cloneable {
/**
* @return server session context
*/
-// BEGIN android-changed
protected ServerSessionContext getServerSessionContext() {
-// END android-changed
return serverSessionContext;
}
/**
* @return client session context
*/
-// BEGIN android-changed
protected ClientSessionContext getClientSessionContext() {
-// END android-changed
return clientSessionContext;
}
@@ -215,23 +203,19 @@ public class SSLParametersImpl implements Cloneable {
return secureRandom;
}
- // BEGIN android-added
/**
* @return the secure random member reference, even it is null
*/
protected SecureRandom getSecureRandomMember() {
return secureRandom;
}
- // END android-added
/**
* @return the names of enabled cipher suites
*/
protected String[] getEnabledCipherSuites() {
if (enabledCipherSuiteNames == null) {
- // BEGIN android-added
CipherSuite[] enabledCipherSuites = getEnabledCipherSuitesMember();
- // END android-added
enabledCipherSuiteNames = new String[enabledCipherSuites.length];
for (int i = 0; i< enabledCipherSuites.length; i++) {
enabledCipherSuiteNames[i] = enabledCipherSuites[i].getName();
@@ -364,13 +348,11 @@ public class SSLParametersImpl implements Cloneable {
*/
@Override
protected Object clone() {
-// BEGIN android-changed
try {
return super.clone();
} catch (CloneNotSupportedException e) {
throw new AssertionError(e);
}
-// END android-changed
}
private static X509KeyManager getDefaultKeyManager() {
diff --git a/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLSessionImpl.java b/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLSessionImpl.java
index f03cd3e..2e2ea7c 100644
--- a/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLSessionImpl.java
+++ b/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLSessionImpl.java
@@ -121,9 +121,7 @@ public class SSLSessionImpl implements SSLSession, Cloneable {
/**
* Context of the session
*/
-// BEGIN android-changed
SSLSessionContext context;
-// END android-changed
/**
* certificates were sent to the peer
diff --git a/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/ServerHandshakeImpl.java b/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/ServerHandshakeImpl.java
index f9df058..7961cdc 100644
--- a/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/ServerHandshakeImpl.java
+++ b/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/ServerHandshakeImpl.java
@@ -264,9 +264,7 @@ public class ServerHandshakeImpl extends HandshakeProtocol {
clientFinished = new Finished(io_stream, length);
verifyFinished(clientFinished.getData());
- // BEGIN android-added
session.context = parameters.getServerSessionContext();
- // END android-added
parameters.getServerSessionContext().putSession(session);
if (!isResuming) {
sendChangeCipherSpec();
@@ -402,13 +400,11 @@ public class ServerHandshakeImpl extends HandshakeProtocol {
"SSL Session may not be created");
}
session = new SSLSessionImpl(cipher_suite, parameters.getSecureRandom());
- // BEGIN android-added
if (engineOwner != null) {
session.setPeer(engineOwner.getPeerHost(), engineOwner.getPeerPort());
} else {
session.setPeer(socketOwner.getInetAddress().getHostName(), socketOwner.getPort());
}
- // END android-added
}
recordProtocol.setVersion(clientHello.client_version);
@@ -635,13 +631,11 @@ public class ServerHandshakeImpl extends HandshakeProtocol {
if (!clientSuite.supported) {
continue;
}
- // BEGIN android-changed
for (CipherSuite enabledCipherSuite : parameters.getEnabledCipherSuitesMember()) {
if (clientSuite.equals(enabledCipherSuite)) {
return clientSuite;
}
}
- // END android-changed
}
return null;
}
diff --git a/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/TrustManagerFactoryImpl.java b/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/TrustManagerFactoryImpl.java
index e4aae6f..6778be9 100644
--- a/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/TrustManagerFactoryImpl.java
+++ b/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/TrustManagerFactoryImpl.java
@@ -51,16 +51,10 @@ public class TrustManagerFactoryImpl extends TrustManagerFactorySpi {
if (ks != null) {
keyStore = ks;
} else {
- // BEGIN android-added
if (System.getProperty("javax.net.ssl.trustStore") == null) {
- String file = System.getProperty("java.home")
- + java.io.File.separator + "etc" + java.io.File.separator
- + "security" + java.io.File.separator
- + "cacerts.bks";
-
- System.setProperty("javax.net.ssl.trustStore", file);
+ String filename = System.getProperty("java.home") + "/etc/security/cacerts.bks";
+ System.setProperty("javax.net.ssl.trustStore", filename);
}
- // END android-added
keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
String keyStoreName = System.getProperty("javax.net.ssl.trustStore");
String keyStorePwd = null;
diff --git a/luni/src/main/java/org/xml/sax/ext/Attributes2Impl.java b/luni/src/main/java/org/xml/sax/ext/Attributes2Impl.java
index b3ec94a..9492218 100644
--- a/luni/src/main/java/org/xml/sax/ext/Attributes2Impl.java
+++ b/luni/src/main/java/org/xml/sax/ext/Attributes2Impl.java
@@ -37,18 +37,16 @@ import libcore.base.EmptyArray;
*/
public class Attributes2Impl extends AttributesImpl implements Attributes2
{
- private boolean declared [];
- private boolean specified [];
+ private boolean[] declared;
+ private boolean[] specified;
/**
* Construct a new, empty Attributes2Impl object.
*/
public Attributes2Impl () {
- // BEGIN android-added
declared = EmptyArray.BOOLEAN;
specified = EmptyArray.BOOLEAN;
- // END android-added
}
@@ -246,12 +244,8 @@ public class Attributes2Impl extends AttributesImpl implements Attributes2
int length = getLength ();
- // BEGIN android-changed
if (length > specified.length) {
- // END android-changed
- boolean newFlags [];
-
- newFlags = new boolean [length];
+ boolean[] newFlags = new boolean [length];
System.arraycopy (declared, 0, newFlags, 0, declared.length);
declared = newFlags;