am cc6d37df: am 4aa9da3f: Merge "Build fix."
* commit 'cc6d37df1373291d98718f7c93dbb5cd65d4c0bb':
Build fix.
diff --git a/NativeCode.mk b/NativeCode.mk
index d811439..bfd7bcf 100644
--- a/NativeCode.mk
+++ b/NativeCode.mk
@@ -66,7 +66,7 @@
core_c_includes := libcore/include $(LOCAL_C_INCLUDES)
core_shared_libraries := $(LOCAL_SHARED_LIBRARIES)
core_static_libraries := $(LOCAL_STATIC_LIBRARIES)
-core_cflags := -Wall -Wextra -Werror
+core_cflags := $(LOCAL_CFLAGS) -Wall -Wextra -Werror
core_cppflags += -std=gnu++11
core_test_files := \
diff --git a/dex/src/main/java/com/android/dex/DexException.java b/dex/src/main/java/com/android/dex/DexException.java
index a30a46f..ee0af18 100644
--- a/dex/src/main/java/com/android/dex/DexException.java
+++ b/dex/src/main/java/com/android/dex/DexException.java
@@ -22,7 +22,7 @@
* Thrown when there's a format problem reading, writing, or generally
* processing a dex file.
*/
-public final class DexException extends ExceptionWithContext {
+public class DexException extends ExceptionWithContext {
public DexException(String message) {
super(message);
}
diff --git a/dex/src/main/java/com/android/dex/DexIndexOverflowException.java b/dex/src/main/java/com/android/dex/DexIndexOverflowException.java
new file mode 100644
index 0000000..3226207
--- /dev/null
+++ b/dex/src/main/java/com/android/dex/DexIndexOverflowException.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.dex;
+
+/**
+ * Thrown when there's an index overflow writing a dex file.
+ */
+public final class DexIndexOverflowException extends DexException {
+ public DexIndexOverflowException(String message) {
+ super(message);
+ }
+
+ public DexIndexOverflowException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/expectations/brokentests.txt b/expectations/brokentests.txt
index 5b5803d..5cebb63 100644
--- a/expectations/brokentests.txt
+++ b/expectations/brokentests.txt
@@ -98,21 +98,6 @@
]
},
{
- description: "Some DecimalFormat tests fail, treating tests as broken while investigate further.",
- bug: 12781028,
- result: EXEC_FAILED,
- names: [
- "org.apache.harmony.tests.java.text.DecimalFormatTest#testSerializationSelf",
- "org.apache.harmony.tests.java.text.DecimalFormatTest#test_formatD",
- "org.apache.harmony.tests.java.text.DecimalFormatTest#test_formatDLjava_lang_StringBufferLjava_text_FieldPosition",
- "org.apache.harmony.tests.java.text.DecimalFormatTest#test_formatDLjava_lang_StringBufferLjava_text_FieldPosition_problem_cases",
- "org.apache.harmony.tests.java.text.DecimalFormatTest#test_formatD_2",
- "org.apache.harmony.tests.java.text.DecimalFormatTest#test_formatJLjava_lang_StringBufferLjava_text_FieldPosition",
- "org.apache.harmony.tests.java.text.DecimalFormatTest#test_formatToCharacterIterator_very_large",
- "org.apache.harmony.tests.java.text.DecimalFormatTest#test_format_minus_zero"
- ]
-},
-{
description: "Fails in CTS, passes in CoreTestRunner.",
result: EXEC_FAILED,
names: [
diff --git a/expectations/knownfailures.txt b/expectations/knownfailures.txt
index 0392a11..bc33437 100644
--- a/expectations/knownfailures.txt
+++ b/expectations/knownfailures.txt
@@ -1438,73 +1438,32 @@
]
},
{
- description: "Known failures in klp-modular-dev branch being suppressed for dory / molly.",
- bug: 14674275,
- names: [
- "libcore.java.lang.SystemTest#testArrayCopyConcurrentModification",
- "libcore.java.lang.ref.FinalizeTest#testSystemRunFinalizationReturnsEvenIfQueueIsNonEmpty",
- "libcore.java.lang.reflect.ClassLoaderReflectionTest#testConstructorsOfDifferentClassLoadersAreNotEqual",
- "libcore.java.lang.reflect.ClassLoaderReflectionTest#testFieldsOfDifferentClassLoadersAreNotEqual",
- "libcore.java.lang.reflect.MethodTest#testEqualMethodEqualsAndHashCode",
- "libcore.java.lang.reflect.MethodTest#testHashCodeSpec",
- "libcore.java.lang.reflect.ProxyTest#testDeclaredExceptionIntersectedByExactReturnTypes",
- "libcore.java.lang.reflect.ProxyTest#testReturnTypeDoesNotSatisfyAllConstraintsWithLenientCaller",
- "libcore.java.net.ConcurrentCloseTest#test_connect",
- "libcore.java.net.ConcurrentCloseTest#test_connect_nonBlocking",
- "libcore.java.net.ConcurrentCloseTest#test_connect_timeout",
- "libcore.java.net.InetAddressTest#test_isReachable",
- "libcore.java.net.OldCookieHandlerTest#test_get_put",
- "libcore.java.net.OldSocketTest#test_ConstructorLjava_lang_StringILjava_net_InetAddressI2",
- "libcore.java.net.OldSocketTest#test_connectLjava_net_SocketAddressI",
- "libcore.java.net.URLConnectionTest#testConnectViaHttpProxyToHttpsUsingBadProxyAndHttpResponseCache",
- "libcore.java.util.prefs.OldFilePreferencesImplTest#testSystemChildNodes",
- "libcore.java.util.prefs.OldNodeChangeEventTest#testGetChild",
- "libcore.java.util.prefs.OldNodeChangeEventTest#testGetParent",
- "org.apache.harmony.luni.tests.java.net.URLConnectionTest#test_getLastModified",
- "org.apache.harmony.tests.java.io.SerializationStressTest4#test_writeObject_Proxy",
- "org.apache.harmony.tests.java.lang.RuntimeTest#test_gc",
- "org.apache.harmony.tests.java.lang.ref.ReferenceQueueTest#test_removeJ",
- "org.apache.harmony.tests.java.lang.reflect.FieldTest#testProtectedFieldAccess",
- "org.apache.harmony.tests.java.lang.reflect.ProxyTest#test_ProxyClass_withParentAndSubInThrowList",
- "org.apache.harmony.tests.java.net.DatagramSocketTest#test_setBroadcastZ",
- "org.apache.harmony.tests.java.net.JarURLConnectionTest#test_getURLEncodedEntry",
- "org.apache.harmony.tests.java.net.MulticastSocketTest#test_joinGroupLjava_net_InetAddress_IPv4",
- "org.apache.harmony.tests.java.net.MulticastSocketTest#test_joinGroupLjava_net_InetAddress_IPv6",
- "org.apache.harmony.tests.java.net.MulticastSocketTest#test_joinGroupLjava_net_SocketAddressLjava_net_NetworkInterface",
- "org.apache.harmony.tests.java.net.MulticastSocketTest#test_joinGroupLjava_net_SocketAddressLjava_net_NetworkInterface_IPv4",
- "org.apache.harmony.tests.java.net.MulticastSocketTest#test_joinGroupLjava_net_SocketAddressLjava_net_NetworkInterface_IPv6",
- "org.apache.harmony.tests.java.net.MulticastSocketTest#test_joinGroupLjava_net_SocketAddressLjava_net_NetworkInterface_multiple_joins_IPv4",
- "org.apache.harmony.tests.java.net.MulticastSocketTest#test_joinGroupLjava_net_SocketAddressLjava_net_NetworkInterface_multiple_joins_IPv6",
- "org.apache.harmony.tests.java.net.MulticastSocketTest#test_leaveGroupLjava_net_InetAddress_IPv4",
- "org.apache.harmony.tests.java.net.MulticastSocketTest#test_leaveGroupLjava_net_InetAddress_IPv6",
- "org.apache.harmony.tests.java.net.MulticastSocketTest#test_leaveGroupLjava_net_SocketAddressLjava_net_NetworkInterface_IPv4",
- "org.apache.harmony.tests.java.net.MulticastSocketTest#test_leaveGroupLjava_net_SocketAddressLjava_net_NetworkInterface_IPv6",
- "org.apache.harmony.tests.java.net.MulticastSocketTest#test_sendLjava_net_DatagramPacketB_IPv4",
- "org.apache.harmony.tests.java.net.MulticastSocketTest#test_sendLjava_net_DatagramPacketB_IPv6",
- "org.apache.harmony.tests.java.net.MulticastSocketTest#test_setLoopbackModeSendReceive_IPv4",
- "org.apache.harmony.tests.java.net.MulticastSocketTest#test_setLoopbackModeSendReceive_IPv6",
- "org.apache.harmony.tests.java.net.MulticastSocketTest#test_setNetworkInterfaceLjava_net_NetworkInterface_IPv4",
- "org.apache.harmony.tests.java.text.SimpleDateFormatTest#test_formatLjava_util_DateLjava_lang_StringBufferLjava_text_FieldPosition",
- "org.apache.harmony.tests.java.text.SimpleDateFormatTest#test_parseLjava_lang_StringLjava_text_ParsePosition",
- "tests.api.internal.net.www.protocol.file.FileURLConnectionTest#testGetContentType",
- "tests.api.internal.net.www.protocol.file.FileURLConnectionTest#testGetInputStream",
- "tests.api.internal.net.www.protocol.file.FileURLConnectionTest#testHeaderFunctions",
- "tests.api.internal.net.www.protocol.file.FileURLConnectionTest#testHeader_BoundaryCheck"
- ]
-},
-{
description: "Known failure in GregorianCalendarTest",
bug: 12778197,
name: "org.apache.harmony.tests.java.util.GregorianCalendarTest#test_computeTime"
},
{
- description: "Environment specific Console test suppressed for dory / molly",
- bug: 12491103,
- name: "org.apache.harmony.tests.java.io.ConsoleTest#test_readPassword_LString_LObject"
-},
-{
- description: "Suppression of a test that proves there is a known bug with Matcher",
- bug: 14865710,
- name: "org.apache.harmony.tests.java.util.ScannerParseLargeFileBenchmarkTest#testParseLargeFile"
+ description: "Failures in external/okhttp tests on Android. Some are flakes. To be investigated",
+ bug: 14462336,
+ names: [
+ "com.squareup.okhttp.internal.http.HttpOverHttp20Draft09Test#acceptAndTransmitCookies",
+ "com.squareup.okhttp.internal.http.HttpOverHttp20Draft09Test#authenticate",
+ "com.squareup.okhttp.internal.http.HttpOverHttp20Draft09Test#conditionalCache",
+ "com.squareup.okhttp.internal.http.HttpOverHttp20Draft09Test#get",
+ "com.squareup.okhttp.internal.http.HttpOverHttp20Draft09Test#noDefaultContentLengthOnPost",
+ "com.squareup.okhttp.internal.http.HttpOverHttp20Draft09Test#readResponseHeaderTimeout",
+ "com.squareup.okhttp.internal.http.HttpOverHttp20Draft09Test#readTimeoutOnSlowConnection",
+ "com.squareup.okhttp.internal.http.HttpOverHttp20Draft09Test#responseCachedWithoutConsumingFullBody",
+ "com.squareup.okhttp.internal.http.HttpOverHttp20Draft09Test#responsesAreCached",
+ "com.squareup.okhttp.internal.http.HttpOverHttp20Draft09Test#serverSendsPushPromise_GET",
+ "com.squareup.okhttp.internal.http.HttpOverHttp20Draft09Test#serverSendsPushPromise_HEAD",
+ "com.squareup.okhttp.internal.http.HttpOverHttp20Draft09Test#synchronousSpdyRequest",
+ "com.squareup.okhttp.internal.http.HttpResponseCacheTest#setIfModifiedSince",
+ "com.squareup.okhttp.internal.http.URLConnectionTest#sslFallbackNotUsedWhenRecycledConnectionFails",
+ "com.squareup.okhttp.internal.spdy.SpdyConnectionTest#initialSettingsWithWindowSizeAdjustsConnection",
+ "com.squareup.okhttp.internal.spdy.SpdyConnectionTest#pushPromiseStream",
+ "com.squareup.okhttp.internal.spdy.SpdyConnectionTest#replyWithNoData",
+ "com.squareup.okhttp.internal.spdy.SpdyConnectionTest#serverClosesClientInputStream"
+ ]
}
]
diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/java/net/InetAddressTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/java/net/InetAddressTest.java
index a029a51..959f83c 100644
--- a/harmony-tests/src/test/java/org/apache/harmony/tests/java/net/InetAddressTest.java
+++ b/harmony-tests/src/test/java/org/apache/harmony/tests/java/net/InetAddressTest.java
@@ -349,9 +349,8 @@
} catch (IllegalArgumentException e) {
// correct
}
- // tests unreachable address. 192.0.2.1 is reserved by RFC 5737
- // and should not be used outside of example code / docs.
- ia = Inet4Address.getByName("192.0.2.1");
+ // tests nowhere
+ ia = Inet4Address.getByName("1.1.1.1");
assertFalse(ia.isReachable(1000));
assertFalse(ia.isReachable(null, 0, 1000));
diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/jar/JarFileTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/jar/JarFileTest.java
index 740340e..d5d8191 100644
--- a/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/jar/JarFileTest.java
+++ b/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/jar/JarFileTest.java
@@ -23,6 +23,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
+import java.security.CodeSigner;
import java.security.Permission;
import java.security.cert.Certificate;
import java.security.cert.X509Certificate;
@@ -98,6 +99,8 @@
private static final String INVALID_CHAIN_JAR = "hyts_signed_invalidChain.jar";
+ private static final String AMBIGUOUS_SIGNERS_JAR = "hyts_signed_ambiguousSignerArray.jar";
+
private File resources;
// custom security manager
@@ -647,13 +650,18 @@
+ jarName + "\"", foundCerts);
}
- private Certificate[] getSignedJarCerts(String jarName, boolean chainCheck) throws Exception {
+ private static class Results {
+ public Certificate[] certificates;
+ public CodeSigner[] signers;
+ }
+
+ private Results getSignedJarCerts(String jarName) throws Exception {
Support_Resources.copyFile(resources, null, jarName);
File file = new File(resources, jarName);
- Certificate[] foundCerts = null;
+ Results results = new Results();
- JarFile jarFile = new JarFile(file, true, ZipFile.OPEN_READ, chainCheck);
+ JarFile jarFile = new JarFile(file, true, ZipFile.OPEN_READ);
try {
Enumeration<JarEntry> e = jarFile.entries();
@@ -664,8 +672,10 @@
is.skip(entry.getSize());
is.close();
Certificate[] certs = entry.getCertificates();
+ CodeSigner[] signers = entry.getCodeSigners();
if (certs != null && certs.length > 0) {
- foundCerts = certs;
+ results.certificates = certs;
+ results.signers = signers;
break;
}
}
@@ -673,42 +683,38 @@
jarFile.close();
}
- return foundCerts;
+ return results;
}
- public void testJarFile_Signed_ValidChain_NoCheck() throws Exception {
- Certificate[] certs = getSignedJarCerts(VALID_CHAIN_JAR, false);
- assertNotNull(certs);
- assertEquals(Arrays.deepToString(certs), 3, certs.length);
- assertEquals("CN=fake-chain", ((X509Certificate) certs[0]).getSubjectDN().toString());
- assertEquals("CN=intermediate1", ((X509Certificate) certs[1]).getSubjectDN().toString());
- assertEquals("CN=root1", ((X509Certificate) certs[2]).getSubjectDN().toString());
+ public void testJarFile_Signed_ValidChain() throws Exception {
+ Results result = getSignedJarCerts(VALID_CHAIN_JAR);
+ assertNotNull(result);
+ assertEquals(Arrays.deepToString(result.certificates), 3, result.certificates.length);
+ assertEquals(Arrays.deepToString(result.signers), 1, result.signers.length);
+ assertEquals(3, result.signers[0].getSignerCertPath().getCertificates().size());
+ assertEquals("CN=fake-chain", ((X509Certificate) result.certificates[0]).getSubjectDN().toString());
+ assertEquals("CN=intermediate1", ((X509Certificate) result.certificates[1]).getSubjectDN().toString());
+ assertEquals("CN=root1", ((X509Certificate) result.certificates[2]).getSubjectDN().toString());
}
- public void testJarFile_Signed_ValidChain_Check() throws Exception {
- Certificate[] certs = getSignedJarCerts(VALID_CHAIN_JAR, true);
- assertNotNull(certs);
- assertEquals(Arrays.deepToString(certs), 3, certs.length);
- assertEquals("CN=fake-chain", ((X509Certificate) certs[0]).getSubjectDN().toString());
- assertEquals("CN=intermediate1", ((X509Certificate) certs[1]).getSubjectDN().toString());
- assertEquals("CN=root1", ((X509Certificate) certs[2]).getSubjectDN().toString());
+ public void testJarFile_Signed_InvalidChain() throws Exception {
+ Results result = getSignedJarCerts(INVALID_CHAIN_JAR);
+ assertNotNull(result);
+ assertEquals(Arrays.deepToString(result.certificates), 3, result.certificates.length);
+ assertEquals(Arrays.deepToString(result.signers), 1, result.signers.length);
+ assertEquals(3, result.signers[0].getSignerCertPath().getCertificates().size());
+ assertEquals("CN=fake-chain", ((X509Certificate) result.certificates[0]).getSubjectDN().toString());
+ assertEquals("CN=intermediate1", ((X509Certificate) result.certificates[1]).getSubjectDN().toString());
+ assertEquals("CN=root1", ((X509Certificate) result.certificates[2]).getSubjectDN().toString());
}
- public void testJarFile_Signed_InvalidChain_NoCheck() throws Exception {
- Certificate[] certs = getSignedJarCerts(INVALID_CHAIN_JAR, false);
- assertNotNull(certs);
- assertEquals(Arrays.deepToString(certs), 3, certs.length);
- assertEquals("CN=fake-chain", ((X509Certificate) certs[0]).getSubjectDN().toString());
- assertEquals("CN=intermediate1", ((X509Certificate) certs[1]).getSubjectDN().toString());
- assertEquals("CN=root1", ((X509Certificate) certs[2]).getSubjectDN().toString());
- }
-
- public void testJarFile_Signed_InvalidChain_Check() throws Exception {
- Certificate[] certs = getSignedJarCerts(INVALID_CHAIN_JAR, true);
- assertNotNull(certs);
- assertEquals(Arrays.deepToString(certs), 2, certs.length);
- assertEquals("CN=fake-chain", ((X509Certificate) certs[0]).getSubjectDN().toString());
- assertEquals("CN=intermediate1", ((X509Certificate) certs[1]).getSubjectDN().toString());
+ public void testJarFile_Signed_AmbiguousSigners() throws Exception {
+ Results result = getSignedJarCerts(AMBIGUOUS_SIGNERS_JAR);
+ assertNotNull(result);
+ assertEquals(Arrays.deepToString(result.certificates), 2, result.certificates.length);
+ assertEquals(Arrays.deepToString(result.signers), 2, result.signers.length);
+ assertEquals(1, result.signers[0].getSignerCertPath().getCertificates().size());
+ assertEquals(1, result.signers[1].getSignerCertPath().getCertificates().size());
}
/*
diff --git a/luni/src/main/java/android/system/ErrnoException.java b/luni/src/main/java/android/system/ErrnoException.java
index 134d6a0..90155c8 100644
--- a/luni/src/main/java/android/system/ErrnoException.java
+++ b/luni/src/main/java/android/system/ErrnoException.java
@@ -24,8 +24,6 @@
* A checked exception thrown when {@link Os} methods fail. This exception contains the native
* errno value, for comparison against the constants in {@link OsConstants}, should sophisticated
* callers need to adjust their behavior based on the exact failure.
- *
- * @hide
*/
public final class ErrnoException extends Exception {
private final String functionName;
diff --git a/luni/src/main/java/android/system/Os.java b/luni/src/main/java/android/system/Os.java
index e7613df..0b80b52 100644
--- a/luni/src/main/java/android/system/Os.java
+++ b/luni/src/main/java/android/system/Os.java
@@ -47,8 +47,6 @@
* primitives used to implement the higher-level APIs.
*
* <p>The corresponding constants can be found in {@link OsConstants}.
- *
- * @hide
*/
public final class Os {
private Os() {}
@@ -63,6 +61,8 @@
*/
public static boolean access(String path, int mode) throws ErrnoException { return Libcore.os.access(path, mode); }
+ /** @hide */ public static InetAddress[] android_getaddrinfo(String node, StructAddrinfo hints, int netId) throws GaiException { return Libcore.os.android_getaddrinfo(node, hints, netId); }
+
/**
* See <a href="http://man7.org/linux/man-pages/man2/bind.2.html">bind(2)</a>.
*/
@@ -157,8 +157,6 @@
*/
public static String gai_strerror(int error) { return Libcore.os.gai_strerror(error); }
- /** @hide */ public static InetAddress[] getaddrinfo(String node, StructAddrinfo hints) throws GaiException { return Libcore.os.getaddrinfo(node, hints); }
-
/**
* See <a href="http://man7.org/linux/man-pages/man2/getegid.2.html">getegid(2)</a>.
*/
diff --git a/luni/src/main/java/android/system/OsConstants.java b/luni/src/main/java/android/system/OsConstants.java
index cfed2f6..4166325 100644
--- a/luni/src/main/java/android/system/OsConstants.java
+++ b/luni/src/main/java/android/system/OsConstants.java
@@ -18,7 +18,6 @@
/**
* Constants and helper functions for use with {@link Os}.
- * @hide
*/
public final class OsConstants {
private OsConstants() {
diff --git a/luni/src/main/java/android/system/StructPollfd.java b/luni/src/main/java/android/system/StructPollfd.java
index 8bdecb2..b812612 100644
--- a/luni/src/main/java/android/system/StructPollfd.java
+++ b/luni/src/main/java/android/system/StructPollfd.java
@@ -22,8 +22,6 @@
/**
* Used as an in/out parameter to {@link Os#poll}.
* Corresponds to C's {@code struct pollfd} from {@code <poll.h>}.
- *
- * @hide
*/
public final class StructPollfd {
/** The file descriptor to poll. */
diff --git a/luni/src/main/java/android/system/StructStat.java b/luni/src/main/java/android/system/StructStat.java
index 87bd50c..a6958c1 100644
--- a/luni/src/main/java/android/system/StructStat.java
+++ b/luni/src/main/java/android/system/StructStat.java
@@ -21,8 +21,6 @@
/**
* File information returned by {@link Os#fstat}, {@link Os#lstat}, and {@link Os#stat}.
* Corresponds to C's {@code struct stat} from {@code <stat.h>}.
- *
- * @hide
*/
public final class StructStat {
/** Device ID of device containing file. */
diff --git a/luni/src/main/java/android/system/StructStatVfs.java b/luni/src/main/java/android/system/StructStatVfs.java
index b0b7802..942a39a 100644
--- a/luni/src/main/java/android/system/StructStatVfs.java
+++ b/luni/src/main/java/android/system/StructStatVfs.java
@@ -20,8 +20,6 @@
/**
* File information returned by {@link Os#fstatvfs} and {@link Os#statvfs}.
- *
- * @hide
*/
public final class StructStatVfs {
/** File system block size (used for block counts). */
diff --git a/luni/src/main/java/android/system/StructUtsname.java b/luni/src/main/java/android/system/StructUtsname.java
index c62dbfa..5d9127b 100644
--- a/luni/src/main/java/android/system/StructUtsname.java
+++ b/luni/src/main/java/android/system/StructUtsname.java
@@ -21,8 +21,6 @@
/**
* Information returned by {@link Os#uname}.
* Corresponds to C's {@code struct utsname} from {@code <sys/utsname.h>}.
- *
- * @hide
*/
public final class StructUtsname {
/** The OS name, such as "Linux". */
diff --git a/luni/src/main/java/android/util/MutableBoolean.java b/luni/src/main/java/android/util/MutableBoolean.java
index 90bf68c..5a8a200 100644
--- a/luni/src/main/java/android/util/MutableBoolean.java
+++ b/luni/src/main/java/android/util/MutableBoolean.java
@@ -17,7 +17,6 @@
package android.util;
/**
- * @hide
*/
public final class MutableBoolean {
public boolean value;
diff --git a/luni/src/main/java/android/util/MutableByte.java b/luni/src/main/java/android/util/MutableByte.java
index 65738b9..7397ba4 100644
--- a/luni/src/main/java/android/util/MutableByte.java
+++ b/luni/src/main/java/android/util/MutableByte.java
@@ -17,7 +17,6 @@
package android.util;
/**
- * @hide
*/
public final class MutableByte {
public byte value;
diff --git a/luni/src/main/java/android/util/MutableChar.java b/luni/src/main/java/android/util/MutableChar.java
index b59bab3..f435331 100644
--- a/luni/src/main/java/android/util/MutableChar.java
+++ b/luni/src/main/java/android/util/MutableChar.java
@@ -17,7 +17,6 @@
package android.util;
/**
- * @hide
*/
public final class MutableChar {
public char value;
diff --git a/luni/src/main/java/android/util/MutableDouble.java b/luni/src/main/java/android/util/MutableDouble.java
index 3e2cc3a..f62f47e 100644
--- a/luni/src/main/java/android/util/MutableDouble.java
+++ b/luni/src/main/java/android/util/MutableDouble.java
@@ -17,7 +17,6 @@
package android.util;
/**
- * @hide
*/
public final class MutableDouble {
public double value;
diff --git a/luni/src/main/java/android/util/MutableFloat.java b/luni/src/main/java/android/util/MutableFloat.java
index 6e30501..6b5441c 100644
--- a/luni/src/main/java/android/util/MutableFloat.java
+++ b/luni/src/main/java/android/util/MutableFloat.java
@@ -17,7 +17,6 @@
package android.util;
/**
- * @hide
*/
public final class MutableFloat {
public float value;
diff --git a/luni/src/main/java/android/util/MutableInt.java b/luni/src/main/java/android/util/MutableInt.java
index 8220c44..2f93030 100644
--- a/luni/src/main/java/android/util/MutableInt.java
+++ b/luni/src/main/java/android/util/MutableInt.java
@@ -17,7 +17,6 @@
package android.util;
/**
- * @hide
*/
public final class MutableInt {
public int value;
diff --git a/luni/src/main/java/android/util/MutableLong.java b/luni/src/main/java/android/util/MutableLong.java
index 5df6a0d..94beab5 100644
--- a/luni/src/main/java/android/util/MutableLong.java
+++ b/luni/src/main/java/android/util/MutableLong.java
@@ -17,7 +17,6 @@
package android.util;
/**
- * @hide
*/
public final class MutableLong {
public long value;
diff --git a/luni/src/main/java/android/util/MutableShort.java b/luni/src/main/java/android/util/MutableShort.java
index 3880fef..cdd9923 100644
--- a/luni/src/main/java/android/util/MutableShort.java
+++ b/luni/src/main/java/android/util/MutableShort.java
@@ -17,7 +17,6 @@
package android.util;
/**
- * @hide
*/
public final class MutableShort {
public short value;
diff --git a/luni/src/main/java/java/lang/Character.java b/luni/src/main/java/java/lang/Character.java
index 2bf3a89..59931f6 100644
--- a/luni/src/main/java/java/lang/Character.java
+++ b/luni/src/main/java/java/lang/Character.java
@@ -1535,7 +1535,6 @@
* don't have a corresponding {@code UnicodeScript} will be in {@code UNKNOWN}.
*
* @since 1.7
- * @hide
*/
public static enum UnicodeScript {
/** ISO 15924 English name "Arabic" */
diff --git a/luni/src/main/java/java/lang/System.java b/luni/src/main/java/java/lang/System.java
index 6fc35da..185701e 100644
--- a/luni/src/main/java/java/lang/System.java
+++ b/luni/src/main/java/java/lang/System.java
@@ -356,11 +356,6 @@
}
p.put("java.home", javaHome);
- String ldLibraryPath = getenv("LD_LIBRARY_PATH");
- if (ldLibraryPath != null) {
- p.put("java.library.path", ldLibraryPath);
- }
-
p.put("java.specification.name", "Dalvik Core Library");
p.put("java.specification.vendor", projectName);
p.put("java.specification.version", "0.9");
diff --git a/luni/src/main/java/java/net/AddressCache.java b/luni/src/main/java/java/net/AddressCache.java
index 194761a..2aba78b 100644
--- a/luni/src/main/java/java/net/AddressCache.java
+++ b/luni/src/main/java/java/net/AddressCache.java
@@ -37,8 +37,36 @@
private static final long TTL_NANOS = 2 * 1000000000L;
// The actual cache.
- private final BasicLruCache<String, AddressCacheEntry> cache
- = new BasicLruCache<String, AddressCacheEntry>(MAX_ENTRIES);
+ private final BasicLruCache<AddressCacheKey, AddressCacheEntry> cache
+ = new BasicLruCache<AddressCacheKey, AddressCacheEntry>(MAX_ENTRIES);
+
+ static class AddressCacheKey {
+ private final String mHostname;
+ private final int mNetId;
+
+ AddressCacheKey(String hostname, int netId) {
+ mHostname = hostname;
+ mNetId = netId;
+ }
+
+ @Override public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (!(o instanceof AddressCacheKey)) {
+ return false;
+ }
+ AddressCacheKey lhs = (AddressCacheKey) o;
+ return mHostname.equals(lhs.mHostname) && mNetId == lhs.mNetId;
+ }
+
+ @Override public int hashCode() {
+ int result = 17;
+ result = 31 * result + mNetId;
+ result = 31 * result + mHostname.hashCode();
+ return result;
+ }
+ }
static class AddressCacheEntry {
// Either an InetAddress[] for a positive entry,
@@ -67,12 +95,12 @@
}
/**
- * Returns the cached InetAddress[] associated with 'hostname'. Returns null if nothing is known
- * about 'hostname'. Returns a String suitable for use as an UnknownHostException detail
- * message if 'hostname' is known not to exist.
+ * Returns the cached InetAddress[] for 'hostname' on network 'netId'. Returns null
+ * if nothing is known about 'hostname'. Returns a String suitable for use as an
+ * UnknownHostException detail message if 'hostname' is known not to exist.
*/
- public Object get(String hostname) {
- AddressCacheEntry entry = cache.get(hostname);
+ public Object get(String hostname, int netId) {
+ AddressCacheEntry entry = cache.get(new AddressCacheKey(hostname, netId));
// Do we have a valid cache entry?
if (entry != null && entry.expiryNanos >= System.nanoTime()) {
return entry.value;
@@ -86,15 +114,15 @@
* Associates the given 'addresses' with 'hostname'. The association will expire after a
* certain length of time.
*/
- public void put(String hostname, InetAddress[] addresses) {
- cache.put(hostname, new AddressCacheEntry(addresses));
+ public void put(String hostname, int netId, InetAddress[] addresses) {
+ cache.put(new AddressCacheKey(hostname, netId), new AddressCacheEntry(addresses));
}
/**
* Records that 'hostname' is known not to have any associated addresses. (I.e. insert a
* negative cache entry.)
*/
- public void putUnknownHost(String hostname, String detailMessage) {
- cache.put(hostname, new AddressCacheEntry(detailMessage));
+ public void putUnknownHost(String hostname, int netId, String detailMessage) {
+ cache.put(new AddressCacheKey(hostname, netId), new AddressCacheEntry(detailMessage));
}
}
diff --git a/luni/src/main/java/java/net/HttpCookie.java b/luni/src/main/java/java/net/HttpCookie.java
index 04121f7..1d8a8cc 100644
--- a/luni/src/main/java/java/net/HttpCookie.java
+++ b/luni/src/main/java/java/net/HttpCookie.java
@@ -564,7 +564,6 @@
* to scripts in a browser.
*
* @since 1.7
- * @hide Until ready for an API update
*/
public boolean isHttpOnly() {
return httpOnly;
@@ -575,7 +574,6 @@
* to scripts in a browser.
*
* @since 1.7
- * @hide Until ready for an API update
*/
public void setHttpOnly(boolean httpOnly) {
this.httpOnly = httpOnly;
diff --git a/luni/src/main/java/java/net/InetAddress.java b/luni/src/main/java/java/net/InetAddress.java
index e31b4c3..5cfa15a 100644
--- a/luni/src/main/java/java/net/InetAddress.java
+++ b/luni/src/main/java/java/net/InetAddress.java
@@ -127,6 +127,9 @@
private static final long serialVersionUID = 3286316764910316507L;
+ /** Using NetID of NETID_UNSET indicates resolution should be done on default network. */
+ private static final int NETID_UNSET = 0;
+
private int family;
byte[] ipaddress;
@@ -209,14 +212,29 @@
* @throws UnknownHostException if the address lookup fails.
*/
public static InetAddress[] getAllByName(String host) throws UnknownHostException {
- return getAllByNameImpl(host).clone();
+ return getAllByNameImpl(host, NETID_UNSET).clone();
}
/**
- * Returns the InetAddresses for {@code host}. The returned array is shared
- * and must be cloned before it is returned to application code.
+ * Operates identically to {@code getAllByName} except host resolution is
+ * performed on the network designated by {@code netId}.
+ *
+ * @param host the hostname or literal IP string to be resolved.
+ * @param netId the network to use for host resolution.
+ * @return the array of addresses associated with the specified host.
+ * @throws UnknownHostException if the address lookup fails.
+ * @hide internal use only
*/
- private static InetAddress[] getAllByNameImpl(String host) throws UnknownHostException {
+ public static InetAddress[] getAllByNameOnNet(String host, int netId) throws UnknownHostException {
+ return getAllByNameImpl(host, netId).clone();
+ }
+
+ /**
+ * Returns the InetAddresses for {@code host} on network {@code netId}. The
+ * returned array is shared and must be cloned before it is returned to
+ * application code.
+ */
+ private static InetAddress[] getAllByNameImpl(String host, int netId) throws UnknownHostException {
if (host == null || host.isEmpty()) {
return loopbackAddresses();
}
@@ -231,7 +249,7 @@
return new InetAddress[] { result };
}
- return lookupHostByName(host).clone();
+ return lookupHostByName(host, netId).clone();
}
private static InetAddress makeInetAddress(byte[] bytes, String hostName) throws UnknownHostException {
@@ -264,7 +282,7 @@
hints.ai_flags = AI_NUMERICHOST;
InetAddress[] addresses = null;
try {
- addresses = Libcore.os.getaddrinfo(address, hints);
+ addresses = Libcore.os.android_getaddrinfo(address, hints, NETID_UNSET);
} catch (GaiException ignored) {
}
return (addresses != null) ? addresses[0] : null;
@@ -284,7 +302,22 @@
* if the address lookup fails.
*/
public static InetAddress getByName(String host) throws UnknownHostException {
- return getAllByNameImpl(host)[0];
+ return getAllByNameImpl(host, NETID_UNSET)[0];
+ }
+
+ /**
+ * Operates identically to {@code getByName} except host resolution is
+ * performed on the network designated by {@code netId}.
+ *
+ * @param host
+ * the hostName to be resolved to an address or {@code null}.
+ * @param netId the network to use for host resolution.
+ * @return the {@code InetAddress} instance representing the host.
+ * @throws UnknownHostException if the address lookup fails.
+ * @hide internal use only
+ */
+ public static InetAddress getByNameOnNet(String host, int netId) throws UnknownHostException {
+ return getAllByNameImpl(host, netId)[0];
}
/**
@@ -360,7 +393,7 @@
*/
public static InetAddress getLocalHost() throws UnknownHostException {
String host = Libcore.os.uname().nodename;
- return lookupHostByName(host)[0];
+ return lookupHostByName(host, NETID_UNSET)[0];
}
/**
@@ -377,12 +410,14 @@
* Resolves a hostname to its IP addresses using a cache.
*
* @param host the hostname to resolve.
+ * @param netId the network to perform resolution upon.
* @return the IP addresses of the host.
*/
- private static InetAddress[] lookupHostByName(String host) throws UnknownHostException {
+ private static InetAddress[] lookupHostByName(String host, int netId)
+ throws UnknownHostException {
BlockGuard.getThreadPolicy().onNetwork();
// Do we have a result cached?
- Object cachedResult = addressCache.get(host);
+ Object cachedResult = addressCache.get(host, netId);
if (cachedResult != null) {
if (cachedResult instanceof InetAddress[]) {
// A cached positive result.
@@ -400,12 +435,12 @@
// for SOCK_STREAM and one for SOCK_DGRAM. Since we do not return the family
// anyway, just pick one.
hints.ai_socktype = SOCK_STREAM;
- InetAddress[] addresses = Libcore.os.getaddrinfo(host, hints);
+ InetAddress[] addresses = Libcore.os.android_getaddrinfo(host, hints, netId);
// TODO: should getaddrinfo set the hostname of the InetAddresses it returns?
for (InetAddress address : addresses) {
address.hostName = host;
}
- addressCache.put(host, addresses);
+ addressCache.put(host, netId, addresses);
return addresses;
} catch (GaiException gaiException) {
// If the failure appears to have been a lack of INTERNET permission, throw a clear
@@ -418,7 +453,7 @@
}
// Otherwise, throw an UnknownHostException.
String detailMessage = "Unable to resolve host \"" + host + "\": " + Libcore.os.gai_strerror(gaiException.error);
- addressCache.putUnknownHost(host, detailMessage);
+ addressCache.putUnknownHost(host, netId, detailMessage);
throw gaiException.rethrowAsUnknownHostException(detailMessage);
}
}
diff --git a/luni/src/main/java/java/net/SocketOption.java b/luni/src/main/java/java/net/SocketOption.java
index 3f65494..bc3e101 100644
--- a/luni/src/main/java/java/net/SocketOption.java
+++ b/luni/src/main/java/java/net/SocketOption.java
@@ -27,7 +27,6 @@
*
* @param <T> the type of the value
* @since 1.7
- * @hide Until ready for a public API change
*/
public interface SocketOption<T> {
diff --git a/luni/src/main/java/java/net/StandardSocketOptions.java b/luni/src/main/java/java/net/StandardSocketOptions.java
index 3d10caf..a793f66 100644
--- a/luni/src/main/java/java/net/StandardSocketOptions.java
+++ b/luni/src/main/java/java/net/StandardSocketOptions.java
@@ -32,7 +32,6 @@
* for each type of socket.
*
* @since 1.7
- * @hide Until ready for a public API change
*/
public final class StandardSocketOptions {
diff --git a/luni/src/main/java/java/net/URLConnection.java b/luni/src/main/java/java/net/URLConnection.java
index cc7de90..d24e273 100644
--- a/luni/src/main/java/java/net/URLConnection.java
+++ b/luni/src/main/java/java/net/URLConnection.java
@@ -320,7 +320,6 @@
* {@code content-length} or {@code -1} if this field is not set.
*
* @since 1.7
- * @hide Until ready for a public API change
*/
public long getContentLengthLong() {
return getHeaderFieldLong("Content-Length", -1);
@@ -568,7 +567,6 @@
* the default value if no field has been found.
* @return the value of the specified header field as a number.
* @since 1.7
- * @hide Until ready for a public API change
*/
public long getHeaderFieldLong(String field, long defaultValue) {
try {
diff --git a/luni/src/main/java/java/nio/DatagramChannelImpl.java b/luni/src/main/java/java/nio/DatagramChannelImpl.java
index 8a5dbb6..343ef00 100644
--- a/luni/src/main/java/java/nio/DatagramChannelImpl.java
+++ b/luni/src/main/java/java/nio/DatagramChannelImpl.java
@@ -112,7 +112,6 @@
return socket;
}
- /** @hide Until ready for a public API change */
@Override
synchronized public DatagramChannel bind(SocketAddress local) throws IOException {
checkOpen();
@@ -160,21 +159,18 @@
}
}
- /** @hide Until ready for a public API change */
@Override
synchronized public SocketAddress getLocalAddress() throws IOException {
checkOpen();
return isBound ? new InetSocketAddress(localAddress, localPort) : null;
}
- /** @hide Until ready for a public API change */
@Override
public <T> T getOption(SocketOption<T> option) throws IOException {
return NioUtils.getSocketOption(
this, StandardSocketOptions.DATAGRAM_SOCKET_OPTIONS, option);
}
- /** @hide Until ready for a public API change */
@Override
public <T> DatagramChannel setOption(SocketOption<T> option, T value) throws IOException {
checkOpen();
@@ -183,7 +179,6 @@
return this;
}
- /** @hide Until ready for a public API change */
@Override
public Set<SocketOption<?>> supportedOptions() {
return StandardSocketOptions.DATAGRAM_SOCKET_OPTIONS;
diff --git a/luni/src/main/java/java/nio/ServerSocketChannelImpl.java b/luni/src/main/java/java/nio/ServerSocketChannelImpl.java
index d2cbf36..1b84797 100644
--- a/luni/src/main/java/java/nio/ServerSocketChannelImpl.java
+++ b/luni/src/main/java/java/nio/ServerSocketChannelImpl.java
@@ -58,7 +58,6 @@
return socket;
}
- /** @hide Until ready for a public API change */
@Override
public final ServerSocketChannel bind(SocketAddress localAddr, int backlog) throws IOException {
if (!isOpen()) {
@@ -81,7 +80,6 @@
return this;
}
- /** @hide Until ready for a public API change */
@Override
public SocketAddress getLocalAddress() throws IOException {
if (!isOpen()) {
@@ -90,20 +88,17 @@
return socket.getLocalSocketAddress();
}
- /** @hide Until ready for a public API change */
@Override
public <T> T getOption(SocketOption<T> option) throws IOException {
return NioUtils.getSocketOption(this, StandardSocketOptions.SERVER_SOCKET_OPTIONS, option);
}
- /** @hide Until ready for a public API change */
@Override
public <T> ServerSocketChannel setOption(SocketOption<T> option, T value) throws IOException {
NioUtils.setSocketOption(this, StandardSocketOptions.SERVER_SOCKET_OPTIONS, option, value);
return this;
}
- /** @hide Until ready for a public API change */
@Override
public Set<SocketOption<?>> supportedOptions() {
return StandardSocketOptions.SERVER_SOCKET_OPTIONS;
diff --git a/luni/src/main/java/java/nio/SocketChannelImpl.java b/luni/src/main/java/java/nio/SocketChannelImpl.java
index 7c3cd78..9064f29 100644
--- a/luni/src/main/java/java/nio/SocketChannelImpl.java
+++ b/luni/src/main/java/java/nio/SocketChannelImpl.java
@@ -139,7 +139,6 @@
return socket;
}
- /** @hide Until ready for a public API change */
@Override
synchronized public final SocketChannel bind(SocketAddress local) throws IOException {
if (!isOpen()) {
@@ -189,7 +188,6 @@
}
}
- /** @hide Until ready for a public API change */
@Override
synchronized public SocketAddress getLocalAddress() throws IOException {
if (!isOpen()) {
@@ -198,20 +196,17 @@
return isBound ? new InetSocketAddress(localAddress, localPort) : null;
}
- /** @hide Until ready for a public API change */
@Override
public <T> T getOption(SocketOption<T> option) throws IOException {
return NioUtils.getSocketOption(this, StandardSocketOptions.SOCKET_OPTIONS, option);
}
- /** @hide Until ready for a public API change */
@Override
public <T> SocketChannel setOption(SocketOption<T> option, T value) throws IOException {
NioUtils.setSocketOption(this, StandardSocketOptions.SOCKET_OPTIONS, option, value);
return this;
}
- /** @hide Until ready for a public API change */
@Override
public Set<SocketOption<?>> supportedOptions() {
return StandardSocketOptions.SOCKET_OPTIONS;
diff --git a/luni/src/main/java/java/nio/channels/AlreadyBoundException.java b/luni/src/main/java/java/nio/channels/AlreadyBoundException.java
index 0a35fc3..70c70ac 100644
--- a/luni/src/main/java/java/nio/channels/AlreadyBoundException.java
+++ b/luni/src/main/java/java/nio/channels/AlreadyBoundException.java
@@ -19,8 +19,6 @@
/**
* An {@code AlreadyBoundException} is thrown when an attempt is made to bind a NetworkChannel that
* is already bound.
- *
- * @hide Until ready for a public API change
*/
public class AlreadyBoundException extends IllegalStateException {
diff --git a/luni/src/main/java/java/nio/channels/DatagramChannel.java b/luni/src/main/java/java/nio/channels/DatagramChannel.java
index 3a5d1cc..b0cc2ac 100644
--- a/luni/src/main/java/java/nio/channels/DatagramChannel.java
+++ b/luni/src/main/java/java/nio/channels/DatagramChannel.java
@@ -92,7 +92,6 @@
*/
public abstract DatagramSocket socket();
- /** @hide Until ready for a public API change */
@Override
public DatagramChannel bind(SocketAddress local) throws IOException {
// This method was added for interoperability with Java 7, where it is abstract. It is
@@ -100,7 +99,6 @@
throw new UnsupportedOperationException("Subclasses must override this method");
}
- /** @hide Until ready for a public API change */
@Override
public SocketAddress getLocalAddress() throws IOException {
// This method was added for interoperability with Java 7, where it is abstract. It is
@@ -108,7 +106,6 @@
throw new UnsupportedOperationException("Subclasses must override this method");
}
- /** @hide Until ready for a public API change */
@Override
public <T> T getOption(SocketOption<T> option) throws IOException {
// This method was added for interoperability with Java 7, where it is abstract. It is
@@ -116,7 +113,6 @@
throw new UnsupportedOperationException("Subclasses must override this method");
}
- /** @hide Until ready for a public API change */
@Override
public <T> DatagramChannel setOption(SocketOption<T> option, T value) throws IOException {
// This method was added for interoperability with Java 7, where it is abstract. It is
@@ -124,7 +120,6 @@
throw new UnsupportedOperationException("Subclasses must override this method");
}
- /** @hide Until ready for a public API change */
@Override
public Set<SocketOption<?>> supportedOptions() {
// This method was added for interoperability with Java 7, where it is abstract. It is
@@ -132,7 +127,6 @@
throw new UnsupportedOperationException("Subclasses must override this method");
}
- /** @hide Until ready for a public API change */
@Override
public MembershipKey join(InetAddress groupAddress, NetworkInterface networkInterface)
throws IOException {
@@ -141,7 +135,6 @@
throw new UnsupportedOperationException("Subclasses must override this method");
}
- /** @hide Until ready for a public API change */
@Override
public MembershipKey join(InetAddress groupAddress, NetworkInterface networkInterface,
InetAddress sourceAddress) throws IOException {
diff --git a/luni/src/main/java/java/nio/channels/FileChannel.java b/luni/src/main/java/java/nio/channels/FileChannel.java
index e5f2862c..3989167 100644
--- a/luni/src/main/java/java/nio/channels/FileChannel.java
+++ b/luni/src/main/java/java/nio/channels/FileChannel.java
@@ -76,9 +76,8 @@
* stream and vice versa; this includes modifications to the file position,
* content, size, etc.
*/
-// TODO: Remove ByteChannel when SeekableByteChannel is unhidden.
public abstract class FileChannel extends AbstractInterruptibleChannel
- implements GatheringByteChannel, ScatteringByteChannel, ByteChannel, SeekableByteChannel {
+ implements GatheringByteChannel, ScatteringByteChannel, SeekableByteChannel {
/**
* {@code MapMode} defines file mapping mode constants.
diff --git a/luni/src/main/java/java/nio/channels/FileLock.java b/luni/src/main/java/java/nio/channels/FileLock.java
index 037537c..d1ba872 100644
--- a/luni/src/main/java/java/nio/channels/FileLock.java
+++ b/luni/src/main/java/java/nio/channels/FileLock.java
@@ -107,7 +107,7 @@
}
/**
- * Returns the lock's {@link FileChannel}.
+ * Returns the lock's {@link FileChannel}. This method has been superseded by {@link #acquiredBy()}.
*/
public final FileChannel channel() {
return channel;
@@ -117,9 +117,7 @@
* Returns the {@link Channel} that holds this lock.
*
* @since 1.7
- * @hide Until ready for an API update
*/
- // TODO: unhiding, add to channel(): This method has been superseded by {@link #acquiredBy()}.
public Channel acquiredBy() {
return channel;
}
diff --git a/luni/src/main/java/java/nio/channels/MembershipKey.java b/luni/src/main/java/java/nio/channels/MembershipKey.java
index 18ff92d..a7eecac 100644
--- a/luni/src/main/java/java/nio/channels/MembershipKey.java
+++ b/luni/src/main/java/java/nio/channels/MembershipKey.java
@@ -36,7 +36,6 @@
* Multicast Source Filters</a> for concepts and terminology associated with multicast membership.
*
* @since 1.7
- * @hide Until ready for a public API change
*/
public abstract class MembershipKey {
diff --git a/luni/src/main/java/java/nio/channels/MulticastChannel.java b/luni/src/main/java/java/nio/channels/MulticastChannel.java
index 41ef501..47433d0 100644
--- a/luni/src/main/java/java/nio/channels/MulticastChannel.java
+++ b/luni/src/main/java/java/nio/channels/MulticastChannel.java
@@ -69,17 +69,15 @@
* information.
*
* @since 1.7
- * @hide Until ready for a public API change
*/
public interface MulticastChannel extends NetworkChannel {
- // @hide Until ready for a public API change
- // /**
- // * {@inheritDoc}
- // *
- // * If the channel is currently part of one or more multicast groups then the memberships are
- // * dropped and any associated {@code MembershipKey} objects are invalidated.
- // */
+ /**
+ * {@inheritDoc}
+ *
+ * If the channel is currently part of one or more multicast groups then the memberships are
+ * dropped and any associated {@code MembershipKey} objects are invalidated.
+ */
void close() throws IOException;
/**
@@ -112,7 +110,6 @@
* if the channel is closed
* @throws IOException
* if some other I/O error occurs
- * @hide Until ready for a public API change
*/
MembershipKey join(InetAddress groupAddress, NetworkInterface networkInterface)
throws IOException;
@@ -151,7 +148,6 @@
* if the channel is closed
* @throws IOException
* if some other I/O error occurs
- * @hide Until ready for a public API change
*/
MembershipKey join(
InetAddress groupAddress, NetworkInterface networkInterface, InetAddress sourceAddress)
diff --git a/luni/src/main/java/java/nio/channels/NetworkChannel.java b/luni/src/main/java/java/nio/channels/NetworkChannel.java
index 9b46e30..3ae1e6b 100644
--- a/luni/src/main/java/java/nio/channels/NetworkChannel.java
+++ b/luni/src/main/java/java/nio/channels/NetworkChannel.java
@@ -26,7 +26,6 @@
* A common interface for channels that are backed by network sockets.
*
* @since 1.7
- * @hide Until ready for a public API change
*/
public interface NetworkChannel extends AutoCloseable, Channel, Closeable {
@@ -46,7 +45,6 @@
* if the channel is already bound.
* @throws IOException
* if another I/O error occurs.
- * @hide Until ready for a public API change
*/
NetworkChannel bind(SocketAddress local) throws IOException;
@@ -64,7 +62,6 @@
* if the channel is closed.
* @throws IOException
* if another I/O error occurs.
- * @hide Until ready for a public API change
*/
SocketAddress getLocalAddress() throws IOException;
@@ -77,7 +74,6 @@
* if the socket is closed
* @throws IOException
* if the value cannot be read.
- * @hide Until ready for a public API change
* @see java.net.StandardSocketOptions
*/
<T> T getOption(SocketOption<T> option) throws IOException;
@@ -94,15 +90,12 @@
* if the socket is closed
* @throws IOException
* if the value cannot be written.
- * @hide Until ready for a public API change
* @see java.net.StandardSocketOptions
*/
<T> NetworkChannel setOption(SocketOption<T> option, T value) throws IOException;
/**
* Returns the set of socket options supported by this channel.
- *
- * @hide Until ready for a public API change
*/
Set<SocketOption<?>> supportedOptions();
}
diff --git a/luni/src/main/java/java/nio/channels/SeekableByteChannel.java b/luni/src/main/java/java/nio/channels/SeekableByteChannel.java
index f4d6beb..da4671d 100644
--- a/luni/src/main/java/java/nio/channels/SeekableByteChannel.java
+++ b/luni/src/main/java/java/nio/channels/SeekableByteChannel.java
@@ -33,7 +33,6 @@
* {@link #truncate}, {@link #position} and {@link #write} for details. The current size can also
* be queried.
*
- * @hide Until ready for a public API change
* @since 1.7
*/
public interface SeekableByteChannel extends ByteChannel {
diff --git a/luni/src/main/java/java/nio/channels/ServerSocketChannel.java b/luni/src/main/java/java/nio/channels/ServerSocketChannel.java
index c720451..790344b 100644
--- a/luni/src/main/java/java/nio/channels/ServerSocketChannel.java
+++ b/luni/src/main/java/java/nio/channels/ServerSocketChannel.java
@@ -89,7 +89,6 @@
* {@inheritDoc}
*
* <p>This is equivalent to {@code bind(local, 0)}.
- * @hide Until ready for a public API change
*/
@Override
public final ServerSocketChannel bind(SocketAddress local) throws IOException {
@@ -115,7 +114,6 @@
* @throws IOException
* if another I/O error occurs.
* @since 1.7
- * @hide Until ready for a public API change
*/
public ServerSocketChannel bind(SocketAddress localAddr, int backlog) throws IOException {
// This method was added for interoperability with Java 7, where it is abstract. It is
@@ -123,15 +121,13 @@
throw new UnsupportedOperationException("Subclasses must override this method");
}
- /** @hide Until ready for a public API change */
- @Override
+ @Override
public SocketAddress getLocalAddress() throws IOException {
// This method was added for interoperability with Java 7, where it is abstract. It is
// concrete here to avoid breaking existing Android applications that extend this class.
throw new UnsupportedOperationException("Subclasses must override this method");
}
- /** @hide Until ready for a public API change */
@Override
public <T> T getOption(SocketOption<T> option) throws IOException {
// This method was added for interoperability with Java 7, where it is abstract. It is
@@ -139,7 +135,6 @@
throw new UnsupportedOperationException("Subclasses must override this method");
}
- /** @hide Until ready for a public API change */
@Override
public <T> ServerSocketChannel setOption(SocketOption<T> option, T value) throws IOException {
// This method was added for interoperability with Java 7, where it is abstract. It is
@@ -147,7 +142,6 @@
throw new UnsupportedOperationException("Subclasses must override this method");
}
- /** @hide Until ready for a public API change */
@Override
public Set<SocketOption<?>> supportedOptions() {
// This method was added for interoperability with Java 7, where it is abstract. It is
diff --git a/luni/src/main/java/java/nio/channels/SocketChannel.java b/luni/src/main/java/java/nio/channels/SocketChannel.java
index a6d1551..e96c6a1 100644
--- a/luni/src/main/java/java/nio/channels/SocketChannel.java
+++ b/luni/src/main/java/java/nio/channels/SocketChannel.java
@@ -142,7 +142,6 @@
*/
public abstract Socket socket();
- /** @hide Until ready for a public API change */
@Override
public SocketChannel bind(SocketAddress local) throws IOException {
// This method was added for interoperability with Java 7, where it is abstract. It is
@@ -150,7 +149,6 @@
throw new UnsupportedOperationException("Subclasses must override this method");
}
- /** @hide Until ready for a public API change */
@Override
public SocketAddress getLocalAddress() throws IOException {
// This method was added for interoperability with Java 7, where it is abstract. It is
@@ -158,7 +156,6 @@
throw new UnsupportedOperationException("Subclasses must override this method");
}
- /** @hide Until ready for a public API change */
@Override
public <T> T getOption(SocketOption<T> option) throws IOException {
// This method was added for interoperability with Java 7, where it is abstract. It is
@@ -166,7 +163,6 @@
throw new UnsupportedOperationException("Subclasses must override this method");
}
- /** @hide Until ready for a public API change */
@Override
public <T> SocketChannel setOption(SocketOption<T> option, T value) throws IOException {
// This method was added for interoperability with Java 7, where it is abstract. It is
@@ -174,7 +170,6 @@
throw new UnsupportedOperationException("Subclasses must override this method");
}
- /** @hide Until ready for a public API change */
@Override
public Set<SocketOption<?>> supportedOptions() {
// This method was added for interoperability with Java 7, where it is abstract. It is
diff --git a/luni/src/main/java/java/util/Currency.java b/luni/src/main/java/java/util/Currency.java
index e8ecdde..333ebc4 100644
--- a/luni/src/main/java/java/util/Currency.java
+++ b/luni/src/main/java/java/util/Currency.java
@@ -131,7 +131,6 @@
* zero is returned.
*
* @since 1.7
- * @hide Until ready for an API update
*/
public int getNumericCode() {
return ICU.getCurrencyNumericCode(currencyCode);
diff --git a/luni/src/main/java/java/util/IllformedLocaleException.java b/luni/src/main/java/java/util/IllformedLocaleException.java
index db1754e..3dec1cd 100644
--- a/luni/src/main/java/java/util/IllformedLocaleException.java
+++ b/luni/src/main/java/java/util/IllformedLocaleException.java
@@ -21,7 +21,6 @@
*
* See {@link Locale} and {@link Locale.Builder}.
*
- * @hide
* @since 1.7
*/
public class IllformedLocaleException extends RuntimeException {
diff --git a/luni/src/main/java/java/util/Locale.java b/luni/src/main/java/java/util/Locale.java
index 163a627..16d7701 100644
--- a/luni/src/main/java/java/util/Locale.java
+++ b/luni/src/main/java/java/util/Locale.java
@@ -253,7 +253,6 @@
*
* See {@link #getExtension(char)} and {@link Builder#setExtension(char, String)}.
*
- * @hide
* @since 1.7
*/
public static final char PRIVATE_USE_EXTENSION = 'x';
@@ -264,7 +263,6 @@
*
* See {@link #getExtension(char)} and {@link Builder#setExtension(char, String)}.
*
- * @hide
* @since 1.7
*/
public static final char UNICODE_LOCALE_EXTENSION = 'u';
@@ -297,7 +295,6 @@
* the structured state (keywords and attributes) specified therein.
*
* @since 1.7
- * @hide
*/
public static final class Builder {
private String language;
@@ -777,7 +774,6 @@
*
* @throws NullPointerException if {@code languageTag} is {@code null}.
*
- * @hide
* @since 1.7
*/
public static Locale forLanguageTag(String languageTag) {
@@ -1184,7 +1180,6 @@
* If set, the script code will be a title cased string of length 4, as per the ISO 15924
* specification.
*
- * @hide
* @since 1.7
*/
public String getScript() {
@@ -1194,7 +1189,6 @@
/**
* Equivalent to {@code getDisplayScript(Locale.getDefault()))}
*
- * @hide
* @since 1.7
*/
public String getDisplayScript() {
@@ -1206,7 +1200,6 @@
* script code is unknown, the return value of this method is the same as that of
* {@link #getScript()}.
*
- * @hide
* @since 1.7
*/
public String getDisplayScript(Locale locale) {
@@ -1243,7 +1236,6 @@
* For example, we do not require scripts to be a registered ISO 15924 scripts or
* languages to appear in the ISO-639-2 code list.
*
- * @hide
* @since 1.7
*/
public String toLanguageTag() {
@@ -1260,7 +1252,6 @@
* See <a href="https://tools.ietf.org/html/bcp47#section-2.1">
* the IETF BCP-47 specification</a> (Section 2.2.6) for details.
*
- * @hide
* @since 1.7
*/
public Set<Character> getExtensionKeys() {
@@ -1275,7 +1266,6 @@
* locale extension can be fetched using {@link #getUnicodeLocaleAttributes()},
* {@link #getUnicodeLocaleKeys()} and {@link #getUnicodeLocaleType}.
*
- * @hide
* @since 1.7
*/
public String getExtension(char extensionKey) {
@@ -1288,7 +1278,6 @@
* For more information about types and keywords, see {@link Builder#setUnicodeLocaleKeyword}
* and <a href="http://www.unicode.org/reports/tr35/#BCP47">Unicode Technical Standard #35</a>
*
- * @hide
* @since 1.7
*/
public String getUnicodeLocaleType(String keyWord) {
@@ -1301,7 +1290,6 @@
* For more information about attributes, see {@link Builder#addUnicodeLocaleAttribute}
* and <a href="http://www.unicode.org/reports/tr35/#BCP47">Unicode Technical Standard #35</a>
*
- * @hide
* @since 1.7
*/
public Set<String> getUnicodeLocaleAttributes() {
@@ -1314,7 +1302,6 @@
* For more information about types and keywords, see {@link Builder#setUnicodeLocaleKeyword}
* and <a href="http://www.unicode.org/reports/tr35/#BCP47">Unicode Technical Standard #35</a>
*
- * @hide
* @since 1.7
*/
public Set<String> getUnicodeLocaleKeys() {
diff --git a/luni/src/main/java/java/util/concurrent/ConcurrentLinkedDeque.java b/luni/src/main/java/java/util/concurrent/ConcurrentLinkedDeque.java
index 54b53ae..b38d6a5 100644
--- a/luni/src/main/java/java/util/concurrent/ConcurrentLinkedDeque.java
+++ b/luni/src/main/java/java/util/concurrent/ConcurrentLinkedDeque.java
@@ -56,8 +56,6 @@
* actions subsequent to the access or removal of that element from
* the {@code ConcurrentLinkedDeque} in another thread.
*
- * @hide
- *
* @since 1.7
* @author Doug Lea
* @author Martin Buchholz
diff --git a/luni/src/main/java/java/util/concurrent/ForkJoinPool.java b/luni/src/main/java/java/util/concurrent/ForkJoinPool.java
index 5ac01c8..9448616 100644
--- a/luni/src/main/java/java/util/concurrent/ForkJoinPool.java
+++ b/luni/src/main/java/java/util/concurrent/ForkJoinPool.java
@@ -39,7 +39,7 @@
* ForkJoinPool}s may also be appropriate for use with event-style
* tasks that are never joined.
*
- * <p>A static {@link #commonPool()} is available and appropriate for
+ * <p>A static {@code commonPool()} is available and appropriate for
* most applications. The common pool is used by any ForkJoinTask that
* is not explicitly submitted to a specified pool. Using the common
* pool normally reduces resource usage (its threads are slowly
@@ -127,7 +127,6 @@
* or internal resources have been exhausted.
*
* @since 1.7
- * @hide
* @author Doug Lea
*/
public class ForkJoinPool extends AbstractExecutorService {
@@ -213,8 +212,7 @@
* choosing existing queues, and may be randomly repositioned upon
* contention with other submitters. In essence, submitters act
* like workers except that they are restricted to executing local
- * tasks that they submitted (or in the case of CountedCompleters,
- * others with the same root task). However, because most
+ * tasks that they submitted. However, because most
* shared/external queue operations are more expensive than
* internal, and because, at steady state, external submitters
* will compete for CPU with workers, ForkJoinTask.join and
@@ -419,12 +417,6 @@
* to find work (see MAX_HELP) and fall back to suspending the
* worker and if necessary replacing it with another.
*
- * Helping actions for CountedCompleters are much simpler: Method
- * helpComplete can take and execute any task with the same root
- * as the task being waited on. However, this still entails some
- * traversal of completer chains, so is less efficient than using
- * CountedCompleters without explicit joins.
- *
* It is impossible to keep exactly the target parallelism number
* of threads running at any given time. Determining the
* existence of conservatively safe helping targets, the
@@ -2907,7 +2899,7 @@
* Possibly initiates an orderly shutdown in which previously
* submitted tasks are executed, but no new tasks will be
* accepted. Invocation has no effect on execution state if this
- * is the {@link #commonPool()}, and no additional effect if
+ * is the {@code commonPool()}, and no additional effect if
* already shut down. Tasks that are in the process of being
* submitted concurrently during the course of this method may or
* may not be rejected.
@@ -2920,7 +2912,7 @@
/**
* Possibly attempts to cancel and/or stop all tasks, and reject
* all subsequently submitted tasks. Invocation has no effect on
- * execution state if this is the {@link #commonPool()}, and no
+ * execution state if this is the {@code commonPool()}, and no
* additional effect if already shut down. Otherwise, tasks that
* are in the process of being submitted or executed concurrently
* during the course of this method may or may not be
@@ -2979,8 +2971,8 @@
/**
* Blocks until all tasks have completed execution after a
* shutdown request, or the timeout occurs, or the current thread
- * is interrupted, whichever happens first. Because the {@link
- * #commonPool()} never terminates until program shutdown, when
+ * is interrupted, whichever happens first. Because the {@code
+ * commonPool()} never terminates until program shutdown, when
* applied to the common pool, this method is equivalent to {@link
* #awaitQuiescence(long, TimeUnit)} but always returns {@code false}.
*
@@ -3064,7 +3056,7 @@
/**
* Waits and/or attempts to assist performing tasks indefinitely
- * until the {@link #commonPool()} {@link #isQuiescent}.
+ * until the {@code commonPool()} {@link #isQuiescent}.
*/
static void quiesceCommonPool() {
common.awaitQuiescence(Long.MAX_VALUE, TimeUnit.NANOSECONDS);
diff --git a/luni/src/main/java/java/util/concurrent/ForkJoinTask.java b/luni/src/main/java/java/util/concurrent/ForkJoinTask.java
index 6d25775..c6bc6de 100644
--- a/luni/src/main/java/java/util/concurrent/ForkJoinTask.java
+++ b/luni/src/main/java/java/util/concurrent/ForkJoinTask.java
@@ -32,8 +32,8 @@
*
* <p>A "main" {@code ForkJoinTask} begins execution when it is
* explicitly submitted to a {@link ForkJoinPool}, or, if not already
- * engaged in a ForkJoin computation, commenced in the {@link
- * ForkJoinPool#commonPool()} via {@link #fork}, {@link #invoke}, or
+ * engaged in a ForkJoin computation, commenced in the {@code
+ * ForkJoinPool.commonPool()} via {@link #fork}, {@link #invoke}, or
* related methods. Once started, it will usually in turn start other
* subtasks. As indicated by the name of this class, many programs
* using {@code ForkJoinTask} employ only methods {@link #fork} and
@@ -74,10 +74,9 @@
* but doing do requires three further considerations: (1) Completion
* of few if any <em>other</em> tasks should be dependent on a task
* that blocks on external synchronization or I/O. Event-style async
- * tasks that are never joined (for example, those subclassing {@link
- * CountedCompleter}) often fall into this category. (2) To minimize
- * resource impact, tasks should be small; ideally performing only the
- * (possibly) blocking action. (3) Unless the {@link
+ * tasks that are never joined often fall into this category.
+ * (2) To minimize resource impact, tasks should be small; ideally
+ * performing only the (possibly) blocking action. (3) Unless the {@link
* ForkJoinPool.ManagedBlocker} API is used, or the number of possibly
* blocked tasks is known to be less than the pool's {@link
* ForkJoinPool#getParallelism} level, the pool cannot guarantee that
@@ -120,13 +119,11 @@
* <p>The ForkJoinTask class is not usually directly subclassed.
* Instead, you subclass one of the abstract classes that support a
* particular style of fork/join processing, typically {@link
- * RecursiveAction} for most computations that do not return results,
- * {@link RecursiveTask} for those that do, and {@link
- * CountedCompleter} for those in which completed actions trigger
- * other actions. Normally, a concrete ForkJoinTask subclass declares
- * fields comprising its parameters, established in a constructor, and
- * then defines a {@code compute} method that somehow uses the control
- * methods supplied by this base class.
+ * RecursiveAction} for most computations that do not return results
+ * and {@link RecursiveTask} for those that do. Normally, a concrete
+ * ForkJoinTask subclass declares fields comprising its parameters,
+ * established in a constructor, and then defines a {@code compute}
+ * method that somehow uses the control methods supplied by this base class.
*
* <p>Method {@link #join} and its variants are appropriate for use
* only when completion dependencies are acyclic; that is, the
@@ -138,9 +135,9 @@
* may be of use in constructing custom subclasses for problems that
* are not statically structured as DAGs. To support such usages, a
* ForkJoinTask may be atomically <em>tagged</em> with a {@code short}
- * value using {@link #setForkJoinTaskTag} or {@link
- * #compareAndSetForkJoinTaskTag} and checked using {@link
- * #getForkJoinTaskTag}. The ForkJoinTask implementation does not use
+ * value using {@code setForkJoinTaskTag} or {@code
+ * compareAndSetForkJoinTaskTag} and checked using {@code
+ * getForkJoinTaskTag}. The ForkJoinTask implementation does not use
* these {@code protected} methods or tags for any purpose, but they
* may be of use in the construction of specialized subclasses. For
* example, parallel graph traversals can use the supplied methods to
@@ -178,7 +175,6 @@
* execution. Serialization is not relied on during execution itself.
*
* @since 1.7
- * @hide
* @author Doug Lea
*/
public abstract class ForkJoinTask<V> implements Future<V>, Serializable {
@@ -645,8 +641,8 @@
/**
* Arranges to asynchronously execute this task in the pool the
- * current task is running in, if applicable, or using the {@link
- * ForkJoinPool#commonPool()} if not {@link #inForkJoinPool}. While
+ * current task is running in, if applicable, or using the {@code
+ * ForkJoinPool.commonPool()} if not {@link #inForkJoinPool}. While
* it is not necessarily enforced, it is a usage error to fork a
* task more than once unless it has completed and been
* reinitialized. Subsequent modifications to the state of this
diff --git a/luni/src/main/java/java/util/concurrent/ForkJoinWorkerThread.java b/luni/src/main/java/java/util/concurrent/ForkJoinWorkerThread.java
index 5f2799b..ae28700 100644
--- a/luni/src/main/java/java/util/concurrent/ForkJoinWorkerThread.java
+++ b/luni/src/main/java/java/util/concurrent/ForkJoinWorkerThread.java
@@ -18,7 +18,6 @@
* {@linkplain ForkJoinPool#ForkJoinPool use it} in a {@code ForkJoinPool}.
*
* @since 1.7
- * @hide
* @author Doug Lea
*/
public class ForkJoinWorkerThread extends Thread {
diff --git a/luni/src/main/java/java/util/concurrent/LinkedTransferQueue.java b/luni/src/main/java/java/util/concurrent/LinkedTransferQueue.java
index cff5dbf..a041fb1 100644
--- a/luni/src/main/java/java/util/concurrent/LinkedTransferQueue.java
+++ b/luni/src/main/java/java/util/concurrent/LinkedTransferQueue.java
@@ -50,7 +50,6 @@
* the {@code LinkedTransferQueue} in another thread.
*
* @since 1.7
- * @hide
* @author Doug Lea
* @param <E> the type of elements held in this collection
*/
diff --git a/luni/src/main/java/java/util/concurrent/Phaser.java b/luni/src/main/java/java/util/concurrent/Phaser.java
index a9adbe5..a97d187 100644
--- a/luni/src/main/java/java/util/concurrent/Phaser.java
+++ b/luni/src/main/java/java/util/concurrent/Phaser.java
@@ -227,7 +227,6 @@
* of participants.
*
* @since 1.7
- * @hide
* @author Doug Lea
*/
public class Phaser {
diff --git a/luni/src/main/java/java/util/concurrent/RecursiveAction.java b/luni/src/main/java/java/util/concurrent/RecursiveAction.java
index 8d666f6..e3a6340 100644
--- a/luni/src/main/java/java/util/concurrent/RecursiveAction.java
+++ b/luni/src/main/java/java/util/concurrent/RecursiveAction.java
@@ -131,7 +131,6 @@
* }}</pre>
*
* @since 1.7
- * @hide
* @author Doug Lea
*/
public abstract class RecursiveAction extends ForkJoinTask<Void> {
diff --git a/luni/src/main/java/java/util/concurrent/RecursiveTask.java b/luni/src/main/java/java/util/concurrent/RecursiveTask.java
index 421c9d3..80baa52 100644
--- a/luni/src/main/java/java/util/concurrent/RecursiveTask.java
+++ b/luni/src/main/java/java/util/concurrent/RecursiveTask.java
@@ -34,7 +34,6 @@
* sequentially solve rather than subdividing.
*
* @since 1.7
- * @hide
* @author Doug Lea
*/
public abstract class RecursiveTask<V> extends ForkJoinTask<V> {
diff --git a/luni/src/main/java/java/util/concurrent/ScheduledThreadPoolExecutor.java b/luni/src/main/java/java/util/concurrent/ScheduledThreadPoolExecutor.java
index a52351b..483981d 100644
--- a/luni/src/main/java/java/util/concurrent/ScheduledThreadPoolExecutor.java
+++ b/luni/src/main/java/java/util/concurrent/ScheduledThreadPoolExecutor.java
@@ -690,7 +690,6 @@
* @param value if {@code true}, remove on cancellation, else don't
* @see #getRemoveOnCancelPolicy
* @since 1.7
- * @hide
*/
public void setRemoveOnCancelPolicy(boolean value) {
removeOnCancel = value;
@@ -705,7 +704,6 @@
* from the queue
* @see #setRemoveOnCancelPolicy
* @since 1.7
- * @hide
*/
public boolean getRemoveOnCancelPolicy() {
return removeOnCancel;
diff --git a/luni/src/main/java/java/util/concurrent/ThreadLocalRandom.java b/luni/src/main/java/java/util/concurrent/ThreadLocalRandom.java
index a559321..5baf75f 100644
--- a/luni/src/main/java/java/util/concurrent/ThreadLocalRandom.java
+++ b/luni/src/main/java/java/util/concurrent/ThreadLocalRandom.java
@@ -30,7 +30,6 @@
* generation methods.
*
* @since 1.7
- * @hide
* @author Doug Lea
*/
public class ThreadLocalRandom extends Random {
diff --git a/luni/src/main/java/java/util/concurrent/TransferQueue.java b/luni/src/main/java/java/util/concurrent/TransferQueue.java
index 9cd5773..4c2be6f 100644
--- a/luni/src/main/java/java/util/concurrent/TransferQueue.java
+++ b/luni/src/main/java/java/util/concurrent/TransferQueue.java
@@ -33,7 +33,6 @@
* and {@code transfer} are effectively synonymous.
*
* @since 1.7
- * @hide
* @author Doug Lea
* @param <E> the type of elements held in this collection
*/
diff --git a/luni/src/main/java/java/util/concurrent/atomic/Fences.java b/luni/src/main/java/java/util/concurrent/atomic/Fences.java
index 7ecf45a..5714ba0 100644
--- a/luni/src/main/java/java/util/concurrent/atomic/Fences.java
+++ b/luni/src/main/java/java/util/concurrent/atomic/Fences.java
@@ -453,7 +453,6 @@
*
* </dl>
*
- * @since 1.7
* @hide
* @author Doug Lea
*/
diff --git a/luni/src/main/java/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java b/luni/src/main/java/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java
index 4c5e280..37aa9d0 100644
--- a/luni/src/main/java/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java
+++ b/luni/src/main/java/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java
@@ -1255,7 +1255,6 @@
* current thread, and {@code false} if the current thread
* is at the head of the queue or the queue is empty
* @since 1.7
- * @hide
*/
public final boolean hasQueuedPredecessors() {
// The correctness of this depends on head being initialized
diff --git a/luni/src/main/java/java/util/concurrent/locks/AbstractQueuedSynchronizer.java b/luni/src/main/java/java/util/concurrent/locks/AbstractQueuedSynchronizer.java
index 0350060..e711da5 100644
--- a/luni/src/main/java/java/util/concurrent/locks/AbstractQueuedSynchronizer.java
+++ b/luni/src/main/java/java/util/concurrent/locks/AbstractQueuedSynchronizer.java
@@ -1485,7 +1485,6 @@
* current thread, and {@code false} if the current thread
* is at the head of the queue or the queue is empty
* @since 1.7
- * @hide
*/
public final boolean hasQueuedPredecessors() {
// The correctness of this depends on head being initialized
diff --git a/luni/src/main/java/java/util/jar/JarEntry.java b/luni/src/main/java/java/util/jar/JarEntry.java
index 85c8678..bceef63 100644
--- a/luni/src/main/java/java/util/jar/JarEntry.java
+++ b/luni/src/main/java/java/util/jar/JarEntry.java
@@ -17,16 +17,16 @@
package java.util.jar;
-import javax.security.auth.x500.X500Principal;
import java.io.IOException;
import java.security.CodeSigner;
import java.security.cert.CertPath;
+import java.security.cert.CertPathValidator;
import java.security.cert.Certificate;
import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
-import java.util.List;
+import java.util.Arrays;
import java.util.zip.ZipEntry;
/**
@@ -114,8 +114,12 @@
* entry or {@code null} if none exists. Make sure that the everything is
* read from the input stream before calling this method, or else the method
* returns {@code null}.
+ * <p>
+ * This method returns all the signers' unverified chains concatenated
+ * together in one array. To know which certificates were tied to the
+ * private keys that made the signatures on this entry, see
+ * {@link #getCodeSigners()} instead.
*
- * @return the certificate for this entry.
* @see java.security.cert.Certificate
*/
public Certificate[] getCertificates() {
@@ -126,7 +130,27 @@
if (jarVerifier == null) {
return null;
}
- return jarVerifier.getCertificates(getName());
+
+ Certificate[][] certChains = jarVerifier.getCertificateChains(getName());
+ if (certChains == null) {
+ return null;
+ }
+
+ // Measure number of certs.
+ int count = 0;
+ for (Certificate[] chain : certChains) {
+ count += chain.length;
+ }
+
+ // Create new array and copy all the certs into it.
+ Certificate[] certs = new Certificate[count];
+ int i = 0;
+ for (Certificate[] chain : certChains) {
+ System.arraycopy(chain, 0, certs, i, chain.length);
+ i += chain.length;
+ }
+
+ return certs;
}
void setAttributes(Attributes attrib) {
@@ -138,68 +162,60 @@
* JAR file. If there is no such code signer, it returns {@code null}. Make
* sure that the everything is read from the input stream before calling
* this method, or else the method returns {@code null}.
+ * <p>
+ * Only the digital signature on the entry is cryptographically verified.
+ * None of the certificates in the the {@link CertPath} returned from
+ * {@link CodeSigner#getSignerCertPath()} are verified and must be verified
+ * by the caller if needed. See {@link CertPathValidator} for more
+ * information.
*
- * @return the code signers for the JAR entry.
+ * @return an array of CodeSigner for this JAR entry.
* @see CodeSigner
*/
public CodeSigner[] getCodeSigners() {
+ if (parentJar == null) {
+ return null;
+ }
+
+ JarVerifier jarVerifier = parentJar.verifier;
+ if (jarVerifier == null) {
+ return null;
+ }
+
if (signers == null) {
- signers = getCodeSigners(getCertificates());
+ signers = getCodeSigners(jarVerifier.getCertificateChains(getName()));
}
if (signers == null) {
return null;
}
- CodeSigner[] tmp = new CodeSigner[signers.length];
- System.arraycopy(signers, 0, tmp, 0, tmp.length);
- return tmp;
+ return signers.clone();
}
- private CodeSigner[] getCodeSigners(Certificate[] certs) {
- if (certs == null) {
+ private CodeSigner[] getCodeSigners(Certificate[][] certChains) {
+ if (certChains == null) {
return null;
}
- X500Principal prevIssuer = null;
- ArrayList<Certificate> list = new ArrayList<Certificate>(certs.length);
- ArrayList<CodeSigner> asigners = new ArrayList<CodeSigner>();
+ ArrayList<CodeSigner> asigners = new ArrayList<CodeSigner>(certChains.length);
- for (Certificate element : certs) {
- if (!(element instanceof X509Certificate)) {
- // Only X509Certificate-s are taken into account - see API spec.
- continue;
- }
- X509Certificate x509 = (X509Certificate) element;
- if (prevIssuer != null) {
- X500Principal subj = x509.getSubjectX500Principal();
- if (!prevIssuer.equals(subj)) {
- // Ok, this ends the previous chain,
- // so transform this one into CertPath ...
- addCodeSigner(asigners, list);
- // ... and start a new one
- list.clear();
- }// else { it's still the same chain }
-
- }
- prevIssuer = x509.getIssuerX500Principal();
- list.add(x509);
- }
- if (!list.isEmpty()) {
- addCodeSigner(asigners, list);
- }
- if (asigners.isEmpty()) {
- // 'signers' is 'null' already
- return null;
+ for (Certificate[] chain : certChains) {
+ addCodeSigner(asigners, chain);
}
CodeSigner[] tmp = new CodeSigner[asigners.size()];
asigners.toArray(tmp);
return tmp;
-
}
- private void addCodeSigner(ArrayList<CodeSigner> asigners,
- List<Certificate> list) {
+ private void addCodeSigner(ArrayList<CodeSigner> asigners, Certificate[] certs) {
+ for (Certificate cert : certs) {
+ // Only X509Certificate instances are counted. See API spec.
+ if (!(cert instanceof X509Certificate)) {
+ return;
+ }
+ }
+
CertPath certPath = null;
if (!isFactoryChecked) {
try {
@@ -214,7 +230,7 @@
return;
}
try {
- certPath = factory.generateCertPath(list);
+ certPath = factory.generateCertPath(Arrays.asList(certs));
} catch (CertificateException ex) {
// do nothing
}
diff --git a/luni/src/main/java/java/util/jar/JarFile.java b/luni/src/main/java/java/util/jar/JarFile.java
index a089019..6b147f6 100644
--- a/luni/src/main/java/java/util/jar/JarFile.java
+++ b/luni/src/main/java/java/util/jar/JarFile.java
@@ -196,16 +196,6 @@
* If the file cannot be read.
*/
public JarFile(File file, boolean verify, int mode) throws IOException {
- this(file, verify, mode, false);
- }
-
- /**
- * See previous constructor for other parameter definitions.
- * @param chainCheck
- * whether or not to check certificate chain signatures
- * @hide
- */
- public JarFile(File file, boolean verify, int mode, boolean chainCheck) throws IOException {
super(file, mode);
// Step 1: Scan the central directory for meta entries (MANIFEST.mf
@@ -225,7 +215,7 @@
// We create the manifest straight away, so that we can create
// the jar verifier as well.
manifest = new Manifest(metaEntries.get(MANIFEST_NAME), true);
- verifier = new JarVerifier(getName(), manifest, metaEntries, chainCheck);
+ verifier = new JarVerifier(getName(), manifest, metaEntries);
} else {
verifier = null;
manifestBytes = metaEntries.get(MANIFEST_NAME);
@@ -257,17 +247,7 @@
* If file cannot be opened or read.
*/
public JarFile(String filename, boolean verify) throws IOException {
- this(filename, verify, false);
- }
-
- /**
- * See previous constructor for other parameter definitions.
- * @param chainCheck
- * whether or not to check certificate chain signatures
- * @hide
- */
- public JarFile(String filename, boolean verify, boolean chainCheck) throws IOException {
- this(new File(filename), verify, ZipFile.OPEN_READ, chainCheck);
+ this(new File(filename), verify, ZipFile.OPEN_READ);
}
/**
diff --git a/luni/src/main/java/java/util/jar/JarVerifier.java b/luni/src/main/java/java/util/jar/JarVerifier.java
index f78cbe8..467e298 100644
--- a/luni/src/main/java/java/util/jar/JarVerifier.java
+++ b/luni/src/main/java/java/util/jar/JarVerifier.java
@@ -27,7 +27,6 @@
import java.security.NoSuchAlgorithmException;
import java.security.cert.Certificate;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
@@ -72,11 +71,8 @@
private final Hashtable<String, Certificate[]> certificates =
new Hashtable<String, Certificate[]>(5);
- private final Hashtable<String, Certificate[]> verifiedEntries =
- new Hashtable<String, Certificate[]>();
-
- /** Whether or not to check certificate chain signatures. */
- private final boolean chainCheck;
+ private final Hashtable<String, Certificate[][]> verifiedEntries =
+ new Hashtable<String, Certificate[][]>();
/**
* Stores and a hash and a message digest and verifies that massage digest
@@ -90,16 +86,16 @@
private final byte[] hash;
- private final Certificate[] certificates;
+ private final Certificate[][] certChains;
- private final Hashtable<String, Certificate[]> verifiedEntries;
+ private final Hashtable<String, Certificate[][]> verifiedEntries;
VerifierEntry(String name, MessageDigest digest, byte[] hash,
- Certificate[] certificates, Hashtable<String, Certificate[]> verifedEntries) {
+ Certificate[][] certChains, Hashtable<String, Certificate[][]> verifedEntries) {
this.name = name;
this.digest = digest;
this.hash = hash;
- this.certificates = certificates;
+ this.certChains = certChains;
this.verifiedEntries = verifedEntries;
}
@@ -135,7 +131,7 @@
if (!MessageDigest.isEqual(d, Base64.decode(hash))) {
throw invalidDigest(JarFile.MANIFEST_NAME, name, name);
}
- verifiedEntries.put(name, certificates);
+ verifiedEntries.put(name, certChains);
}
}
@@ -150,27 +146,16 @@
}
/**
- * Convenience constructor for backward compatibility.
- */
- JarVerifier(String name, Manifest manifest, HashMap<String, byte[]> metaEntries) {
- this(name, manifest, metaEntries, false);
- }
-
- /**
* Constructs and returns a new instance of {@code JarVerifier}.
*
* @param name
* the name of the JAR file being verified.
- * @param chainCheck
- * whether to check the certificate chain signatures
*/
- JarVerifier(String name, Manifest manifest, HashMap<String, byte[]> metaEntries,
- boolean chainCheck) {
+ JarVerifier(String name, Manifest manifest, HashMap<String, byte[]> metaEntries) {
jarName = name;
this.manifest = manifest;
this.metaEntries = metaEntries;
this.mainAttributesEnd = manifest.getMainAttributesEnd();
- this.chainCheck = chainCheck;
}
/**
@@ -199,7 +184,7 @@
return null;
}
- ArrayList<Certificate> certs = new ArrayList<Certificate>();
+ ArrayList<Certificate[]> certChains = new ArrayList<Certificate[]>();
Iterator<Map.Entry<String, HashMap<String, Attributes>>> it = signatures.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, HashMap<String, Attributes>> entry = it.next();
@@ -209,16 +194,16 @@
String signatureFile = entry.getKey();
Certificate[] certChain = certificates.get(signatureFile);
if (certChain != null) {
- Collections.addAll(certs, certChain);
+ certChains.add(certChain);
}
}
}
// entry is not signed
- if (certs.isEmpty()) {
+ if (certChains.isEmpty()) {
return null;
}
- Certificate[] certificatesArray = certs.toArray(new Certificate[certs.size()]);
+ Certificate[][] certChainsArray = certChains.toArray(new Certificate[certChains.size()][]);
for (int i = 0; i < DIGEST_ALGORITHMS.length; i++) {
final String algorithm = DIGEST_ALGORITHMS[i];
@@ -230,9 +215,8 @@
try {
return new VerifierEntry(name, MessageDigest.getInstance(algorithm), hashBytes,
- certificatesArray, verifiedEntries);
- } catch (NoSuchAlgorithmException e) {
- // ignored
+ certChainsArray, verifiedEntries);
+ } catch (NoSuchAlgorithmException ignored) {
}
}
return null;
@@ -309,15 +293,7 @@
try {
Certificate[] signerCertChain = JarUtils.verifySignature(
new ByteArrayInputStream(sfBytes),
- new ByteArrayInputStream(sBlockBytes),
- chainCheck);
- /*
- * Recursive call in loading security provider related class which
- * is in a signed JAR.
- */
- if (metaEntries == null) {
- return;
- }
+ new ByteArrayInputStream(sBlockBytes));
if (signerCertChain != null) {
certificates.put(signatureFile, signerCertChain);
}
@@ -418,20 +394,16 @@
}
/**
- * Returns all of the {@link java.security.cert.Certificate} instances that
+ * Returns all of the {@link java.security.cert.Certificate} chains that
* were used to verify the signature on the JAR entry called
- * {@code name}.
+ * {@code name}. Callers must not modify the returned arrays.
*
* @param name
* the name of a JAR entry.
- * @return an array of {@link java.security.cert.Certificate}.
+ * @return an array of {@link java.security.cert.Certificate} chains.
*/
- Certificate[] getCertificates(String name) {
- Certificate[] verifiedCerts = verifiedEntries.get(name);
- if (verifiedCerts == null) {
- return null;
- }
- return verifiedCerts.clone();
+ Certificate[][] getCertificateChains(String name) {
+ return verifiedEntries.get(name);
}
/**
diff --git a/luni/src/main/java/java/util/jar/StrictJarFile.java b/luni/src/main/java/java/util/jar/StrictJarFile.java
index 80b4fe9..4a8af5f 100644
--- a/luni/src/main/java/java/util/jar/StrictJarFile.java
+++ b/luni/src/main/java/java/util/jar/StrictJarFile.java
@@ -63,7 +63,7 @@
// or manifests, so it's best to throw as early as possible.
HashMap<String, byte[]> metaEntries = getMetaEntries();
this.manifest = new Manifest(metaEntries.get(JarFile.MANIFEST_NAME), true);
- this.verifier = new JarVerifier(fileName, manifest, metaEntries, true);
+ this.verifier = new JarVerifier(fileName, manifest, metaEntries);
isSigned = verifier.readCertificates() && verifier.isSignedJar();
} catch (IOException ioe) {
@@ -87,16 +87,51 @@
}
/**
- * Return all certificates for a given {@link ZipEntry} belonging to this jar.
+ * Return all certificate chains for a given {@link ZipEntry} belonging to this jar.
* This method MUST be called only after fully exhausting the InputStream belonging
* to this entry.
*
* Returns {@code null} if this jar file isn't signed or if this method is
* called before the stream is processed.
*/
+ public Certificate[][] getCertificateChains(ZipEntry ze) {
+ if (isSigned) {
+ return verifier.getCertificateChains(ze.getName());
+ }
+
+ return null;
+ }
+
+ /**
+ * Return all certificates for a given {@link ZipEntry} belonging to this jar.
+ * This method MUST be called only after fully exhausting the InputStream belonging
+ * to this entry.
+ *
+ * Returns {@code null} if this jar file isn't signed or if this method is
+ * called before the stream is processed.
+ *
+ * @deprecated Switch callers to use getCertificateChains instead
+ */
+ @Deprecated
public Certificate[] getCertificates(ZipEntry ze) {
if (isSigned) {
- return verifier.getCertificates(ze.getName());
+ Certificate[][] certChains = verifier.getCertificateChains(ze.getName());
+
+ // Measure number of certs.
+ int count = 0;
+ for (Certificate[] chain : certChains) {
+ count += chain.length;
+ }
+
+ // Create new array and copy all the certs into it.
+ Certificate[] certs = new Certificate[count];
+ int i = 0;
+ for (Certificate[] chain : certChains) {
+ System.arraycopy(chain, 0, certs, i, chain.length);
+ i += chain.length;
+ }
+
+ return certs;
}
return null;
diff --git a/luni/src/main/java/java/util/zip/ZipFile.java b/luni/src/main/java/java/util/zip/ZipFile.java
index 43e8567..877e9ee 100644
--- a/luni/src/main/java/java/util/zip/ZipFile.java
+++ b/luni/src/main/java/java/util/zip/ZipFile.java
@@ -132,7 +132,6 @@
* @throws ZipException if a zip error occurs.
* @throws IOException if an {@code IOException} occurs.
* @since 1.7
- * @hide Until ready for an API update
*/
public ZipFile(File file, Charset charset) throws ZipException, IOException {
this(file, OPEN_READ, charset);
@@ -179,7 +178,6 @@
*
* @throws IOException if an {@code IOException} occurs.
* @since 1.7
- * @hide Until ready for an API update
*/
public ZipFile(File file, int mode, Charset charset) throws IOException {
filename = file.getPath();
diff --git a/luni/src/main/java/java/util/zip/ZipInputStream.java b/luni/src/main/java/java/util/zip/ZipInputStream.java
index 5a73619..402cd33 100644
--- a/luni/src/main/java/java/util/zip/ZipInputStream.java
+++ b/luni/src/main/java/java/util/zip/ZipInputStream.java
@@ -108,7 +108,6 @@
* by the zip file then {@code charset} is used to decode them.
*
* @since 1.7
- * @hide Until ready for an API update
*/
public ZipInputStream(InputStream stream, Charset charset) {
super(new PushbackInputStream(stream, BUF_SIZE), new Inflater(true));
diff --git a/luni/src/main/java/java/util/zip/ZipOutputStream.java b/luni/src/main/java/java/util/zip/ZipOutputStream.java
index ac6bdf2..77b00c9 100644
--- a/luni/src/main/java/java/util/zip/ZipOutputStream.java
+++ b/luni/src/main/java/java/util/zip/ZipOutputStream.java
@@ -114,7 +114,6 @@
* comments.
*
* @since 1.7
- * @hide Until ready for an API update
*/
public ZipOutputStream(OutputStream os, Charset charset) {
super(os, new Deflater(Deflater.DEFAULT_COMPRESSION, true));
diff --git a/luni/src/main/java/javax/net/ssl/SSLEngine.java b/luni/src/main/java/javax/net/ssl/SSLEngine.java
index d63ee94..b55acd4 100644
--- a/luni/src/main/java/javax/net/ssl/SSLEngine.java
+++ b/luni/src/main/java/javax/net/ssl/SSLEngine.java
@@ -783,7 +783,6 @@
*
* @return the SSL session for this engine instance.
* @since 1.7
- * @hide
*/
public SSLSession getHandshakeSession() {
throw new UnsupportedOperationException();
diff --git a/luni/src/main/java/javax/net/ssl/SSLParameters.java b/luni/src/main/java/javax/net/ssl/SSLParameters.java
index b8fdc38..93e766f 100644
--- a/luni/src/main/java/javax/net/ssl/SSLParameters.java
+++ b/luni/src/main/java/javax/net/ssl/SSLParameters.java
@@ -146,7 +146,6 @@
*
* @see #setEndpointIdentificationAlgorithm(String)
* @since 1.7
- * @hide
*/
public String getEndpointIdentificationAlgorithm() {
return endpointIdentificationAlgorithm;
@@ -158,7 +157,6 @@
*
* @see #getEndpointIdentificationAlgorithm()
* @since 1.7
- * @hide
*/
public void setEndpointIdentificationAlgorithm(String endpointIdentificationAlgorithm) {
this.endpointIdentificationAlgorithm = endpointIdentificationAlgorithm;
diff --git a/luni/src/main/java/javax/net/ssl/SSLSocket.java b/luni/src/main/java/javax/net/ssl/SSLSocket.java
index f681681..148f3cf 100644
--- a/luni/src/main/java/javax/net/ssl/SSLSocket.java
+++ b/luni/src/main/java/javax/net/ssl/SSLSocket.java
@@ -895,7 +895,6 @@
*
* @return the session object.
* @since 1.7
- * @hide
*/
public SSLSession getHandshakeSession() {
throw new UnsupportedOperationException();
diff --git a/luni/src/main/java/javax/net/ssl/X509ExtendedTrustManager.java b/luni/src/main/java/javax/net/ssl/X509ExtendedTrustManager.java
index 8b398ce..2af1c11 100644
--- a/luni/src/main/java/javax/net/ssl/X509ExtendedTrustManager.java
+++ b/luni/src/main/java/javax/net/ssl/X509ExtendedTrustManager.java
@@ -27,7 +27,6 @@
*
* @see SSLParameters#setEndpointIdentificationAlgorithm(String)
* @since 1.7
- * @hide
*/
public abstract class X509ExtendedTrustManager implements X509TrustManager {
/**
diff --git a/luni/src/main/java/libcore/io/ForwardingOs.java b/luni/src/main/java/libcore/io/ForwardingOs.java
index d09e442..bf4b448 100644
--- a/luni/src/main/java/libcore/io/ForwardingOs.java
+++ b/luni/src/main/java/libcore/io/ForwardingOs.java
@@ -52,6 +52,7 @@
public FileDescriptor accept(FileDescriptor fd, InetSocketAddress peerAddress) throws ErrnoException, SocketException { return os.accept(fd, peerAddress); }
public boolean access(String path, int mode) throws ErrnoException { return os.access(path, mode); }
+ public InetAddress[] android_getaddrinfo(String node, StructAddrinfo hints, int netId) throws GaiException { return os.android_getaddrinfo(node, hints, netId); }
public void bind(FileDescriptor fd, InetAddress address, int port) throws ErrnoException, SocketException { os.bind(fd, address, port); }
public void chmod(String path, int mode) throws ErrnoException { os.chmod(path, mode); }
public void chown(String path, int uid, int gid) throws ErrnoException { os.chown(path, uid, gid); }
@@ -73,7 +74,6 @@
public void fsync(FileDescriptor fd) throws ErrnoException { os.fsync(fd); }
public void ftruncate(FileDescriptor fd, long length) throws ErrnoException { os.ftruncate(fd, length); }
public String gai_strerror(int error) { return os.gai_strerror(error); }
- public InetAddress[] getaddrinfo(String node, StructAddrinfo hints) throws GaiException { return os.getaddrinfo(node, hints); }
public int getegid() { return os.getegid(); }
public int geteuid() { return os.geteuid(); }
public int getgid() { return os.getgid(); }
diff --git a/luni/src/main/java/libcore/io/Os.java b/luni/src/main/java/libcore/io/Os.java
index a537aeb..511bb27 100644
--- a/luni/src/main/java/libcore/io/Os.java
+++ b/luni/src/main/java/libcore/io/Os.java
@@ -43,6 +43,7 @@
public interface Os {
public FileDescriptor accept(FileDescriptor fd, InetSocketAddress peerAddress) throws ErrnoException, SocketException;
public boolean access(String path, int mode) throws ErrnoException;
+ public InetAddress[] android_getaddrinfo(String node, StructAddrinfo hints, int netId) throws GaiException;
public void bind(FileDescriptor fd, InetAddress address, int port) throws ErrnoException, SocketException;
public void chmod(String path, int mode) throws ErrnoException;
public void chown(String path, int uid, int gid) throws ErrnoException;
@@ -64,7 +65,6 @@
public void fsync(FileDescriptor fd) throws ErrnoException;
public void ftruncate(FileDescriptor fd, long length) throws ErrnoException;
public String gai_strerror(int error);
- public InetAddress[] getaddrinfo(String node, StructAddrinfo hints) throws GaiException;
public int getegid();
public int geteuid();
public int getgid();
diff --git a/luni/src/main/java/libcore/io/Posix.java b/luni/src/main/java/libcore/io/Posix.java
index 7551190..f5eaaa3 100644
--- a/luni/src/main/java/libcore/io/Posix.java
+++ b/luni/src/main/java/libcore/io/Posix.java
@@ -46,6 +46,7 @@
public native FileDescriptor accept(FileDescriptor fd, InetSocketAddress peerAddress) throws ErrnoException, SocketException;
public native boolean access(String path, int mode) throws ErrnoException;
+ public native InetAddress[] android_getaddrinfo(String node, StructAddrinfo hints, int netId) throws GaiException;
public native void bind(FileDescriptor fd, InetAddress address, int port) throws ErrnoException, SocketException;
public native void chmod(String path, int mode) throws ErrnoException;
public native void chown(String path, int uid, int gid) throws ErrnoException;
@@ -67,7 +68,6 @@
public native void fsync(FileDescriptor fd) throws ErrnoException;
public native void ftruncate(FileDescriptor fd, long length) throws ErrnoException;
public native String gai_strerror(int error);
- public native InetAddress[] getaddrinfo(String node, StructAddrinfo hints) throws GaiException;
public native int getegid();
public native int geteuid();
public native int getgid();
diff --git a/luni/src/main/java/libcore/net/url/FileURLConnection.java b/luni/src/main/java/libcore/net/url/FileURLConnection.java
index 94fe1d6..a6a575e 100644
--- a/luni/src/main/java/libcore/net/url/FileURLConnection.java
+++ b/luni/src/main/java/libcore/net/url/FileURLConnection.java
@@ -228,7 +228,6 @@
*
* @return the length of the file
* @since 1.7
- * @hide Until ready for a public API change
*/
@Override
public long getContentLengthLong() {
diff --git a/luni/src/main/java/libcore/net/url/JarURLConnectionImpl.java b/luni/src/main/java/libcore/net/url/JarURLConnectionImpl.java
index e00bcab..231b078 100644
--- a/luni/src/main/java/libcore/net/url/JarURLConnectionImpl.java
+++ b/luni/src/main/java/libcore/net/url/JarURLConnectionImpl.java
@@ -273,8 +273,6 @@
* Returns the content length of the resource. Test cases reveal that if the URL is referring to
* a Jar file, this method answers a content-length returned by URLConnection. For a jar entry
* it should return the entry's size. Otherwise, it will return -1.
- *
- * @hide Until ready for a public API change
*/
@Override
public long getContentLengthLong() {
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 b9056353..d11c8dd 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
@@ -54,27 +54,18 @@
new int[] {1, 2, 840, 113549, 1, 9, 4};
/**
- * @see #verifySignature(InputStream, InputStream, boolean)
- */
- public static Certificate[] verifySignature(InputStream signature, InputStream signatureBlock)
- throws IOException, GeneralSecurityException {
- return verifySignature(signature, signatureBlock, false);
- }
-
- /**
* This method handle all the work with PKCS7, ASN1 encoding, signature verifying,
* and certification path building.
* See also PKCS #7: Cryptographic Message Syntax Standard:
* http://www.ietf.org/rfc/rfc2315.txt
* @param signature - the input stream of signature file to be verified
* @param signatureBlock - the input stream of corresponding signature block file
- * @param chainCheck - whether to validate certificate chain signatures
* @return array of certificates used to verify the signature file
* @throws IOException - if some errors occurs during reading from the stream
* @throws GeneralSecurityException - if signature verification process fails
*/
public static Certificate[] verifySignature(InputStream signature, InputStream
- signatureBlock, boolean chainCheck) throws IOException, GeneralSecurityException {
+ signatureBlock) throws IOException, GeneralSecurityException {
BerInputStream bis = new BerInputStream(signatureBlock);
ContentInfo info = (ContentInfo)ContentInfo.ASN1.decode(bis);
@@ -232,11 +223,11 @@
throw new SecurityException("Incorrect signature");
}
- return createChain(certs[issuerSertIndex], certs, chainCheck);
+ return createChain(certs[issuerSertIndex], certs);
}
private static X509Certificate[] createChain(X509Certificate signer,
- X509Certificate[] candidates, boolean chainCheck) {
+ X509Certificate[] candidates) {
Principal issuer = signer.getIssuerDN();
// Signer is self-signed
@@ -248,11 +239,10 @@
chain.add(0, signer);
X509Certificate issuerCert;
- X509Certificate subjectCert = signer;
int count = 1;
while (true) {
- issuerCert = findCert(issuer, candidates, subjectCert, chainCheck);
- if( issuerCert == null) {
+ issuerCert = findCert(issuer, candidates);
+ if (issuerCert == null) {
break;
}
chain.add(issuerCert);
@@ -261,22 +251,13 @@
if (issuerCert.getSubjectDN().equals(issuer)) {
break;
}
- subjectCert = issuerCert;
}
return chain.toArray(new X509Certificate[count]);
}
- private static X509Certificate findCert(Principal issuer, X509Certificate[] candidates,
- X509Certificate subjectCert, boolean chainCheck) {
+ private static X509Certificate findCert(Principal issuer, X509Certificate[] candidates) {
for (int i = 0; i < candidates.length; i++) {
if (issuer.equals(candidates[i].getSubjectDN())) {
- if (chainCheck) {
- try {
- subjectCert.verify(candidates[i].getPublicKey());
- } catch (Exception e) {
- continue;
- }
- }
return candidates[i];
}
}
diff --git a/luni/src/main/native/Portability.h b/luni/src/main/native/Portability.h
index fb60ed4..e01243a 100644
--- a/luni/src/main/native/Portability.h
+++ b/luni/src/main/native/Portability.h
@@ -73,6 +73,15 @@
#include <sys/sendfile.h>
#include <sys/statvfs.h>
+#if !defined(__BIONIC__)
+#include <netdb.h>
+#include "../../bionic/libc/dns/include/resolv_netid.h"
+inline int android_getaddrinfofornet(const char *hostname, const char *servname,
+ const struct addrinfo *hints, unsigned /*netid*/, unsigned /*mark*/, struct addrinfo **res) {
+ return getaddrinfo(hostname, servname, hints, res);
+}
+#endif
+
#endif
#endif // PORTABILITY_H_included
diff --git a/luni/src/main/native/libcore_io_Posix.cpp b/luni/src/main/native/libcore_io_Posix.cpp
index d763c9e..e4a878a 100644
--- a/luni/src/main/native/libcore_io_Posix.cpp
+++ b/luni/src/main/native/libcore_io_Posix.cpp
@@ -25,6 +25,7 @@
#include "NetworkUtilities.h"
#include "Portability.h"
#include "readlink.h"
+#include "../../bionic/libc/dns/include/resolv_netid.h" // For android_getaddrinfofornet.
#include "ScopedBytes.h"
#include "ScopedLocalRef.h"
#include "ScopedPrimitiveArray.h"
@@ -658,7 +659,8 @@
return env->NewStringUTF(gai_strerror(error));
}
-static jobjectArray Posix_getaddrinfo(JNIEnv* env, jobject, jstring javaNode, jobject javaHints) {
+static jobjectArray Posix_android_getaddrinfo(JNIEnv* env, jobject, jstring javaNode,
+ jobject javaHints, jint netId) {
ScopedUtfChars node(env, javaNode);
if (node.c_str() == NULL) {
return NULL;
@@ -678,10 +680,10 @@
addrinfo* addressList = NULL;
errno = 0;
- int rc = getaddrinfo(node.c_str(), NULL, &hints, &addressList);
+ int rc = android_getaddrinfofornet(node.c_str(), NULL, &hints, netId, 0, &addressList);
UniquePtr<addrinfo, addrinfo_deleter> addressListDeleter(addressList);
if (rc != 0) {
- throwGaiException(env, "getaddrinfo", rc);
+ throwGaiException(env, "android_getaddrinfo", rc);
return NULL;
}
@@ -691,7 +693,7 @@
if (ai->ai_family == AF_INET || ai->ai_family == AF_INET6) {
++addressCount;
} else {
- ALOGE("getaddrinfo unexpected ai_family %i", ai->ai_family);
+ ALOGE("android_getaddrinfo unexpected ai_family %i", ai->ai_family);
}
}
if (addressCount == 0) {
@@ -709,7 +711,7 @@
for (addrinfo* ai = addressList; ai != NULL; ai = ai->ai_next) {
if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6) {
// Unknown address family. Skip this address.
- ALOGE("getaddrinfo unexpected ai_family %i", ai->ai_family);
+ ALOGE("android_getaddrinfo unexpected ai_family %i", ai->ai_family);
continue;
}
@@ -1534,6 +1536,7 @@
static JNINativeMethod gMethods[] = {
NATIVE_METHOD(Posix, accept, "(Ljava/io/FileDescriptor;Ljava/net/InetSocketAddress;)Ljava/io/FileDescriptor;"),
NATIVE_METHOD(Posix, access, "(Ljava/lang/String;I)Z"),
+ NATIVE_METHOD(Posix, android_getaddrinfo, "(Ljava/lang/String;Landroid/system/StructAddrinfo;I)[Ljava/net/InetAddress;"),
NATIVE_METHOD(Posix, bind, "(Ljava/io/FileDescriptor;Ljava/net/InetAddress;I)V"),
NATIVE_METHOD(Posix, chmod, "(Ljava/lang/String;I)V"),
NATIVE_METHOD(Posix, chown, "(Ljava/lang/String;II)V"),
@@ -1555,7 +1558,6 @@
NATIVE_METHOD(Posix, fsync, "(Ljava/io/FileDescriptor;)V"),
NATIVE_METHOD(Posix, ftruncate, "(Ljava/io/FileDescriptor;J)V"),
NATIVE_METHOD(Posix, gai_strerror, "(I)Ljava/lang/String;"),
- NATIVE_METHOD(Posix, getaddrinfo, "(Ljava/lang/String;Landroid/system/StructAddrinfo;)[Ljava/net/InetAddress;"),
NATIVE_METHOD(Posix, getegid, "()I"),
NATIVE_METHOD(Posix, geteuid, "()I"),
NATIVE_METHOD(Posix, getgid, "()I"),
diff --git a/luni/src/test/java/com/android/org/bouncycastle/jce/provider/CertBlacklistTest.java b/luni/src/test/java/com/android/org/bouncycastle/jce/provider/CertBlacklistTest.java
index 6d033d3..1475a63 100644
--- a/luni/src/test/java/com/android/org/bouncycastle/jce/provider/CertBlacklistTest.java
+++ b/luni/src/test/java/com/android/org/bouncycastle/jce/provider/CertBlacklistTest.java
@@ -109,6 +109,24 @@
"3xQAyMuOHm72exJljYFqIsiNvGE0KufCqCuH1PD97IXMrLlwGmKKg5jP349lySBpJjm6RDqCTT+6" +
"dUl2jkVbeNmco99Y7AOdtLsOdXBMCo5x8lK8zwQWFrzEms0joHXCpWfGWA==";
+ public static final String ANSSI = "" +
+ "MIIDbDCCAlSgAwIBAgIDAx2nMA0GCSqGSIb3DQEBBQUAMEsxCzAJBgNVBAYTAkZSMQ4wDAYDVQQK" +
+ "EwVER1RQRTEsMCoGA1UEAxMjQUMgREdUUEUgU2lnbmF0dXJlIEF1dGhlbnRpZmljYXRpb24wHhcN" +
+ "MTMwNzE4MTAwNTI4WhcNMTQwNzE4MTAwNTI4WjA+MQswCQYDVQQGEwJGUjETMBEGA1UECgwKREcg" +
+ "VHLDqXNvcjEaMBgGA1UEAwwRQUMgREcgVHLDqXNvciBTU0wwggEiMA0GCSqGSIb3DQEBAQUAA4IB" +
+ "DwAwggEKAoIBAQDI0WFSUyY+MmtFkqFjTefoFyDgh9b1C/2YvSIvT8oCH62JWT5rpeTCZwaXbqWc" +
+ "jaNfzggqaFsokqfhBif43HNHNtNJmvKE32VcuLB0SpsLR/1VeTd9F99C1JeHVa+nelumOHEfouX8" +
+ "rRFrxNXNIYTVeiENT8Y2YqRb/XAril9g7i674uFzLiNR/t/N/F8Exujv9U8m8rmgud/+tG9WDRaD" +
+ "Jwoj3ZFCOnL5qLnSUEcS6TzWpozLmC2JVO5GZKGGd7qC9FjdBkVilkbVIEGSrYvz2Uz2v5IGqMBI" +
+ "QaFL/kSYWxGTaedTOk2drFEApp9AEPTfv1NwCWBfegsGQrHUROM3AgMBAAGjZjBkMBIGA1UdEwEB" +
+ "/wQIMAYBAf8CAQQwHQYDVR0OBBYEFAAMW8lJqJW0DtAv5p3Mjogxvh9lMB8GA1UdIwQYMBaAFOnb" +
+ "kI/9W5nkFTvwYlyn5A1Y6IeZMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAtDfG" +
+ "HkHOLW2d9fiMtwtkEwDauISJLJyCjoRmawzmQbIZXq7HaLliVfE0sdfKUm0iQ0im1/CpnJLPoTeK" +
+ "yBHvNu1ubLc2m+9dabAYhF3pVdKC+gNaAzBXZ9Gt0p1CLk1lf8Hg+R10HN2IPCv7V/crz2Ga+c23" +
+ "4P3pfwYW8+Nd7alGCuvqot6UYXOlheF7zWUkHn6z6tvY+9oMDHKSUAthhA/FB50JgJU89zyTv1eg" +
+ "Y3ldKwvYBW3W3yNZdTHbPyNsPJdhqA55mDNsteE5YTp1PyySDb1MSVrbxDEruoH6ZE99Hob4Ih8A" +
+ "mn7MHZatGClECgjXWFZ2Gxa7OUCaQpcH8g==";
+
public CertBlacklistTest() throws IOException {
tmpFile = File.createTempFile("test", "");
DEFAULT_PUBKEYS = getDefaultPubkeys();
@@ -415,6 +433,20 @@
assertEquals(bl.isPublicKeyBlackListed(pk), true);
}
+ public void testANSSISerialBlacklist() throws Exception {
+ CertBlacklist bl = new CertBlacklist();
+ assertEquals(bl.isSerialNumberBlackListed(createSerialNumber(ANSSI)), true);
+ }
+
+ public void testANSSIIntermediatePubkeyBlacklist() throws Exception {
+ // build the public key
+ PublicKey pk = createPublicKey(ANSSI);
+ // set our blacklist path
+ CertBlacklist bl = new CertBlacklist();
+ // check to make sure it isn't blacklisted
+ assertEquals(bl.isPublicKeyBlackListed(pk), true);
+ }
+
private static void printHash(String cert) throws Exception {
System.out.println("CERTIFICATE PUBLIC KEY HASH: " + getHash(createPublicKey(cert)));
}
diff --git a/luni/src/test/java/libcore/java/util/jar/StrictJarFileTest.java b/luni/src/test/java/libcore/java/util/jar/StrictJarFileTest.java
index 0b194f5..e5a6cd8 100644
--- a/luni/src/test/java/libcore/java/util/jar/StrictJarFileTest.java
+++ b/luni/src/test/java/libcore/java/util/jar/StrictJarFileTest.java
@@ -122,6 +122,7 @@
jarFile.getInputStream(zipEntry).skip(Long.MAX_VALUE);
if ("Test.class".equals(zipEntry.getName())) {
assertNotNull(jarFile.getCertificates(zipEntry));
+ assertNotNull(jarFile.getCertificateChains(zipEntry));
}
}
}
diff --git a/support/src/test/java/tests/resources/hyts_signed_ambiguousSignerArray.jar b/support/src/test/java/tests/resources/hyts_signed_ambiguousSignerArray.jar
new file mode 100644
index 0000000..7da4b59
--- /dev/null
+++ b/support/src/test/java/tests/resources/hyts_signed_ambiguousSignerArray.jar
Binary files differ