summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--auth/src/main/java/javax/security/auth/x500/X500Principal.java22
-rw-r--r--luni-kernel/src/main/java/java/lang/Thread.java4
-rw-r--r--luni/src/main/java/java/net/DatagramSocket.java12
-rw-r--r--luni/src/main/java/java/net/Inet4Address.java38
-rw-r--r--luni/src/main/java/java/net/Inet6Address.java47
-rw-r--r--luni/src/main/java/java/net/InetAddress.java101
-rw-r--r--luni/src/main/java/java/net/InetSocketAddress.java10
-rw-r--r--luni/src/main/java/java/net/MulticastSocket.java6
-rw-r--r--luni/src/main/java/java/net/ServerSocket.java8
-rw-r--r--luni/src/main/java/java/net/Socket.java8
-rw-r--r--luni/src/main/java/java/util/Properties.java5
-rw-r--r--luni/src/main/native/org_apache_harmony_luni_platform_OSMemory.cpp54
-rw-r--r--luni/src/main/native/org_apache_harmony_luni_platform_OSNetworkSystem.cpp64
-rw-r--r--luni/src/test/java/org/apache/harmony/luni/platform/AllTests.java36
-rw-r--r--luni/src/test/java/org/apache/harmony/luni/platform/OSMemoryTest.java164
-rw-r--r--luni/src/test/java/org/apache/harmony/luni/tests/java/net/Inet4AddressTest.java9
-rw-r--r--luni/src/test/java/org/apache/harmony/luni/tests/java/net/Inet6AddressTest.java9
-rw-r--r--luni/src/test/java/org/apache/harmony/luni/tests/java/net/InetAddressTest.java62
-rw-r--r--luni/src/test/java/tests/AllTests.java2
-rw-r--r--prefs/src/main/java/java/util/prefs/AbstractPreferences.java199
-rw-r--r--prefs/src/main/java/java/util/prefs/BackingStoreException.java23
-rw-r--r--prefs/src/main/java/java/util/prefs/FilePreferencesFactoryImpl.java6
-rw-r--r--prefs/src/main/java/java/util/prefs/FilePreferencesImpl.java41
-rw-r--r--prefs/src/main/java/java/util/prefs/InvalidPreferencesFormatException.java26
-rw-r--r--prefs/src/main/java/java/util/prefs/NodeChangeEvent.java37
-rw-r--r--prefs/src/main/java/java/util/prefs/NodeChangeListener.java17
-rw-r--r--prefs/src/main/java/java/util/prefs/PreferenceChangeEvent.java28
-rw-r--r--prefs/src/main/java/java/util/prefs/PreferenceChangeListener.java16
-rw-r--r--prefs/src/main/java/java/util/prefs/Preferences.java499
-rw-r--r--prefs/src/main/java/java/util/prefs/PreferencesFactory.java18
-rw-r--r--prefs/src/main/java/java/util/prefs/XMLParser.java147
-rw-r--r--prefs/src/main/java/org/apache/harmony/prefs/internal/nls/Messages.java14
-rw-r--r--prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/AbstractPreferencesTest.java42
-rw-r--r--prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/FilePreferencesImplTest.java20
-rw-r--r--prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/InvalidPreferencesFormatExceptionTest.java4
-rw-r--r--prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/MockAbstractPreferences.java9
-rw-r--r--prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/MockSecurityManager.java2
-rw-r--r--prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/NodeChangeEventTest.java18
-rw-r--r--prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/NodeChangeListenerTest.java7
-rw-r--r--prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/PreferenceChangeEventTest.java4
-rw-r--r--prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/PreferenceChangeListenerTest.java1
-rw-r--r--prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/PreferencesFactoryTest.java5
-rw-r--r--prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/PreferencesTest.java69
-rw-r--r--prefs/src/test/java/tests/prefs/AllTests.java3
-rw-r--r--prefs/src/test/resources/prefs/java/util/prefs/preferences.dtd56
-rw-r--r--regex/src/main/java/java/util/regex/Pattern.java59
-rw-r--r--regex/src/test/java/org/apache/harmony/regex/tests/java/util/regex/SplitTest.java56
-rw-r--r--security/src/main/files/cacerts.bksbin51899 -> 55715 bytes
-rw-r--r--security/src/main/files/cacerts/3e7271e8.085
-rw-r--r--security/src/main/files/cacerts/ab86d4de.0104
-rw-r--r--security/src/main/files/cacerts/b0f3e76e.063
-rw-r--r--security/src/main/files/cacerts/bf64f35b.092
-rwxr-xr-xsecurity/src/main/files/certimport.sh9
-rw-r--r--security/src/main/java/org/apache/harmony/security/provider/cert/X509CertImpl.java4
-rw-r--r--security/src/main/java/org/bouncycastle/jce/provider/CertPathValidatorUtilities.java69
-rw-r--r--security/src/main/java/org/bouncycastle/jce/provider/IndexedPKIXParameters.java144
-rw-r--r--security/src/main/java/org/bouncycastle/jce/provider/PKIXCertPathValidatorSpi.java6
-rw-r--r--security/src/main/java/org/bouncycastle/jce/provider/X509CertificateObject.java30
-rw-r--r--sql/src/main/java/java/sql/Array.java12
-rw-r--r--sql/src/main/java/java/sql/BatchUpdateException.java12
-rw-r--r--sql/src/main/java/java/sql/Blob.java13
-rw-r--r--sql/src/main/java/java/sql/CallableStatement.java139
-rw-r--r--sql/src/main/java/java/sql/Clob.java13
-rw-r--r--sql/src/main/java/java/sql/Connection.java78
-rw-r--r--sql/src/main/java/java/sql/DataTruncation.java8
-rw-r--r--sql/src/main/java/java/sql/DatabaseMetaData.java315
-rw-r--r--sql/src/main/java/java/sql/Date.java55
-rw-r--r--sql/src/main/java/java/sql/Driver.java17
-rw-r--r--sql/src/main/java/java/sql/DriverManager.java77
-rw-r--r--sql/src/main/java/java/sql/DriverPropertyInfo.java17
-rw-r--r--sql/src/main/java/java/sql/ParameterMetaData.java25
-rw-r--r--sql/src/main/java/java/sql/PreparedStatement.java78
-rw-r--r--sql/src/main/java/java/sql/Ref.java8
-rw-r--r--sql/src/main/java/java/sql/ResultSet.java194
-rw-r--r--sql/src/main/java/java/sql/ResultSetMetaData.java29
-rw-r--r--sql/src/main/java/java/sql/SQLData.java13
-rw-r--r--sql/src/main/java/java/sql/SQLException.java7
-rw-r--r--sql/src/main/java/java/sql/SQLInput.java32
-rw-r--r--sql/src/main/java/java/sql/SQLOutput.java30
-rw-r--r--sql/src/main/java/java/sql/SQLPermission.java3
-rw-r--r--sql/src/main/java/java/sql/SQLWarning.java8
-rw-r--r--sql/src/main/java/java/sql/Savepoint.java4
-rw-r--r--sql/src/main/java/java/sql/Statement.java83
-rw-r--r--sql/src/main/java/java/sql/Struct.java5
-rw-r--r--sql/src/main/java/java/sql/Time.java63
-rw-r--r--sql/src/main/java/java/sql/Timestamp.java135
-rw-r--r--sql/src/main/java/java/sql/Types.java62
-rw-r--r--sql/src/main/java/javax/sql/ConnectionEvent.java17
-rw-r--r--sql/src/main/java/javax/sql/ConnectionEventListener.java6
-rw-r--r--sql/src/main/java/javax/sql/ConnectionPoolDataSource.java13
-rw-r--r--sql/src/main/java/javax/sql/DataSource.java15
-rw-r--r--sql/src/main/java/javax/sql/PooledConnection.java11
-rw-r--r--sql/src/main/java/javax/sql/RowSet.java80
-rw-r--r--sql/src/main/java/javax/sql/RowSetEvent.java4
-rw-r--r--sql/src/main/java/javax/sql/RowSetInternal.java12
-rw-r--r--sql/src/main/java/javax/sql/RowSetListener.java5
-rw-r--r--sql/src/main/java/javax/sql/RowSetMetaData.java23
-rw-r--r--sql/src/main/java/javax/sql/RowSetReader.java3
-rw-r--r--sql/src/main/java/javax/sql/RowSetWriter.java6
-rw-r--r--sql/src/main/java/org/apache/harmony/sql/internal/nls/Messages.java1
-rw-r--r--sql/src/main/java/org/apache/harmony/sql/internal/nls/messages.properties19
-rw-r--r--sql/src/test/java/org/apache/harmony/sql/tests/java/sql/DateTest.java69
-rw-r--r--sql/src/test/java/org/apache/harmony/sql/tests/java/sql/DriverManagerTest.java73
-rw-r--r--sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TestHelper_Connection1.java15
-rw-r--r--sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TestHelper_Driver1.java3
-rw-r--r--sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TestHelper_Driver3.java1
-rw-r--r--sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TestHelper_Driver4.java12
-rw-r--r--sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TestMainForDriver.java36
-rw-r--r--sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TimestampTest.java86
-rw-r--r--sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/ConnectionEventTest.java64
-rw-r--r--sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/Impl_PooledConnection.java3
-rw-r--r--sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/Impl_RowSet.java100
-rw-r--r--sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/RowSetEventTest.java2
-rw-r--r--support/src/test/java/tests/support/Support_Configuration.java14
-rw-r--r--support/src/test/java/tests/util/PrefsTester.java73
-rw-r--r--x-net/src/main/java/javax/net/DefaultServerSocketFactory.java26
-rw-r--r--x-net/src/main/java/javax/net/DefaultSocketFactory.java31
-rw-r--r--x-net/src/main/java/javax/net/ServerSocketFactory.java55
-rw-r--r--x-net/src/main/java/javax/net/SocketFactory.java61
-rw-r--r--x-net/src/main/java/javax/net/ssl/CertPathTrustManagerParameters.java9
-rw-r--r--x-net/src/main/java/javax/net/ssl/ContextImpl.java33
-rw-r--r--x-net/src/main/java/javax/net/ssl/DefaultSSLContext.java76
-rw-r--r--x-net/src/main/java/javax/net/ssl/DefaultSSLServerSocketFactory.java25
-rw-r--r--x-net/src/main/java/javax/net/ssl/DefaultSSLSocketFactory.java52
-rw-r--r--x-net/src/main/java/javax/net/ssl/HandshakeCompletedEvent.java47
-rw-r--r--x-net/src/main/java/javax/net/ssl/HandshakeCompletedListener.java10
-rw-r--r--x-net/src/main/java/javax/net/ssl/HostnameVerifier.java11
-rw-r--r--x-net/src/main/java/javax/net/ssl/HttpsURLConnection.java160
-rw-r--r--x-net/src/main/java/javax/net/ssl/KeyManager.java12
-rw-r--r--x-net/src/main/java/javax/net/ssl/KeyManagerFactory.java156
-rw-r--r--x-net/src/main/java/javax/net/ssl/KeyManagerFactorySpi.java24
-rw-r--r--x-net/src/main/java/javax/net/ssl/KeyStoreBuilderParameters.java23
-rw-r--r--x-net/src/main/java/javax/net/ssl/ManagerFactoryParameters.java6
-rw-r--r--x-net/src/main/java/javax/net/ssl/SSLContext.java96
-rw-r--r--x-net/src/main/java/javax/net/ssl/SSLContextSpi.java36
-rw-r--r--x-net/src/main/java/javax/net/ssl/SSLEngine.java231
-rw-r--r--x-net/src/main/java/javax/net/ssl/SSLEngineResult.java175
-rw-r--r--x-net/src/main/java/javax/net/ssl/SSLException.java12
-rw-r--r--x-net/src/main/java/javax/net/ssl/SSLHandshakeException.java7
-rw-r--r--x-net/src/main/java/javax/net/ssl/SSLKeyException.java11
-rw-r--r--x-net/src/main/java/javax/net/ssl/SSLPeerUnverifiedException.java9
-rw-r--r--x-net/src/main/java/javax/net/ssl/SSLPermission.java19
-rw-r--r--x-net/src/main/java/javax/net/ssl/SSLProtocolException.java9
-rw-r--r--x-net/src/main/java/javax/net/ssl/SSLServerSocket.java66
-rw-r--r--x-net/src/main/java/javax/net/ssl/SSLServerSocketFactory.java58
-rw-r--r--x-net/src/main/java/javax/net/ssl/SSLSession.java77
-rw-r--r--x-net/src/main/java/javax/net/ssl/SSLSessionBindingEvent.java32
-rw-r--r--x-net/src/main/java/javax/net/ssl/SSLSessionBindingListener.java12
-rw-r--r--x-net/src/main/java/javax/net/ssl/SSLSessionContext.java27
-rw-r--r--x-net/src/main/java/javax/net/ssl/SSLSocket.java130
-rw-r--r--x-net/src/main/java/javax/net/ssl/SSLSocketFactory.java114
-rw-r--r--x-net/src/main/java/javax/net/ssl/TrustManager.java6
-rw-r--r--x-net/src/main/java/javax/net/ssl/TrustManagerFactory.java146
-rw-r--r--x-net/src/main/java/javax/net/ssl/TrustManagerFactorySpi.java16
-rw-r--r--x-net/src/main/java/javax/net/ssl/X509ExtendedKeyManager.java19
-rw-r--r--x-net/src/main/java/javax/net/ssl/X509KeyManager.java22
-rw-r--r--x-net/src/main/java/javax/net/ssl/X509TrustManager.java15
-rw-r--r--x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/AlertException.java30
-rw-r--r--x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/AlertProtocol.java11
-rw-r--r--x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/Appendable.java13
-rw-r--r--x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/CertificateMessage.java11
-rw-r--r--x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/CertificateRequest.java11
-rw-r--r--x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/CertificateVerify.java8
-rw-r--r--x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/CipherSuite.java32
-rw-r--r--x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ClientHandshakeImpl.java30
-rw-r--r--x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ClientHello.java8
-rw-r--r--x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ClientKeyExchange.java8
-rw-r--r--x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ConnectionState.java5
-rw-r--r--x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ConnectionStateSSLv3.java14
-rw-r--r--x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ConnectionStateTLS.java15
-rw-r--r--x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ContentType.java5
-rw-r--r--x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/DHParameters.java5
-rw-r--r--x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/DataStream.java5
-rw-r--r--x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/DelegatedTask.java9
-rw-r--r--x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/DigitalSignature.java147
-rw-r--r--x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/EndOfBufferException.java15
-rw-r--r--x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/EndOfSourceException.java16
-rw-r--r--x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/Finished.java7
-rw-r--r--x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/Handshake.java5
-rw-r--r--x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/HandshakeIODataStream.java14
-rw-r--r--x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/HandshakeProtocol.java18
-rw-r--r--x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/HelloRequest.java7
-rw-r--r--x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/JSSEProvider.java22
-rw-r--r--x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/KeyManagerFactoryImpl.java10
-rw-r--r--x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/KeyManagerImpl.java144
-rw-r--r--x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/Logger.java7
-rw-r--r--x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/Message.java4
-rw-r--r--x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLSocketImplWrapper.java55
-rw-r--r--x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/PRF.java5
-rw-r--r--x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ProtocolVersion.java66
-rw-r--r--x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLBufferedInput.java7
-rw-r--r--x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLContextImpl.java11
-rw-r--r--x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLEngineAppData.java12
-rw-r--r--x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLEngineDataStream.java5
-rw-r--r--x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLEngineImpl.java34
-rw-r--r--x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLInputStream.java9
-rw-r--r--x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLParameters.java24
-rw-r--r--x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLRecordProtocol.java16
-rw-r--r--x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLSessionImpl.java225
-rw-r--r--x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLStreamedInput.java7
-rw-r--r--x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLv3Constants.java5
-rw-r--r--x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ServerHandshakeImpl.java72
-rw-r--r--x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ServerHello.java7
-rw-r--r--x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ServerHelloDone.java8
-rw-r--r--x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ServerKeyExchange.java7
-rw-r--r--x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/TrustManagerFactoryImpl.java8
-rw-r--r--x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/TrustManagerImpl.java35
-rw-r--r--x-net/src/main/native/org_apache_harmony_xnet_provider_jsse_OpenSSLSocketImpl.cpp2
208 files changed, 3760 insertions, 4652 deletions
diff --git a/auth/src/main/java/javax/security/auth/x500/X500Principal.java b/auth/src/main/java/javax/security/auth/x500/X500Principal.java
index 41f3a6d..19254a0 100644
--- a/auth/src/main/java/javax/security/auth/x500/X500Principal.java
+++ b/auth/src/main/java/javax/security/auth/x500/X500Principal.java
@@ -139,6 +139,16 @@ public final class X500Principal implements Serializable, Principal {
}
}
+// BEGIN android-added
+ private transient String canonicalName;
+ private synchronized String getCanonicalName() {
+ if (canonicalName == null) {
+ canonicalName = dn.getName(CANONICAL);
+ }
+ return canonicalName;
+ }
+// END android-added
+
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -148,7 +158,9 @@ public final class X500Principal implements Serializable, Principal {
return false;
}
X500Principal principal = (X500Principal) o;
- return dn.getName(CANONICAL).equals(principal.dn.getName(CANONICAL));
+// BEGIN android-changed
+ return getCanonicalName().equals(principal.getCanonicalName());
+// END android-changed
}
/**
@@ -194,13 +206,19 @@ public final class X500Principal implements Serializable, Principal {
* mentioned above
*/
public String getName(String format) {
+// BEGIN android-changed
+ if (CANONICAL.equals(format)) {
+ return getCanonicalName();
+ }
+
return dn.getName(format);
}
@Override
public int hashCode() {
- return dn.getName(CANONICAL).hashCode();
+ return getCanonicalName().hashCode();
}
+// END android-changed
@Override
public String toString() {
diff --git a/luni-kernel/src/main/java/java/lang/Thread.java b/luni-kernel/src/main/java/java/lang/Thread.java
index 484c258..4f9f988 100644
--- a/luni-kernel/src/main/java/java/lang/Thread.java
+++ b/luni-kernel/src/main/java/java/lang/Thread.java
@@ -922,9 +922,7 @@ public class Thread implements Runnable {
* @since Android 1.0
*/
public final boolean isAlive() {
- Thread.State state = getState();
-
- return (state != Thread.State.TERMINATED && state != Thread.State.NEW);
+ return (vmThread != null);
}
/**
diff --git a/luni/src/main/java/java/net/DatagramSocket.java b/luni/src/main/java/java/net/DatagramSocket.java
index 6b3b6cc..ba5e207 100644
--- a/luni/src/main/java/java/net/DatagramSocket.java
+++ b/luni/src/main/java/java/net/DatagramSocket.java
@@ -81,7 +81,7 @@ public class DatagramSocket {
public DatagramSocket(int aPort) throws SocketException {
super();
checkListen(aPort);
- createSocket(aPort, InetAddress.ANY);
+ createSocket(aPort, Inet4Address.ANY);
}
/**
@@ -99,7 +99,7 @@ public class DatagramSocket {
public DatagramSocket(int aPort, InetAddress addr) throws SocketException {
super();
checkListen(aPort);
- createSocket(aPort, null == addr ? InetAddress.ANY : addr);
+ createSocket(aPort, null == addr ? Inet4Address.ANY : addr);
}
/**
@@ -228,7 +228,7 @@ public class DatagramSocket {
return null;
}
if (!isBound()) {
- return InetAddress.ANY;
+ return Inet4Address.ANY;
}
InetAddress anAddr = impl.getLocalAddress();
try {
@@ -237,7 +237,7 @@ public class DatagramSocket {
security.checkConnect(anAddr.getHostName(), -1);
}
} catch (SecurityException e) {
- return InetAddress.ANY;
+ return Inet4Address.ANY;
}
return anAddr;
}
@@ -603,7 +603,7 @@ public class DatagramSocket {
}
if (bind && !isBound()) {
checkListen(0);
- impl.bind(0, InetAddress.ANY);
+ impl.bind(0, Inet4Address.ANY);
isBound = true;
}
}
@@ -624,7 +624,7 @@ public class DatagramSocket {
public void bind(SocketAddress localAddr) throws SocketException {
checkClosedAndBind(false);
int localPort = 0;
- InetAddress addr = InetAddress.ANY;
+ InetAddress addr = Inet4Address.ANY;
if (localAddr != null) {
if (!(localAddr instanceof InetSocketAddress)) {
throw new IllegalArgumentException(Msg.getString(
diff --git a/luni/src/main/java/java/net/Inet4Address.java b/luni/src/main/java/java/net/Inet4Address.java
index 23efa5e..5e1a420 100644
--- a/luni/src/main/java/java/net/Inet4Address.java
+++ b/luni/src/main/java/java/net/Inet4Address.java
@@ -33,11 +33,17 @@ public final class Inet4Address extends InetAddress {
private static final long serialVersionUID = 3286316764910316507L;
+ final static InetAddress ANY = new Inet4Address(new byte[] { 0, 0, 0, 0 });
+ final static InetAddress LOOPBACK = new Inet4Address(
+ new byte[] { 127, 0, 0, 1 }, "localhost"); //$NON-NLS-1$
+
Inet4Address(byte[] address) {
+ family = AF_INET;
ipaddress = address;
}
Inet4Address(byte[] address, String name) {
+ family = AF_INET;
ipaddress = address;
hostName = name;
}
@@ -228,31 +234,17 @@ public final class Inet4Address extends InetAddress {
return hostAddress;
}
- /**
- * Gets the hashcode of the represented IP address.
- *
- * @return the appropriate hashcode value.
- */
- @Override
- public int hashCode() {
- return InetAddress.bytesToInt(ipaddress, 0);
- }
+ // BEGIN android-removed
+ // public int hashCode() {
+ // }
+ // END android-removed
- /**
- * Compares this instance with the IP address in the object {@code obj} and
- * returns {@code true} if they are of the same type and represent the same
- * IP address, {@code false} otherwise.
- *
- * @param obj
- * the object to be tested for equality.
- * @return {@code true} if the addresses are equal, {@code false} otherwise.
- */
- @Override
- public boolean equals(Object obj) {
- return super.equals(obj);
- }
+ // BEGIN android-removed
+ // public boolean equals(Object obj) {
+ // }
+ // END android-removed
private Object writeReplace() throws ObjectStreamException {
- return new InetAddress(ipaddress, hostName);
+ return new Inet4Address(ipaddress, hostName);
}
}
diff --git a/luni/src/main/java/java/net/Inet6Address.java b/luni/src/main/java/java/net/Inet6Address.java
index 0569829..91ec48e 100644
--- a/luni/src/main/java/java/net/Inet6Address.java
+++ b/luni/src/main/java/java/net/Inet6Address.java
@@ -33,16 +33,10 @@ public final class Inet6Address extends InetAddress {
private static final long serialVersionUID = 6880410070516793377L;
- static final byte[] any_bytes = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0 };
-
- static final byte[] localhost_bytes = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1 };
-
- static final InetAddress ANY = new Inet6Address(any_bytes);
-
- static final InetAddress LOOPBACK = new Inet6Address(localhost_bytes,
- "localhost"); //$NON-NLS-1$
+ static final InetAddress ANY = new Inet6Address(new byte[]
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 });
+ static final InetAddress LOOPBACK = new Inet6Address(new byte[]
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }, "localhost"); //$NON-NLS-1$
int scope_id;
@@ -58,11 +52,13 @@ public final class Inet6Address extends InetAddress {
transient NetworkInterface scopedIf;
Inet6Address(byte address[]) {
+ family = AF_INET6;
ipaddress = address;
scope_id = 0;
}
Inet6Address(byte address[], String name) {
+ family = AF_INET6;
hostName = name;
ipaddress = address;
scope_id = 0;
@@ -80,6 +76,7 @@ public final class Inet6Address extends InetAddress {
* the scope id for link- or site-local addresses.
*/
Inet6Address(byte address[], String name, int scope_id) {
+ family = AF_INET6;
hostName = name;
ipaddress = address;
this.scope_id = scope_id;
@@ -402,31 +399,13 @@ public final class Inet6Address extends InetAddress {
return null;
}
- /**
- * Gets the hashcode of the represented IP address.
- *
- * @return the appropriate hashcode value.
- */
- @Override
- public int hashCode() {
- /* Returns the low order int as the hash code */
- return bytesToInt(ipaddress, 12);
- }
+ // BEGIN android-removed
+ // public int hashCode() {}
+ // END android-removed
- /**
- * Compares this instance with the IP address in the object {@code obj} and
- * returns {@code true} if they are of the same type and represent the same
- * IP address, {@code false} otherwise. The scope id does not seem to be
- * part of the comparison.
- *
- * @param obj
- * the object to be tested for equality.
- * @return {@code true} if the addresses are equal, {@code false} otherwise.
- */
- @Override
- public boolean equals(Object obj) {
- return super.equals(obj);
- }
+ // BEGIN android-removed
+ // public boolean equals(Object obj) {}
+ // END android-removed
/**
* Returns whether this address is IPv4 compatible or not. An IPv4
diff --git a/luni/src/main/java/java/net/InetAddress.java b/luni/src/main/java/java/net/InetAddress.java
index eec153f..2eaf1cd 100644
--- a/luni/src/main/java/java/net/InetAddress.java
+++ b/luni/src/main/java/java/net/InetAddress.java
@@ -46,17 +46,8 @@ import org.apache.harmony.luni.util.PriviAction;
*/
public class InetAddress extends Object implements Serializable {
- final static byte[] any_bytes = { 0, 0, 0, 0 };
-
- final static byte[] localhost_bytes = { 127, 0, 0, 1 };
-
- static InetAddress ANY = new Inet4Address(any_bytes);
-
private final static INetworkSystem NETIMPL = Platform.getNetworkSystem();
- final static InetAddress LOOPBACK = new Inet4Address(localhost_bytes,
- "localhost"); //$NON-NLS-1$
-
private static final String ERRMSG_CONNECTION_REFUSED = "Connection refused"; //$NON-NLS-1$
private static final long serialVersionUID = 3286316764910316507L;
@@ -79,7 +70,9 @@ public class InetAddress extends Object implements Serializable {
private int addrCount;
- int family = 2;
+ int family = 0;
+ static final int AF_INET = 2;
+ static final int AF_INET6 = 10;
byte[] ipaddress;
@@ -93,12 +86,22 @@ public class InetAddress extends Object implements Serializable {
// END android-removed
/**
- * Constructs an InetAddress.
+ * Constructs an {@code InetAddress}.
+ *
+ * Note: this constructor should not be used. Creating an InetAddress
+ * without specifying whether it's an IPv4 or IPv6 address does not make
+ * sense, because subsequent code cannot know which of of the subclasses'
+ * methods need to be called to implement a given InetAddress method. The
+ * proper way to create an InetAddress is to call new Inet4Address or
+ * Inet6Address or to use one of the static methods that return
+ * InetAddresses (e.g., getByAddress). That is why the API does not have
+ * public constructors for any of these classes.
*/
InetAddress() {
super();
}
+ // BEGIN android-removed
/**
* Constructs an {@code InetAddress}, representing the {@code address} and
* {@code hostName}.
@@ -106,23 +109,27 @@ public class InetAddress extends Object implements Serializable {
* @param address
* the network address.
*/
- InetAddress(byte[] address) {
- super();
- this.ipaddress = address;
- }
+ // InetAddress(byte[] address) {
+ // super();
+ // this.ipaddress = address;
+ // }
+ // END android-removed
+ // BEGIN android-removed
/**
* Constructs an {@code InetAddress}, representing the {@code address} and
* {@code hostName}.
*
* @param address
* the network address.
+ *
*/
- InetAddress(byte[] address, String hostName) {
- super();
- this.ipaddress = address;
- this.hostName = hostName;
- }
+ // InetAddress(byte[] address, String hostName) {
+ // super();
+ // this.ipaddress = address;
+ // this.hostName = hostName;
+ // }
+ // END android-removed
// BEGIN android-removed
// CacheElement cacheElement() {
@@ -145,21 +152,8 @@ public class InetAddress extends Object implements Serializable {
if (!(obj instanceof InetAddress)) {
return false;
}
+ return Arrays.equals(this.ipaddress, ((InetAddress) obj).ipaddress);
// END android-changed
-
- // now check if their byte arrays match...
- byte[] objIPaddress = ((InetAddress) obj).ipaddress;
- // BEGIN android-added
- if (objIPaddress.length != ipaddress.length) {
- return false;
- }
- // END android-added
- for (int i = 0; i < objIPaddress.length; i++) {
- if (objIPaddress[i] != this.ipaddress[i]) {
- return false;
- }
- }
- return true;
}
/**
@@ -253,15 +247,17 @@ public class InetAddress extends Object implements Serializable {
throws UnknownHostException {
if (host == null || 0 == host.length()) {
if (preferIPv6Addresses()) {
- return new InetAddress[] { Inet6Address.LOOPBACK, LOOPBACK };
+ return new InetAddress[] { Inet6Address.LOOPBACK,
+ Inet4Address.LOOPBACK };
} else {
- return new InetAddress[] { LOOPBACK, Inet6Address.LOOPBACK };
+ return new InetAddress[] { Inet4Address.LOOPBACK,
+ Inet6Address.LOOPBACK };
}
}
// Special-case "0" for legacy IPv4 applications.
if (host.equals("0")) { //$NON-NLS-1$
- return new InetAddress[] { InetAddress.ANY };
+ return new InetAddress[] { Inet4Address.ANY };
}
if (isHostName(host)) {
@@ -281,8 +277,10 @@ public class InetAddress extends Object implements Serializable {
return (new InetAddress[] { new Inet4Address(hBytes) });
} else if (hBytes.length == 16) {
return (new InetAddress[] { new Inet6Address(hBytes) });
+ } else {
+ throw new UnknownHostException(
+ Msg.getString("K0339")); //$NON-NLS-1$
}
- return (new InetAddress[] { new InetAddress(hBytes) });
}
// END android-added
@@ -403,7 +401,7 @@ public class InetAddress extends Object implements Serializable {
security.checkConnect(host, -1);
}
} catch (SecurityException e) {
- return InetAddress.LOOPBACK;
+ return Inet4Address.LOOPBACK;
}
return lookupHostByName(host)[0];
}
@@ -415,18 +413,24 @@ public class InetAddress extends Object implements Serializable {
*/
@Override
public int hashCode() {
- return bytesToInt(ipaddress, 0);
+ // BEGIN android-changed
+ return Arrays.hashCode(ipaddress);
+ // END android-changed
}
- /**
- * Returns whether this address is an IP multicast address or not.
+ // BEGIN android-changed
+ /*
+ * Returns whether this address is an IP multicast address or not. This
+ * implementation returns always {@code false}.
*
* @return {@code true} if this address is in the multicast group, {@code
* false} otherwise.
*/
public boolean isMulticastAddress() {
- return ((ipaddress[0] & 255) >>> 4) == 0xE;
+ return false;
}
+ // END android-changed
+
/**
* Resolves a hostname to its IP addresses using a cache for faster lookups.
@@ -530,7 +534,14 @@ public class InetAddress extends Object implements Serializable {
// throws UnknownHostException;
static InetAddress getHostByAddrImpl(byte[] addr)
throws UnknownHostException {
- return new InetAddress(addr, gethostbyaddr(addr));
+ if (addr.length == 4) {
+ return new Inet4Address(addr, gethostbyaddr(addr));
+ } else if (addr.length == 16) {
+ return new Inet6Address(addr, gethostbyaddr(addr));
+ } else {
+ throw new UnknownHostException(Msg.getString(
+ "K0339")); //$NON-NLS-1$
+ }
}
/**
@@ -618,7 +629,7 @@ public class InetAddress extends Object implements Serializable {
static String getHostNameInternal(String host) throws UnknownHostException {
if (host == null || 0 == host.length()) {
- return InetAddress.LOOPBACK.getHostAddress();
+ return Inet4Address.LOOPBACK.getHostAddress();
}
if (isHostName(host)) {
return lookupHostByName(host)[0].getHostAddress();
diff --git a/luni/src/main/java/java/net/InetSocketAddress.java b/luni/src/main/java/java/net/InetSocketAddress.java
index 13c10f2..08e75a9 100644
--- a/luni/src/main/java/java/net/InetSocketAddress.java
+++ b/luni/src/main/java/java/net/InetSocketAddress.java
@@ -35,9 +35,9 @@ public class InetSocketAddress extends SocketAddress {
private int port;
/**
- * Creates a socket endpoint with the given port number {@code port} and the
- * wildcard address {@code InetAddress.ANY}. The range for valid port numbers
- * is between 0 and 65535 inclusive.
+ * Creates a socket endpoint with the given port number {@code port} and
+ * no specified address. The range for valid port numbers is between 0 and
+ * 65535 inclusive.
*
* @param port
* the specified port number to which this socket is bound.
@@ -50,7 +50,7 @@ public class InetSocketAddress extends SocketAddress {
* Creates a socket endpoint with the given port number {@code port} and
* {@code address}. The range for valid port numbers is between 0 and 65535
* inclusive. If {@code address} is {@code null} this socket is bound to the
- * wildcard address {@code InetAddress.ANY}.
+ * IPv4 wildcard address.
*
* @param port
* the specified port number to which this socket is bound.
@@ -62,7 +62,7 @@ public class InetSocketAddress extends SocketAddress {
throw new IllegalArgumentException();
}
if (address == null) {
- addr = InetAddress.ANY;
+ addr = Inet4Address.ANY;
} else {
addr = address;
}
diff --git a/luni/src/main/java/java/net/MulticastSocket.java b/luni/src/main/java/java/net/MulticastSocket.java
index 0b1c99b..60d967b 100644
--- a/luni/src/main/java/java/net/MulticastSocket.java
+++ b/luni/src/main/java/java/net/MulticastSocket.java
@@ -146,7 +146,7 @@ public class MulticastSocket extends DatagramSocket {
&& (InetAddress.preferIPv6Addresses() == true)) {
theAddresses[0] = Inet6Address.ANY;
} else {
- theAddresses[0] = InetAddress.ANY;
+ theAddresses[0] = Inet4Address.ANY;
}
return new NetworkInterface(null, null, theAddresses,
NetworkInterface.UNSET_INTERFACE_INDEX);
@@ -385,7 +385,7 @@ public class MulticastSocket extends DatagramSocket {
throw new NullPointerException();
}
if (addr.isAnyLocalAddress()) {
- impl.setOption(SocketOptions.IP_MULTICAST_IF, InetAddress.ANY);
+ impl.setOption(SocketOptions.IP_MULTICAST_IF, Inet4Address.ANY);
} else if (addr instanceof Inet4Address) {
impl.setOption(SocketOptions.IP_MULTICAST_IF, addr);
// keep the address used to do the set as we must return the same
@@ -449,7 +449,7 @@ public class MulticastSocket extends DatagramSocket {
if (netInterface.getIndex() == NetworkInterface.UNSET_INTERFACE_INDEX) {
// set the address using IP_MULTICAST_IF to make sure this
// works for both IPV4 and IPV6
- impl.setOption(SocketOptions.IP_MULTICAST_IF, InetAddress.ANY);
+ impl.setOption(SocketOptions.IP_MULTICAST_IF, Inet4Address.ANY);
try {
// we have the index so now we pass set the interface
diff --git a/luni/src/main/java/java/net/ServerSocket.java b/luni/src/main/java/java/net/ServerSocket.java
index 99fad3f..f9d5b22 100644
--- a/luni/src/main/java/java/net/ServerSocket.java
+++ b/luni/src/main/java/java/net/ServerSocket.java
@@ -84,7 +84,7 @@ public class ServerSocket {
* if an error occurs while creating the server socket.
*/
public ServerSocket(int aport) throws IOException {
- this(aport, defaultBacklog(), InetAddress.ANY);
+ this(aport, defaultBacklog(), Inet4Address.ANY);
}
/**
@@ -102,7 +102,7 @@ public class ServerSocket {
* if an error occurs while creating the server socket.
*/
public ServerSocket(int aport, int backlog) throws IOException {
- this(aport, backlog, InetAddress.ANY);
+ this(aport, backlog, Inet4Address.ANY);
}
/**
@@ -127,7 +127,7 @@ public class ServerSocket {
checkListen(aport);
impl = factory != null ? factory.createSocketImpl()
: new PlainServerSocketImpl();
- InetAddress addr = localAddr == null ? InetAddress.ANY : localAddr;
+ InetAddress addr = localAddr == null ? Inet4Address.ANY : localAddr;
synchronized (this) {
impl.create(true);
@@ -391,7 +391,7 @@ public class ServerSocket {
throw new BindException(Msg.getString("K0315")); //$NON-NLS-1$
}
int port = 0;
- InetAddress addr = InetAddress.ANY;
+ InetAddress addr = Inet4Address.ANY;
if (localAddr != null) {
if (!(localAddr instanceof InetSocketAddress)) {
throw new IllegalArgumentException(Msg.getString(
diff --git a/luni/src/main/java/java/net/Socket.java b/luni/src/main/java/java/net/Socket.java
index 71a1bf2..5289566 100644
--- a/luni/src/main/java/java/net/Socket.java
+++ b/luni/src/main/java/java/net/Socket.java
@@ -479,7 +479,7 @@ public class Socket {
*/
public InetAddress getLocalAddress() {
if (!isBound()) {
- return InetAddress.ANY;
+ return Inet4Address.ANY;
}
return Platform.getNetworkSystem().getSocketLocalAddress(impl.fd,
InetAddress.preferIPv6Addresses());
@@ -767,7 +767,7 @@ public class Socket {
throw new IllegalArgumentException(Msg.getString("K0046")); //$NON-NLS-1$
}
- InetAddress addr = localAddress == null ? InetAddress.ANY
+ InetAddress addr = localAddress == null ? Inet4Address.ANY
: localAddress;
synchronized (this) {
impl.create(streaming);
@@ -955,7 +955,7 @@ public class Socket {
}
int port = 0;
- InetAddress addr = InetAddress.ANY;
+ InetAddress addr = Inet4Address.ANY;
if (localAddr != null) {
if (!(localAddr instanceof InetSocketAddress)) {
throw new IllegalArgumentException(Msg.getString(
@@ -1047,7 +1047,7 @@ public class Socket {
// options on create
// impl.create(true);
if (!NetUtil.usingSocks(proxy)) {
- impl.bind(InetAddress.ANY, 0);
+ impl.bind(Inet4Address.ANY, 0);
}
isBound = true;
}
diff --git a/luni/src/main/java/java/util/Properties.java b/luni/src/main/java/java/util/Properties.java
index 79d7069..b0f3b9d 100644
--- a/luni/src/main/java/java/util/Properties.java
+++ b/luni/src/main/java/java/util/Properties.java
@@ -293,7 +293,10 @@ public class Properties extends Hashtable<Object, Object> {
char nextChar, buf[] = new char[40];
int offset = 0, keyLength = -1, intVal;
boolean firstChar = true;
- BufferedInputStream bis = new BufferedInputStream(in);
+
+ // BEGIN android-changed
+ BufferedInputStream bis = new BufferedInputStream(in, 8192);
+ // END android-changed
while (true) {
intVal = bis.read();
diff --git a/luni/src/main/native/org_apache_harmony_luni_platform_OSMemory.cpp b/luni/src/main/native/org_apache_harmony_luni_platform_OSMemory.cpp
index 3e31743..2e814cc 100644
--- a/luni/src/main/native/org_apache_harmony_luni_platform_OSMemory.cpp
+++ b/luni/src/main/native/org_apache_harmony_luni_platform_OSMemory.cpp
@@ -172,12 +172,10 @@ static void harmony_nio_putBytesImpl(JNIEnv *_env, jobject _this,
}
static void
-swapShorts(jshort *shorts, int numBytes) {
+swapShorts(jshort *shorts, int count) {
jbyte *src = (jbyte *) shorts;
jbyte *dst = src;
- int i;
-
- for (i = 0; i < numBytes; i+=2) {
+ for (int i = 0; i < count; ++i) {
jbyte b0 = *src++;
jbyte b1 = *src++;
*dst++ = b1;
@@ -186,11 +184,10 @@ swapShorts(jshort *shorts, int numBytes) {
}
static void
-swapInts(jint *ints, int numBytes) {
+swapInts(jint *ints, int count) {
jbyte *src = (jbyte *) ints;
jbyte *dst = src;
- int i;
- for (i = 0; i < numBytes; i+=4) {
+ for (int i = 0; i < count; ++i) {
jbyte b0 = *src++;
jbyte b1 = *src++;
jbyte b2 = *src++;
@@ -204,48 +201,30 @@ swapInts(jint *ints, int numBytes) {
/*
* Class: org_apache_harmony_luni_platform_OSMemory
- * Method: putShortsImpl
+ * Method: setShortArrayImpl
* Signature: (I[SIIZ)V
*/
-static void harmony_nio_putShortsImpl(JNIEnv *_env, jobject _this,
+static void harmony_nio_setShortArrayImpl(JNIEnv *_env, jobject _this,
jint pointer, jshortArray src, jint offset, jint length, jboolean swap) {
-
- offset = offset << 1;
- length = length << 1;
-
- jshort *src_ =
- (jshort *)_env->GetPrimitiveArrayCritical(src, (jboolean *)0);
- if (swap) {
- swapShorts(src_ + offset, length);
- }
- memcpy((jbyte *)pointer, (jbyte *)src_ + offset, length);
+ jshort* dst = reinterpret_cast<jshort*>(static_cast<uintptr_t>(pointer));
+ _env->GetShortArrayRegion(src, offset, length, dst);
if (swap) {
- swapShorts(src_ + offset, length);
+ swapShorts(dst, length);
}
- _env->ReleasePrimitiveArrayCritical(src, src_, JNI_ABORT);
}
/*
* Class: org_apache_harmony_luni_platform_OSMemory
- * Method: putIntsImpl
+ * Method: setIntArrayImpl
* Signature: (I[IIIZ)V
*/
-static void harmony_nio_putIntsImpl(JNIEnv *_env, jobject _this,
+static void harmony_nio_setIntArrayImpl(JNIEnv *_env, jobject _this,
jint pointer, jintArray src, jint offset, jint length, jboolean swap) {
-
- offset = offset << 2;
- length = length << 2;
-
- jint *src_ =
- (jint *)_env->GetPrimitiveArrayCritical(src, (jboolean *)0);
+ jint* dst = reinterpret_cast<jint*>(static_cast<uintptr_t>(pointer));
+ _env->GetIntArrayRegion(src, offset, length, dst);
if (swap) {
- swapInts(src_ + offset, length);
+ swapInts(dst, length);
}
- memcpy((jbyte *)pointer, (jbyte *)src_ + offset, length);
- if (swap) {
- swapInts(src_ + offset, length);
- }
- _env->ReleasePrimitiveArrayCritical(src, src_, JNI_ABORT);
}
/*
@@ -588,8 +567,8 @@ static JNINativeMethod gMethods[] = {
{ "memmove", "(IIJ)V", (void*) harmony_nio_memmove },
{ "getByteArray", "(I[BII)V",(void*) harmony_nio_getBytesImpl },
{ "setByteArray", "(I[BII)V",(void*) harmony_nio_putBytesImpl },
- { "setShortArray", "(I[SIIZ)V",(void*) harmony_nio_putShortsImpl },
- { "setIntArray", "(I[IIIZ)V",(void*) harmony_nio_putIntsImpl },
+ { "setShortArray", "(I[SIIZ)V",(void*) harmony_nio_setShortArrayImpl },
+ { "setIntArray", "(I[IIIZ)V",(void*) harmony_nio_setIntArrayImpl },
{ "getByte", "(I)B", (void*) harmony_nio_getByteImpl },
{ "setByte", "(IB)V", (void*) harmony_nio_putByteImpl },
{ "getShort", "(I)S", (void*) harmony_nio_getShortImpl },
@@ -653,4 +632,3 @@ int register_org_apache_harmony_luni_platform_OSMemory(JNIEnv *_env) {
"org/apache/harmony/luni/platform/OSMemory",
gMethods, NELEM(gMethods));
}
-
diff --git a/luni/src/main/native/org_apache_harmony_luni_platform_OSNetworkSystem.cpp b/luni/src/main/native/org_apache_harmony_luni_platform_OSNetworkSystem.cpp
index cce822a..22d1cd4 100644
--- a/luni/src/main/native/org_apache_harmony_luni_platform_OSNetworkSystem.cpp
+++ b/luni/src/main/native/org_apache_harmony_luni_platform_OSNetworkSystem.cpp
@@ -156,8 +156,9 @@
struct CachedFields {
jfieldID fd_descriptor;
jclass iaddr_class;
- jmethodID iaddr_class_init;
jmethodID iaddr_getbyaddress;
+ jclass i4addr_class;
+ jmethodID i4addr_class_init;
jfieldID iaddr_ipaddress;
jclass genericipmreq_class;
jclass integer_class;
@@ -1401,23 +1402,27 @@ static void osNetworkSystem_oneTimeInitializationImpl(JNIEnv* env, jobject obj,
// initializing InetAddress
jclass iaddrclass = env->FindClass("java/net/InetAddress");
-
if (iaddrclass == NULL) {
jniThrowException(env, "java/lang/ClassNotFoundException",
"java.net.InetAddress");
return;
}
-
gCachedFields.iaddr_class = (jclass) env->NewGlobalRef(iaddrclass);
- jmethodID iaddrclassinit = env->GetMethodID(iaddrclass, "<init>", "()V");
-
- if (iaddrclassinit == NULL) {
- jniThrowException(env, "java/lang/NoSuchMethodError", "InetAddress.<init>()");
+ jclass i4addrclass = env->FindClass("java/net/Inet4Address");
+ if (i4addrclass == NULL) {
+ jniThrowException(env, "java/lang/ClassNotFoundException",
+ "java.net.Inet4Address");
return;
}
+ gCachedFields.i4addr_class = (jclass) env->NewGlobalRef(i4addrclass);
- gCachedFields.iaddr_class_init = iaddrclassinit;
+ jmethodID i4addrclassinit = env->GetMethodID(i4addrclass, "<init>", "([B)V");
+ if (i4addrclassinit == NULL) {
+ jniThrowException(env, "java/lang/NoSuchMethodError", "Inet4Address.<init>(byte[])");
+ return;
+ }
+ gCachedFields.i4addr_class_init = i4addrclassinit;
jmethodID iaddrgetbyaddress = env->GetStaticMethodID(iaddrclass,
"getByAddress", "([B)Ljava/net/InetAddress;");
@@ -1431,13 +1436,11 @@ static void osNetworkSystem_oneTimeInitializationImpl(JNIEnv* env, jobject obj,
gCachedFields.iaddr_getbyaddress = iaddrgetbyaddress;
jfieldID iaddripaddress = env->GetFieldID(iaddrclass, "ipaddress", "[B");
-
if (iaddripaddress == NULL) {
jniThrowException(env, "java/lang/NoSuchFieldError",
"Can't find field InetAddress.ipaddress");
return;
}
-
gCachedFields.iaddr_ipaddress = iaddripaddress;
// get the GenericIPMreq class
@@ -3621,8 +3624,10 @@ static jobject osNetworkSystem_inheritedChannelImpl(JNIEnv* env, jobject obj) {
ntohs(local_addr.sin_port));
// new and set remote addr
- addr_object = env->NewObject(gCachedFields.iaddr_class,
- gCachedFields.iaddr_class_init);
+ addr_array = env->NewByteArray((jsize)4);
+ env->SetByteArrayRegion(addr_array, (jsize)0, (jsize)4, address);
+ addr_object = env->NewObject(gCachedFields.i4addr_class,
+ gCachedFields.i4addr_class_init, addr_array);
if (NULL == addr_object) {
goto clean;
}
@@ -3634,13 +3639,6 @@ static jobject osNetworkSystem_inheritedChannelImpl(JNIEnv* env, jobject obj) {
if (NULL == socketaddr_object) {
goto clean;
}
- addr_field = env->GetFieldID(socketaddr_class, "addr",
- "Ljava/net/InetAddress;");
- env->SetObjectField(socketaddr_object, addr_field, addr_object);
- addr_array = env->NewByteArray((jsize)4);
- env->SetByteArrayRegion(addr_array, (jsize)0, (jsize)4, address);
- env->SetObjectField(addr_object, gCachedFields.iaddr_ipaddress,
- addr_array);
// localAddr
socketaddr_class = env->FindClass("java/net/InetSocketAddress");
@@ -3650,9 +3648,11 @@ static jobject osNetworkSystem_inheritedChannelImpl(JNIEnv* env, jobject obj) {
socketaddr_field);
localAddr_field = env->GetFieldID(channel_class, "localAddress",
- "Ljava/net/InetAddress;");
- localAddr_object = env->NewObject(gCachedFields.iaddr_class,
- gCachedFields.iaddr_class_init);
+ "Ljava/net/Inet4Address;");
+ addr_array = env->NewByteArray((jsize)4);
+ env->SetByteArrayRegion(addr_array, (jsize)0, (jsize)4, localAddr);
+ localAddr_object = env->NewObject(gCachedFields.i4addr_class,
+ gCachedFields.i4addr_class_init, addr_array);
jfieldID socketaddr_field = env->GetFieldID(channel_class,
"connectAddress", "Ljava/net/InetSocketAddress;");
jobject socketaddr_object = env->GetObjectField(channel_object,
@@ -3662,10 +3662,6 @@ static jobject osNetworkSystem_inheritedChannelImpl(JNIEnv* env, jobject obj) {
if (NULL == localAddr_object) {
goto clean;
}
- addr_array = env->NewByteArray((jsize)4);
- env->SetByteArrayRegion(addr_array, (jsize)0, (jsize)4, localAddr);
- env->SetObjectField(localAddr_object, gCachedFields.iaddr_ipaddress,
- addr_array);
// set port
@@ -3720,8 +3716,10 @@ static jobject osNetworkSystem_inheritedChannelImpl(JNIEnv* env, jobject obj) {
localAddr_field = env->GetFieldID(channel_class, "localAddress",
"Ljava/net/InetAddress;");
- localAddr_object = env->NewObject(gCachedFields.iaddr_class,
- gCachedFields.iaddr_class_init);
+ memset(address, 0, 4);
+ env->SetByteArrayRegion(addr_array, (jsize)0, (jsize)4, address);
+ localAddr_object = env->NewObject(gCachedFields.i4addr_class,
+ gCachedFields.i4addr_class_init, addr_array);
if (NULL == localAddr_object) {
goto clean;
}
@@ -3768,8 +3766,10 @@ static jobject osNetworkSystem_inheritedChannelImpl(JNIEnv* env, jobject obj) {
env->SetIntField(channel_object, port_field, ntohs(local_addr.sin_port));
// new and set remote addr
+ addr_array = env->NewByteArray((jsize)4);
+ env->SetByteArrayRegion(addr_array, (jsize)0, (jsize)4, address);
addr_object = env->NewObject(gCachedFields.iaddr_class,
- gCachedFields.iaddr_class_init);
+ gCachedFields.i4addr_class_init, addr_array);
if (NULL == addr_object) {
goto clean;
}
@@ -3780,12 +3780,6 @@ static jobject osNetworkSystem_inheritedChannelImpl(JNIEnv* env, jobject obj) {
if (NULL == socketaddr_object) {
goto clean;
}
- addr_field = env->GetFieldID(socketaddr_class, "addr",
- "Ljava/net/InetAddress;");
- env->SetObjectField(socketaddr_object, addr_field, addr_object);
- addr_array = env->NewByteArray((jsize)4);
- env->SetByteArrayRegion(addr_array, (jsize)0, (jsize)4, address);
- env->SetObjectField(addr_object, gCachedFields.iaddr_ipaddress, addr_array);
// set bound
if (0 != local_addr.sin_port) {
diff --git a/luni/src/test/java/org/apache/harmony/luni/platform/AllTests.java b/luni/src/test/java/org/apache/harmony/luni/platform/AllTests.java
new file mode 100644
index 0000000..be28d41
--- /dev/null
+++ b/luni/src/test/java/org/apache/harmony/luni/platform/AllTests.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.apache.harmony.luni.platform;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+public class AllTests {
+ public static void run() {
+ TestRunner.main(new String[] { AllTests.class.getName() });
+ }
+
+ public static final Test suite() {
+ TestSuite suite = tests.TestSuiteFactory.createTestSuite("Tests for org.apache.harmony.luni.platform");
+
+ suite.addTestSuite(OSMemoryTest.class);
+
+ return suite;
+ }
+}
diff --git a/luni/src/test/java/org/apache/harmony/luni/platform/OSMemoryTest.java b/luni/src/test/java/org/apache/harmony/luni/platform/OSMemoryTest.java
new file mode 100644
index 0000000..a546289
--- /dev/null
+++ b/luni/src/test/java/org/apache/harmony/luni/platform/OSMemoryTest.java
@@ -0,0 +1,164 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.apache.harmony.luni.platform;
+
+import dalvik.annotation.TestLevel;
+import dalvik.annotation.TestTargetNew;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.AndroidOnly;
+
+import junit.framework.TestCase;
+
+/**
+ * Tests org.apache.harmony.luni.platform.OSMemory (via IMemorySystem).
+ */
+@TestTargetClass(org.apache.harmony.luni.platform.OSMemory.class)
+public class OSMemoryTest extends TestCase {
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "",
+ method = "memset",
+ args = {}
+ )
+ public void testMemset() {
+ IMemorySystem memory = Platform.getMemorySystem();
+
+ int byteCount = 32;
+ int ptr = memory.malloc(byteCount);
+ try {
+ // Ensure our newly-allocated block isn't zeroed.
+ memory.setByte(ptr, (byte) 1);
+ assertEquals((byte) 1, memory.getByte(ptr));
+ // Check that we can clear memory.
+ memory.memset(ptr, (byte) 0, byteCount);
+ assertBytesEqual((byte) 0, ptr, byteCount);
+ // Check that we can set an arbitrary value.
+ memory.memset(ptr, (byte) 1, byteCount);
+ assertBytesEqual((byte) 1, ptr, byteCount);
+ } finally {
+ memory.free(ptr);
+ }
+ }
+
+ void assertBytesEqual(byte value, int ptr, int byteCount) {
+ IMemorySystem memory = Platform.getMemorySystem();
+ for (int i = 0; i < byteCount; ++i) {
+ assertEquals(value, memory.getByte(ptr + i));
+ }
+ }
+
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "",
+ method = "setIntArray",
+ args = {}
+ )
+ public void testSetIntArray() {
+ IMemorySystem memory = Platform.getMemorySystem();
+
+ int[] values = { 3, 7, 31, 127, 8191, 131071, 524287, 2147483647 };
+ int[] swappedValues = new int[values.length];
+ for (int i = 0; i < values.length; ++i) {
+ swappedValues[i] = swapInt(values[i]);
+ }
+
+ int scale = ICommonDataTypes.SIZEOF_JINT;
+ int ptr = memory.malloc(scale * values.length);
+ try {
+ // Regular copy. Memset first so we start from a known state.
+ memory.memset(ptr, (byte) 0, scale * values.length);
+ memory.setIntArray(ptr, values, 0, values.length, false);
+ assertIntsEqual(values, ptr);
+
+ // Swapped copy.
+ memory.memset(ptr, (byte) 0, scale * values.length);
+ memory.setIntArray(ptr, values, 0, values.length, true);
+ assertIntsEqual(swappedValues, ptr);
+
+ // Swapped copies of slices (to ensure we test non-zero offsets).
+ memory.memset(ptr, (byte) 0, scale * values.length);
+ for (int i = 0; i < values.length; ++i) {
+ memory.setIntArray(ptr + i * scale, values, i, 1, true);
+ }
+ assertIntsEqual(swappedValues, ptr);
+ } finally {
+ memory.free(ptr);
+ }
+ }
+
+ private void assertIntsEqual(int[] expectedValues, int ptr) {
+ IMemorySystem memory = Platform.getMemorySystem();
+ for (int i = 0; i < expectedValues.length; ++i) {
+ assertEquals(expectedValues[i], memory.getInt(ptr + ICommonDataTypes.SIZEOF_JINT * i));
+ }
+ }
+
+ private static int swapInt(int n) {
+ return (((n >> 0) & 0xff) << 24) |
+ (((n >> 8) & 0xff) << 16) |
+ (((n >> 16) & 0xff) << 8) |
+ (((n >> 24) & 0xff) << 0);
+ }
+
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "",
+ method = "setShortArray",
+ args = {}
+ )
+ public void testSetShortArray() {
+ IMemorySystem memory = Platform.getMemorySystem();
+
+ short[] values = { 0x0001, 0x0020, 0x0300, 0x4000 };
+ short[] swappedValues = { 0x0100, 0x2000, 0x0003, 0x0040 };
+
+ int scale = ICommonDataTypes.SIZEOF_JSHORT;
+ int ptr = memory.malloc(scale * values.length);
+ try {
+ // Regular copy. Memset first so we start from a known state.
+ memory.memset(ptr, (byte) 0, scale * values.length);
+ memory.setShortArray(ptr, values, 0, values.length, false);
+ assertShortsEqual(values, ptr);
+
+ // Swapped copy.
+ memory.memset(ptr, (byte) 0, scale * values.length);
+ memory.setShortArray(ptr, values, 0, values.length, true);
+ assertShortsEqual(swappedValues, ptr);
+
+ // Swapped copies of slices (to ensure we test non-zero offsets).
+ memory.memset(ptr, (byte) 0, scale * values.length);
+ for (int i = 0; i < values.length; ++i) {
+ memory.setShortArray(ptr + i * scale, values, i, 1, true);
+ }
+ assertShortsEqual(swappedValues, ptr);
+ } finally {
+ memory.free(ptr);
+ }
+ }
+
+ private void assertShortsEqual(short[] expectedValues, int ptr) {
+ IMemorySystem memory = Platform.getMemorySystem();
+ for (int i = 0; i < expectedValues.length; ++i) {
+ assertEquals(expectedValues[i], memory.getShort(ptr + ICommonDataTypes.SIZEOF_JSHORT * i));
+ }
+ }
+
+ private static short swapShort(short n) {
+ return (short) ((((n >> 0) & 0xff) << 8) | (((n >> 8) & 0xff) << 0));
+ }
+}
diff --git a/luni/src/test/java/org/apache/harmony/luni/tests/java/net/Inet4AddressTest.java b/luni/src/test/java/org/apache/harmony/luni/tests/java/net/Inet4AddressTest.java
index 163db31..920f137 100644
--- a/luni/src/test/java/org/apache/harmony/luni/tests/java/net/Inet4AddressTest.java
+++ b/luni/src/test/java/org/apache/harmony/luni/tests/java/net/Inet4AddressTest.java
@@ -17,6 +17,7 @@
package org.apache.harmony.luni.tests.java.net;
+import dalvik.annotation.KnownFailure;
import dalvik.annotation.TestTargetClass;
import dalvik.annotation.TestTargets;
import dalvik.annotation.TestLevel;
@@ -483,6 +484,12 @@ public class Inet4AddressTest extends junit.framework.TestCase {
method = "equals",
args = {java.lang.Object.class}
)
+ @KnownFailure("127.0.0 is not recognized as a valid IP address. " +
+ "Unfortunately, despite the fact that these IP address formats " +
+ "have been the cause of numerous phishing and security " +
+ "vulnerabilities in the past, and most other languages refuse " +
+ "them, the RI documentation explicitly specifies that they are " +
+ "supported. Fix the code to support these.")
public void test_equals() throws Exception {
InetAddress addr = Inet4Address.getByName("239.191.255.255");
assertTrue(addr.equals(addr));
@@ -501,6 +508,7 @@ public class Inet4AddressTest extends junit.framework.TestCase {
method = "getHostAddress",
args = {}
)
+ @KnownFailure("1, 1.1 and 1.1.1 are not recognized as valid IP addresses.")
public void test_getHostAddress() throws Exception {
InetAddress addr = Inet4Address.getByName("localhost");
assertEquals("127.0.0.1", addr.getHostAddress());
@@ -527,6 +535,7 @@ public class Inet4AddressTest extends junit.framework.TestCase {
method = "hashCode",
args = {}
)
+ @KnownFailure("1.1 and 1.1.1 are not recognized as valid IP addresses.")
public void test_hashCode() throws Exception {
InetAddress addr1 = Inet4Address.getByName("1.1");
InetAddress addr2 = Inet4Address.getByName("1.1.1");
diff --git a/luni/src/test/java/org/apache/harmony/luni/tests/java/net/Inet6AddressTest.java b/luni/src/test/java/org/apache/harmony/luni/tests/java/net/Inet6AddressTest.java
index 498c486..62952d9 100644
--- a/luni/src/test/java/org/apache/harmony/luni/tests/java/net/Inet6AddressTest.java
+++ b/luni/src/test/java/org/apache/harmony/luni/tests/java/net/Inet6AddressTest.java
@@ -17,6 +17,7 @@
package org.apache.harmony.luni.tests.java.net;
+import dalvik.annotation.KnownFailure;
import dalvik.annotation.TestTargetClass;
import dalvik.annotation.TestLevel;
import dalvik.annotation.TestTargetNew;
@@ -1152,6 +1153,12 @@ public class Inet6AddressTest extends junit.framework.TestCase {
method = "equals",
args = {java.lang.Object.class}
)
+ @KnownFailure("127.0.0 is not recognized as a valid IP address. " +
+ "Unfortunately, despite the fact that these IP address formats " +
+ "have been the cause of numerous phishing and security " +
+ "vulnerabilities in the past, and most other languages refuse " +
+ "them, the RI documentation explicitly specifies that they are " +
+ "supported. Fix the code to support these.")
public void test_equals() throws Exception {
InetAddress addr = Inet6Address.getByName("239.191.255.255");
assertTrue(addr.equals(addr));
@@ -1170,6 +1177,7 @@ public class Inet6AddressTest extends junit.framework.TestCase {
method = "getHostAddress",
args = {}
)
+ @KnownFailure("1, 1.1 and 1.1.1 are not recognized as valid IP addresses.")
public void test_getHostAddress() throws Exception {
InetAddress aAddr = Inet6Address.getByName("localhost");
assertEquals("127.0.0.1", aAddr.getHostAddress());
@@ -1230,6 +1238,7 @@ public class Inet6AddressTest extends junit.framework.TestCase {
method = "hashCode",
args = {}
)
+ @KnownFailure("1.1 and 1.1.1 are not recognized as valid IP addresses.")
public void test_hashCode() throws Exception {
InetAddress addr1 = Inet6Address.getByName("1.1");
InetAddress addr2 = Inet6Address.getByName("1.1.1");
diff --git a/luni/src/test/java/org/apache/harmony/luni/tests/java/net/InetAddressTest.java b/luni/src/test/java/org/apache/harmony/luni/tests/java/net/InetAddressTest.java
index fa7dd26..5c8808c 100644
--- a/luni/src/test/java/org/apache/harmony/luni/tests/java/net/InetAddressTest.java
+++ b/luni/src/test/java/org/apache/harmony/luni/tests/java/net/InetAddressTest.java
@@ -18,6 +18,7 @@
package org.apache.harmony.luni.tests.java.net;
import dalvik.annotation.BrokenTest;
+import dalvik.annotation.KnownFailure;
import dalvik.annotation.TestTargetClass;
import dalvik.annotation.TestTargets;
import dalvik.annotation.TestLevel;
@@ -228,11 +229,14 @@ public class InetAddressTest extends junit.framework.TestCase {
System.setSecurityManager(oldman);
}
- //Regression for HARMONY-56
- InetAddress[] ia = InetAddress.getAllByName(null);
- assertEquals("Assert 0: No loopback address", 1, ia.length);
- assertTrue("Assert 1: getAllByName(null) not loopback",
- ia[0].isLoopbackAddress());
+ // Regression for HARMONY-56
+ InetAddress[] addresses = InetAddress.getAllByName(null);
+ assertTrue("getAllByName(null): no results", addresses.length > 0);
+ for (int i = 0; i < addresses.length; i++) {
+ InetAddress address = addresses[i];
+ assertTrue("Assert 1: getAllByName(null): " + address +
+ " is not loopback", address.isLoopbackAddress());
+ }
try {
InetAddress.getAllByName("unknown.host");
@@ -251,6 +255,12 @@ public class InetAddressTest extends junit.framework.TestCase {
method = "getByName",
args = {java.lang.String.class}
)
+ @KnownFailure("1.2.3 and 1.2 are not recognized as valid IPv4 addresses. " +
+ "Unfortunately, despite the fact that these IP address formats " +
+ "have been the cause of numerous phishing and security " +
+ "vulnerabilities in the past, and most other languages refuse " +
+ "them, the RI documentation explicitly specifies that they are " +
+ "supported. Fix the code to support these.")
public void test_getByNameLjava_lang_String() throws Exception {
// Test for method java.net.InetAddress
// java.net.InetAddress.getByName(java.lang.String)
@@ -469,6 +479,10 @@ public class InetAddressTest extends junit.framework.TestCase {
}
}
+ static final int TEST_IP_HASHCODE = 2130706433;
+ static final int TEST_IP6_HASHCODE = -1022939537;
+ static final int TEST_IP6_LO_HASHCODE = 1353309698;
+
/**
* @tests java.net.InetAddress#hashCode()
*/
@@ -478,17 +492,28 @@ public class InetAddressTest extends junit.framework.TestCase {
method = "hashCode",
args = {}
)
- public void test_hashCode() {
- // Test for method int java.net.InetAddress.hashCode()
+ void assertHashCode(String literal, int expectedHashCode) {
+ InetAddress host = null;
try {
- InetAddress host = InetAddress
- .getByName(Support_Configuration.InetTestAddress);
- int hashcode = host.hashCode();
- assertTrue("Incorrect hash returned: " + hashcode + " from host: "
- + host, hashcode == Support_Configuration.InetTestHashcode);
- } catch (java.net.UnknownHostException e) {
- fail("Exception during test : " + e.getMessage());
+ host = InetAddress.getByName(literal);
+ } catch(UnknownHostException e) {
+ fail("Exception during hashCode test : " + e.getMessage());
}
+ int hashCode = host.hashCode();
+ assertEquals("incorrect hashCode for " + host, expectedHashCode,
+ hashCode);
+ }
+
+ public void test_hashCode() {
+ // Test for method int java.net.InetAddress.hashCode()
+ // Create InetAddresses from string literals instead of from hostnames
+ // because we are only testing hashCode, not getByName. That way the
+ // test does not depend on name resolution and we can test many
+ // different addresses, not just localhost.
+ assertHashCode(Support_Configuration.InetTestIP, TEST_IP_HASHCODE);
+ assertHashCode(Support_Configuration.InetTestIP6, TEST_IP6_HASHCODE);
+ assertHashCode(Support_Configuration.InetTestIP6LO,
+ TEST_IP6_LO_HASHCODE);
}
/**
@@ -503,9 +528,18 @@ public class InetAddressTest extends junit.framework.TestCase {
public void test_isMulticastAddress() {
// Test for method boolean java.net.InetAddress.isMulticastAddress()
try {
+ InetAddress ia1 = InetAddress.getByName("ff02::1");
+ assertTrue("isMulticastAddress returned incorrect result", ia1
+ .isMulticastAddress());
InetAddress ia2 = InetAddress.getByName("239.255.255.255");
assertTrue("isMulticastAddress returned incorrect result", ia2
.isMulticastAddress());
+ InetAddress ia3 = InetAddress.getByName("fefb::");
+ assertFalse("isMulticastAddress returned incorrect result", ia3
+ .isMulticastAddress());
+ InetAddress ia4 = InetAddress.getByName("10.0.0.1");
+ assertFalse("isMulticastAddress returned incorrect result", ia4
+ .isMulticastAddress());
} catch (Exception e) {
fail("Exception during isMulticastAddress test : " + e.getMessage());
}
diff --git a/luni/src/test/java/tests/AllTests.java b/luni/src/test/java/tests/AllTests.java
index 26e58c1..893cdf0 100644
--- a/luni/src/test/java/tests/AllTests.java
+++ b/luni/src/test/java/tests/AllTests.java
@@ -54,6 +54,8 @@ public class AllTests
suite.addTest(tests.xml.AllTests.suite());
suite.addTest(tests.xnet.AllTests.suite());
+ suite.addTest(org.apache.harmony.luni.platform.AllTests.suite());
+
return suite;
}
}
diff --git a/prefs/src/main/java/java/util/prefs/AbstractPreferences.java b/prefs/src/main/java/java/util/prefs/AbstractPreferences.java
index 711cc01..3264569 100644
--- a/prefs/src/main/java/java/util/prefs/AbstractPreferences.java
+++ b/prefs/src/main/java/java/util/prefs/AbstractPreferences.java
@@ -20,6 +20,7 @@ package java.util.prefs;
import java.io.IOException;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
+import java.util.Collection;
import java.util.EventListener;
import java.util.EventObject;
import java.util.HashMap;
@@ -27,7 +28,6 @@ import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
-import java.util.StringTokenizer;
import java.util.TreeSet;
import org.apache.harmony.luni.util.Base64;
@@ -38,8 +38,9 @@ import org.apache.harmony.prefs.internal.nls.Messages;
* Preferences, which can be used to simplify {@code Preferences} provider's
* implementation. This class defines nine abstract SPI methods, which must be
* implemented by a preference provider.
- *
- * @since Android 1.0
+ *
+ * @since 1.4
+ * @see Preferences
*/
public abstract class AbstractPreferences extends Preferences {
/*
@@ -47,14 +48,9 @@ public abstract class AbstractPreferences extends Preferences {
* Class fields
* -----------------------------------------------------------
*/
- /**
- * The unhandled events collection.
- */
+ /** the unhandled events collection */
private static final List<EventObject> events = new LinkedList<EventObject>();
-
- /**
- * The event dispatcher thread.
- */
+ /** the event dispatcher thread */
private static final EventDispatcher dispatcher = new EventDispatcher("Preference Event Dispatcher"); //$NON-NLS-1$
/*
@@ -72,11 +68,13 @@ public abstract class AbstractPreferences extends Preferences {
Preferences sroot = Preferences.systemRoot();
try {
uroot.flush();
- } catch (BackingStoreException e) {//ignore
+ } catch (BackingStoreException e) {
+ // ignore
}
try {
sroot.flush();
- } catch (BackingStoreException e) {//ignore
+ } catch (BackingStoreException e) {
+ // ignore
}
}
});
@@ -87,9 +85,7 @@ public abstract class AbstractPreferences extends Preferences {
* Instance fields (package-private)
* -----------------------------------------------------------
*/
- /**
- * True, if this node is in user preference hierarchy.
- */
+ /** true if this node is in user preference hierarchy */
boolean userNode;
/*
@@ -97,16 +93,11 @@ public abstract class AbstractPreferences extends Preferences {
* Instance fields (private)
* -----------------------------------------------------------
*/
- /**
- * Marker class for 'lock' field.
- */
- private static class Lock {
- }
+ /** Marker class for 'lock' field. */
+ private static class Lock {}
/**
* The object used to lock this node.
- *
- * @since Android 1.0
*/
protected final Object lock;
@@ -115,14 +106,10 @@ public abstract class AbstractPreferences extends Preferences {
* backing store. This field's default value is false, and it is checked
* when the node creation is completed, and if it is true, the node change
* event will be fired for this node's parent.
- *
- * @since Android 1.0
*/
protected boolean newNode;
- /**
- * Cached child nodes
- */
+ /** cached child nodes */
private Map<String, AbstractPreferences> cachedNode;
//the collections of listeners
@@ -147,9 +134,9 @@ public abstract class AbstractPreferences extends Preferences {
* -----------------------------------------------------------
*/
/**
- * Constructs a new {@code AbstractPreferences} instance using the given parent node
- * and node name.
- *
+ * Constructs a new {@code AbstractPreferences} instance using the given
+ * parent node and node name.
+ *
* @param parent
* the parent node of the new node or {@code null} to indicate
* that the new node is a root node.
@@ -159,7 +146,6 @@ public abstract class AbstractPreferences extends Preferences {
* @throws IllegalArgumentException
* if the name contains a slash character or is empty if {@code
* parent} is not {@code null}.
- * @since Android 1.0
*/
protected AbstractPreferences(AbstractPreferences parent, String name) {
if ((null == parent ^ name.length() == 0) || name.indexOf("/") >= 0) { //$NON-NLS-1$
@@ -185,7 +171,6 @@ public abstract class AbstractPreferences extends Preferences {
* Returns an array of all cached child nodes.
*
* @return the array of cached child nodes.
- * @since Android 1.0
*/
protected final AbstractPreferences[] cachedChildren() {
return cachedNode.values().toArray(new AbstractPreferences[cachedNode.size()]);
@@ -193,9 +178,10 @@ public abstract class AbstractPreferences extends Preferences {
/**
* Returns the child node with the specified name or {@code null} if it
- * doesn't exist. Implementers can assume that the name supplied to this method
- * will be a valid node name string (conforming to the node naming format) and
- * will not correspond to a node that has been cached or removed.
+ * doesn't exist. Implementers can assume that the name supplied to this
+ * method will be a valid node name string (conforming to the node naming
+ * format) and will not correspond to a node that has been cached or
+ * removed.
*
* @param name
* the name of the desired child node.
@@ -204,7 +190,6 @@ public abstract class AbstractPreferences extends Preferences {
* @throws BackingStoreException
* if the backing store is unavailable or causes an operation
* failure.
- * @since Android 1.0
*/
protected AbstractPreferences getChild(String name)
throws BackingStoreException {
@@ -226,10 +211,9 @@ public abstract class AbstractPreferences extends Preferences {
/**
* Returns whether this node has been removed by invoking the method {@code
* removeNode()}.
- *
+ *
* @return {@code true}, if this node has been removed, {@code false}
* otherwise.
- * @since Android 1.0
*/
protected boolean isRemoved() {
synchronized (lock) {
@@ -240,33 +224,31 @@ public abstract class AbstractPreferences extends Preferences {
/**
* Flushes changes of this node to the backing store. This method should
* only flush this node and should not include the descendant nodes. Any
- * implementation that wants to provide functionality to flush all nodes
+ * implementation that wants to provide functionality to flush all nodes
* at once should override the method {@link #flush() flush()}.
- *
+ *
* @throws BackingStoreException
* if the backing store is unavailable or causes an operation
* failure.
- * @since Android 1.0
*/
protected abstract void flushSpi() throws BackingStoreException;
/**
- * Returns the names of all of the child nodes of this node or an empty array if
- * this node has no children. The names of cached children are not required to be
- * returned.
- *
+ * Returns the names of all of the child nodes of this node or an empty
+ * array if this node has no children. The names of cached children are not
+ * required to be returned.
+ *
* @return the names of this node's children.
* @throws BackingStoreException
* if the backing store is unavailable or causes an operation
* failure.
- * @since Android 1.0
*/
protected abstract String[] childrenNamesSpi() throws BackingStoreException;
/**
* Returns the child preference node with the given name, creating it
* if it does not exist. The caller of this method should ensure that the
- * given name is valid and that this node has not been removed or cached.
+ * given name is valid and that this node has not been removed or cached.
* If the named node has just been removed, the implementation
* of this method must create a new one instead of reactivating the removed
* one.
@@ -278,7 +260,6 @@ public abstract class AbstractPreferences extends Preferences {
* @param name
* the name of the child preference to be returned.
* @return the child preference node.
- * @since Android 1.0
*/
protected abstract AbstractPreferences childSpi(String name);
@@ -287,39 +268,37 @@ public abstract class AbstractPreferences extends Preferences {
* Puts the given key-value pair into this node. Caller of this method
* should ensure that both of the given values are valid and that this
* node has not been removed.
- *
+ *
* @param name
* the given preference key.
* @param value
* the given preference value.
- * @since Android 1.0
*/
protected abstract void putSpi(String name, String value);
/**
- * Gets the preference value mapped to the given key. The caller of this method
- * should ensure that the given key is valid and that this node has not been
- * removed. This method should not throw any exceptions but if it does, the
- * caller will ignore the exception, regarding it as a {@code null} return value.
- *
+ * Gets the preference value mapped to the given key. The caller of this
+ * method should ensure that the given key is valid and that this node has
+ * not been removed. This method should not throw any exceptions but if it
+ * does, the caller will ignore the exception, regarding it as a {@code
+ * null} return value.
+ *
* @param key
* the given key to be searched for.
* @return the preference value mapped to the given key.
- * @since Android 1.0
*/
protected abstract String getSpi(String key);
/**
* Returns an array of all preference keys of this node or an empty array if
- * no preferences have been found. The caller of this method should ensure that
- * this node has not been removed.
- *
+ * no preferences have been found. The caller of this method should ensure
+ * that this node has not been removed.
+ *
* @return the array of all preference keys.
* @throws BackingStoreException
* if the backing store is unavailable or causes an operation
* failure.
- * @since Android 1.0
*/
protected abstract String[] keysSpi() throws BackingStoreException;
@@ -329,11 +308,10 @@ public abstract class AbstractPreferences extends Preferences {
* method {@link Preferences#removeNode() Preferences.removeNode()} should
* invoke this method multiple-times in bottom-up pattern. The removal is
* not required to be persisted until after it is flushed.
- *
+ *
* @throws BackingStoreException
* if the backing store is unavailable or causes an operation
* failure.
- * @since Android 1.0
*/
protected abstract void removeNodeSpi() throws BackingStoreException;
@@ -344,20 +322,18 @@ public abstract class AbstractPreferences extends Preferences {
*
* @param key
* the key of the preference that is to be removed.
- * @since Android 1.0
*/
protected abstract void removeSpi(String key);
/**
* Synchronizes this node with the backing store. This method should only
* synchronize this node and should not include the descendant nodes. An
- * implementation that wants to provide functionality to synchronize all nodes at once should
- * override the method {@link #sync() sync()}.
+ * implementation that wants to provide functionality to synchronize all
+ * nodes at once should override the method {@link #sync() sync()}.
*
* @throws BackingStoreException
* if the backing store is unavailable or causes an operation
* failure.
- * @since Android 1.0
*/
protected abstract void syncSpi() throws BackingStoreException;
@@ -385,7 +361,7 @@ public abstract class AbstractPreferences extends Preferences {
for (int i = 0; i < names.length; i++) {
result.add(names[i]);
}
- return result.toArray(new String[0]);
+ return result.toArray(new String[result.size()]);
}
}
@@ -439,13 +415,13 @@ public abstract class AbstractPreferences extends Preferences {
if (key == null) {
throw new NullPointerException();
}
- String result;
+ String result = null;
synchronized (lock) {
checkState();
try {
result = getSpi(key);
} catch (Exception e) {
- result = null;
+ // ignored
}
}
return (result == null ? deflt : result);
@@ -456,9 +432,10 @@ public abstract class AbstractPreferences extends Preferences {
String result = get(key, null);
if (result == null) {
return deflt;
- } else if (result.equalsIgnoreCase("true")) { //$NON-NLS-1$
+ }
+ if ("true".equalsIgnoreCase(result)) { //$NON-NLS-1$
return true;
- } else if (result.equalsIgnoreCase("false")) { //$NON-NLS-1$
+ } else if ("false".equalsIgnoreCase(result)) { //$NON-NLS-1$
return false;
} else {
return deflt;
@@ -474,17 +451,15 @@ public abstract class AbstractPreferences extends Preferences {
if (svalue.length() == 0) {
return new byte[0];
}
- byte[] dres;
try {
byte[] bavalue = svalue.getBytes("US-ASCII"); //$NON-NLS-1$
if (bavalue.length % 4 != 0) {
return deflt;
}
- dres = Base64.decode(bavalue);
+ return Base64.decode(bavalue);
} catch (Exception e) {
- dres = deflt;
+ return deflt;
}
- return dres;
}
@Override
@@ -493,13 +468,11 @@ public abstract class AbstractPreferences extends Preferences {
if (result == null) {
return deflt;
}
- double dres;
try {
- dres = Double.parseDouble(result);
+ return Double.parseDouble(result);
} catch (NumberFormatException e) {
- dres = deflt;
+ return deflt;
}
- return dres;
}
@Override
@@ -508,13 +481,11 @@ public abstract class AbstractPreferences extends Preferences {
if (result == null) {
return deflt;
}
- float fres;
try {
- fres = Float.parseFloat(result);
+ return Float.parseFloat(result);
} catch (NumberFormatException e) {
- fres = deflt;
+ return deflt;
}
- return fres;
}
@Override
@@ -523,13 +494,11 @@ public abstract class AbstractPreferences extends Preferences {
if (result == null) {
return deflt;
}
- int ires;
try {
- ires = Integer.parseInt(result);
+ return Integer.parseInt(result);
} catch (NumberFormatException e) {
- ires = deflt;
+ return deflt;
}
- return ires;
}
@Override
@@ -538,13 +507,11 @@ public abstract class AbstractPreferences extends Preferences {
if (result == null) {
return deflt;
}
- long lres;
try {
- lres = Long.parseLong(result);
+ return Long.parseLong(result);
} catch (NumberFormatException e) {
- lres = deflt;
+ return deflt;
}
- return lres;
}
@Override
@@ -583,42 +550,44 @@ public abstract class AbstractPreferences extends Preferences {
startNode = this;
}
}
- Preferences result = null;
try {
- result = startNode.nodeImpl(name, true);
+ return startNode.nodeImpl(name, true);
} catch (BackingStoreException e) {
- //should not happen
+ // should not happen
+ return null;
}
- return result;
}
private void validateName(String name) {
if (name.endsWith("/") && name.length() > 1) { //$NON-NLS-1$
// prefs.6=Name cannot end with '/'\!
- throw new IllegalArgumentException(Messages.getString("prefs.6")); //$NON-NLS-1$
+ throw new IllegalArgumentException(Messages.getString("prefs.6")); //$NON-NLS-1$
}
if (name.indexOf("//") >= 0) { //$NON-NLS-1$
// prefs.7=Name cannot contains consecutive '/'\!
- throw new IllegalArgumentException(
- Messages.getString("prefs.7")); //$NON-NLS-1$
+ throw new IllegalArgumentException(Messages.getString("prefs.7")); //$NON-NLS-1$
}
}
private AbstractPreferences nodeImpl(String path, boolean createNew)
throws BackingStoreException {
- StringTokenizer st = new StringTokenizer(path, "/"); //$NON-NLS-1$
+ String[] names = path.split("/");//$NON-NLS-1$
AbstractPreferences currentNode = this;
AbstractPreferences temp = null;
- while (st.hasMoreTokens() && null != currentNode) {
- String name = st.nextToken();
- synchronized (currentNode.lock) {
- temp = currentNode.cachedNode.get(name);
- if (temp == null) {
- temp = getNodeFromBackend(createNew, currentNode, name);
+ if (null != currentNode) {
+ for (int i = 0; i < names.length; i++) {
+ String name = names[i];
+ synchronized (currentNode.lock) {
+ temp = currentNode.cachedNode.get(name);
+ if (temp == null) {
+ temp = getNodeFromBackend(createNew, currentNode, name);
+ }
+ }
+ currentNode = temp;
+ if (null == currentNode) {
+ break;
}
}
-
- currentNode = temp;
}
return currentNode;
}
@@ -626,12 +595,12 @@ public abstract class AbstractPreferences extends Preferences {
private AbstractPreferences getNodeFromBackend(boolean createNew,
AbstractPreferences currentNode, String name)
throws BackingStoreException {
- AbstractPreferences temp;
if (name.length() > MAX_NAME_LENGTH) {
// prefs.8=Name length is too long: {0}
- throw new IllegalArgumentException(Messages.getString("prefs.8", //$NON-NLS-1$
+ throw new IllegalArgumentException(Messages.getString("prefs.8", //$NON-NLS-1$
name));
}
+ AbstractPreferences temp;
if (createNew) {
temp = currentNode.childSpi(name);
currentNode.cachedNode.put(name, temp);
@@ -646,6 +615,9 @@ public abstract class AbstractPreferences extends Preferences {
@Override
public boolean nodeExists(String name) throws BackingStoreException {
+ if (null == name) {
+ throw new NullPointerException();
+ }
AbstractPreferences startNode = null;
synchronized (lock) {
if (isRemoved()) {
@@ -771,10 +743,11 @@ public abstract class AbstractPreferences extends Preferences {
cachedNode.put(childrenNames[i], child);
}
}
- AbstractPreferences[] children = cachedNode
- .values().toArray(new AbstractPreferences[0]);
- for (int i = 0; i < children.length; i++) {
- children[i].removeNodeImpl();
+
+ final Collection<AbstractPreferences> values = cachedNode.values();
+ final AbstractPreferences[] children = values.toArray(new AbstractPreferences[values.size()]);
+ for (AbstractPreferences child : children) {
+ child.removeNodeImpl();
}
removeNodeSpi();
isRemoved = true;
diff --git a/prefs/src/main/java/java/util/prefs/BackingStoreException.java b/prefs/src/main/java/java/util/prefs/BackingStoreException.java
index e8a805c..553d7ab 100644
--- a/prefs/src/main/java/java/util/prefs/BackingStoreException.java
+++ b/prefs/src/main/java/java/util/prefs/BackingStoreException.java
@@ -17,40 +17,35 @@
package java.util.prefs;
-
/**
* An exception to indicate that an error was encountered while accessing the
* backing store.
- *
- * @since Android 1.0
+ *
+ * @since 1.4
*/
public class BackingStoreException extends Exception {
-
+
private static final long serialVersionUID = 859796500401108469L;
-
+
/**
- * Constructs a new {@code BackingStoreException} instance with a detailed exception
- * message.
+ * Constructs a new {@code BackingStoreException} instance with a detailed
+ * exception message.
*
* @param s
* the detailed exception message.
- * @since Android 1.0
*/
public BackingStoreException (String s) {
super(s);
}
/**
- * Constructs a new {@code BackingStoreException} instance with a nested {@code Throwable}.
- *
+ * Constructs a new {@code BackingStoreException} instance with a nested
+ * {@code Throwable}.
+ *
* @param t
* the nested {@code Throwable}.
- * @since Android 1.0
*/
public BackingStoreException (Throwable t) {
super(t);
}
}
-
-
-
diff --git a/prefs/src/main/java/java/util/prefs/FilePreferencesFactoryImpl.java b/prefs/src/main/java/java/util/prefs/FilePreferencesFactoryImpl.java
index cc68e62..69eaa01 100644
--- a/prefs/src/main/java/java/util/prefs/FilePreferencesFactoryImpl.java
+++ b/prefs/src/main/java/java/util/prefs/FilePreferencesFactoryImpl.java
@@ -17,10 +17,10 @@
package java.util.prefs;
/**
- * The default implementation of <code>PreferencesFactory</code> for the Linux
+ * The default implementation of <code>PreferencesFactory</code> for the Linux
* platform, using the file system as its back end.
- *
- * @since Android 1.0
+ *
+ * @since 1.4
*/
class FilePreferencesFactoryImpl implements PreferencesFactory {
// user root preferences
diff --git a/prefs/src/main/java/java/util/prefs/FilePreferencesImpl.java b/prefs/src/main/java/java/util/prefs/FilePreferencesImpl.java
index cf85fa0..f6e5e8f 100644
--- a/prefs/src/main/java/java/util/prefs/FilePreferencesImpl.java
+++ b/prefs/src/main/java/java/util/prefs/FilePreferencesImpl.java
@@ -28,12 +28,12 @@ import java.util.Set;
import org.apache.harmony.prefs.internal.nls.Messages;
/**
- * The default implementation of <code>AbstractPreferences</code> for the Linux platform,
- * using the file system as its back end.
- *
+ * The default implementation of <code>AbstractPreferences</code> for the Linux
+ * platform, using the file system as its back end.
+ *
* TODO some sync mechanism with backend, Performance - check file edit date
- *
- * @since Android 1.0
+ *
+ * @since 1.4
*/
class FilePreferencesImpl extends AbstractPreferences {
@@ -64,7 +64,6 @@ class FilePreferencesImpl extends AbstractPreferences {
SYSTEM_HOME = System.getProperty("java.home") + "/.systemPrefs";//$NON-NLS-1$//$NON-NLS-2$
return null;
}
-
});
}
@@ -97,9 +96,9 @@ class FilePreferencesImpl extends AbstractPreferences {
* Constructors
* --------------------------------------------------------------
*/
-
+
/**
- * Construct root <code>FilePreferencesImpl</code> instance, construct
+ * Construct root <code>FilePreferencesImpl</code> instance, construct
* user root if userNode is true, system root otherwise
*/
FilePreferencesImpl(boolean userNode) {
@@ -108,9 +107,9 @@ class FilePreferencesImpl extends AbstractPreferences {
path = userNode ? USER_HOME : SYSTEM_HOME;
initPrefs();
}
-
+
/**
- * Construct a prefs using given parent and given name
+ * Construct a prefs using given parent and given name
*/
private FilePreferencesImpl(AbstractPreferences parent, String name) {
super(parent, name);
@@ -132,16 +131,16 @@ class FilePreferencesImpl extends AbstractPreferences {
@Override
protected String[] childrenNamesSpi() throws BackingStoreException {
String[] names = AccessController
- .doPrivileged(new PrivilegedAction<String[]>() {
- public String[] run() {
- return dir.list(new FilenameFilter() {
- public boolean accept(File parent, String name) {
- return new File(path + File.separator + name).isDirectory();
- }
- });
-
+ .doPrivileged(new PrivilegedAction<String[]>() {
+ public String[] run() {
+ return dir.list(new FilenameFilter() {
+ public boolean accept(File parent, String name) {
+ return new File(path + File.separator + name).isDirectory();
}
});
+
+ }
+ });
if (null == names) {// file is not a directory, exception case
// prefs.3=Cannot get children names for {0}!
throw new BackingStoreException(
@@ -192,14 +191,16 @@ class FilePreferencesImpl extends AbstractPreferences {
prefs = XMLParser.loadFilePrefs(prefsFile);
}
return prefs.getProperty(key);
- } catch (Exception e) {// if Exception happened, return null
+ } catch (Exception e) {
+ // if Exception happened, return null
return null;
}
}
@Override
protected String[] keysSpi() throws BackingStoreException {
- return prefs.keySet().toArray(new String[0]);
+ final Set<Object> ks = prefs.keySet();
+ return ks.toArray(new String[ks.size()]);
}
@Override
diff --git a/prefs/src/main/java/java/util/prefs/InvalidPreferencesFormatException.java b/prefs/src/main/java/java/util/prefs/InvalidPreferencesFormatException.java
index b31b3a1..ba8940b 100644
--- a/prefs/src/main/java/java/util/prefs/InvalidPreferencesFormatException.java
+++ b/prefs/src/main/java/java/util/prefs/InvalidPreferencesFormatException.java
@@ -21,51 +21,43 @@ package java.util.prefs;
* An exception to indicate that the input XML file is not well-formed or could
* not be validated against the appropriate document type (specified by
* in the {@code Preferences}).
- *
- * @since Android 1.0
*/
public class InvalidPreferencesFormatException extends Exception {
-
+
private static final long serialVersionUID = -791715184232119669L;
-
+
/**
- * Constructs a new {@code InvalidPreferencesFormatException} instance with a
- * detailed exception message.
+ * Constructs a new {@code InvalidPreferencesFormatException} instance with
+ * a detailed exception message.
*
* @param s
* the detailed exception message.
- * @since Android 1.0
*/
public InvalidPreferencesFormatException (String s) {
super(s);
}
/**
- * Constructs a new {@code InvalidPreferencesFormatException} instance with a
- * detailed exception message and a nested {@code Throwable}.
+ * Constructs a new {@code InvalidPreferencesFormatException} instance with
+ * a detailed exception message and a nested {@code Throwable}.
*
* @param s
* the detailed exception message.
* @param t
* the nested {@code Throwable}.
- * @since Android 1.0
*/
public InvalidPreferencesFormatException (String s, Throwable t) {
super(s,t);
}
/**
- * Constructs a new {@code InvalidPreferencesFormatException} instance with a nested
- * {@code Throwable}.
- *
+ * Constructs a new {@code InvalidPreferencesFormatException} instance with
+ * a nested {@code Throwable}.
+ *
* @param t
* the nested {@code Throwable}.
- * @since Android 1.0
*/
public InvalidPreferencesFormatException (Throwable t) {
super(t);
}
}
-
-
-
diff --git a/prefs/src/main/java/java/util/prefs/NodeChangeEvent.java b/prefs/src/main/java/java/util/prefs/NodeChangeEvent.java
index e9824bc..3e23f5a 100644
--- a/prefs/src/main/java/java/util/prefs/NodeChangeEvent.java
+++ b/prefs/src/main/java/java/util/prefs/NodeChangeEvent.java
@@ -14,7 +14,6 @@
* limitations under the License.
*/
-
package java.util.prefs;
import java.io.Serializable;
@@ -28,19 +27,22 @@ import java.io.IOException;
* This is the event class to indicate that one child of the preference node has
* been added or deleted.
* <p>
- * Please note that the serialization functionality has not yet been implemented, so
- * the serialization methods do nothing but throw a {@code NotSerializableException}.
- * </p>
+ * Please note that although the class is marked as {@code Serializable} by
+ * inheritance from {@code EventObject}, this type is not intended to be serialized
+ * so the serialization methods do nothing but throw a {@code NotSerializableException}.
+ *
+ * @see java.util.prefs.Preferences
+ * @see java.util.prefs.NodeChangeListener
*
- * @since Android 1.0
+ * @since 1.4
*/
public class NodeChangeEvent extends EventObject implements Serializable {
-
+
private static final long serialVersionUID = 8068949086596572957L;
-
+
private final Preferences parent;
private final Preferences child;
-
+
/**
* Constructs a new {@code NodeChangeEvent} instance.
*
@@ -49,43 +51,40 @@ public class NodeChangeEvent extends EventObject implements Serializable {
* considered as the event source.
* @param c
* the child {@code Preferences} instance that was added or deleted.
- * @since Android 1.0
*/
public NodeChangeEvent (Preferences p, Preferences c) {
super(p);
parent = p;
child = c;
}
-
+
/**
* Gets the {@code Preferences} instance that fired this event.
*
* @return the {@code Preferences} instance that fired this event.
- * @since Android 1.0
*/
public Preferences getParent() {
return parent;
}
-
+
/**
* Gets the child {@code Preferences} node that was added or removed.
*
* @return the added or removed child {@code Preferences} node.
- * @since Android 1.0
*/
public Preferences getChild() {
return child;
}
-
- /*
+
+ /**
* This method always throws a <code>NotSerializableException</code>,
* because this object cannot be serialized,
*/
private void writeObject (ObjectOutputStream out) throws IOException {
throw new NotSerializableException();
}
-
- /*
+
+ /**
* This method always throws a <code>NotSerializableException</code>,
* because this object cannot be serialized,
*/
@@ -93,7 +92,3 @@ public class NodeChangeEvent extends EventObject implements Serializable {
throw new NotSerializableException();
}
}
-
-
-
-
diff --git a/prefs/src/main/java/java/util/prefs/NodeChangeListener.java b/prefs/src/main/java/java/util/prefs/NodeChangeListener.java
index f16b206..41da23e 100644
--- a/prefs/src/main/java/java/util/prefs/NodeChangeListener.java
+++ b/prefs/src/main/java/java/util/prefs/NodeChangeListener.java
@@ -14,41 +14,36 @@
* limitations under the License.
*/
-
package java.util.prefs;
import java.util.EventListener;
import java.util.prefs.NodeChangeEvent;
/**
- * This interface is used to handle preference node change events.
- * The implementation of this interface can be installed by the {@code Preferences} instance.
+ * This interface is used to handle preference node change events. The
+ * implementation of this interface can be installed by the {@code Preferences}
+ * instance.
*
+ * @see Preferences
* @see NodeChangeEvent
*
- * @since Android 1.0
+ * @since 1.4
*/
public interface NodeChangeListener extends EventListener {
-
/**
* This method gets called whenever a child node is added to another node.
*
* @param e
* the node change event.
- * @since Android 1.0
*/
public void childAdded (NodeChangeEvent e);
-
+
/**
* This method gets called whenever a child node is removed from another
* node.
*
* @param e
* the node change event.
- * @since Android 1.0
*/
public void childRemoved (NodeChangeEvent e);
}
-
-
-
diff --git a/prefs/src/main/java/java/util/prefs/PreferenceChangeEvent.java b/prefs/src/main/java/java/util/prefs/PreferenceChangeEvent.java
index f0f0787..d355f4e 100644
--- a/prefs/src/main/java/java/util/prefs/PreferenceChangeEvent.java
+++ b/prefs/src/main/java/java/util/prefs/PreferenceChangeEvent.java
@@ -14,7 +14,6 @@
* limitations under the License.
*/
-
package java.util.prefs;
import java.io.IOException;
@@ -28,16 +27,19 @@ import java.util.EventObject;
* This is the event class to indicate that a preference has been added, deleted
* or updated.
* <p>
- * Please note that the serialization functionality has not yet been implemented, so
- * the serialization methods do nothing but throw a {@code NotSerializableException}.
- * </p>
+ * Please note that although the class is marked as {@code Serializable} by
+ * inheritance from {@code EventObject}, this type is not intended to be serialized
+ * so the serialization methods do nothing but throw a {@code NotSerializableException}.
+ *
+ * @see java.util.prefs.Preferences
+ * @see java.util.prefs.PreferenceChangeListener
*
- * @since Android 1.0
+ * @since 1.4
*/
public class PreferenceChangeEvent extends EventObject implements Serializable {
private static final long serialVersionUID = 793724513368024975L;
-
+
private final Preferences node;
private final String key;
@@ -55,7 +57,6 @@ public class PreferenceChangeEvent extends EventObject implements Serializable {
* @param v
* the new value of the changed preference, this value can be
* {@code null}, which means the preference has been removed.
- * @since Android 1.0
*/
public PreferenceChangeEvent(Preferences p, String k, String v) {
super(p);
@@ -68,7 +69,6 @@ public class PreferenceChangeEvent extends EventObject implements Serializable {
* Gets the key of the changed preference.
*
* @return the changed preference's key.
- * @since Android 1.0
*/
public String getKey() {
return key;
@@ -78,9 +78,8 @@ public class PreferenceChangeEvent extends EventObject implements Serializable {
* Gets the new value of the changed preference or {@code null} if the
* preference has been removed.
*
- * @return the new value of the changed preference or null if the preference
- * has been removed.
- * @since Android 1.0
+ * @return the new value of the changed preference or {@code null} if the
+ * preference has been removed.
*/
public String getNewValue() {
return value;
@@ -90,13 +89,12 @@ public class PreferenceChangeEvent extends EventObject implements Serializable {
* Gets the {@code Preferences} instance that fired this event.
*
* @return the {@code Preferences} instance that fired this event.
- * @since Android 1.0
*/
public Preferences getNode() {
return node;
}
- /*
+ /**
* This method always throws a <code>NotSerializableException</code>,
* because this object cannot be serialized,
*/
@@ -104,7 +102,7 @@ public class PreferenceChangeEvent extends EventObject implements Serializable {
throw new NotSerializableException();
}
- /*
+ /**
* This method always throws a <code>NotSerializableException</code>,
* because this object cannot be serialized,
*/
@@ -112,5 +110,3 @@ public class PreferenceChangeEvent extends EventObject implements Serializable {
throw new NotSerializableException();
}
}
-
-
diff --git a/prefs/src/main/java/java/util/prefs/PreferenceChangeListener.java b/prefs/src/main/java/java/util/prefs/PreferenceChangeListener.java
index 28bb763..97aeced 100644
--- a/prefs/src/main/java/java/util/prefs/PreferenceChangeListener.java
+++ b/prefs/src/main/java/java/util/prefs/PreferenceChangeListener.java
@@ -14,21 +14,23 @@
* limitations under the License.
*/
-
package java.util.prefs;
import java.util.EventListener;
/**
- * This interface is used to handle preferences change events. The implementation of
- * this interface can be installed by the {@code Preferences} instance.
+ * This interface is used to handle preferences change events. The
+ * implementation of this interface can be installed by the {@code Preferences}
+ * instance.
*
+ * @see Preferences
* @see PreferenceChangeEvent
+ *
*
- * @since Android 1.0
+ * @since 1.4
*/
public interface PreferenceChangeListener extends EventListener {
-
+
/**
* This method gets invoked whenever a preference is added, deleted or
* updated.
@@ -36,10 +38,6 @@ public interface PreferenceChangeListener extends EventListener {
* @param pce
* the event instance which describes the changed {@code Preferences}
* instance and the preference value.
- * @since Android 1.0
*/
void preferenceChange (PreferenceChangeEvent pce);
}
-
-
-
diff --git a/prefs/src/main/java/java/util/prefs/Preferences.java b/prefs/src/main/java/java/util/prefs/Preferences.java
index 719c89a..8b961e4 100644
--- a/prefs/src/main/java/java/util/prefs/Preferences.java
+++ b/prefs/src/main/java/java/util/prefs/Preferences.java
@@ -30,89 +30,83 @@ import java.io.OutputStream;
import java.net.MalformedURLException;
import java.security.AccessController;
import java.security.PrivilegedAction;
+import java.util.Locale;
import org.apache.harmony.prefs.internal.nls.Messages;
/**
- * An instance of the class {@code Preferences} represents one node in a preference tree,
- * which provides a mechanism to store and access configuration data in a
- * hierarchical way. Two hierarchy trees are maintained, one for system
- * preferences shared by all users and the other for user preferences
+ * An instance of the class {@code Preferences} represents one node in a
+ * preference tree, which provides a mechanism to store and access configuration
+ * data in a hierarchical way. Two hierarchy trees are maintained, one for
+ * system preferences shared by all users and the other for user preferences
* specific to the user. {@code Preferences} hierarchy trees and data are stored
* in an implementation-dependent back-end.
* <p>
- * Every node has one name and one unique absolute path following the same
- * notational conventions as directories in a file system. The root node's
- * name is "", and other node name strings cannot contain the slash character
- * and cannot be empty. The root node's absolute path is "/", and all other
- * nodes' absolute paths are constructed in the standard way: &lt;parent's absolute
- * path&gt; + "/" + &lt;node's name&gt;. Since the set of nodes forms a tree with
- * the root node at its base, all absolute paths start with the slash character.
- * Every node has one relative path to each of its ancestors. The relative path
- * doesn't start with slash: it equals the node's absolute path with leading
- * substring removed corresponding to the ancestor's absolute path and a slash.
- * </p>
+ * Every node has one name and one unique absolute path following the same
+ * notational conventions as directories in a file system. The root node's
+ * name is "", and other node name strings cannot contain the slash character
+ * and cannot be empty. The root node's absolute path is "/", and all other
+ * nodes' absolute paths are constructed in the standard way: &lt;parent's
+ * absolute path&gt; + "/" + &lt;node's name&gt;. Since the set of nodes forms a
+ * tree with the root node at its base, all absolute paths start with the slash
+ * character. Every node has one relative path to each of its ancestors. The
+ * relative path doesn't start with slash: it equals the node's absolute path
+ * with leading substring removed corresponding to the ancestor's absolute path
+ * and a slash.
* <p>
- * Modification to preferences data may be asynchronous, which means that
- * preference update method calls may return immediately instead of blocking.
- * The {@code flush()} and {@code sync()} methods force the back-end to
- * synchronously perform all pending updates, but the implementation is
- * permitted to perform the modifications on the underlying back-end data
- * at any time between the moment the request is made and the moment the
- * {@code flush()} or {@code sync()} method returns.
- * Please note that if JVM exit normally, the implementation must assure all
- * modifications are persisted implicitly.
- * </p>
+ * Modification to preferences data may be asynchronous, which means that
+ * preference update method calls may return immediately instead of blocking.
+ * The {@code flush()} and {@code sync()} methods force the back-end to
+ * synchronously perform all pending updates, but the implementation is
+ * permitted to perform the modifications on the underlying back-end data
+ * at any time between the moment the request is made and the moment the
+ * {@code flush()} or {@code sync()} method returns. Please note that if the JVM
+ * exits normally, the implementation must assure all modifications are
+ * persisted implicitly.
* <p>
- * When invoking a method that retrieves preferences, the user must provide
- * a default value. The default value is returned when the preferences cannot
- * be found or the back-end is unavailable. Some other methods will throw
+ * When invoking a method that retrieves preferences, the user must provide
+ * a default value. The default value is returned when the preferences cannot
+ * be found or the back-end is unavailable. Some other methods will throw
* {@code BackingStoreException} when the back-end is unavailable.
* </p>
* <p>
- * Preferences can be exported to and imported from an XML files.
+ * Preferences can be exported to and imported from an XML files. These
+ * documents must have an XML DOCTYPE declaration:
+ * <pre>{@code
+ * <!DOCTYPE preferences SYSTEM "http://java.sun.com/dtd/preferences.dtd">
+ * }</pre>
+ * This system URI is not really accessed by network, it is only a
+ * identification string. Visit the DTD location to see the actual format
+ * permitted.
* <p>
* There must be a concrete {@code PreferencesFactory} type for every concrete
- * {@code Preferences} type developed. Every J2SE implementation must provide a default
- * implementation for every supported platform, and must also provide a means of
- * replacing the default implementation. This implementation uses the system property
- * {@code java.util.prefs.PreferencesFactory} to detemine which preferences
- * implementation to use.
- * </p>
+ * {@code Preferences} type developed. Every J2SE implementation must provide a
+ * default implementation for every supported platform, and must also provide a
+ * means of replacing the default implementation. This implementation uses the
+ * system property {@code java.util.prefs.PreferencesFactory} to detemine which
+ * preferences implementation to use.
* <p>
- * The methods of this class are thread-safe. If multiple JVMs are using the same
- * back-end concurrently, the back-end won't be corrupted, but no other
+ * The methods of this class are thread-safe. If multiple JVMs are using the
+ * same back-end concurrently, the back-end won't be corrupted, but no other
* behavior guarantees are made.
- * </p>
+ *
+ * @see PreferencesFactory
*
- * @since Android 1.0
+ * @since 1.4
*/
public abstract class Preferences {
-
- /*
- * ---------------------------------------------------------
- * Class fields
- * ---------------------------------------------------------
- */
-
/**
* Maximum size in characters allowed for a preferences key.
- *
- * @since Android 1.0
*/
public static final int MAX_KEY_LENGTH = 80;
-
+
/**
* Maximum size in characters allowed for a preferences name.
- *
- * @since Android 1.0
*/
public static final int MAX_NAME_LENGTH = 80;
-
+
/**
* Maximum size in characters allowed for a preferences value.
- *
- * @since Android 1.0
*/
public static final int MAX_VALUE_LENGTH = 8192;
@@ -137,36 +131,53 @@ public abstract class Preferences {
//permission
private static final RuntimePermission PREFS_PERM = new RuntimePermission("preferences"); //$NON-NLS-1$
-
+
//factory used to get user/system prefs root
private static final PreferencesFactory factory;
-
- /**
- * ---------------------------------------------------------
- * Class initializer
- * ---------------------------------------------------------
- */
- static{
+
+ // BEGIN android-removed
+ // // default provider factory name for Windows
+ // private static final String DEFAULT_FACTORY_NAME_WIN = "java.util.prefs.RegistryPreferencesFactoryImpl"; //$NON-NLS-1$
+ //
+ // // default provider factory name for Unix
+ // private static final String DEFAULT_FACTORY_NAME_UNIX = "java.util.prefs.FilePreferencesFactoryImpl"; //$NON-NLS-1$
+ // END android-removed
+
+ static {
String factoryClassName = AccessController.doPrivileged(new PrivilegedAction<String>() {
public String run() {
return System.getProperty("java.util.prefs.PreferencesFactory"); //$NON-NLS-1$
}
});
// BEGIN android-removed
- // if(factoryClassName != null) {
- // try {
- // ClassLoader loader = Thread.currentThread().getContextClassLoader();
- // if(loader == null){
- // loader = ClassLoader.getSystemClassLoader();
+ // // set default provider
+ // if (factoryClassName == null) {
+ // String osName = AccessController.doPrivileged(new PrivilegedAction<String>() {
+ // public String run() {
+ // return System.getProperty("os.name"); //$NON-NLS-1$
+ // }
+ // });
+ //
+ // // only comparing ASCII, so assume english locale
+ // osName = (osName == null ? null : osName.toLowerCase(Locale.ENGLISH));
+ //
+ // if (osName != null && osName.startsWith("windows")) {
+ // factoryClassName = DEFAULT_FACTORY_NAME_WIN;
+ // } else {
+ // factoryClassName = DEFAULT_FACTORY_NAME_UNIX;
+ // }
// }
- // Class<?> factoryClass = loader.loadClass(factoryClassName);
- // factory = (PreferencesFactory) factoryClass.newInstance();
+ // try {
+ // ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ // if(loader == null){
+ // loader = ClassLoader.getSystemClassLoader();
+ // }
+ // Class<?> factoryClass = loader.loadClass(factoryClassName);
+ // factory = (PreferencesFactory) factoryClass.newInstance();
// } catch (Exception e) {
- // // prefs.10=Cannot initiate PreferencesFactory: {0}. Caused by {1}
- // throw new InternalError(Messages.getString("prefs.10", factoryClassName, e)); //$NON-NLS-1$
+ // // prefs.10=Cannot initiate PreferencesFactory: {0}. Caused by {1}
+ // throw new InternalError(Messages.getString("prefs.10", factoryClassName, e)); //$NON-NLS-1$
// }
- // }
- // END android-removed
// BEGIN android-added
ClassLoader loader = Thread.currentThread().getContextClassLoader();
if (loader == null) {
@@ -182,10 +193,8 @@ public abstract class Preferences {
try {
InputStream is = en.nextElement().openStream();
// Read each line for charset provider class names
- // BEGIN android-modified
reader = new BufferedReader(new InputStreamReader(is,
CONFIGURATION_FILE_ENCODING), 8192);
- // END android-modified
factoryClassName = reader.readLine();
commentIndex = factoryClassName.indexOf(CONFIGURATION_FILE_COMMENT);
if (commentIndex > 0) {
@@ -215,42 +224,27 @@ public abstract class Preferences {
factory = (PreferencesFactory)c.newInstance();
} catch (Exception e) {
// prefs.10=Cannot initiate PreferencesFactory: {0}. Caused by {1}
- throw new InternalError(Messages.getString("prefs.10", factoryClassName, e)); //$NON-NLS-1$
+ throw new InternalError(Messages.getString("prefs.10", factoryClassName, e)); //$NON-NLS-1$
}
// END android-added
}
-
- /*
- * ---------------------------------------------------------
- * Constructors
- * ---------------------------------------------------------
- */
-
+
/**
* Default constructor, for use by subclasses only.
- *
- * @since Android 1.0
*/
protected Preferences() {
super();
}
-
- /*
- * ---------------------------------------------------------
- * Methods
- * ---------------------------------------------------------
- */
-
+
/**
* Gets the absolute path string of this preference node.
*
* @return the preference node's absolute path string.
- * @since Android 1.0
*/
public abstract String absolutePath();
-
+
/**
- * Returns the names of all children of this node or an empty string if this
+ * Returns the names of all children of this node or an empty array if this
* node has no children.
*
* @return the names of all children of this node.
@@ -259,10 +253,9 @@ public abstract class Preferences {
* failure.
* @throws IllegalStateException
* if this node has been removed.
- * @since Android 1.0
*/
public abstract String[] childrenNames() throws BackingStoreException;
-
+
/**
* Removes all preferences of this node.
*
@@ -271,13 +264,12 @@ public abstract class Preferences {
* failure.
* @throws IllegalStateException
* if this node has been removed.
- * @since Android 1.0
*/
public abstract void clear() throws BackingStoreException;
-
+
/**
- * Exports all of the preferences of this node to a XML document using the given
- * output stream.
+ * Exports all of the preferences of this node to a XML document using the
+ * given output stream.
* <p>
* This XML document uses the UTF-8 encoding and is written according to the
* DTD in its DOCTYPE declaration, which is the following:
@@ -286,7 +278,8 @@ public abstract class Preferences {
* &lt;!DOCTYPE preferences SYSTEM &quot;http://java.sun.com/dtd/preferences.dtd&quot;&gt;
* </pre>
*
- * <i>Please note that (unlike the methods of this class that don't concern serialization), this call is not thread-safe.</i>
+ * <i>Please note that (unlike the methods of this class that don't concern
+ * serialization), this call is not thread-safe.</i>
* </p>
*
* @param ostream
@@ -298,13 +291,12 @@ public abstract class Preferences {
* failure.
* @throws IllegalStateException
* if this node has been removed.
- * @since Android 1.0
*/
- public abstract void exportNode (OutputStream ostream) throws IOException, BackingStoreException;
-
+ public abstract void exportNode(OutputStream ostream) throws IOException, BackingStoreException;
+
/**
- * Exports all of the preferences of this node and all its descendants to a XML
- * document using the given output stream.
+ * Exports all of the preferences of this node and all its descendants to a
+ * XML document using the given output stream.
* <p>
* This XML document uses the UTF-8 encoding and is written according to the
* DTD in its DOCTYPE declaration, which is the following:
@@ -313,7 +305,8 @@ public abstract class Preferences {
* &lt;!DOCTYPE preferences SYSTEM &quot;http://java.sun.com/dtd/preferences.dtd&quot;&gt;
* </pre>
*
- * <i>Please note that (unlike the methods of this class that don't concern serialization), this call is not thread-safe.</i>
+ * <i>Please note that (unlike the methods of this class that don't concern
+ * serialization), this call is not thread-safe.</i>
* </p>
*
* @param ostream
@@ -325,12 +318,12 @@ public abstract class Preferences {
* failure.
* @throws IllegalStateException
* if this node has been removed.
- * @since Android 1.0
*/
- public abstract void exportSubtree (OutputStream ostream) throws IOException, BackingStoreException;
-
+ public abstract void exportSubtree(OutputStream ostream) throws IOException,
+ BackingStoreException;
+
/**
- * Forces all pending updates to this node and its descendants to be
+ * Forces all pending updates to this node and its descendants to be
* persisted in the backing store.
* <p>
* If this node has been removed, the invocation of this method only flushes
@@ -340,13 +333,12 @@ public abstract class Preferences {
* @throws BackingStoreException
* if the backing store is unavailable or causes an operation
* failure.
- * @since Android 1.0
*/
public abstract void flush() throws BackingStoreException;
-
+
/**
- * Gets the {@code String} value mapped to the given key or its default value if no
- * value is mapped or no backing store is available.
+ * Gets the {@code String} value mapped to the given key or its default
+ * value if no value is mapped or no backing store is available.
* <p>
* Some implementations may store default values in backing stores. In this
* case, if there is no value mapped to the given key, the stored default
@@ -363,16 +355,16 @@ public abstract class Preferences {
* if this node has been removed.
* @throws NullPointerException
* if the parameter {@code key} is {@code null}.
- * @since Android 1.0
*/
- public abstract String get (String key, String deflt);
-
+ public abstract String get(String key, String deflt);
+
/**
- * Gets the {@code boolean} value mapped to the given key or its default value if no
- * value is mapped, if the backing store is unavailable, or if the value is invalid.
+ * Gets the {@code boolean} value mapped to the given key or its default
+ * value if no value is mapped, if the backing store is unavailable, or if
+ * the value is invalid.
* <p>
- * The only valid values are the {@code String} "true", which represents {@code true} and
- * "false", which represents {@code false}, ignoring case.
+ * The only valid values are the {@code String} "true", which represents
+ * {@code true} and "false", which represents {@code false}, ignoring case.
* </p>
* <p>
* Some implementations may store default values in backing stores. In this
@@ -384,25 +376,24 @@ public abstract class Preferences {
* the preference key.
* @param deflt
* the default value, which will be returned if no value is
- * mapped to the given key, if the backing store is unavailable, or if the
- * value is invalid.
+ * mapped to the given key, if the backing store is unavailable,
+ * or if the value is invalid.
* @return the boolean value mapped to the given key.
* @throws IllegalStateException
* if this node has been removed.
* @throws NullPointerException
* if the parameter {@code key} is {@code null}.
- * @since Android 1.0
*/
- public abstract boolean getBoolean (String key, boolean deflt);
-
+ public abstract boolean getBoolean(String key, boolean deflt);
+
/**
- * Gets the {@code byte} array value mapped to the given key or its default value if
- * no value is mapped, if the backing store is unavailable, or if the value is an
- * invalid string.
+ * Gets the {@code byte} array value mapped to the given key or its default
+ * value if no value is mapped, if the backing store is unavailable, or if
+ * the value is an invalid string.
* <p>
- * To be valid, the value string must be Base64-encoded binary data. The Base64 encoding
- * is as defined in <a href="http://www.ietf.org/rfc/rfc2045.txt">RFC
- * 2045</a>, section 6.8.
+ * To be valid, the value string must be Base64-encoded binary data. The
+ * Base64 encoding is as defined in <a
+ * href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045</a>, section 6.8.
* </p>
* <p>
* Some implementations may store default values in backing stores. In this
@@ -414,25 +405,24 @@ public abstract class Preferences {
* the preference key.
* @param deflt
* the default value, which will be returned if no value is
- * mapped to the given key, if the backing store is unavailable, or if the
- * value is invalid.
+ * mapped to the given key, if the backing store is unavailable,
+ * or if the value is invalid.
* @return the byte array value mapped to the given key.
* @throws IllegalStateException
* if this node has been removed.
* @throws NullPointerException
* if the parameter {@code key} is {@code null}.
- * @since Android 1.0
*/
- public abstract byte[] getByteArray (String key, byte[] deflt);
-
+ public abstract byte[] getByteArray(String key, byte[] deflt);
+
/**
- * Gets the {@code double} value mapped to the given key or its default value if no
- * value is mapped, if the backing store is unavailable, or if the value is an invalid
- * string.
+ * Gets the {@code double} value mapped to the given key or its default
+ * value if no value is mapped, if the backing store is unavailable, or if
+ * the value is an invalid string.
* <p>
- * To be valid, the value string must be a string that can be converted to a {@code double} by
- * {@link Double#parseDouble(String) Double.parseDouble(String)}.
- * </p>
+ * To be valid, the value string must be a string that can be converted to a
+ * {@code double} by {@link Double#parseDouble(String)
+ * Double.parseDouble(String)}.
* <p>
* Some implementations may store default values in backing stores. In this
* case, if there is no value mapped to the given key, the stored default
@@ -450,17 +440,17 @@ public abstract class Preferences {
* if this node has been removed.
* @throws NullPointerException
* if the parameter {@code key} is {@code null}.
- * @since Android 1.0
*/
- public abstract double getDouble (String key, double deflt);
-
+ public abstract double getDouble(String key, double deflt);
+
/**
- * Gets the {@code float} value mapped to the given key or its default value if no
- * value is mapped, if the backing store is unavailable, or if the value is an invalid
- * string.
+ * Gets the {@code float} value mapped to the given key or its default value
+ * if no value is mapped, if the backing store is unavailable, or if the
+ * value is an invalid string.
* <p>
- * To be valid, the value string must be a string that can be converted to a {@code float} by
- * {@link Float#parseFloat(String) Float.parseFloat(String)}.
+ * To be valid, the value string must be a string that can be converted to a
+ * {@code float} by {@link Float#parseFloat(String)
+ * Float.parseFloat(String)}.
* </p>
* <p>
* Some implementations may store default values in backing stores. In this
@@ -479,17 +469,17 @@ public abstract class Preferences {
* if this node has been removed.
* @throws NullPointerException
* if the parameter {@code key} is {@code null}.
- * @since Android 1.0
*/
- public abstract float getFloat (String key, float deflt);
-
+ public abstract float getFloat(String key, float deflt);
+
/**
- * Gets the {@code int} value mapped to the given key or its default value if no
- * value is mapped, if the backing store is unavailable, or if the value is an invalid
- * string.
+ * Gets the {@code int} value mapped to the given key or its default value
+ * if no value is mapped, if the backing store is unavailable, or if the
+ * value is an invalid string.
* <p>
- * To be valid, the value string must be a string that can be converted to an {@code int} by
- * {@link Integer#parseInt(String) Integer.parseInt(String)}.
+ * To be valid, the value string must be a string that can be converted to
+ * an {@code int} by {@link Integer#parseInt(String)
+ * Integer.parseInt(String)}.
* </p>
* <p>
* Some implementations may store default values in backing stores. In this
@@ -501,24 +491,23 @@ public abstract class Preferences {
* the preference key.
* @param deflt
* the default value, which will be returned if no value is
- * mapped to the given key, if the backing store is unavailable, or if the
- * value is invalid.
+ * mapped to the given key, if the backing store is unavailable,
+ * or if the value is invalid.
* @return the integer value mapped to the given key.
* @throws IllegalStateException
* if this node has been removed.
* @throws NullPointerException
* if the parameter {@code key} is {@code null}.
- * @since Android 1.0
*/
- public abstract int getInt (String key, int deflt);
-
+ public abstract int getInt(String key, int deflt);
+
/**
- * Gets the {@code long} value mapped to the given key or its default value if no
- * value is mapped, if the backing store is unavailable, or if the value is an invalid
- * string.
+ * Gets the {@code long} value mapped to the given key or its default value
+ * if no value is mapped, if the backing store is unavailable, or if the
+ * value is an invalid string.
* <p>
- * To be valid, the value string must be a string that can be converted to a {@code long} by
- * {@link Long#parseLong(String) Long.parseLong(String)}.
+ * To be valid, the value string must be a string that can be converted to a
+ * {@code long} by {@link Long#parseLong(String) Long.parseLong(String)}.
* </p>
* <p>
* Some implementations may store default values in backing stores. In this
@@ -530,29 +519,29 @@ public abstract class Preferences {
* the preference key.
* @param deflt
* the default value, which will be returned if no value is
- * mapped to the given key, if the backing store is unavailable, or if the
- * value is invalid.
+ * mapped to the given key, if the backing store is unavailable,
+ * or if the value is invalid.
* @return the long value mapped to the given key.
* @throws IllegalStateException
* if this node has been removed.
* @throws NullPointerException
* if the parameter {@code key} is {@code null}.
- * @since Android 1.0
*/
- public abstract long getLong (String key, long deflt);
-
+ public abstract long getLong(String key, long deflt);
+
/**
* Imports all the preferences from an XML document using the given input
* stream.
* <p>
- * This XML document uses the UTF-8 encoding and must be written according to the
- * DTD in its DOCTYPE declaration, which must be the following:
+ * This XML document uses the UTF-8 encoding and must be written according
+ * to the DTD in its DOCTYPE declaration, which must be the following:
*
* <pre>
* &lt;!DOCTYPE preferences SYSTEM &quot;http://java.sun.com/dtd/preferences.dtd&quot;&gt;
* </pre>
*
- * <i>Please note that (unlike the methods of this class that don't concern serialization), this call is not thread-safe.</i>
+ * <i>Please note that (unlike the methods of this class that don't concern
+ * serialization), this call is not thread-safe.</i>
* </p>
*
* @param istream
@@ -565,7 +554,6 @@ public abstract class Preferences {
* @throws SecurityException
* if {@code RuntimePermission("preferences")} is denied by a
* SecurityManager.
- * @since Android 1.0
*/
public static void importPreferences (InputStream istream) throws InvalidPreferencesFormatException, IOException {
checkSecurity();
@@ -575,16 +563,15 @@ public abstract class Preferences {
}
XMLParser.importPrefs(istream);
}
-
+
/**
* Returns whether this is a user preference node.
*
* @return {@code true}, if this is a user preference node, {@code false} if
* this is a system preference node.
- * @since Android 1.0
*/
public abstract boolean isUserNode();
-
+
/**
* Returns all preference keys stored in this node or an empty array if no
* key was found.
@@ -595,18 +582,16 @@ public abstract class Preferences {
* failure.
* @throws IllegalStateException
* if this node has been removed.
- * @since Android 1.0
*/
public abstract String[] keys() throws BackingStoreException;
-
+
/**
* Returns the name of this node.
*
* @return the name of this node.
- * @since Android 1.0
*/
public abstract String name();
-
+
/**
* Returns the preference node with the given path name. The path name can
* be relative or absolute. The requested node and its ancestors will
@@ -625,10 +610,9 @@ public abstract class Preferences {
* if the path name is invalid.
* @throws NullPointerException
* if the given path is {@code null}.
- * @since Android 1.0
*/
- public abstract Preferences node (String path);
-
+ public abstract Preferences node(String path);
+
/**
* Returns whether the preference node with the given path name exists. The
* path is treated as relative to this node if it doesn't start with a slash,
@@ -653,10 +637,9 @@ public abstract class Preferences {
* @throws BackingStoreException
* if the backing store is unavailable or causes an operation
* failure.
- * @since Android 1.0
*/
- public abstract boolean nodeExists (String path) throws BackingStoreException;
-
+ public abstract boolean nodeExists(String path) throws BackingStoreException;
+
/**
* Returns the parent preference node of this node or {@code null} if this
* node is the root node.
@@ -664,10 +647,9 @@ public abstract class Preferences {
* @return the parent preference node of this node.
* @throws IllegalStateException
* if this node has been removed.
- * @since Android 1.0
*/
public abstract Preferences parent();
-
+
/**
* Adds a new preference to this node using the given key and value or
* updates the value if a preference with the given key already exists.
@@ -684,14 +666,13 @@ public abstract class Preferences {
* MAX_VALUE_LENGTH}.
* @throws IllegalStateException
* if this node has been removed.
- * @since Android 1.0
*/
- public abstract void put (String key, String value);
-
+ public abstract void put(String key, String value);
+
/**
- * Adds a new preference with a {@code boolean} value to this node using the given
- * key and value or updates the value if a preference with the given key
- * already exists.
+ * Adds a new preference with a {@code boolean} value to this node using the
+ * given key and value or updates the value if a preference with the given
+ * key already exists.
*
* @param key
* the preference key to be added or updated.
@@ -704,10 +685,9 @@ public abstract class Preferences {
* MAX_KEY_LENGTH}.
* @throws IllegalStateException
* if this node has been removed.
- * @since Android 1.0
*/
- public abstract void putBoolean (String key, boolean value);
-
+ public abstract void putBoolean(String key, boolean value);
+
/**
* Adds a new preference to this node using the given key and the string
* form of the given value or updates the value if a preference with the
@@ -730,10 +710,9 @@ public abstract class Preferences {
* quarters of {@code MAX_KEY_LENGTH}.
* @throws IllegalStateException
* if this node has been removed.
- * @since Android 1.0
*/
- public abstract void putByteArray (String key, byte[] value);
-
+ public abstract void putByteArray(String key, byte[] value);
+
/**
* Adds a new preference to this node using the given key and {@code double}
* value or updates the value if a preference with the
@@ -754,12 +733,11 @@ public abstract class Preferences {
* MAX_KEY_LENGTH}.
* @throws IllegalStateException
* if this node has been removed.
- * @since Android 1.0
*/
- public abstract void putDouble (String key, double value);
-
+ public abstract void putDouble(String key, double value);
+
/**
- * Adds a new preference to this node using the given key and {@code float}
+ * Adds a new preference to this node using the given key and {@code float}
* value or updates the value if a preference with the
* given key already exists.
* <p>
@@ -778,12 +756,11 @@ public abstract class Preferences {
* MAX_KEY_LENGTH}.
* @throws IllegalStateException
* if this node has been removed.
- * @since Android 1.0
*/
- public abstract void putFloat (String key, float value);
-
+ public abstract void putFloat(String key, float value);
+
/**
- * Adds a new preference to this node using the given key and {@code int}
+ * Adds a new preference to this node using the given key and {@code int}
* value or updates the value if a preference with the
* given key already exists.
* <p>
@@ -802,12 +779,11 @@ public abstract class Preferences {
* MAX_KEY_LENGTH}.
* @throws IllegalStateException
* if this node has been removed.
- * @since Android 1.0
*/
- public abstract void putInt (String key, int value);
-
+ public abstract void putInt(String key, int value);
+
/**
- * Adds a new preference to this node using the given key and {@code long}
+ * Adds a new preference to this node using the given key and {@code long}
* value or updates the value if a preference with the
* given key already exists.
* <p>
@@ -826,9 +802,8 @@ public abstract class Preferences {
* MAX_KEY_LENGTH}.
* @throws IllegalStateException
* if this node has been removed.
- * @since Android 1.0
*/
- public abstract void putLong (String key, long value);
+ public abstract void putLong(String key, long value);
/**
* Removes the preference mapped to the given key from this node.
@@ -839,13 +814,12 @@ public abstract class Preferences {
* if the given key is {@code null}.
* @throws IllegalStateException
* if this node has been removed.
- * @since Android 1.0
*/
- public abstract void remove (String key);
-
+ public abstract void remove(String key);
+
/**
- * Removes this preference node with all its descendants. The removal
- * won't necessarily be persisted until the method {@code flush()} is invoked.
+ * Removes this preference node with all its descendants. The removal won't
+ * necessarily be persisted until the method {@code flush()} is invoked.
*
* @throws BackingStoreException
* if the backing store is unavailable or causes an operation
@@ -854,14 +828,13 @@ public abstract class Preferences {
* if this node has been removed.
* @throws UnsupportedOperationException
* if this is a root node.
- * @since Android 1.0
*/
public abstract void removeNode() throws BackingStoreException;
-
+
/**
- * Registers a {@code NodeChangeListener} instance for this node, which will handle
- * {@code NodeChangeEvent}s. {@code NodeChangeEvent}s will be fired when a child node has
- * been added to or removed from this node.
+ * Registers a {@code NodeChangeListener} instance for this node, which will
+ * handle {@code NodeChangeEvent}s. {@code NodeChangeEvent}s will be fired
+ * when a child node has been added to or removed from this node.
*
* @param ncl
* the listener to be registered.
@@ -869,25 +842,24 @@ public abstract class Preferences {
* if the given listener is {@code null}.
* @throws IllegalStateException
* if this node has been removed.
- * @since Android 1.0
*/
- public abstract void addNodeChangeListener (NodeChangeListener ncl);
-
+ public abstract void addNodeChangeListener(NodeChangeListener ncl);
+
/**
- * Registers a {@code PreferenceChangeListener} instance for this node, which will
- * handle {@code PreferenceChangeEvent}s. {@code PreferenceChangeEvent}s will be fired when
- * a preference has been added to, removed from, or updated for this node.
- *
+ * Registers a {@code PreferenceChangeListener} instance for this node,
+ * which will handle {@code PreferenceChangeEvent}s. {@code
+ * PreferenceChangeEvent}s will be fired when a preference has been added
+ * to, removed from, or updated for this node.
+ *
* @param pcl
* the listener to be registered.
* @throws NullPointerException
* if the given listener is {@code null}.
* @throws IllegalStateException
* if this node has been removed.
- * @since Android 1.0
*/
public abstract void addPreferenceChangeListener (PreferenceChangeListener pcl);
-
+
/**
* Removes the given {@code NodeChangeListener} instance from this node.
*
@@ -897,12 +869,12 @@ public abstract class Preferences {
* if the given listener is {@code null}.
* @throws IllegalStateException
* if this node has been removed.
- * @since Android 1.0
*/
public abstract void removeNodeChangeListener (NodeChangeListener ncl);
-
+
/**
- * Removes the given {@code PreferenceChangeListener} instance from this node.
+ * Removes the given {@code PreferenceChangeListener} instance from this
+ * node.
*
* @param pcl
* the listener to be removed.
@@ -910,36 +882,34 @@ public abstract class Preferences {
* if the given listener is {@code null}.
* @throws IllegalStateException
* if this node has been removed.
- * @since Android 1.0
*/
public abstract void removePreferenceChangeListener (PreferenceChangeListener pcl);
-
+
/**
* Synchronizes the data of this preference node and its descendants with
- * the back-end preference store. Any changes found in the back-end data should be reflected
- * in this node and its descendants, and at the same time any local changes to this node and
- * descendants should be persisted.
+ * the back-end preference store. Any changes found in the back-end data
+ * should be reflected in this node and its descendants, and at the same
+ * time any local changes to this node and descendants should be persisted.
*
* @throws BackingStoreException
* if the backing store is unavailable or causes an operation
* failure.
* @throws IllegalStateException
* if this node has been removed.
- * @since Android 1.0
*/
public abstract void sync() throws BackingStoreException;
-
+
/**
* Returns the system preference node for the package of the given class.
* The absolute path of the returned node is one slash followed by the given
* class's full package name, replacing each period character ('.') with
- * a slash. For example, the absolute path of the preference associated with
+ * a slash. For example, the absolute path of the preference associated with
* the class Object would be "/java/lang". As a special case, the unnamed
* package is associated with a preference node "/&lt;unnamed&gt;". This
* method will create the node and its ancestors as needed. Any nodes created
- * by this method won't necessarily be persisted until the method {@code flush()} is
- * invoked.
- *
+ * by this method won't necessarily be persisted until the method {@code
+ * flush()} is invoked.
+ *
* @param c
* the given class.
* @return the system preference node for the package of the given class.
@@ -948,13 +918,12 @@ public abstract class Preferences {
* @throws SecurityException
* if the {@code RuntimePermission("preferences")} is denied by
* a SecurityManager.
- * @since Android 1.0
*/
public static Preferences systemNodeForPackage (Class<?> c) {
checkSecurity();
return factory.systemRoot().node(getNodeName(c));
}
-
+
/**
* Returns the root node of the system preference hierarchy.
*
@@ -962,33 +931,32 @@ public abstract class Preferences {
* @throws SecurityException
* if the {@code RuntimePermission("preferences")} is denied by
* a SecurityManager.
- * @since Android 1.0
*/
public static Preferences systemRoot() {
checkSecurity();
return factory.systemRoot();
}
-
+
//check the RuntimePermission("preferences")
private static void checkSecurity() {
SecurityManager manager = System.getSecurityManager();
if(null != manager){
manager.checkPermission(PREFS_PERM);
}
-
+
}
/**
* Returns the user preference node for the package of the given class.
* The absolute path of the returned node is one slash followed by the given
* class's full package name, replacing each period character ('.') with
- * a slash. For example, the absolute path of the preference associated with
+ * a slash. For example, the absolute path of the preference associated with
* the class Object would be "/java/lang". As a special case, the unnamed
* package is associated with a preference node "/&lt;unnamed&gt;". This
* method will create the node and its ancestors as needed. Any nodes created
- * by this method won't necessarily be persisted until the method {@code flush()} is
- * invoked.
- *
+ * by this method won't necessarily be persisted until the method {@code
+ * flush()} is invoked.
+ *
* @param c
* the given class.
* @return the user preference node for the package of the given class.
@@ -997,13 +965,12 @@ public abstract class Preferences {
* @throws SecurityException
* if the {@code RuntimePermission("preferences")} is denied by
* a SecurityManager.
- * @since Android 1.0
*/
public static Preferences userNodeForPackage (Class<?> c) {
checkSecurity();
return factory.userRoot().node(getNodeName(c));
}
-
+
//parse node's absolute path from class instance
private static String getNodeName(Class<?> c){
Package p = c.getPackage();
@@ -1020,7 +987,6 @@ public abstract class Preferences {
* @throws SecurityException
* if the {@code RuntimePermission("preferences")} is denied by
* a SecurityManager.
- * @since Android 1.0
*/
public static Preferences userRoot() {
checkSecurity();
@@ -1032,7 +998,6 @@ public abstract class Preferences {
* Preference Node: " followed by this node's absolute path.
*
* @return the string representation of this node.
- * @since Android 1.0
*/
@Override
public abstract String toString();
diff --git a/prefs/src/main/java/java/util/prefs/PreferencesFactory.java b/prefs/src/main/java/java/util/prefs/PreferencesFactory.java
index e56dd95..3ac13e4 100644
--- a/prefs/src/main/java/java/util/prefs/PreferencesFactory.java
+++ b/prefs/src/main/java/java/util/prefs/PreferencesFactory.java
@@ -14,36 +14,30 @@
* limitations under the License.
*/
-
package java.util.prefs;
/**
* This interface is used by the {@link Preferences} class as factory class to
- * create {@code Preferences} instances. This interface can be implemented and installed
- * to replace the default preferences implementation.
+ * create {@code Preferences} instances. This interface can be implemented and
+ * installed to replace the default preferences implementation.
+ *
+ * @see java.util.prefs.Preferences
*
- * @since Android 1.0
+ * @since 1.4
*/
public interface PreferencesFactory {
-
/**
* Returns the root node of the preferences hierarchy for the calling user
* context.
*
* @return the user preferences hierarchy root node.
- * @since Android 1.0
*/
Preferences userRoot();
-
+
/**
* Returns the root node of the system preferences hierarchy.
*
* @return the system preferences hierarchy root node.
- * @since Android 1.0
*/
Preferences systemRoot();
}
-
-
-
-
diff --git a/prefs/src/main/java/java/util/prefs/XMLParser.java b/prefs/src/main/java/java/util/prefs/XMLParser.java
index 2edfc71..c5a234c 100644
--- a/prefs/src/main/java/java/util/prefs/XMLParser.java
+++ b/prefs/src/main/java/java/util/prefs/XMLParser.java
@@ -14,7 +14,6 @@
* limitations under the License.
*/
-
package java.util.prefs;
import java.io.BufferedInputStream;
@@ -27,6 +26,7 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.StringReader;
+import java.io.Writer;
import java.nio.channels.FileChannel;
import java.nio.channels.FileLock;
import java.security.AccessController;
@@ -64,9 +64,7 @@ import org.w3c.dom.Node;
// END android-added
/**
- * Utility class for importing and exporting {@code Preferences} data from an XML file.
- *
- * @since Android 1.0
+ * Utility class for the Preferences import/export from XML file.
*/
class XMLParser {
@@ -79,15 +77,15 @@ class XMLParser {
* Constant - the DTD string
*/
static final String PREFS_DTD = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" //$NON-NLS-1$
- + " <!ELEMENT preferences (root)>" //$NON-NLS-1$
- + " <!ATTLIST preferences EXTERNAL_XML_VERSION CDATA \"0.0\" >" //$NON-NLS-1$
- + " <!ELEMENT root (map, node*) >" //$NON-NLS-1$
- + " <!ATTLIST root type (system|user) #REQUIRED >" //$NON-NLS-1$
- + " <!ELEMENT node (map, node*) >" //$NON-NLS-1$
- + " <!ATTLIST node name CDATA #REQUIRED >" //$NON-NLS-1$
- + " <!ELEMENT map (entry*) >" //$NON-NLS-1$
- + " <!ELEMENT entry EMPTY >" //$NON-NLS-1$
- + " <!ATTLIST entry key CDATA #REQUIRED value CDATA #REQUIRED >"; //$NON-NLS-1$
+ + " <!ELEMENT preferences (root)>" //$NON-NLS-1$
+ + " <!ATTLIST preferences EXTERNAL_XML_VERSION CDATA \"0.0\" >" //$NON-NLS-1$
+ + " <!ELEMENT root (map, node*) >" //$NON-NLS-1$
+ + " <!ATTLIST root type (system|user) #REQUIRED >" //$NON-NLS-1$
+ + " <!ELEMENT node (map, node*) >" //$NON-NLS-1$
+ + " <!ATTLIST node name CDATA #REQUIRED >" //$NON-NLS-1$
+ + " <!ELEMENT map (entry*) >" //$NON-NLS-1$
+ + " <!ELEMENT entry EMPTY >" //$NON-NLS-1$
+ + " <!ATTLIST entry key CDATA #REQUIRED value CDATA #REQUIRED >"; //$NON-NLS-1$
/*
* Constant - the specified header
@@ -103,24 +101,24 @@ class XMLParser {
* empty string array constant
*/
private static final String[] EMPTY_SARRAY = new String[0];
-
+
/*
- * Constant - used by FilePreferencesImpl, which is default implementation of Linux platform
+ * Constant - used by FilePreferencesImpl, which is default implementation of Linux platform
*/
private static final String FILE_PREFS = "<!DOCTYPE map SYSTEM 'http://java.sun.com/dtd/preferences.dtd'>"; //$NON-NLS-1$
/*
* Constant - specify the DTD version
*/
- private static final float XML_VERSION = 1.0f;
-
+ private static final float XML_VERSION = 1.0f;
+
/*
* DOM builder
*/
private static final DocumentBuilder builder;
/*
- * specify the indent level
+ * specify the indent level
*/
private static int indent = -1;
@@ -139,7 +137,7 @@ class XMLParser {
}
builder.setEntityResolver(new EntityResolver() {
public InputSource resolveEntity(String publicId, String systemId)
- throws SAXException, IOException {
+ throws SAXException, IOException {
if (systemId.equals(PREFS_DTD_NAME)) {
InputSource result = new InputSource(new StringReader(
PREFS_DTD));
@@ -196,7 +194,7 @@ class XMLParser {
flushEmptyElement("map", out); //$NON-NLS-1$
StringTokenizer ancestors = new StringTokenizer(prefs.absolutePath(),
- "/"); //$NON-NLS-1$
+ "/"); //$NON-NLS-1$
exportNode(ancestors, prefs, withSubTree, out);
flushEndTag("root", out); //$NON-NLS-1$
@@ -207,7 +205,7 @@ class XMLParser {
private static void exportNode(StringTokenizer ancestors,
Preferences prefs, boolean withSubTree, BufferedWriter out)
- throws IOException, BackingStoreException {
+ throws IOException, BackingStoreException {
if (ancestors.hasMoreTokens()) {
String name = ancestors.nextToken();
flushStartTag(
@@ -226,7 +224,7 @@ class XMLParser {
}
private static void exportSubTree(Preferences prefs, BufferedWriter out)
- throws BackingStoreException, IOException {
+ throws BackingStoreException, IOException {
String[] names = prefs.childrenNames();
if (names.length > 0) {
for (int i = 0; i < names.length; i++) {
@@ -241,7 +239,7 @@ class XMLParser {
}
private static void exportEntries(Preferences prefs, BufferedWriter out)
- throws BackingStoreException, IOException {
+ throws BackingStoreException, IOException {
String[] keys = prefs.keys();
String[] values = new String[keys.length];
for (int i = 0; i < keys.length; i++) {
@@ -267,7 +265,7 @@ class XMLParser {
}
private static void flushEndTag(String tagName, BufferedWriter out)
- throws IOException {
+ throws IOException {
flushIndent(indent--, out);
out.write("</"); //$NON-NLS-1$
out.write(tagName);
@@ -276,7 +274,7 @@ class XMLParser {
}
private static void flushEmptyElement(String tagName, BufferedWriter out)
- throws IOException {
+ throws IOException {
flushIndent(++indent, out);
out.write("<"); //$NON-NLS-1$
out.write(tagName);
@@ -308,7 +306,7 @@ class XMLParser {
}
private static void flushIndent(int ind, BufferedWriter out)
- throws IOException {
+ throws IOException {
for (int i = 0; i < ind; i++) {
out.write(" "); //$NON-NLS-1$
}
@@ -325,7 +323,7 @@ class XMLParser {
}
private static void flushStartTag(String tagName, BufferedWriter out)
- throws IOException {
+ throws IOException {
flushIndent(++indent, out);
out.write("<"); //$NON-NLS-1$
out.write(tagName);
@@ -365,7 +363,7 @@ class XMLParser {
* utilities for Preferences import
**************************************************************************/
static void importPrefs(InputStream in) throws IOException,
- InvalidPreferencesFormatException {
+ InvalidPreferencesFormatException {
try {
// load XML document
Document doc = builder.parse(new InputSource(in));
@@ -382,7 +380,7 @@ class XMLParser {
// check preferences root's type
Element root = (Element) preferences
- .getElementsByTagName("root").item(0); //$NON-NLS-1$
+ .getElementsByTagName("root").item(0); //$NON-NLS-1$
Preferences prefsRoot = null;
String type = root.getAttribute("type"); //$NON-NLS-1$
if (type.equals("user")) { //$NON-NLS-1$
@@ -445,15 +443,15 @@ class XMLParser {
// TODO dirty implementation of a method from javax.xml.xpath
// should be replaced with a call to a good impl of this method
private static NodeList selectNodeList(Element documentElement, String string) {
-
+
NodeList result = null;
-
+
ArrayList<Node> input = new ArrayList<Node>();
-
+
String[] path = string.split("/");
-
+
NodeList childNodes = documentElement.getChildNodes();
-
+
if(path[0].equals("entry") || path[0].equals("node")) {
for(int i = 0; i < childNodes.getLength(); i++) {
Object next = childNodes.item(i);
@@ -483,21 +481,21 @@ class XMLParser {
}
}
}
-
+
result = new NodeSet(input.iterator());
-
+
return result;
}
// END android-added
-
+
/***************************************************************************
* utilities for FilePreferencesImpl, which is default implementation of Linux platform
**************************************************************************/
/**
* load preferences from file, if cannot load, create a new one FIXME: need
* lock or not?
- *
- * @param file the XML file to be read
+ *
+ * @param file the XML file to be read
* @return Properties instance which indicates the preferences key-value pairs
*/
static Properties loadFilePrefs(final File file) {
@@ -506,14 +504,6 @@ class XMLParser {
return loadFilePrefsImpl(file);
}
});
-
- // try {
- // //FIXME: lines below can be deleted, because it is not required to
- // persistent at the very beginning
- // flushFilePrefs(file, result);
- // } catch (IOException e) {
- // e.printStackTrace();
- // }
}
static Properties loadFilePrefsImpl(final File file) {
@@ -524,7 +514,6 @@ class XMLParser {
InputStream in = null;
FileLock lock = null;
try {
-
FileInputStream istream = new FileInputStream(file);
// BEGIN android-modified
in = new BufferedInputStream(istream, 8192);
@@ -544,17 +533,16 @@ class XMLParser {
result.setProperty(key, value);
}
return result;
- } catch (Exception e) {
- e.printStackTrace();
+ } catch (IOException e) {
+ } catch (SAXException e) {
+ // BEGIN android-removed
+ // } catch (TransformerException e) {
+ // // transform shouldn't fail for xpath call
+ // throw new AssertionError(e);
+ // END android-removed
} finally {
- try {
- lock.release();
- } catch (Exception e) {//ignore
- }
- try {
- in.close();
- } catch (Exception e) {//ignore
- }
+ releaseQuietly(lock);
+ closeQuietly(in);
}
} else {
file.delete();
@@ -563,7 +551,7 @@ class XMLParser {
}
/**
- *
+ *
* @param file
* @param prefs
* @throws PrivilegedActionException
@@ -576,7 +564,7 @@ class XMLParser {
}
});
}
-
+
static void flushFilePrefsImpl(File file, Properties prefs) throws IOException {
BufferedWriter out = null;
FileLock lock = null;
@@ -604,18 +592,35 @@ class XMLParser {
}
out.flush();
} finally {
- try {
- lock.release();
- } catch (Exception e) {//ignore
- }
- try {
- if (null != out) {
- out.close();
- }
- } catch (Exception e) {//ignore
- }
+ releaseQuietly(lock);
+ closeQuietly(out);
}
}
-}
+ private static void releaseQuietly(FileLock lock) {
+ if (lock == null) {
+ return;
+ }
+ try {
+ lock.release();
+ } catch (IOException e) {}
+ }
+ private static void closeQuietly(Writer out) {
+ if (out == null) {
+ return;
+ }
+ try {
+ out.close();
+ } catch (IOException e) {}
+ }
+
+ private static void closeQuietly(InputStream in) {
+ if (in == null) {
+ return;
+ }
+ try {
+ in.close();
+ } catch (IOException e) {}
+ }
+}
diff --git a/prefs/src/main/java/org/apache/harmony/prefs/internal/nls/Messages.java b/prefs/src/main/java/org/apache/harmony/prefs/internal/nls/Messages.java
index cfc7236..aaf5d8d 100644
--- a/prefs/src/main/java/org/apache/harmony/prefs/internal/nls/Messages.java
+++ b/prefs/src/main/java/org/apache/harmony/prefs/internal/nls/Messages.java
@@ -43,7 +43,7 @@ import org.apache.harmony.luni.util.MsgHelp;
* is looked up, or resource bundle support is not available, the key itself
* will be returned as the associated message. This means that the <em>KEY</em>
* should a reasonable human-readable (english) string.
- *
+ *
*/
public class Messages {
@@ -54,7 +54,7 @@ public class Messages {
/**
* Retrieves a message which has no arguments.
- *
+ *
* @param msg
* String the key to look up.
* @return String the message for that key in the system message bundle.
@@ -67,7 +67,7 @@ public class Messages {
/**
* Retrieves a message which takes 1 argument.
- *
+ *
* @param msg
* String the key to look up.
* @param arg
@@ -80,7 +80,7 @@ public class Messages {
/**
* Retrieves a message which takes 1 integer argument.
- *
+ *
* @param msg
* String the key to look up.
* @param arg
@@ -93,7 +93,7 @@ public class Messages {
/**
* Retrieves a message which takes 1 character argument.
- *
+ *
* @param msg
* String the key to look up.
* @param arg
@@ -106,7 +106,7 @@ public class Messages {
/**
* Retrieves a message which takes 2 arguments.
- *
+ *
* @param msg
* String the key to look up.
* @param arg1
@@ -121,7 +121,7 @@ public class Messages {
/**
* Retrieves a message which takes several arguments.
- *
+ *
* @param msg
* String the key to look up.
* @param args
diff --git a/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/AbstractPreferencesTest.java b/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/AbstractPreferencesTest.java
index 418e52d..76ef4e7 100644
--- a/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/AbstractPreferencesTest.java
+++ b/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/AbstractPreferencesTest.java
@@ -35,9 +35,13 @@ import java.util.prefs.PreferenceChangeEvent;
import java.util.prefs.PreferenceChangeListener;
import java.util.prefs.Preferences;
+import tests.util.PrefsTester;
+
@TestTargetClass(AbstractPreferences.class)
public class AbstractPreferencesTest extends TestCase {
+ private final PrefsTester prefsTester = new PrefsTester();
+
AbstractPreferences pref;
static AbstractPreferences root;
@@ -51,13 +55,8 @@ public class AbstractPreferencesTest extends TestCase {
protected void setUp() throws Exception {
super.setUp();
+ prefsTester.setUp();
- System.setProperty("user.home", System.getProperty("java.io.tmpdir"));
- System.setProperty("java.home", System.getProperty("java.io.tmpdir"));
-
- Preferences.systemRoot().clear();
- Preferences.userRoot().clear();
-
root = (AbstractPreferences) Preferences.userRoot();
parent = (AbstractPreferences) Preferences.userNodeForPackage(this.getClass());
@@ -65,11 +64,7 @@ public class AbstractPreferencesTest extends TestCase {
}
protected void tearDown() throws Exception {
- parent.removeNode();
- Preferences.systemRoot().clear();
- Preferences.userRoot().clear();
- System.setProperty("user.home", oldUserHome);
- System.setProperty("java.home", oldJavaHome);
+ prefsTester.tearDown();
super.tearDown();
}
@@ -855,6 +850,31 @@ public class AbstractPreferencesTest extends TestCase {
}
@TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "",
+ method = "nodeExists",
+ args = {String.class}
+ )
+ public void test_nodeExists() throws BackingStoreException {
+ AbstractPreferences test = (AbstractPreferences) Preferences.userRoot()
+ .node("test");
+ try {
+ test.nodeExists(null);
+ fail("should throw NullPointerException");
+ } catch (NullPointerException e) {
+ // Expected
+ }
+
+ test.removeNode();
+ try {
+ test.nodeExists(null);
+ fail("should throw NullPointerException");
+ } catch (NullPointerException e) {
+ // Expected
+ }
+ }
+
+ @TestTargetNew(
level = TestLevel.COMPLETE,
notes = "",
method = "parent",
diff --git a/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/FilePreferencesImplTest.java b/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/FilePreferencesImplTest.java
index 0c61e75..0cb1975 100644
--- a/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/FilePreferencesImplTest.java
+++ b/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/FilePreferencesImplTest.java
@@ -28,28 +28,22 @@ import java.util.prefs.BackingStoreException;
import java.util.prefs.Preferences;
import junit.framework.TestCase;
+import tests.util.PrefsTester;
@TestTargetClass(java.util.prefs.Preferences.class)
public class FilePreferencesImplTest extends TestCase {
- String oldUserHome = System.getProperty("user.home");
- String oldJavaHome = System.getProperty("java.home");
+ private final PrefsTester prefsTester = new PrefsTester();
+ @Override
protected void setUp() throws Exception {
super.setUp();
-
- System.setProperty("user.home", System.getProperty("java.io.tmpdir"));
- System.setProperty("java.home", System.getProperty("java.io.tmpdir"));
- Preferences.systemRoot().clear();
- Preferences.userRoot().clear();
+ prefsTester.setUp();
}
+ @Override
protected void tearDown() throws Exception {
- Preferences.systemRoot().clear();
- Preferences.userRoot().clear();
- System.setProperty("user.home", oldUserHome);
- System.setProperty("java.home", oldJavaHome);
-
+ prefsTester.tearDown();
super.tearDown();
}
@@ -313,6 +307,7 @@ public class FilePreferencesImplTest extends TestCase {
System.setSecurityManager(dflt);
}
+ @Override
public void checkPermission(Permission perm) {
if (perm instanceof FilePermission) {
throw new SecurityException();
@@ -321,6 +316,7 @@ public class FilePreferencesImplTest extends TestCase {
}
}
+ @Override
public void checkPermission(Permission perm, Object ctx) {
if (perm instanceof FilePermission) {
System.out.println(perm.getActions());
diff --git a/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/InvalidPreferencesFormatExceptionTest.java b/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/InvalidPreferencesFormatExceptionTest.java
index 28c953e..c7ff946 100644
--- a/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/InvalidPreferencesFormatExceptionTest.java
+++ b/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/InvalidPreferencesFormatExceptionTest.java
@@ -44,7 +44,7 @@ public class InvalidPreferencesFormatExceptionTest extends TestCase {
)
public void testInvalidPreferencesFormatExceptionString() {
InvalidPreferencesFormatException e = new InvalidPreferencesFormatException(
- "msg");
+ "msg");
assertNull(e.getCause());
assertEquals("msg", e.getMessage());
}
@@ -99,7 +99,7 @@ public class InvalidPreferencesFormatExceptionTest extends TestCase {
public void testSerializationSelf() throws Exception {
SerializationTest.verifySelf(new InvalidPreferencesFormatException(
- "msg"));
+ "msg"));
}
/**
diff --git a/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/MockAbstractPreferences.java b/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/MockAbstractPreferences.java
index 1820954..b149225 100644
--- a/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/MockAbstractPreferences.java
+++ b/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/MockAbstractPreferences.java
@@ -84,6 +84,7 @@ public class MockAbstractPreferences extends AbstractPreferences {
return lock;
}
+ @Override
public String[] childrenNamesSpi() throws BackingStoreException {
checkException();
if (result == returnNull)
@@ -108,6 +109,7 @@ public class MockAbstractPreferences extends AbstractPreferences {
return childSpi(name);
}
+ @Override
public AbstractPreferences childSpi(String name) {
try {
checkException();
@@ -123,11 +125,13 @@ public class MockAbstractPreferences extends AbstractPreferences {
return r;
}
+ @Override
public void flushSpi() throws BackingStoreException {
checkException();
flushedTimes++;
}
+ @Override
public String getSpi(String key) {
try {
checkException();
@@ -139,6 +143,7 @@ public class MockAbstractPreferences extends AbstractPreferences {
return result == returnNull ? null : attr.getProperty(key);
}
+ @Override
public String[] keysSpi() throws BackingStoreException {
checkException();
Set<Object> keys = attr.keySet();
@@ -147,6 +152,7 @@ public class MockAbstractPreferences extends AbstractPreferences {
return result == returnNull ? null : results;
}
+ @Override
public void putSpi(String name, String value) {
try {
checkException();
@@ -158,11 +164,13 @@ public class MockAbstractPreferences extends AbstractPreferences {
attr.put(name, value);
}
+ @Override
protected void removeNodeSpi() throws BackingStoreException {
checkException();
((MockAbstractPreferences) parent()).childs.remove(name());
}
+ @Override
public void removeSpi(String key) {
try {
checkException();
@@ -174,6 +182,7 @@ public class MockAbstractPreferences extends AbstractPreferences {
attr.remove(key);
}
+ @Override
public void syncSpi() throws BackingStoreException {
checkException();
syncTimes++;
diff --git a/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/MockSecurityManager.java b/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/MockSecurityManager.java
index e5a0bfd..d6047fb 100644
--- a/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/MockSecurityManager.java
+++ b/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/MockSecurityManager.java
@@ -39,6 +39,7 @@ class MockSecurityManager extends SecurityManager {
System.setSecurityManager(dflt);
}
+ @Override
public void checkPermission(Permission perm) {
if (perm instanceof RuntimePermission
&& perm.getName().equals("preferences")) {
@@ -48,6 +49,7 @@ class MockSecurityManager extends SecurityManager {
}
}
+ @Override
public void checkPermission(Permission perm, Object ctx) {
if (perm instanceof RuntimePermission
&& perm.getName().equals("preferences")) {
diff --git a/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/NodeChangeEventTest.java b/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/NodeChangeEventTest.java
index eab3b14..1afd755 100644
--- a/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/NodeChangeEventTest.java
+++ b/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/NodeChangeEventTest.java
@@ -30,6 +30,7 @@ import java.util.prefs.Preferences;
import junit.framework.TestCase;
import org.apache.harmony.testframework.serialization.SerializationTest;
+import tests.util.PrefsTester;
/**
*
@@ -37,26 +38,17 @@ import org.apache.harmony.testframework.serialization.SerializationTest;
@TestTargetClass(NodeChangeEvent.class)
public class NodeChangeEventTest extends TestCase {
- NodeChangeEvent event;
+ private final PrefsTester prefsTester = new PrefsTester();
- String oldUserHome = System.getProperty("user.home");
- String oldJavaHome = System.getProperty("java.home");
+ NodeChangeEvent event;
protected void setUp() throws Exception {
super.setUp();
-
- System.setProperty("user.home", System.getProperty("java.io.tmpdir"));
- System.setProperty("java.home", System.getProperty("java.io.tmpdir"));
- Preferences.systemRoot().clear();
- Preferences.userRoot().clear();
+ prefsTester.setUp();
}
protected void tearDown() throws Exception {
- Preferences.systemRoot().clear();
- Preferences.userRoot().clear();
- System.setProperty("user.home", oldUserHome);
- System.setProperty("java.home", oldJavaHome);
-
+ prefsTester.tearDown();
super.tearDown();
}
diff --git a/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/NodeChangeListenerTest.java b/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/NodeChangeListenerTest.java
index c5e3252..3cdb4d9 100644
--- a/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/NodeChangeListenerTest.java
+++ b/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/NodeChangeListenerTest.java
@@ -26,6 +26,7 @@ import java.util.prefs.NodeChangeListener;
import java.util.prefs.Preferences;
import junit.framework.TestCase;
+import tests.util.PrefsTester;
/**
*
@@ -33,20 +34,26 @@ import junit.framework.TestCase;
@TestTargetClass(NodeChangeListener.class)
public class NodeChangeListenerTest extends TestCase {
+ private final PrefsTester prefsTester = new PrefsTester();
+
NodeChangeListener l;
/*
* @see TestCase#setUp()
*/
+ @Override
protected void setUp() throws Exception {
super.setUp();
+ prefsTester.setUp();
l = new NodeChangeListenerImpl();
}
/*
* @see TestCase#tearDown()
*/
+ @Override
protected void tearDown() throws Exception {
+ prefsTester.tearDown();
super.tearDown();
}
diff --git a/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/PreferenceChangeEventTest.java b/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/PreferenceChangeEventTest.java
index 4030b89..dda1f6c 100644
--- a/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/PreferenceChangeEventTest.java
+++ b/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/PreferenceChangeEventTest.java
@@ -92,7 +92,7 @@ public class PreferenceChangeEventTest extends TestCase {
)
public void testConstructor() {
event = new PreferenceChangeEvent(Preferences.userRoot(), "key",
- "value");
+ "value");
assertEquals("key", event.getKey());
assertEquals("value", event.getNewValue());
assertSame(Preferences.userRoot(), event.getNode());
@@ -107,7 +107,7 @@ public class PreferenceChangeEventTest extends TestCase {
)
public void testSerialization() throws Exception {
event = new PreferenceChangeEvent(Preferences.userRoot(), "key",
- "value");
+ "value");
try {
SerializationTest.copySerializable(event);
fail("No expected NotSerializableException");
diff --git a/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/PreferenceChangeListenerTest.java b/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/PreferenceChangeListenerTest.java
index e4df9c4..7080aa5 100644
--- a/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/PreferenceChangeListenerTest.java
+++ b/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/PreferenceChangeListenerTest.java
@@ -38,6 +38,7 @@ public class PreferenceChangeListenerTest extends TestCase {
/*
* @see TestCase#setUp()
*/
+ @Override
protected void setUp() throws Exception {
super.setUp();
l = new PreferenceChangeListenerImpl();
diff --git a/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/PreferencesFactoryTest.java b/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/PreferencesFactoryTest.java
index 818d5ad..729bc05 100644
--- a/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/PreferencesFactoryTest.java
+++ b/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/PreferencesFactoryTest.java
@@ -37,6 +37,7 @@ public class PreferencesFactoryTest extends TestCase {
/*
* @see TestCase#setUp()
*/
+ @Override
protected void setUp() throws Exception {
super.setUp();
f = new PreferencesFactoryImpl();
@@ -49,7 +50,7 @@ public class PreferencesFactoryTest extends TestCase {
args = {}
)
public void testUserRoot() {
- f.userRoot();
+ assertNull(f.userRoot());
}
@TestTargetNew(
@@ -59,7 +60,7 @@ public class PreferencesFactoryTest extends TestCase {
args = {}
)
public void testSystemRoot() {
- f.systemRoot();
+ assertNull(f.systemRoot());
}
public static class PreferencesFactoryImpl implements PreferencesFactory {
diff --git a/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/PreferencesTest.java b/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/PreferencesTest.java
index 0ebf6bb..c9c74fd 100644
--- a/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/PreferencesTest.java
+++ b/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/PreferencesTest.java
@@ -39,14 +39,15 @@ import java.util.prefs.NodeChangeListener;
import java.util.prefs.PreferenceChangeListener;
import java.util.prefs.Preferences;
+import tests.util.PrefsTester;
+
/**
*
*/
@TestTargetClass(Preferences.class)
public class PreferencesTest extends TestCase {
- String oldUserHome = System.getProperty("user.home");
- String oldJavaHome = System.getProperty("java.home");
+ private final PrefsTester prefsTester = new PrefsTester();
MockSecurityManager manager = new MockSecurityManager();
@@ -74,43 +75,24 @@ public class PreferencesTest extends TestCase {
/*
* @see TestCase#setUp()
*/
+ @Override
protected void setUp() throws Exception {
super.setUp();
in = new ByteArrayInputStream(
"<!DOCTYPE preferences SYSTEM \"http://java.sun.com/dtd/preferences.dtd\"><preferences><root type=\"user\"><map></map></root></preferences>"
.getBytes("UTF-8"));
stream = new MockInputStream(in);
-
- System.setProperty("user.home", System.getProperty("java.io.tmpdir"));
- System.setProperty("java.home", System.getProperty("java.io.tmpdir"));
- Preferences.systemRoot().clear();
- Preferences.userRoot().clear();
-
- Preferences p = Preferences.userNodeForPackage(Preferences.class);
- p.clear();
- try {
- p.removeNode();
- } catch (BackingStoreException e) {
- }
+ prefsTester.setUp();
}
/*
* @see TestCase#tearDown()
*/
+ @Override
protected void tearDown() throws Exception {
- super.tearDown();
stream.close();
- Preferences p = Preferences.userNodeForPackage(Preferences.class);
- p.clear();
- try {
- p.removeNode();
- } catch (BackingStoreException e) {
- }
-
- Preferences.systemRoot().clear();
- Preferences.userRoot().clear();
- System.setProperty("user.home", oldUserHome);
- System.setProperty("java.home", oldJavaHome);
+ prefsTester.tearDown();
+ super.tearDown();
}
@TestTargetNew(
@@ -1830,6 +1812,7 @@ public class PreferencesTest extends TestCase {
wrapper = in;
}
+ @Override
public int read() throws IOException {
checkException();
return wrapper.read();
@@ -1843,136 +1826,170 @@ public class PreferencesTest extends TestCase {
super();
}
+ @Override
public String absolutePath() {
return null;
}
+ @Override
public String[] childrenNames() throws BackingStoreException {
return null;
}
+ @Override
public void clear() throws BackingStoreException {
}
+ @Override
public void exportNode(OutputStream ostream) throws IOException,
BackingStoreException {
}
+ @Override
public void exportSubtree(OutputStream ostream) throws IOException,
BackingStoreException {
}
+ @Override
public void flush() throws BackingStoreException {
}
+ @Override
public String get(String key, String deflt) {
return null;
}
+ @Override
public boolean getBoolean(String key, boolean deflt) {
return false;
}
+ @Override
public byte[] getByteArray(String key, byte[] deflt) {
return null;
}
+ @Override
public double getDouble(String key, double deflt) {
return 0;
}
+ @Override
public float getFloat(String key, float deflt) {
return 0;
}
+ @Override
public int getInt(String key, int deflt) {
return 0;
}
+ @Override
public long getLong(String key, long deflt) {
return 0;
}
+ @Override
public boolean isUserNode() {
return false;
}
+ @Override
public String[] keys() throws BackingStoreException {
return null;
}
+ @Override
public String name() {
return null;
}
+ @Override
public Preferences node(String name) {
return null;
}
+ @Override
public boolean nodeExists(String name) throws BackingStoreException {
return false;
}
+ @Override
public Preferences parent() {
return null;
}
+ @Override
public void put(String key, String value) {
}
+ @Override
public void putBoolean(String key, boolean value) {
}
+ @Override
public void putByteArray(String key, byte[] value) {
}
+ @Override
public void putDouble(String key, double value) {
}
+ @Override
public void putFloat(String key, float value) {
}
+ @Override
public void putInt(String key, int value) {
}
+ @Override
public void putLong(String key, long value) {
}
+ @Override
public void remove(String key) {
}
+ @Override
public void removeNode() throws BackingStoreException {
}
+ @Override
public void addNodeChangeListener(NodeChangeListener ncl) {
}
+ @Override
public void addPreferenceChangeListener(PreferenceChangeListener pcl) {
}
+ @Override
public void removeNodeChangeListener(NodeChangeListener ncl) {
}
+ @Override
public void removePreferenceChangeListener(PreferenceChangeListener pcl) {
}
+ @Override
public void sync() throws BackingStoreException {
}
+ @Override
public String toString() {
return null;
}
diff --git a/prefs/src/test/java/tests/prefs/AllTests.java b/prefs/src/test/java/tests/prefs/AllTests.java
index 843d733..b3f2ed6 100644
--- a/prefs/src/test/java/tests/prefs/AllTests.java
+++ b/prefs/src/test/java/tests/prefs/AllTests.java
@@ -20,7 +20,8 @@ import junit.framework.Test;
import junit.framework.TestSuite;
/**
- * Test suite that includes all tests for the Math project.
+ * Test suite that includes all tests for the Prefs project.
+ *
*/
public class AllTests {
diff --git a/prefs/src/test/resources/prefs/java/util/prefs/preferences.dtd b/prefs/src/test/resources/prefs/java/util/prefs/preferences.dtd
deleted file mode 100644
index a116015..0000000
--- a/prefs/src/test/resources/prefs/java/util/prefs/preferences.dtd
+++ /dev/null
@@ -1,56 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
- -->
-
-<!-- DTD for a Preferences tree. -->
-
-<!-- The preferences element is at the root of an XML document
- representing a Preferences tree. -->
-<!ELEMENT preferences (root)>
-
-<!-- The preferences element contains an optional version attribute,
- which specifies version of DTD. -->
-<!ATTLIST preferences EXTERNAL_XML_VERSION CDATA "0.0" >
-
-<!-- The root element has a map representing the root's preferences
- (if any), and one node for each child of the root (if any). -->
-<!ELEMENT root (map, node*) >
-
-<!-- Additionally, the root contains a type attribute, which
- specifies whether it's the system or user root. -->
-<!ATTLIST root
- type (system|user) #REQUIRED >
-
-<!-- Each node has a map representing its preferences (if any),
- and one node for each child (if any). -->
-
-<!ELEMENT node (map, node*) >
-
-<!-- Additionally, each node has a name attribute -->
-<!ATTLIST node
- name CDATA #REQUIRED >
-
-<!-- A map represents the preferences stored at a node (if any). -->
-<!ELEMENT map (entry*) >
-
-<!-- An entry represents a single preference, which is simply
- a key-value pair. -->
-<!ELEMENT entry EMPTY >
-<!ATTLIST entry
- key CDATA #REQUIRED
- value CDATA #REQUIRED > \ No newline at end of file
diff --git a/regex/src/main/java/java/util/regex/Pattern.java b/regex/src/main/java/java/util/regex/Pattern.java
index c058db8..2853bbe 100644
--- a/regex/src/main/java/java/util/regex/Pattern.java
+++ b/regex/src/main/java/java/util/regex/Pattern.java
@@ -356,28 +356,33 @@ public final class Pattern implements Serializable {
}
/**
- * Splits the given input sequence around occurrences of the {@code Pattern}.
- * The function first determines all occurrences of the {@code Pattern}
- * inside the input sequence. It then builds an array of the
- * &quot;remaining&quot; strings before, in-between, and after these
- * occurrences. An additional parameter determines the maximal number of
- * entries in the resulting array and the handling of trailing empty
- * strings.
+ * Splits the given input sequence at occurrences of this {@code Pattern}.
+ *
+ * If this {@code Pattern} does not occur in the input, the result is an
+ * array containing the input (converted from a {@code CharSequence} to
+ * a {@code String}).
+ *
+ * Otherwise, the {@code limit} parameter controls the contents of the
+ * returned array as described below.
*
* @param inputSeq
* the input sequence.
* @param limit
- * Determines the maximal number of entries in the resulting
- * array.
+ * Determines the maximum number of entries in the resulting
+ * array, and the treatment of trailing empty strings.
* <ul>
- * <li>For n &gt; 0, it is guaranteed that the resulting array
- * contains at most n entries.
+ * <li>For n &gt; 0, the resulting array contains at most n
+ * entries. If this is fewer than the number of matches, the
+ * final entry will contain all remaining input.
* <li>For n &lt; 0, the length of the resulting array is
- * exactly the number of occurrences of the {@code Pattern} +1.
+ * exactly the number of occurrences of the {@code Pattern}
+ * plus one for the text after the final separator.
* All entries are included.
- * <li>For n == 0, the length of the resulting array is at most
- * the number of occurrences of the {@code Pattern} +1. Empty
- * strings at the end of the array are not included.
+ * <li>For n == 0, the result is as for n &lt; 0, except
+ * trailing empty strings will not be returned. (Note that
+ * the case where the input is itself an empty string is
+ * special, as described above, and the limit parameter does
+ * not apply there.)
* </ul>
*
* @return the resulting array.
@@ -385,6 +390,13 @@ public final class Pattern implements Serializable {
* @since Android 1.0
*/
public String[] split(CharSequence inputSeq, int limit) {
+ if (inputSeq.length() == 0) {
+ // Unlike Perl, which considers the result of splitting the empty
+ // string to be the empty array, Java returns an array containing
+ // the empty string.
+ return new String[] { "" };
+ }
+
int maxLength = limit <= 0 ? Integer.MAX_VALUE : limit;
String input = inputSeq.toString();
@@ -393,14 +405,10 @@ public final class Pattern implements Serializable {
Matcher matcher = new Matcher(this, inputSeq);
int savedPos = 0;
- // Add text preceding each occurrence, if enough space. Only do this for
- // non-empty input sequences, because otherwise we'd add the "trailing
- // empty string" twice.
- if (inputSeq.length() != 0) {
- while(matcher.find() && list.size() + 1 < maxLength) {
- list.add(input.substring(savedPos, matcher.start()));
- savedPos = matcher.end();
- }
+ // Add text preceding each occurrence, if enough space.
+ while(matcher.find() && list.size() + 1 < maxLength) {
+ list.add(input.substring(savedPos, matcher.start()));
+ savedPos = matcher.end();
}
// Add trailing text if enough space.
@@ -412,11 +420,10 @@ public final class Pattern implements Serializable {
}
}
- // Remove trailing spaces, if limit == 0 is requested.
+ // Remove trailing empty matches in the limit == 0 case.
if (limit == 0) {
int i = list.size() - 1;
- // Don't remove 1st element, since array must not be empty.
- while(i > 0 && "".equals(list.get(i))) {
+ while (i >= 0 && "".equals(list.get(i))) {
list.remove(i);
i--;
}
diff --git a/regex/src/test/java/org/apache/harmony/regex/tests/java/util/regex/SplitTest.java b/regex/src/test/java/org/apache/harmony/regex/tests/java/util/regex/SplitTest.java
index ea615c0..894dfff 100644
--- a/regex/src/test/java/org/apache/harmony/regex/tests/java/util/regex/SplitTest.java
+++ b/regex/src/test/java/org/apache/harmony/regex/tests/java/util/regex/SplitTest.java
@@ -32,12 +32,62 @@ public class SplitTest extends TestCase {
Pattern p = Pattern.compile("/");
String[] results = p.split("have/you/done/it/right");
String[] expected = new String[] { "have", "you", "done", "it", "right" };
- assertEquals(expected.length, results.length);
+ assertArraysEqual(expected, results);
+ }
+
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the basic functionality of split with empty matches.",
+ method = "split",
+ args = {java.lang.CharSequence.class}
+ )
+ })
+ public void testEmptySplits() {
+ // Trailing empty matches are removed.
+ assertArraysEqual(new String[0], "hello".split("."));
+ assertArraysEqual(new String[] { "1", "2" }, "1:2:".split(":"));
+ // ...including when that results in an empty result.
+ assertArraysEqual(new String[0], ":".split(":"));
+ // ...but not when limit < 0.
+ assertArraysEqual(new String[] { "1", "2", "" }, "1:2:".split(":", -1));
+
+ // Leading empty matches are retained.
+ assertArraysEqual(new String[] { "", "", "o" }, "hello".split(".."));
+
+ // A separator that doesn't occur in the input gets you the input.
+ assertArraysEqual(new String[] { "hello" }, "hello".split("not-present-in-test"));
+ // ...including when the input is the empty string.
+ // (Perl returns an empty list instead.)
+ assertArraysEqual(new String[] { "" }, "".split("not-present-in-test"));
+ assertArraysEqual(new String[] { "" }, "".split("A?"));
+
+ // The limit argument controls the size of the result.
+ // If l == 0, the result is as long as needed, except trailing empty matches are dropped.
+ // If l < 0, the result is as long as needed, and trailing empty matches are retained.
+ // If l > 0, the result contains the first l matches, plus one string containing the remaining input.
+ // Examples without a trailing separator (and hence without a trailing empty match):
+ assertArraysEqual(new String[] { "a", "b", "c" }, "a,b,c".split(",", 0));
+ assertArraysEqual(new String[] { "a,b,c" }, "a,b,c".split(",", 1));
+ assertArraysEqual(new String[] { "a", "b,c" }, "a,b,c".split(",", 2));
+ assertArraysEqual(new String[] { "a", "b", "c" }, "a,b,c".split(",", 3));
+ assertArraysEqual(new String[] { "a", "b", "c" }, "a,b,c".split(",", Integer.MAX_VALUE));
+ // Examples with a trailing separator (and hence possibly with a trailing empty match):
+ assertArraysEqual(new String[] { "a", "b", "c" }, "a,b,c,".split(",", 0));
+ assertArraysEqual(new String[] { "a,b,c," }, "a,b,c,".split(",", 1));
+ assertArraysEqual(new String[] { "a", "b,c," }, "a,b,c,".split(",", 2));
+ assertArraysEqual(new String[] { "a", "b", "c," }, "a,b,c,".split(",", 3));
+ assertArraysEqual(new String[] { "a", "b", "c", "" }, "a,b,c,".split(",", Integer.MAX_VALUE));
+ assertArraysEqual(new String[] { "a", "b", "c", "" }, "a,b,c,".split(",", -1));
+ }
+
+ private void assertArraysEqual(String[] expected, String[] actual) {
+ assertEquals(expected.length, actual.length);
for (int i = 0; i < expected.length; i++) {
- assertEquals(results[i], expected[i]);
+ assertEquals(Integer.toString(i), expected[i], actual[i]);
}
}
-
+
@TestTargetNew(
level = TestLevel.PARTIAL_COMPLETE,
notes = "Verifies the functionality of split(java.lang.CharSequence). Test uses not empty pattern.",
diff --git a/security/src/main/files/cacerts.bks b/security/src/main/files/cacerts.bks
index bbcc080..36f4919 100644
--- a/security/src/main/files/cacerts.bks
+++ b/security/src/main/files/cacerts.bks
Binary files differ
diff --git a/security/src/main/files/cacerts/3e7271e8.0 b/security/src/main/files/cacerts/3e7271e8.0
new file mode 100644
index 0000000..62b5b22
--- /dev/null
+++ b/security/src/main/files/cacerts/3e7271e8.0
@@ -0,0 +1,85 @@
+Certificate:
+ Data:
+ Version: 3 (0x2)
+ Serial Number: 946059622 (0x3863b966)
+ Signature Algorithm: sha1WithRSAEncryption
+ Issuer: O=Entrust.net, OU=www.entrust.net/CPS_2048 incorp. by ref. (limits liab.), OU=(c) 1999 Entrust.net Limited, CN=Entrust.net Certification Authority (2048)
+ Validity
+ Not Before: Dec 24 17:50:51 1999 GMT
+ Not After : Dec 24 18:20:51 2019 GMT
+ Subject: O=Entrust.net, OU=www.entrust.net/CPS_2048 incorp. by ref. (limits liab.), OU=(c) 1999 Entrust.net Limited, CN=Entrust.net Certification Authority (2048)
+ Subject Public Key Info:
+ Public Key Algorithm: rsaEncryption
+ RSA Public Key: (2048 bit)
+ Modulus (2048 bit):
+ 00:ad:4d:4b:a9:12:86:b2:ea:a3:20:07:15:16:64:
+ 2a:2b:4b:d1:bf:0b:4a:4d:8e:ed:80:76:a5:67:b7:
+ 78:40:c0:73:42:c8:68:c0:db:53:2b:dd:5e:b8:76:
+ 98:35:93:8b:1a:9d:7c:13:3a:0e:1f:5b:b7:1e:cf:
+ e5:24:14:1e:b1:81:a9:8d:7d:b8:cc:6b:4b:03:f1:
+ 02:0c:dc:ab:a5:40:24:00:7f:74:94:a1:9d:08:29:
+ b3:88:0b:f5:87:77:9d:55:cd:e4:c3:7e:d7:6a:64:
+ ab:85:14:86:95:5b:97:32:50:6f:3d:c8:ba:66:0c:
+ e3:fc:bd:b8:49:c1:76:89:49:19:fd:c0:a8:bd:89:
+ a3:67:2f:c6:9f:bc:71:19:60:b8:2d:e9:2c:c9:90:
+ 76:66:7b:94:e2:af:78:d6:65:53:5d:3c:d6:9c:b2:
+ cf:29:03:f9:2f:a4:50:b2:d4:48:ce:05:32:55:8a:
+ fd:b2:64:4c:0e:e4:98:07:75:db:7f:df:b9:08:55:
+ 60:85:30:29:f9:7b:48:a4:69:86:e3:35:3f:1e:86:
+ 5d:7a:7a:15:bd:ef:00:8e:15:22:54:17:00:90:26:
+ 93:bc:0e:49:68:91:bf:f8:47:d3:9d:95:42:c1:0e:
+ 4d:df:6f:26:cf:c3:18:21:62:66:43:70:d6:d5:c0:
+ 07:e1
+ Exponent: 65537 (0x10001)
+ X509v3 extensions:
+ Netscape Cert Type:
+ SSL CA, S/MIME CA, Object Signing CA
+ X509v3 Authority Key Identifier:
+ keyid:55:E4:81:D1:11:80:BE:D8:89:B9:08:A3:31:F9:A1:24:09:16:B9:70
+
+ X509v3 Subject Key Identifier:
+ 55:E4:81:D1:11:80:BE:D8:89:B9:08:A3:31:F9:A1:24:09:16:B9:70
+ 1.2.840.113533.7.65.0:
+ 0...V5.0:4.0....
+ Signature Algorithm: sha1WithRSAEncryption
+ 59:47:ac:21:84:8a:17:c9:9c:89:53:1e:ba:80:85:1a:c6:3c:
+ 4e:3e:b1:9c:b6:7c:c6:92:5d:18:64:02:e3:d3:06:08:11:61:
+ 7c:63:e3:2b:9d:31:03:70:76:d2:a3:28:a0:f4:bb:9a:63:73:
+ ed:6d:e5:2a:db:ed:14:a9:2b:c6:36:11:d0:2b:eb:07:8b:a5:
+ da:9e:5c:19:9d:56:12:f5:54:29:c8:05:ed:b2:12:2a:8d:f4:
+ 03:1b:ff:e7:92:10:87:b0:3a:b5:c3:9d:05:37:12:a3:c7:f4:
+ 15:b9:d5:a4:39:16:9b:53:3a:23:91:f1:a8:82:a2:6a:88:68:
+ c1:79:02:22:bc:aa:a6:d6:ae:df:b0:14:5f:b8:87:d0:dd:7c:
+ 7f:7b:ff:af:1c:cf:e6:db:07:ad:5e:db:85:9d:d0:2b:0d:33:
+ db:04:d1:e6:49:40:13:2b:76:fb:3e:e9:9c:89:0f:15:ce:18:
+ b0:85:78:21:4f:6b:4f:0e:fa:36:67:cd:07:f2:ff:08:d0:e2:
+ de:d9:bf:2a:af:b8:87:86:21:3c:04:ca:b7:94:68:7f:cf:3c:
+ e9:98:d7:38:ff:ec:c0:d9:50:f0:2e:4b:58:ae:46:6f:d0:2e:
+ c3:60:da:72:55:72:bd:4c:45:9e:61:ba:bf:84:81:92:03:d1:
+ d2:69:7c:c5
+-----BEGIN CERTIFICATE-----
+MIIEXDCCA0SgAwIBAgIEOGO5ZjANBgkqhkiG9w0BAQUFADCBtDEUMBIGA1UEChML
+RW50cnVzdC5uZXQxQDA+BgNVBAsUN3d3dy5lbnRydXN0Lm5ldC9DUFNfMjA0OCBp
+bmNvcnAuIGJ5IHJlZi4gKGxpbWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAxOTk5
+IEVudHJ1c3QubmV0IExpbWl0ZWQxMzAxBgNVBAMTKkVudHJ1c3QubmV0IENlcnRp
+ZmljYXRpb24gQXV0aG9yaXR5ICgyMDQ4KTAeFw05OTEyMjQxNzUwNTFaFw0xOTEy
+MjQxODIwNTFaMIG0MRQwEgYDVQQKEwtFbnRydXN0Lm5ldDFAMD4GA1UECxQ3d3d3
+LmVudHJ1c3QubmV0L0NQU18yMDQ4IGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxp
+YWIuKTElMCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDEzMDEG
+A1UEAxMqRW50cnVzdC5uZXQgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgKDIwNDgp
+MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArU1LqRKGsuqjIAcVFmQq
+K0vRvwtKTY7tgHalZ7d4QMBzQshowNtTK91euHaYNZOLGp18EzoOH1u3Hs/lJBQe
+sYGpjX24zGtLA/ECDNyrpUAkAH90lKGdCCmziAv1h3edVc3kw37XamSrhRSGlVuX
+MlBvPci6Zgzj/L24ScF2iUkZ/cCovYmjZy/Gn7xxGWC4LeksyZB2ZnuU4q941mVT
+XTzWnLLPKQP5L6RQstRIzgUyVYr9smRMDuSYB3Xbf9+5CFVghTAp+XtIpGmG4zU/
+HoZdenoVve8AjhUiVBcAkCaTvA5JaJG/+EfTnZVCwQ5N328mz8MYIWJmQ3DW1cAH
+4QIDAQABo3QwcjARBglghkgBhvhCAQEEBAMCAAcwHwYDVR0jBBgwFoAUVeSB0RGA
+vtiJuQijMfmhJAkWuXAwHQYDVR0OBBYEFFXkgdERgL7YibkIozH5oSQJFrlwMB0G
+CSqGSIb2fQdBAAQQMA4bCFY1LjA6NC4wAwIEkDANBgkqhkiG9w0BAQUFAAOCAQEA
+WUesIYSKF8mciVMeuoCFGsY8Tj6xnLZ8xpJdGGQC49MGCBFhfGPjK50xA3B20qMo
+oPS7mmNz7W3lKtvtFKkrxjYR0CvrB4ul2p5cGZ1WEvVUKcgF7bISKo30Axv/55IQ
+h7A6tcOdBTcSo8f0FbnVpDkWm1M6I5HxqIKiaohowXkCIryqptau37AUX7iH0N18
+f3v/rxzP5tsHrV7bhZ3QKw0z2wTR5klAEyt2+z7pnIkPFc4YsIV4IU9rTw76NmfN
+B/L/CNDi3tm/Kq+4h4YhPATKt5Rof8886ZjXOP/swNlQ8C5LWK5Gb9Auw2DaclVy
+vUxFnmG6v4SBkgPR0ml8xQ==
+-----END CERTIFICATE-----
diff --git a/security/src/main/files/cacerts/ab86d4de.0 b/security/src/main/files/cacerts/ab86d4de.0
new file mode 100644
index 0000000..c6f241f
--- /dev/null
+++ b/security/src/main/files/cacerts/ab86d4de.0
@@ -0,0 +1,104 @@
+Certificate:
+ Data:
+ Version: 3 (0x2)
+ Serial Number: 946062766 (0x3863c5ae)
+ Signature Algorithm: sha1WithRSAEncryption
+ Issuer: O=Entrust.net, OU=www.entrust.net/CPS_2048 incorp. by ref. (limits liab.), OU=(c) 1999 Entrust.net Limited, CN=Entrust.net Certification Authority (2048)
+ Validity
+ Not Before: Aug 25 18:14:26 2008 GMT
+ Not After : Aug 25 18:44:26 2018 GMT
+ Subject: C=US, O=Entrust, Inc., OU=AND ADDITIONAL TERMS GOVERNING USE AND RELIANCE, OU=CPS CONTAINS IMPORTANT LIMITATIONS OF WARRANTIES AND LIABILITY, OU=www.entrust.net/CPS is incorporated by reference, OU=(c) 2008 Entrust, Inc., CN=Entrust Certification Authority - L1B
+ Subject Public Key Info:
+ Public Key Algorithm: rsaEncryption
+ RSA Public Key: (2048 bit)
+ Modulus (2048 bit):
+ 00:dc:21:f5:68:f9:7a:ce:87:f2:78:df:d8:3b:4d:
+ 06:7d:c6:24:e4:a9:cd:9d:01:56:e4:f6:71:17:aa:
+ 7f:75:22:18:e4:74:6d:1b:3e:56:d5:b1:a6:1e:dd:
+ 59:26:53:ca:06:e6:ba:0b:6f:37:bb:a8:c6:9c:15:
+ 3b:06:1b:87:0c:c2:1a:4d:d3:81:ae:db:50:65:a5:
+ 3a:64:4f:30:34:9a:2b:a9:1f:fd:2b:d1:38:71:19:
+ 68:f2:8e:eb:7b:c9:40:3c:48:c4:19:b1:b7:10:25:
+ ef:44:a7:e6:77:9b:7d:22:9a:de:d8:5e:d9:c3:ce:
+ c9:71:22:bb:ae:ef:05:d6:f2:17:e7:56:78:e1:53:
+ 05:4a:26:73:b8:c7:49:67:93:23:0f:56:b2:8f:dd:
+ c9:59:05:e5:63:15:b4:87:7e:40:46:e9:b5:00:7b:
+ 03:b4:0d:e4:96:67:2c:de:1b:59:0b:1a:1f:b8:63:
+ 44:ae:c1:d7:44:87:c4:91:59:9c:00:43:6d:c6:df:
+ 0a:b0:b1:04:cd:fe:be:30:5e:3a:25:72:dd:a2:3e:
+ ed:46:3a:c7:a4:5c:5c:e4:25:f2:13:07:e8:ae:da:
+ 9b:19:9b:a2:d9:60:9d:ce:90:47:6a:61:7b:40:e8:
+ 14:c2:fe:2f:84:5a:66:17:c0:97:d3:49:38:de:63:
+ 02:9f
+ Exponent: 65537 (0x10001)
+ X509v3 extensions:
+ X509v3 Key Usage: critical
+ Certificate Sign, CRL Sign
+ X509v3 Basic Constraints: critical
+ CA:TRUE
+ Authority Information Access:
+ OCSP - URI:http://ocsp.entrust.net
+
+ X509v3 CRL Distribution Points:
+ URI:http://crl.entrust.net/2048ca.crl
+
+ X509v3 Certificate Policies:
+ Policy: X509v3 Any Policy
+ CPS: http://www.entrust.net/CPS
+
+ X509v3 Subject Key Identifier:
+ F5:F2:96:88:7D:0D:F3:2A:F9:4E:E7:34:A0:BD:46:7E:13:D6:16:C8
+ X509v3 Authority Key Identifier:
+ keyid:55:E4:81:D1:11:80:BE:D8:89:B9:08:A3:31:F9:A1:24:09:16:B9:70
+
+ 1.2.840.113533.7.65.0:
+ 0
+..V7.1....
+ Signature Algorithm: sha1WithRSAEncryption
+ 0b:25:3c:58:fa:8e:dc:a2:42:3b:76:71:6e:6c:d4:4f:2b:b9:
+ 53:5c:b2:58:b9:b1:dc:6f:1a:e4:e3:c4:50:f2:41:82:ba:f4:
+ 7d:c7:c1:f9:fa:8c:53:bf:b9:62:b7:49:e3:1d:0a:fc:1f:d6:
+ c4:76:6a:93:cb:77:1e:2c:7f:d0:3f:16:63:4c:72:4c:67:60:
+ 0f:f8:80:d6:a7:9a:ca:a2:33:91:0f:44:b2:66:3d:8e:68:0c:
+ 40:85:12:37:91:b9:82:77:34:59:2d:5c:df:82:6e:2c:b6:7a:
+ d2:04:90:67:68:4b:70:fc:2d:b8:ff:90:64:6f:7e:91:f7:d1:
+ 47:33:f3:5b:b8:58:2e:21:d8:75:60:1b:13:cc:f8:b2:a8:fa:
+ 6a:a9:2a:5a:4f:45:85:40:b4:dd:34:05:b7:70:ca:01:ef:e1:
+ 81:e7:11:50:db:3e:e2:d7:10:2e:6a:15:7f:b7:d4:a3:62:b2:
+ 89:69:61:57:c6:7f:8e:9e:d4:24:7a:f3:a1:43:5f:a0:7a:89:
+ dc:59:cd:7d:d7:75:a7:bc:53:d5:47:35:c6:31:30:20:9f:9b:
+ ba:b5:83:e6:89:55:01:4d:91:3b:d6:89:35:87:3c:83:6b:7a:
+ 29:82:d4:4b:d4:e6:16:74:b0:01:10:ab:69:06:14:37:7b:f7:
+ 66:30:3a:c5
+-----BEGIN CERTIFICATE-----
+MIIFkTCCBHmgAwIBAgIEOGPFrjANBgkqhkiG9w0BAQUFADCBtDEUMBIGA1UEChML
+RW50cnVzdC5uZXQxQDA+BgNVBAsUN3d3dy5lbnRydXN0Lm5ldC9DUFNfMjA0OCBp
+bmNvcnAuIGJ5IHJlZi4gKGxpbWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAxOTk5
+IEVudHJ1c3QubmV0IExpbWl0ZWQxMzAxBgNVBAMTKkVudHJ1c3QubmV0IENlcnRp
+ZmljYXRpb24gQXV0aG9yaXR5ICgyMDQ4KTAeFw0wODA4MjUxODE0MjZaFw0xODA4
+MjUxODQ0MjZaMIIBNDELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUVudHJ1c3QsIElu
+Yy4xODA2BgNVBAsTL0FORCBBRERJVElPTkFMIFRFUk1TIEdPVkVSTklORyBVU0Ug
+QU5EIFJFTElBTkNFMUcwRQYDVQQLEz5DUFMgQ09OVEFJTlMgSU1QT1JUQU5UIExJ
+TUlUQVRJT05TIE9GIFdBUlJBTlRJRVMgQU5EIExJQUJJTElUWTE5MDcGA1UECxMw
+d3d3LmVudHJ1c3QubmV0L0NQUyBpcyBpbmNvcnBvcmF0ZWQgYnkgcmVmZXJlbmNl
+MR8wHQYDVQQLExYoYykgMjAwOCBFbnRydXN0LCBJbmMuMS4wLAYDVQQDEyVFbnRy
+dXN0IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gTDFCMIIBIjANBgkqhkiG9w0B
+AQEFAAOCAQ8AMIIBCgKCAQEA3CH1aPl6zofyeN/YO00GfcYk5KnNnQFW5PZxF6p/
+dSIY5HRtGz5W1bGmHt1ZJlPKBua6C283u6jGnBU7BhuHDMIaTdOBrttQZaU6ZE8w
+NJorqR/9K9E4cRlo8o7re8lAPEjEGbG3ECXvRKfmd5t9Ipre2F7Zw87JcSK7ru8F
+1vIX51Z44VMFSiZzuMdJZ5MjD1ayj93JWQXlYxW0h35ARum1AHsDtA3klmcs3htZ
+CxofuGNErsHXRIfEkVmcAENtxt8KsLEEzf6+MF46JXLdoj7tRjrHpFxc5CXyEwfo
+rtqbGZui2WCdzpBHamF7QOgUwv4vhFpmF8CX00k43mMCnwIDAQABo4IBJjCCASIw
+DgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wMwYIKwYBBQUHAQEEJzAl
+MCMGCCsGAQUFBzABhhdodHRwOi8vb2NzcC5lbnRydXN0Lm5ldDAyBgNVHR8EKzAp
+MCegJaAjhiFodHRwOi8vY3JsLmVudHJ1c3QubmV0LzIwNDhjYS5jcmwwOwYDVR0g
+BDQwMjAwBgRVHSAAMCgwJgYIKwYBBQUHAgEWGmh0dHA6Ly93d3cuZW50cnVzdC5u
+ZXQvQ1BTMB0GA1UdDgQWBBT18paIfQ3zKvlO5zSgvUZ+E9YWyDAfBgNVHSMEGDAW
+gBRV5IHREYC+2Im5CKMx+aEkCRa5cDAZBgkqhkiG9n0HQQAEDDAKGwRWNy4xAwIA
+gTANBgkqhkiG9w0BAQUFAAOCAQEACyU8WPqO3KJCO3ZxbmzUTyu5U1yyWLmx3G8a
+5OPEUPJBgrr0fcfB+fqMU7+5YrdJ4x0K/B/WxHZqk8t3Hix/0D8WY0xyTGdgD/iA
+1qeayqIzkQ9EsmY9jmgMQIUSN5G5gnc0WS1c34JuLLZ60gSQZ2hLcPwtuP+QZG9+
+kffRRzPzW7hYLiHYdWAbE8z4sqj6aqkqWk9FhUC03TQFt3DKAe/hgecRUNs+4tcQ
+LmoVf7fUo2KyiWlhV8Z/jp7UJHrzoUNfoHqJ3FnNfdd1p7xT1Uc1xjEwIJ+burWD
+5olVAU2RO9aJNYc8g2t6KYLUS9TmFnSwARCraQYUN3v3ZjA6xQ==
+-----END CERTIFICATE-----
diff --git a/security/src/main/files/cacerts/b0f3e76e.0 b/security/src/main/files/cacerts/b0f3e76e.0
index 05ce1ec..386b70a 100644
--- a/security/src/main/files/cacerts/b0f3e76e.0
+++ b/security/src/main/files/cacerts/b0f3e76e.0
@@ -2,12 +2,12 @@ Certificate:
Data:
Version: 3 (0x2)
Serial Number:
- 02:00:00:00:00:00:d6:78:b7:94:05
- Signature Algorithm: md5WithRSAEncryption
+ 04:00:00:00:00:01:15:4b:5a:c3:94
+ Signature Algorithm: sha1WithRSAEncryption
Issuer: C=BE, O=GlobalSign nv-sa, OU=Root CA, CN=GlobalSign Root CA
Validity
Not Before: Sep 1 12:00:00 1998 GMT
- Not After : Jan 28 12:00:00 2014 GMT
+ Not After : Jan 28 12:00:00 2028 GMT
Subject: C=BE, O=GlobalSign nv-sa, OU=Root CA, CN=GlobalSign Root CA
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
@@ -35,32 +35,31 @@ Certificate:
X509v3 extensions:
X509v3 Key Usage: critical
Certificate Sign, CRL Sign
- X509v3 Subject Key Identifier:
- 60:7B:66:1A:45:0D:97:CA:89:50:2F:7D:04:CD:34:A8:FF:FC:FD:4B
X509v3 Basic Constraints: critical
CA:TRUE
- Signature Algorithm: md5WithRSAEncryption
- ae:aa:9f:fc:b7:d2:cb:1f:5f:39:29:28:18:9e:34:c9:6c:4f:
- 6f:1a:f0:64:a2:70:4a:4f:13:86:9b:60:28:9e:e8:81:49:98:
- 7d:0a:bb:e5:b0:9d:3d:36:db:8f:05:51:ff:09:31:2a:1f:dd:
- 89:77:9e:0f:2e:6c:95:04:ed:86:cb:b4:00:3f:84:02:4d:80:
- 6a:2a:2d:78:0b:ae:6f:2b:a2:83:44:83:1f:cd:50:82:4c:24:
- af:bd:f7:a5:b4:c8:5a:0f:f4:e7:47:5e:49:8e:37:96:fe:9a:
- 88:05:3a:d9:c0:db:29:87:e6:19:96:47:a7:3a:a6:8c:8b:3c:
- 77:fe:46:63:a7:53:da:21:d1:ac:7e:49:a2:4b:e6:c3:67:59:
- 2f:b3:8a:0e:bb:2c:bd:a9:aa:42:7c:35:c1:d8:7f:d5:a7:31:
- 3a:4e:63:43:39:af:08:b0:61:34:8c:d3:98:a9:43:34:f6:0f:
- 87:29:3b:9d:c2:56:58:98:77:c3:f7:1b:ac:f6:9d:f8:3e:aa:
- a7:54:45:f0:f5:f9:d5:31:65:fe:6b:58:9c:71:b3:1e:d7:52:
- ea:32:17:fc:40:60:1d:c9:79:24:b2:f6:6c:fd:a8:66:0e:82:
- dd:98:cb:da:c2:44:4f:2e:a0:7b:f2:f7:6b:2c:76:11:84:46:
- 8a:78:a3:e3
-SHA1 Fingerprint=2F:17:3F:7D:E9:96:67:AF:A5:7A:F8:0A:A2:D1:B1:2F:AC:83:03:38
+ X509v3 Subject Key Identifier:
+ 60:7B:66:1A:45:0D:97:CA:89:50:2F:7D:04:CD:34:A8:FF:FC:FD:4B
+ Signature Algorithm: sha1WithRSAEncryption
+ d6:73:e7:7c:4f:76:d0:8d:bf:ec:ba:a2:be:34:c5:28:32:b5:
+ 7c:fc:6c:9c:2c:2b:bd:09:9e:53:bf:6b:5e:aa:11:48:b6:e5:
+ 08:a3:b3:ca:3d:61:4d:d3:46:09:b3:3e:c3:a0:e3:63:55:1b:
+ f2:ba:ef:ad:39:e1:43:b9:38:a3:e6:2f:8a:26:3b:ef:a0:50:
+ 56:f9:c6:0a:fd:38:cd:c4:0b:70:51:94:97:98:04:df:c3:5f:
+ 94:d5:15:c9:14:41:9c:c4:5d:75:64:15:0d:ff:55:30:ec:86:
+ 8f:ff:0d:ef:2c:b9:63:46:f6:aa:fc:df:bc:69:fd:2e:12:48:
+ 64:9a:e0:95:f0:a6:ef:29:8f:01:b1:15:b5:0c:1d:a5:fe:69:
+ 2c:69:24:78:1e:b3:a7:1c:71:62:ee:ca:c8:97:ac:17:5d:8a:
+ c2:f8:47:86:6e:2a:c4:56:31:95:d0:67:89:85:2b:f9:6c:a6:
+ 5d:46:9d:0c:aa:82:e4:99:51:dd:70:b7:db:56:3d:61:e4:6a:
+ e1:5c:d6:f6:fe:3d:de:41:cc:07:ae:63:52:bf:53:53:f4:2b:
+ e9:c7:fd:b6:f7:82:5f:85:d2:41:18:db:81:b3:04:1c:c5:1f:
+ a4:80:6f:15:20:c9:de:0c:88:0a:1d:d6:66:55:e2:fc:48:c9:
+ 29:26:69:e0
-----BEGIN CERTIFICATE-----
-MIIDdTCCAl2gAwIBAgILAgAAAAAA1ni3lAUwDQYJKoZIhvcNAQEEBQAwVzELMAkG
+MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkG
A1UEBhMCQkUxGTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jv
b3QgQ0ExGzAZBgNVBAMTEkdsb2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAw
-MDBaFw0xNDAxMjgxMjAwMDBaMFcxCzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9i
+MDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9i
YWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYDVQQDExJHbG9iYWxT
aWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDaDuaZ
jc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavp
@@ -68,12 +67,12 @@ xy0Sy6scTHAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp
1Wrjsok6Vjk4bwY8iGlbKk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdG
snUOhugZitVtbNV4FpWi6cgKOOvyJBNPc1STE4U6G7weNLWLBYy5d4ux2x8gkasJ
U26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrXgzT/LCrBbBlDSgeF59N8
-9iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIABjAdBgNVHQ4EFgQU
-YHtmGkUNl8qJUC99BM00qP/8/UswDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0B
-AQQFAAOCAQEArqqf/LfSyx9fOSkoGJ40yWxPbxrwZKJwSk8ThptgKJ7ogUmYfQq7
-5bCdPTbbjwVR/wkxKh/diXeeDy5slQTthsu0AD+EAk2AaioteAuubyuig0SDH81Q
-gkwkr733pbTIWg/050deSY43lv6aiAU62cDbKYfmGZZHpzqmjIs8d/5GY6dT2iHR
-rH5Jokvmw2dZL7OKDrssvamqQnw1wdh/1acxOk5jQzmvCLBhNIzTmKlDNPYPhyk7
-ncJWWJh3w/cbrPad+D6qp1RF8PX51TFl/mtYnHGzHtdS6jIX/EBgHcl5JLL2bP2o
-Zg6C3ZjL2sJETy6ge/L3ayx2EYRGinij4w==
+9iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8E
+BTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0B
+AQUFAAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOz
+yj1hTdNGCbM+w6DjY1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE
+38NflNUVyRRBnMRddWQVDf9VMOyGj/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymP
+AbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhHhm4qxFYxldBniYUr+WymXUad
+DKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveCX4XSQRjbgbME
+HMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A==
-----END CERTIFICATE-----
diff --git a/security/src/main/files/cacerts/bf64f35b.0 b/security/src/main/files/cacerts/bf64f35b.0
new file mode 100644
index 0000000..389623c
--- /dev/null
+++ b/security/src/main/files/cacerts/bf64f35b.0
@@ -0,0 +1,92 @@
+Certificate:
+ Data:
+ Version: 3 (0x2)
+ Serial Number: 1116155212 (0x42872d4c)
+ Signature Algorithm: sha1WithRSAEncryption
+ Issuer: C=US, O=Entrust.net, OU=www.entrust.net/CPS incorp. by ref. (limits liab.), OU=(c) 1999 Entrust.net Limited, CN=Entrust.net Secure Server Certification Authority
+ Validity
+ Not Before: Jan 5 19:20:39 2007 GMT
+ Not After : Jan 5 19:50:39 2017 GMT
+ Subject: C=US, O=Entrust, Inc., OU=www.entrust.net/CPS is incorporated by reference, OU=(c) 2006 Entrust, Inc., CN=Entrust Root Certification Authority
+ Subject Public Key Info:
+ Public Key Algorithm: rsaEncryption
+ RSA Public Key: (2048 bit)
+ Modulus (2048 bit):
+ 00:b6:95:b6:43:42:fa:c6:6d:2a:6f:48:df:94:4c:
+ 39:57:05:ee:c3:79:11:41:68:36:ed:ec:fe:9a:01:
+ 8f:a1:38:28:fc:f7:10:46:66:2e:4d:1e:1a:b1:1a:
+ 4e:c6:d1:c0:95:88:b0:c9:ff:31:8b:33:03:db:b7:
+ 83:7b:3e:20:84:5e:ed:b2:56:28:a7:f8:e0:b9:40:
+ 71:37:c5:cb:47:0e:97:2a:68:c0:22:95:62:15:db:
+ 47:d9:f5:d0:2b:ff:82:4b:c9:ad:3e:de:4c:db:90:
+ 80:50:3f:09:8a:84:00:ec:30:0a:3d:18:cd:fb:fd:
+ 2a:59:9a:23:95:17:2c:45:9e:1f:6e:43:79:6d:0c:
+ 5c:98:fe:48:a7:c5:23:47:5c:5e:fd:6e:e7:1e:b4:
+ f6:68:45:d1:86:83:5b:a2:8a:8d:b1:e3:29:80:fe:
+ 25:71:88:ad:be:bc:8f:ac:52:96:4b:aa:51:8d:e4:
+ 13:31:19:e8:4e:4d:9f:db:ac:b3:6a:d5:bc:39:54:
+ 71:ca:7a:7a:7f:90:dd:7d:1d:80:d9:81:bb:59:26:
+ c2:11:fe:e6:93:e2:f7:80:e4:65:fb:34:37:0e:29:
+ 80:70:4d:af:38:86:2e:9e:7f:57:af:9e:17:ae:eb:
+ 1c:cb:28:21:5f:b6:1c:d8:e7:a2:04:22:f9:d3:da:
+ d8:cb
+ Exponent: 65537 (0x10001)
+ X509v3 extensions:
+ X509v3 Key Usage: critical
+ Certificate Sign, CRL Sign
+ X509v3 Basic Constraints: critical
+ CA:TRUE
+ Authority Information Access:
+ OCSP - URI:http://ocsp.entrust.net
+
+ X509v3 CRL Distribution Points:
+ URI:http://crl.entrust.net/server1.crl
+
+ X509v3 Certificate Policies:
+ Policy: X509v3 Any Policy
+ CPS: http://www.entrust.net/CPS
+
+ X509v3 Subject Key Identifier:
+ 68:90:E4:67:A4:A6:53:80:C7:86:66:A4:F1:F7:4B:43:FB:84:BD:6D
+ X509v3 Authority Key Identifier:
+ keyid:F0:17:62:13:55:3D:B3:FF:0A:00:6B:FB:50:84:97:F3:ED:62:D0:1A
+
+ 1.2.840.113533.7.65.0:
+ 0
+..V7.1....
+ Signature Algorithm: sha1WithRSAEncryption
+ 0c:b0:84:7c:2d:13:fe:9a:3d:bf:18:05:95:3d:20:48:a3:16:
+ 81:87:15:50:15:a4:88:8d:9f:60:d4:3a:6f:eb:2d:6e:3a:86:
+ a4:a9:d2:c1:9d:89:7a:08:1c:a4:2d:b3:47:8e:0f:64:4a:6f:
+ 66:03:83:3f:4f:34:94:36:aa:29:6d:8b:8d:02:22:2b:8c:cd:
+ 77:a5:70:95:86:91:d1:b6:bf:52:be:33:6a:6b:99:f9:6f:e1:
+ 12:be:04:cb:33:bf:f5:12:1a:4e:44:ba:5b:16:4d:30:b9:f3:
+ b4:74:ce:6e:f2:68:56:58:dd:d8:a1:fd:54:05:f4:23:91:85:
+ c9:f9
+-----BEGIN CERTIFICATE-----
+MIIEmzCCBASgAwIBAgIEQoctTDANBgkqhkiG9w0BAQUFADCBwzELMAkGA1UEBhMC
+VVMxFDASBgNVBAoTC0VudHJ1c3QubmV0MTswOQYDVQQLEzJ3d3cuZW50cnVzdC5u
+ZXQvQ1BTIGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTElMCMGA1UECxMc
+KGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDE6MDgGA1UEAxMxRW50cnVzdC5u
+ZXQgU2VjdXJlIFNlcnZlciBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNzAx
+MDUxOTIwMzlaFw0xNzAxMDUxOTUwMzlaMIGwMQswCQYDVQQGEwJVUzEWMBQGA1UE
+ChMNRW50cnVzdCwgSW5jLjE5MDcGA1UECxMwd3d3LmVudHJ1c3QubmV0L0NQUyBp
+cyBpbmNvcnBvcmF0ZWQgYnkgcmVmZXJlbmNlMR8wHQYDVQQLExYoYykgMjAwNiBF
+bnRydXN0LCBJbmMuMS0wKwYDVQQDEyRFbnRydXN0IFJvb3QgQ2VydGlmaWNhdGlv
+biBBdXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC2lbZD
+QvrGbSpvSN+UTDlXBe7DeRFBaDbt7P6aAY+hOCj89xBGZi5NHhqxGk7G0cCViLDJ
+/zGLMwPbt4N7PiCEXu2yViin+OC5QHE3xctHDpcqaMAilWIV20fZ9dAr/4JLya0+
+3kzbkIBQPwmKhADsMAo9GM37/SpZmiOVFyxFnh9uQ3ltDFyY/kinxSNHXF79buce
+tPZoRdGGg1uiio2x4ymA/iVxiK2+vI+sUpZLqlGN5BMxGehOTZ/brLNq1bw5VHHK
+enp/kN19HYDZgbtZJsIR/uaT4veA5GX7NDcOKYBwTa84hi6ef1evnheu6xzLKCFf
+thzY56IEIvnT2tjLAgMBAAGjggEnMIIBIzAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0T
+AQH/BAUwAwEB/zAzBggrBgEFBQcBAQQnMCUwIwYIKwYBBQUHMAGGF2h0dHA6Ly9v
+Y3NwLmVudHJ1c3QubmV0MDMGA1UdHwQsMCowKKAmoCSGImh0dHA6Ly9jcmwuZW50
+cnVzdC5uZXQvc2VydmVyMS5jcmwwOwYDVR0gBDQwMjAwBgRVHSAAMCgwJgYIKwYB
+BQUHAgEWGmh0dHA6Ly93d3cuZW50cnVzdC5uZXQvQ1BTMB0GA1UdDgQWBBRokORn
+pKZTgMeGZqTx90tD+4S9bTAfBgNVHSMEGDAWgBTwF2ITVT2z/woAa/tQhJfz7WLQ
+GjAZBgkqhkiG9n0HQQAEDDAKGwRWNy4xAwIAgTANBgkqhkiG9w0BAQUFAAOBgQAM
+sIR8LRP+mj2/GAWVPSBIoxaBhxVQFaSIjZ9g1Dpv6y1uOoakqdLBnYl6CBykLbNH
+jg9kSm9mA4M/TzSUNqopbYuNAiIrjM13pXCVhpHRtr9SvjNqa5n5b+ESvgTLM7/1
+EhpORLpbFk0wufO0dM5u8mhWWN3Yof1UBfQjkYXJ+Q==
+-----END CERTIFICATE-----
diff --git a/security/src/main/files/certimport.sh b/security/src/main/files/certimport.sh
index 7c0fab0..c021a10 100755
--- a/security/src/main/files/certimport.sh
+++ b/security/src/main/files/certimport.sh
@@ -1,4 +1,5 @@
#!/bin/bash
+# java version >= 1.6 is required for this script.
# This script was tested to work with bouncycastle 1.32.
set -x
@@ -6,6 +7,14 @@ set -e
CERTSTORE=cacerts.bks
+# Check java version.
+JAVA_VERSION=`java -version 2>&1 | head -1`
+JAVA_VERSION_MINOR=`expr match "$JAVA_VERSION" "java version \"[1-9]\.\([0-9]\).*\""`
+if [ $JAVA_VERSION_MINOR -lt 6 ]; then
+ echo "java version 1.6 or greater required for keytool usage"
+ exit 255
+fi
+
if [ -a $CERTSTORE ]; then
rm $CERTSTORE || exit 1
fi
diff --git a/security/src/main/java/org/apache/harmony/security/provider/cert/X509CertImpl.java b/security/src/main/java/org/apache/harmony/security/provider/cert/X509CertImpl.java
index ccbc4a4..d3b4563 100644
--- a/security/src/main/java/org/apache/harmony/security/provider/cert/X509CertImpl.java
+++ b/security/src/main/java/org/apache/harmony/security/provider/cert/X509CertImpl.java
@@ -95,7 +95,9 @@ public class X509CertImpl extends X509Certificate {
private PublicKey publicKey;
// encoding of the certificate
- private byte[] encoding;
+// BEGIN android-changed
+ private volatile byte[] encoding;
+// END android-changed
//
// ---------------------- Constructors -------------------------------
diff --git a/security/src/main/java/org/bouncycastle/jce/provider/CertPathValidatorUtilities.java b/security/src/main/java/org/bouncycastle/jce/provider/CertPathValidatorUtilities.java
index 56da91a..8383b98 100644
--- a/security/src/main/java/org/bouncycastle/jce/provider/CertPathValidatorUtilities.java
+++ b/security/src/main/java/org/bouncycastle/jce/provider/CertPathValidatorUtilities.java
@@ -78,12 +78,13 @@ public class CertPathValidatorUtilities
"privilegeWithdrawn",
"aACompromise" };
+// BEGIN android-changed
/**
* Search the given Set of TrustAnchor's for one that is the
* issuer of the given X509 certificate.
*
* @param cert the X509 certificate
- * @param trustAnchors a Set of TrustAnchor's
+ * @param params with trust anchors
*
* @return the <code>TrustAnchor</code> object if found or
* <code>null</code> if not.
@@ -93,15 +94,20 @@ public class CertPathValidatorUtilities
* has thrown an exception. This Exception can be obtainted with
* <code>getCause()</code> method.
**/
- protected static final TrustAnchor findTrustAnchor(
- X509Certificate cert,
- CertPath certPath,
- int index,
- Set trustAnchors)
- throws CertPathValidatorException
- {
- Iterator iter = trustAnchors.iterator();
- TrustAnchor trust = null;
+ static final TrustAnchor findTrustAnchor(
+ X509Certificate cert,
+ CertPath certPath,
+ int index,
+ PKIXParameters params)
+ throws CertPathValidatorException {
+ // If we have a trust anchor index, use it.
+ if (params instanceof IndexedPKIXParameters) {
+ IndexedPKIXParameters indexed = (IndexedPKIXParameters) params;
+ return indexed.findTrustAnchor(cert, certPath, index);
+ }
+
+ Iterator iter = params.getTrustAnchors().iterator();
+ TrustAnchor found = null;
PublicKey trustPublicKey = null;
Exception invalidKeyEx = null;
@@ -116,65 +122,63 @@ public class CertPathValidatorUtilities
throw new CertPathValidatorException(ex);
}
- // BEGIN android-changed
byte[] certBytes = null;
try {
certBytes = cert.getEncoded();
} catch (Exception e) {
// ignore, just continue
}
- while (iter.hasNext() && trust == null)
+ while (iter.hasNext() && found == null)
{
- trust = (TrustAnchor) iter.next();
- X509Certificate trustCert = trust.getTrustedCert();
- if (trustCert != null)
+ found = (TrustAnchor) iter.next();
+ X509Certificate foundCert = found.getTrustedCert();
+ if (foundCert != null)
{
// If the trust anchor is identical to the certificate we're
// done. Just return the anchor.
// There is similar code in PKIXCertPathValidatorSpi.
try {
- byte[] trustBytes = trustCert.getEncoded();
- if (certBytes != null && Arrays.equals(trustBytes,
+ byte[] foundBytes = foundCert.getEncoded();
+ if (certBytes != null && Arrays.equals(foundBytes,
certBytes)) {
- return trust;
+ return found;
}
} catch (Exception e) {
// ignore, continue and verify the certificate
}
- if (certSelectX509.match(trustCert))
+ if (certSelectX509.match(foundCert))
{
- trustPublicKey = trustCert.getPublicKey();
+ trustPublicKey = foundCert.getPublicKey();
}
else
{
- trust = null;
+ found = null;
}
- // END android-changed
}
- else if (trust.getCAName() != null
- && trust.getCAPublicKey() != null)
+ else if (found.getCAName() != null
+ && found.getCAPublicKey() != null)
{
try
{
X500Principal certIssuer = getEncodedIssuerPrincipal(cert);
- X500Principal caName = new X500Principal(trust.getCAName());
+ X500Principal caName = new X500Principal(found.getCAName());
if (certIssuer.equals(caName))
{
- trustPublicKey = trust.getCAPublicKey();
+ trustPublicKey = found.getCAPublicKey();
}
else
{
- trust = null;
+ found = null;
}
}
catch (IllegalArgumentException ex)
{
- trust = null;
+ found = null;
}
}
else
{
- trust = null;
+ found = null;
}
if (trustPublicKey != null)
@@ -186,18 +190,19 @@ public class CertPathValidatorUtilities
catch (Exception ex)
{
invalidKeyEx = ex;
- trust = null;
+ found = null;
}
}
}
- if (trust == null && invalidKeyEx != null)
+ if (found == null && invalidKeyEx != null)
{
throw new CertPathValidatorException("TrustAnchor found but certificate validation failed.", invalidKeyEx, certPath, index);
}
- return trust;
+ return found;
}
+// END android-changed
protected static X500Principal getEncodedIssuerPrincipal(X509Certificate cert)
{
diff --git a/security/src/main/java/org/bouncycastle/jce/provider/IndexedPKIXParameters.java b/security/src/main/java/org/bouncycastle/jce/provider/IndexedPKIXParameters.java
new file mode 100644
index 0000000..e8e834a
--- /dev/null
+++ b/security/src/main/java/org/bouncycastle/jce/provider/IndexedPKIXParameters.java
@@ -0,0 +1,144 @@
+/*
+ * Copyright (C) 2009 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 org.bouncycastle.jce.provider;
+
+import javax.security.auth.x500.X500Principal;
+
+import java.security.cert.CertPath;
+import java.security.cert.CertPathValidatorException;
+import java.security.cert.CertificateEncodingException;
+import java.security.cert.PKIXParameters;
+import java.security.cert.TrustAnchor;
+import java.security.cert.X509Certificate;
+import java.security.InvalidAlgorithmParameterException;
+import java.security.KeyStoreException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.logging.Logger;
+import java.util.logging.Level;
+
+/**
+ * Indexes trust anchors so they can be found in O(1) time instead of O(N).
+ */
+public class IndexedPKIXParameters extends PKIXParameters {
+
+ final Map<Bytes, TrustAnchor> encodings
+ = new HashMap<Bytes, TrustAnchor>();
+ final Map<X500Principal, TrustAnchor> bySubject
+ = new HashMap<X500Principal, TrustAnchor>();
+ final Map<X500Principal, List<TrustAnchor>> byCA
+ = new HashMap<X500Principal, List<TrustAnchor>>();
+
+ public IndexedPKIXParameters(Set<TrustAnchor> anchors)
+ throws KeyStoreException, InvalidAlgorithmParameterException,
+ CertificateEncodingException {
+ super(anchors);
+
+ for (TrustAnchor anchor : anchors) {
+ X509Certificate cert = anchor.getTrustedCert();
+
+ Bytes encoded = new Bytes(cert.getEncoded());
+ encodings.put(encoded, anchor);
+
+ X500Principal subject = cert.getSubjectX500Principal();
+ if (bySubject.put(subject, anchor) != null) {
+ // TODO: Should we allow this?
+ throw new KeyStoreException("Two certs have the same subject: "
+ + subject);
+ }
+
+ X500Principal ca = anchor.getCA();
+ List<TrustAnchor> caAnchors = byCA.get(ca);
+ if (caAnchors == null) {
+ caAnchors = new ArrayList<TrustAnchor>();
+ byCA.put(ca, caAnchors);
+ }
+ caAnchors.add(anchor);
+ }
+ }
+
+ TrustAnchor findTrustAnchor(X509Certificate cert, CertPath certPath,
+ int index) throws CertPathValidatorException {
+ // Mimic the alg in CertPathValidatorUtilities.findTrustAnchor().
+ Exception verificationException = null;
+ X500Principal issuer = cert.getIssuerX500Principal();
+
+ List<TrustAnchor> anchors = byCA.get(issuer);
+ if (anchors != null) {
+ for (TrustAnchor caAnchor : anchors) {
+ try {
+ cert.verify(caAnchor.getCAPublicKey());
+ return caAnchor;
+ } catch (Exception e) {
+ verificationException = e;
+ }
+ }
+ }
+
+ TrustAnchor anchor = bySubject.get(issuer);
+ if (anchor != null) {
+ try {
+ cert.verify(anchor.getTrustedCert().getPublicKey());
+ return anchor;
+ } catch (Exception e) {
+ verificationException = e;
+ }
+ }
+
+ try {
+ Bytes encoded = new Bytes(cert.getEncoded());
+ anchor = encodings.get(encoded);
+ if (anchor != null) {
+ return anchor;
+ }
+ } catch (Exception e) {
+ Logger.getLogger(IndexedPKIXParameters.class.getName()).log(
+ Level.WARNING, "Error encoding cert.", e);
+ }
+
+ // Throw last verification exception.
+ if (verificationException != null) {
+ throw new CertPathValidatorException("TrustAnchor found but"
+ + " certificate verification failed.",
+ verificationException, certPath, index);
+ }
+
+ return null;
+ }
+
+ /**
+ * Wraps a byte[] and adds equals() and hashCode() support.
+ */
+ static class Bytes {
+ final byte[] bytes;
+ final int hash;
+ Bytes(byte[] bytes) {
+ this.bytes = bytes;
+ this.hash = Arrays.hashCode(bytes);
+ }
+ @Override public int hashCode() {
+ return hash;
+ }
+ @Override public boolean equals(Object o) {
+ return Arrays.equals(bytes, ((Bytes) o).bytes);
+ }
+ }
+}
diff --git a/security/src/main/java/org/bouncycastle/jce/provider/PKIXCertPathValidatorSpi.java b/security/src/main/java/org/bouncycastle/jce/provider/PKIXCertPathValidatorSpi.java
index 3029bce..f5d6711 100644
--- a/security/src/main/java/org/bouncycastle/jce/provider/PKIXCertPathValidatorSpi.java
+++ b/security/src/main/java/org/bouncycastle/jce/provider/PKIXCertPathValidatorSpi.java
@@ -138,7 +138,11 @@ public class PKIXCertPathValidatorSpi extends CertPathValidatorSpi
// (d)
//
X509Certificate lastCert = (X509Certificate)certs.get(certs.size() - 1);
- TrustAnchor trust = CertPathValidatorUtilities.findTrustAnchor(lastCert, certPath, certs.size() - 1, paramsPKIX.getTrustAnchors());
+
+// BEGIN android-changed
+ TrustAnchor trust = CertPathValidatorUtilities.findTrustAnchor(lastCert,
+ certPath, certs.size() - 1, paramsPKIX);
+// END android-changed
if (trust == null)
{
diff --git a/security/src/main/java/org/bouncycastle/jce/provider/X509CertificateObject.java b/security/src/main/java/org/bouncycastle/jce/provider/X509CertificateObject.java
index c9a4da2..d17fd59 100644
--- a/security/src/main/java/org/bouncycastle/jce/provider/X509CertificateObject.java
+++ b/security/src/main/java/org/bouncycastle/jce/provider/X509CertificateObject.java
@@ -542,23 +542,25 @@ public class X509CertificateObject
return JDKKeyFactory.createPublicKeyFromPublicKeyInfo(c.getSubjectPublicKeyInfo());
}
+// BEGIN android-changed
+ private ByteArrayOutputStream encodedOut;
public byte[] getEncoded()
- throws CertificateEncodingException
- {
- ByteArrayOutputStream bOut = new ByteArrayOutputStream();
- DEROutputStream dOut = new DEROutputStream(bOut);
-
- try
- {
- dOut.writeObject(c);
-
- return bOut.toByteArray();
- }
- catch (IOException e)
- {
- throw new CertificateEncodingException(e.toString());
+ throws CertificateEncodingException {
+ synchronized (this) {
+ if (encodedOut == null) {
+ ByteArrayOutputStream bOut = new ByteArrayOutputStream();
+ DEROutputStream dOut = new DEROutputStream(bOut);
+ try {
+ dOut.writeObject(c);
+ encodedOut = bOut;
+ } catch (IOException e) {
+ throw new CertificateEncodingException(e.toString());
+ }
+ }
}
+ return encodedOut.toByteArray();
}
+// END android-changed
public boolean equals(
Object o)
diff --git a/sql/src/main/java/java/sql/Array.java b/sql/src/main/java/java/sql/Array.java
index 6113c46..fc9debe 100644
--- a/sql/src/main/java/java/sql/Array.java
+++ b/sql/src/main/java/java/sql/Array.java
@@ -21,8 +21,6 @@ import java.util.Map;
/**
* A Java representation of the SQL {@code ARRAY} type.
- *
- * @since Android 1.0
*/
public interface Array {
@@ -33,7 +31,6 @@ public interface Array {
* @return A Java array containing the elements of this Array
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public Object getArray() throws SQLException;
@@ -50,7 +47,6 @@ public interface Array {
* @return A Java array containing the desired set of elements from this Array
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public Object getArray(long index, int count) throws SQLException;
@@ -70,7 +66,6 @@ public interface Array {
* @return A Java array containing the desired set of elements from this Array
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public Object getArray(long index, int count, Map<String, Class<?>> map)
throws SQLException;
@@ -84,7 +79,6 @@ public interface Array {
* @return A Java array containing the elements of this array
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public Object getArray(Map<String, Class<?>> map) throws SQLException;
@@ -95,7 +89,6 @@ public interface Array {
* @return An integer constant from the {@code java.sql.Types} class
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public int getBaseType() throws SQLException;
@@ -106,7 +99,6 @@ public interface Array {
* @return The database specific name or a fully-qualified SQL type name.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public String getBaseTypeName() throws SQLException;
@@ -117,7 +109,6 @@ public interface Array {
* @return the elements of the array as a {@code ResultSet}.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public ResultSet getResultSet() throws SQLException;
@@ -134,7 +125,6 @@ public interface Array {
* @return the elements of the array as a {@code ResultSet}.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public ResultSet getResultSet(long index, int count) throws SQLException;
@@ -155,7 +145,6 @@ public interface Array {
* database error has occurred.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public ResultSet getResultSet(long index, int count,
Map<String, Class<?>> map) throws SQLException;
@@ -170,7 +159,6 @@ public interface Array {
* @return the array as a {@code ResultSet}.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public ResultSet getResultSet(Map<String, Class<?>> map)
throws SQLException;
diff --git a/sql/src/main/java/java/sql/BatchUpdateException.java b/sql/src/main/java/java/sql/BatchUpdateException.java
index 36a7ef9..0a616db 100644
--- a/sql/src/main/java/java/sql/BatchUpdateException.java
+++ b/sql/src/main/java/java/sql/BatchUpdateException.java
@@ -26,7 +26,7 @@ import java.io.Serializable;
* problem that occurred, compared with a standard {@code SQLException}. It
* supplies update counts for successful commands which were executed before the
* exception was encountered.
- * </p>
+ * <p>
* The element order in the array of update counts matches the order that the
* commands were added to the batch operation.
* <p>
@@ -37,9 +37,6 @@ import java.io.Serializable;
* for every command in the batch, not only those that executed successfully. In
* this case, the array element for any command which encountered a problem is
* set to {@code Statement.EXECUTE_FAILED}.
- * </p>
- *
- * @since Android 1.0
*/
public class BatchUpdateException extends SQLException implements Serializable {
@@ -51,8 +48,6 @@ public class BatchUpdateException extends SQLException implements Serializable {
* Creates a default {@code BatchUpdateException} with the parameters
* <i>reason</i>, <i>SQLState</i>, and <i>update counts</i> set to {@code
* null} and the <i>vendor code</i> set to 0.
- *
- * @since Android 1.0
*/
public BatchUpdateException() {
super();
@@ -67,7 +62,6 @@ public class BatchUpdateException extends SQLException implements Serializable {
* the array of {@code updateCounts} giving the number of
* successful updates (or another status code) for each command
* in the batch that was attempted.
- * @since Android 1.0
*/
public BatchUpdateException(int[] updateCounts) {
super();
@@ -86,7 +80,6 @@ public class BatchUpdateException extends SQLException implements Serializable {
* the array of {@code updateCounts} giving the number of
* successful updates (or another status code) for each command
* in the batch that was attempted.
- * @since Android 1.0
*/
public BatchUpdateException(String reason, int[] updateCounts) {
super(reason);
@@ -107,7 +100,6 @@ public class BatchUpdateException extends SQLException implements Serializable {
* the array of {@code updateCounts} giving the number of
* successful updates (or another status code) for each command
* in the batch that was attempted.
- * @since Android 1.0
*/
public BatchUpdateException(String reason, String SQLState,
int[] updateCounts) {
@@ -130,7 +122,6 @@ public class BatchUpdateException extends SQLException implements Serializable {
* the array of {@code updateCounts} giving the number of
* successful updates (or another status code) for each command
* in the batch that was attempted.
- * @since Android 1.0
*/
public BatchUpdateException(String reason, String SQLState, int vendorCode,
int[] updateCounts) {
@@ -162,7 +153,6 @@ public class BatchUpdateException extends SQLException implements Serializable {
* <li>{@code Statement.EXECUTE_FAILED} indicating that the command
* was unsuccessful.</li>
* </ol>
- * @since Android 1.0
*/
public int[] getUpdateCounts() {
return updateCounts;
diff --git a/sql/src/main/java/java/sql/Blob.java b/sql/src/main/java/java/sql/Blob.java
index e6d9b19..0074b98 100644
--- a/sql/src/main/java/java/sql/Blob.java
+++ b/sql/src/main/java/java/sql/Blob.java
@@ -25,12 +25,10 @@ import java.io.InputStream;
* <p>
* An SQL {@code BLOB} type stores a large array of binary data (bytes) as the
* value in a column of a database.
- * </p>
+ * <p>
* The {@code java.sql.Blob} interface provides methods for setting and
* retrieving data in the {@code Blob}, for querying {@code Blob} data length,
* and for searching for data within the {@code Blob}.
- *
- * @since Android 1.0
*/
public interface Blob {
@@ -41,7 +39,6 @@ public interface Blob {
* data.
* @throws SQLException
* if an error occurs accessing the {@code Blob}.
- * @since Android 1.0
*/
public InputStream getBinaryStream() throws SQLException;
@@ -57,7 +54,6 @@ public interface Blob {
* at {@code pos} and is up to {@code length} bytes long.
* @throws SQLException
* if an error occurs accessing the {@code Blob}.
- * @since Android 1.0
*/
public byte[] getBytes(long pos, int length) throws SQLException;
@@ -68,7 +64,6 @@ public interface Blob {
* bytes.
* @throws SQLException
* if an error occurs accessing the {@code Blob}.
- * @since Android 1.0
*/
public long length() throws SQLException;
@@ -87,7 +82,6 @@ public interface Blob {
* {@code Blob}.
* @throws SQLException
* if an error occurs accessing the {@code Blob}.
- * @since Android 1.0
*/
public long position(Blob pattern, long start) throws SQLException;
@@ -106,7 +100,6 @@ public interface Blob {
* {@code Blob}.
* @throws SQLException
* if an error occurs accessing the {@code Blob}.
- * @since Android 1.0
*/
public long position(byte[] pattern, long start) throws SQLException;
@@ -121,7 +114,6 @@ public interface Blob {
* the {@code Blob} starting at the specified position.
* @throws SQLException
* if an error occurs accessing the {@code Blob}.
- * @since Android 1.0
*/
public OutputStream setBinaryStream(long pos) throws SQLException;
@@ -139,7 +131,6 @@ public interface Blob {
* Blob}.
* @throws SQLException
* if an error occurs accessing the {@code Blob}.
- * @since Android 1.0
*/
public int setBytes(long pos, byte[] theBytes) throws SQLException;
@@ -162,7 +153,6 @@ public interface Blob {
* Blob}.
* @throws SQLException
* if an error occurs accessing the {@code Blob}.
- * @since Android 1.0
*/
public int setBytes(long pos, byte[] theBytes, int offset, int len)
throws SQLException;
@@ -176,7 +166,6 @@ public interface Blob {
* is to be truncated.
* @throws SQLException
* if an error occurs accessing the {@code Blob}.
- * @since Android 1.0
*/
public void truncate(long len) throws SQLException;
}
diff --git a/sql/src/main/java/java/sql/CallableStatement.java b/sql/src/main/java/java/sql/CallableStatement.java
index 7a90041..be5463b 100644
--- a/sql/src/main/java/java/sql/CallableStatement.java
+++ b/sql/src/main/java/java/sql/CallableStatement.java
@@ -36,7 +36,6 @@ import java.io.Reader;
* name or by a numerical index starting at 1.
* <p>
* The correct syntax is:
- * </p>
* <dd>
* <dl>
* { ?= call &lt;procedurename&gt; [( [parameter1,parameter2,...] )] }
@@ -44,7 +43,8 @@ import java.io.Reader;
* <dl>
* { call &lt;procedurename&gt; [( [parameter1,parameter2,...] )] }
* </dl>
- * </code></dd> </p> {@code IN} parameters are set before calling the procedure,
+ * </code></dd>
+ * {@code IN} parameters are set before calling the procedure,
* using the setter methods which are inherited from {@code PreparedStatement}.
* For {@code OUT} parameters, their type must be registered before executing
* the stored procedure. The values are retrieved using the getter methods
@@ -53,9 +53,6 @@ import java.io.Reader;
* {@code CallableStatement}s can return one or more {@code ResultSets}. In the
* event that multiple {@code ResultSets} are returned, they are accessed using
* the methods inherited from the {@code Statement} interface.
- * </p>
- *
- * @since Android 1.0
*/
public interface CallableStatement extends PreparedStatement {
@@ -69,7 +66,6 @@ public interface CallableStatement extends PreparedStatement {
* @return a {@code java.sql.Array} containing the parameter value.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public Array getArray(int parameterIndex) throws SQLException;
@@ -82,7 +78,6 @@ public interface CallableStatement extends PreparedStatement {
* @return a {@code java.sql.Array} containing the parameter's value.
* @throws SQLException
* if there is a problem accessing the database.
- * @since Android 1.0
*/
public Array getArray(String parameterName) throws SQLException;
@@ -98,7 +93,6 @@ public interface CallableStatement extends PreparedStatement {
* the parameter in question is an SQL {@code NULL}.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public BigDecimal getBigDecimal(int parameterIndex) throws SQLException;
@@ -119,7 +113,6 @@ public interface CallableStatement extends PreparedStatement {
* if a database error occurs.
* @deprecated Use {@link #getBigDecimal(int)} or
* {@link #getBigDecimal(String)}
- * @since Android 1.0
*/
@Deprecated
public BigDecimal getBigDecimal(int parameterIndex, int scale)
@@ -136,7 +129,6 @@ public interface CallableStatement extends PreparedStatement {
* the parameter in question is an SQL {@code NULL}.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public BigDecimal getBigDecimal(String parameterName) throws SQLException;
@@ -152,7 +144,6 @@ public interface CallableStatement extends PreparedStatement {
* the parameter in question is an SQL {@code NULL}.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public Blob getBlob(int parameterIndex) throws SQLException;
@@ -167,7 +158,6 @@ public interface CallableStatement extends PreparedStatement {
* the parameter in question is an SQL {@code NULL}.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public Blob getBlob(String parameterName) throws SQLException;
@@ -181,7 +171,6 @@ public interface CallableStatement extends PreparedStatement {
* is returned if the value is SQL {@code NULL}.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public boolean getBoolean(int parameterIndex) throws SQLException;
@@ -195,7 +184,6 @@ public interface CallableStatement extends PreparedStatement {
* {@code false} is returned if the SQL value is {@code NULL}.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public boolean getBoolean(String parameterName) throws SQLException;
@@ -210,7 +198,6 @@ public interface CallableStatement extends PreparedStatement {
* {@code 0} is returned if the value is SQL {@code NULL}.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public byte getByte(int parameterIndex) throws SQLException;
@@ -224,7 +211,6 @@ public interface CallableStatement extends PreparedStatement {
* {@code 0} is returned if the SQL value is {@code NULL}.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public byte getByte(String parameterName) throws SQLException;
@@ -239,7 +225,6 @@ public interface CallableStatement extends PreparedStatement {
* is returned if the value is SQL {@code NULL}.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public byte[] getBytes(int parameterIndex) throws SQLException;
@@ -253,7 +238,6 @@ public interface CallableStatement extends PreparedStatement {
* is returned if the value is SQL {@code NULL}.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public byte[] getBytes(String parameterName) throws SQLException;
@@ -270,7 +254,6 @@ public interface CallableStatement extends PreparedStatement {
* @throws SQLException
* if a database error occurs.
* @see Clob
- * @since Android 1.0
*/
public Clob getClob(int parameterIndex) throws SQLException;
@@ -285,7 +268,6 @@ public interface CallableStatement extends PreparedStatement {
* @throws SQLException
* if a database error occurs.
* @see Clob
- * @since Android 1.0
*/
public Clob getClob(String parameterName) throws SQLException;
@@ -301,7 +283,6 @@ public interface CallableStatement extends PreparedStatement {
* @throws SQLException
* if a database error occurs.
* @see Date
- * @since Android 1.0
*/
public Date getDate(int parameterIndex) throws SQLException;
@@ -312,8 +293,7 @@ public interface CallableStatement extends PreparedStatement {
* The JDBC driver uses the calendar to create the Date using a particular
* timezone and locale. The default behavior of the driver is to use the Java
* virtual machine default settings.
- * </p>
- *
+ *
* @param parameterIndex
* the parameter number index, where the first parameter has
* index 1.
@@ -324,7 +304,6 @@ public interface CallableStatement extends PreparedStatement {
* @throws SQLException
* if a database error occurs.
* @see Date
- * @since Android 1.0
*/
public Date getDate(int parameterIndex, Calendar cal) throws SQLException;
@@ -339,7 +318,6 @@ public interface CallableStatement extends PreparedStatement {
* @throws SQLException
* if a database error occurs.
* @see Date
- * @since Android 1.0
*/
public Date getDate(String parameterName) throws SQLException;
@@ -350,8 +328,7 @@ public interface CallableStatement extends PreparedStatement {
* The JDBC driver uses the calendar to create the date using a particular
* timezone and locale. The default behavior of the driver is to use the Java
* virtual machine default settings.
- * </p>
- *
+ *
* @param parameterName
* the name of the desired parameter.
* @param cal
@@ -361,7 +338,6 @@ public interface CallableStatement extends PreparedStatement {
* @throws SQLException
* if a database error occurs.
* @see Date
- * @since Android 1.0
*/
public Date getDate(String parameterName, Calendar cal) throws SQLException;
@@ -376,7 +352,6 @@ public interface CallableStatement extends PreparedStatement {
* is returned if the value is SQL {@code NULL}.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public double getDouble(int parameterIndex) throws SQLException;
@@ -390,7 +365,6 @@ public interface CallableStatement extends PreparedStatement {
* is returned if the value is SQL {@code NULL}.
* @throws SQLException
* if there is a problem accessing the database.
- * @since Android 1.0
*/
public double getDouble(String parameterName) throws SQLException;
@@ -405,7 +379,6 @@ public interface CallableStatement extends PreparedStatement {
* is returned if the value is SQL {@code NULL}.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public float getFloat(int parameterIndex) throws SQLException;
@@ -419,7 +392,6 @@ public interface CallableStatement extends PreparedStatement {
* is returned if the value is SQL {@code NULL}.
* @throws SQLException
* if there is a problem accessing the database.
- * @since Android 1.0
*/
public float getFloat(String parameterName) throws SQLException;
@@ -434,7 +406,6 @@ public interface CallableStatement extends PreparedStatement {
* is returned if the value is SQL {@code NULL}.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public int getInt(int parameterIndex) throws SQLException;
@@ -448,7 +419,6 @@ public interface CallableStatement extends PreparedStatement {
* is returned if the value is SQL {@code NULL}.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public int getInt(String parameterName) throws SQLException;
@@ -463,7 +433,6 @@ public interface CallableStatement extends PreparedStatement {
* is returned if the value is SQL {@code NULL}.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public long getLong(int parameterIndex) throws SQLException;
@@ -477,7 +446,6 @@ public interface CallableStatement extends PreparedStatement {
* is returned if the value is SQL {@code NULL}.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public long getLong(String parameterName) throws SQLException;
@@ -488,15 +456,13 @@ public interface CallableStatement extends PreparedStatement {
* with a {@code registerOutParameter} call. If a parameter was registered
* as a {@code java.sql.Types.OTHER} then it may hold abstract types that
* are particular to the connected database.
- * </p>
- *
+ *
* @param parameterIndex
* the parameter number index, where the first parameter has
* index 1.
* @return an Object holding the value of the parameter.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public Object getObject(int parameterIndex) throws SQLException;
@@ -513,7 +479,6 @@ public interface CallableStatement extends PreparedStatement {
* @return an Object holding the value of the parameter.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public Object getObject(int parameterIndex, Map<String, Class<?>> map)
throws SQLException;
@@ -526,15 +491,13 @@ public interface CallableStatement extends PreparedStatement {
* If a parameter was registered as a {@code java.sql.Types.OTHER}
* then it may hold abstract types that are particular to the
* connected database.
- * </p>
- *
+ *
* @param parameterName
* the parameter name.
* @return the Java {@code Object} representation of the value of the
* parameter.
* @throws SQLException
* if there is a problem accessing the database.
- * @since Android 1.0
*/
public Object getObject(String parameterName) throws SQLException;
@@ -550,7 +513,6 @@ public interface CallableStatement extends PreparedStatement {
* @return an {@code Object} holding the value of the parameter.
* @throws SQLException
* if there is a problem accessing the database.
- * @since Android 1.0
*/
public Object getObject(String parameterName, Map<String, Class<?>> map)
throws SQLException;
@@ -566,7 +528,6 @@ public interface CallableStatement extends PreparedStatement {
* is returned if the value is SQL {@code NULL}.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public Ref getRef(int parameterIndex) throws SQLException;
@@ -582,7 +543,6 @@ public interface CallableStatement extends PreparedStatement {
* @throws SQLException
* if there is a problem accessing the database.
* @see Ref
- * @since Android 1.0
*/
public Ref getRef(String parameterName) throws SQLException;
@@ -597,7 +557,6 @@ public interface CallableStatement extends PreparedStatement {
* if the parameter's value is SQL {@code NULL}.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public short getShort(int parameterIndex) throws SQLException;
@@ -611,7 +570,6 @@ public interface CallableStatement extends PreparedStatement {
* if the parameter's value is SQL {@code NULL}.
* @throws SQLException
* if there is a problem accessing the database.
- * @since Android 1.0
*/
public short getShort(String parameterName) throws SQLException;
@@ -623,8 +581,7 @@ public interface CallableStatement extends PreparedStatement {
* The {@code String} corresponding to a {@code CHAR} of fixed length
* will be of identical length to the value in the database inclusive
* of padding characters.
- * </p>
- *
+ *
* @param parameterIndex
* the parameter number index, where the first parameter has
* index 1.
@@ -632,7 +589,6 @@ public interface CallableStatement extends PreparedStatement {
* is returned if the value is SQL {@code NULL}.
* @throws SQLException
* if there is a problem accessing the database.
- * @since Android 1.0
*/
public String getString(int parameterIndex) throws SQLException;
@@ -644,15 +600,13 @@ public interface CallableStatement extends PreparedStatement {
* The string corresponding to a {@code CHAR} of fixed length will be of
* identical length to the value in the database inclusive of padding
* characters.
- * </p>
- *
+ *
* @param parameterName
* the desired parameter's name.
* @return the parameter's value as a {@code String}. {@code null}
* is returned if the value is SQL {@code NULL}.
* @throws SQLException
* if there is a problem accessing the database.
- * @since Android 1.0
*/
public String getString(String parameterName) throws SQLException;
@@ -668,7 +622,6 @@ public interface CallableStatement extends PreparedStatement {
* @throws SQLException
* if a database error occurs.
* @see Time
- * @since Android 1.0
*/
public Time getTime(int parameterIndex) throws SQLException;
@@ -689,7 +642,6 @@ public interface CallableStatement extends PreparedStatement {
* if a database error occurs.
* @see Time
* @see java.util.Calendar
- * @since Android 1.0
*/
public Time getTime(int parameterIndex, Calendar cal) throws SQLException;
@@ -704,7 +656,6 @@ public interface CallableStatement extends PreparedStatement {
* @throws SQLException
* if a database error occurs.
* @see Time
- * @since Android 1.0
*/
public Time getTime(String parameterName) throws SQLException;
@@ -724,7 +675,6 @@ public interface CallableStatement extends PreparedStatement {
* if a database error occurs.
* @see Time
* @see java.util.Calendar
- * @since Android 1.0
*/
public Time getTime(String parameterName, Calendar cal) throws SQLException;
@@ -741,7 +691,6 @@ public interface CallableStatement extends PreparedStatement {
* @throws SQLException
* if a database error occurs.
* @see Timestamp
- * @since Android 1.0
*/
public Timestamp getTimestamp(int parameterIndex) throws SQLException;
@@ -761,7 +710,6 @@ public interface CallableStatement extends PreparedStatement {
* @throws SQLException
* if a database error occurs.
* @see Timestamp
- * @since Android 1.0
*/
public Timestamp getTimestamp(int parameterIndex, Calendar cal)
throws SQLException;
@@ -778,7 +726,6 @@ public interface CallableStatement extends PreparedStatement {
* @throws SQLException
* if a database error occurs.
* @see Timestamp
- * @since Android 1.0
*/
public Timestamp getTimestamp(String parameterName) throws SQLException;
@@ -797,7 +744,6 @@ public interface CallableStatement extends PreparedStatement {
* @throws SQLException
* if a database error occurs.
* @see Timestamp
- * @since Android 1.0
*/
public Timestamp getTimestamp(String parameterName, Calendar cal)
throws SQLException;
@@ -814,7 +760,6 @@ public interface CallableStatement extends PreparedStatement {
* @throws SQLException
* if a database error occurs.
* @see java.net.URL
- * @since Android 1.0
*/
public URL getURL(int parameterIndex) throws SQLException;
@@ -830,7 +775,6 @@ public interface CallableStatement extends PreparedStatement {
* @throws SQLException
* if a database error occurs.
* @see java.net.URL
- * @since Android 1.0
*/
public URL getURL(String parameterName) throws SQLException;
@@ -845,8 +789,7 @@ public interface CallableStatement extends PreparedStatement {
* If a database specific type is expected for a parameter, the Type {@code
* java.sql.Types.OTHER} should be used. Note that there is another variant
* of this method for User Defined Types or a {@code REF} type.
- * </p>
- *
+ *
* @param parameterIndex
* the parameter number index, where the first parameter has
* index 1
@@ -857,7 +800,6 @@ public interface CallableStatement extends PreparedStatement {
* @throws SQLException
* if a database error occurs.
* @see Types
- * @since Android 1.0
*/
public void registerOutParameter(int parameterIndex, int sqlType)
throws SQLException;
@@ -873,8 +815,7 @@ public interface CallableStatement extends PreparedStatement {
* The type supplied in the {@code sqlType} parameter fixes the
* type that will be returned by the getter methods of
* {@code CallableStatement}.
- * </p>
- *
+ *
* @param parameterIndex
* the parameter number index, where the first parameter has
* index 1
@@ -886,7 +827,6 @@ public interface CallableStatement extends PreparedStatement {
* @throws SQLException
* if a database error occurs.
* @see Types
- * @since Android 1.0
*/
public void registerOutParameter(int parameterIndex, int sqlType, int scale)
throws SQLException;
@@ -908,7 +848,6 @@ public interface CallableStatement extends PreparedStatement {
* @throws SQLException
* if a database error occurs.
* @see Ref
- * @since Android 1.0
*/
public void registerOutParameter(int paramIndex, int sqlType,
String typeName) throws SQLException;
@@ -923,8 +862,7 @@ public interface CallableStatement extends PreparedStatement {
* If a database-specific type is expected for a parameter, the Type {@code
* java.sql.Types.OTHER} should be used. Note that there is another variant
* of this method for User Defined Types or a {@code REF} type.
- * </p>
- *
+ *
* @param parameterName
* the parameter name.
* @param sqlType
@@ -934,7 +872,6 @@ public interface CallableStatement extends PreparedStatement {
* parameter.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public void registerOutParameter(String parameterName, int sqlType)
throws SQLException;
@@ -950,8 +887,7 @@ public interface CallableStatement extends PreparedStatement {
* The type supplied in the {@code sqlType} parameter fixes the
* type that will be returned by the getter methods of
* {@code CallableStatement}.
- * </p>
- *
+ *
* @param parameterName
* the parameter name.
* @param sqlType
@@ -961,7 +897,6 @@ public interface CallableStatement extends PreparedStatement {
* than or equal to 0.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public void registerOutParameter(String parameterName, int sqlType,
int scale) throws SQLException;
@@ -982,7 +917,6 @@ public interface CallableStatement extends PreparedStatement {
* of the referenced type.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public void registerOutParameter(String parameterName, int sqlType,
String typeName) throws SQLException;
@@ -991,12 +925,11 @@ public interface CallableStatement extends PreparedStatement {
* Sets the value of a specified parameter to the content of a supplied
* {@code InputStream}, which has a specified number of bytes.
* <p>
- * This is a good method for setting an SQL {@code LONVARCHAR} parameter
+ * This is a good method for setting an SQL {@code LONGVARCHAR} parameter
* where the length of the data is large. Data is read from the {@code
* InputStream} until end-of-file is reached or the specified number of
* bytes is copied.
- * </p>
- *
+ *
* @param parameterName
* the parameter name
* @param theInputStream
@@ -1007,7 +940,6 @@ public interface CallableStatement extends PreparedStatement {
* parameter.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public void setAsciiStream(String parameterName,
InputStream theInputStream, int length) throws SQLException;
@@ -1022,7 +954,6 @@ public interface CallableStatement extends PreparedStatement {
* the {@code java.math.BigInteger} value to set.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public void setBigDecimal(String parameterName, BigDecimal theBigDecimal)
throws SQLException;
@@ -1033,8 +964,7 @@ public interface CallableStatement extends PreparedStatement {
* <p>
* Use this method when a large amount of data needs to be set into a
* {@code LONGVARBINARY} parameter.
- * </p>
- *
+ *
* @param parameterName
* the name of the parameter.
* @param theInputStream
@@ -1045,7 +975,6 @@ public interface CallableStatement extends PreparedStatement {
* parameter.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public void setBinaryStream(String parameterName,
InputStream theInputStream, int length) throws SQLException;
@@ -1060,7 +989,6 @@ public interface CallableStatement extends PreparedStatement {
* the new value with which to update the parameter.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public void setBoolean(String parameterName, boolean theBoolean)
throws SQLException;
@@ -1074,7 +1002,6 @@ public interface CallableStatement extends PreparedStatement {
* the new value with which to update the parameter.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public void setByte(String parameterName, byte theByte) throws SQLException;
@@ -1089,7 +1016,6 @@ public interface CallableStatement extends PreparedStatement {
* the new value with which to update the parameter.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public void setBytes(String parameterName, byte[] theBytes)
throws SQLException;
@@ -1106,7 +1032,6 @@ public interface CallableStatement extends PreparedStatement {
* a count of the characters contained in {@code reader}.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public void setCharacterStream(String parameterName, Reader reader,
int length) throws SQLException;
@@ -1121,7 +1046,6 @@ public interface CallableStatement extends PreparedStatement {
* the new value with which to update the parameter.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public void setDate(String parameterName, Date theDate) throws SQLException;
@@ -1144,7 +1068,6 @@ public interface CallableStatement extends PreparedStatement {
* if a database error occurs.
* @see java.util.Calendar
* @see Date
- * @since Android 1.0
*/
public void setDate(String parameterName, Date theDate, Calendar cal)
throws SQLException;
@@ -1159,7 +1082,6 @@ public interface CallableStatement extends PreparedStatement {
* the new value with which to update the parameter.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public void setDouble(String parameterName, double theDouble)
throws SQLException;
@@ -1174,7 +1096,6 @@ public interface CallableStatement extends PreparedStatement {
* the new value with which to update the parameter.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public void setFloat(String parameterName, float theFloat)
throws SQLException;
@@ -1188,7 +1109,6 @@ public interface CallableStatement extends PreparedStatement {
* the new value with which to update the parameter.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public void setInt(String parameterName, int theInt) throws SQLException;
@@ -1201,7 +1121,6 @@ public interface CallableStatement extends PreparedStatement {
* the new value with which to update the parameter.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public void setLong(String parameterName, long theLong) throws SQLException;
@@ -1216,7 +1135,6 @@ public interface CallableStatement extends PreparedStatement {
* a JDBC type expressed as a constant from {@link Types}.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public void setNull(String parameterName, int sqlType) throws SQLException;
@@ -1229,8 +1147,7 @@ public interface CallableStatement extends PreparedStatement {
* type code and type name (which is just the parameter name if the type is
* user defined, referred to as a {@code UDT}, or the name of the referenced
* type in case of a {@code REF} type).
- * </p>
- *
+ *
* @param parameterName
* the parameter name.
* @param sqlType
@@ -1243,7 +1160,6 @@ public interface CallableStatement extends PreparedStatement {
* @throws SQLException
* if a database error occurs.
* @see Types
- * @since Android 1.0
*/
public void setNull(String parameterName, int sqlType, String typeName)
throws SQLException;
@@ -1263,8 +1179,7 @@ public interface CallableStatement extends PreparedStatement {
* <li>{@link Array}</li>
* <li>{@link Clob}</li>
* <li>{@link Blob}</li> </ul>
- * </p>
- *
+ *
* @param parameterName
* the parameter name
* @param theObject
@@ -1272,7 +1187,6 @@ public interface CallableStatement extends PreparedStatement {
* @throws SQLException
* if a database error occurs.
* @see SQLData
- * @since Android 1.0
*/
public void setObject(String parameterName, Object theObject)
throws SQLException;
@@ -1295,8 +1209,7 @@ public interface CallableStatement extends PreparedStatement {
* </ul>
* then the driver is in charge of mapping the value to the appropriate
* SQL type and deliver it to the database.
- * </p>
- *
+ *
* @param parameterName
* the parameter name.
* @param theObject
@@ -1306,7 +1219,6 @@ public interface CallableStatement extends PreparedStatement {
* @throws SQLException
* if a database error occurs.
* @see SQLData
- * @since Android 1.0
*/
public void setObject(String parameterName, Object theObject,
int targetSqlType) throws SQLException;
@@ -1328,8 +1240,7 @@ public interface CallableStatement extends PreparedStatement {
* </ul>
* then the driver is charge of mapping the value to the appropriate
* SQL type.
- * </p>
- *
+ *
* @param parameterName
* the parameter name.
* @param theObject
@@ -1342,7 +1253,6 @@ public interface CallableStatement extends PreparedStatement {
* @throws SQLException
* if a database error occurs.
* @see SQLData
- * @since Android 1.0
*/
public void setObject(String parameterName, Object theObject,
int targetSqlType, int scale) throws SQLException;
@@ -1357,7 +1267,6 @@ public interface CallableStatement extends PreparedStatement {
* a short value to update the parameter.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public void setShort(String parameterName, short theShort)
throws SQLException;
@@ -1371,7 +1280,6 @@ public interface CallableStatement extends PreparedStatement {
* a {@code String} value to update the parameter.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public void setString(String parameterName, String theString)
throws SQLException;
@@ -1387,7 +1295,6 @@ public interface CallableStatement extends PreparedStatement {
* @throws SQLException
* if a database error occurs.
* @see Time
- * @since Android 1.0
*/
public void setTime(String parameterName, Time theTime) throws SQLException;
@@ -1409,7 +1316,6 @@ public interface CallableStatement extends PreparedStatement {
* @throws SQLException
* if a database error occurs.
* @see Time
- * @since Android 1.0
*/
public void setTime(String parameterName, Time theTime, Calendar cal)
throws SQLException;
@@ -1425,7 +1331,6 @@ public interface CallableStatement extends PreparedStatement {
* @throws SQLException
* if a database error occurs.
* @see Timestamp
- * @since Android 1.0
*/
public void setTimestamp(String parameterName, Timestamp theTimestamp)
throws SQLException;
@@ -1437,8 +1342,7 @@ public interface CallableStatement extends PreparedStatement {
* The driver uses the supplied calendar to create the SQL {@code TIMESTAMP}
* value, which allows it to use a custom timezone - otherwise the driver
* uses the default timezone of the Java virtual machine.
- * </p>
- *
+ *
* @param parameterName
* the parameter name.
* @param theTimestamp
@@ -1449,7 +1353,6 @@ public interface CallableStatement extends PreparedStatement {
* if a database error occurs.
* @see Timestamp
* @see java.util.Calendar
- * @since Android 1.0
*/
public void setTimestamp(String parameterName, Timestamp theTimestamp,
Calendar cal) throws SQLException;
@@ -1465,7 +1368,6 @@ public interface CallableStatement extends PreparedStatement {
* @throws SQLException
* if a database error occurs.
* @see java.net.URL
- * @since Android 1.0
*/
public void setURL(String parameterName, URL theURL) throws SQLException;
@@ -1477,7 +1379,6 @@ public interface CallableStatement extends PreparedStatement {
* otherwise.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public boolean wasNull() throws SQLException;
}
diff --git a/sql/src/main/java/java/sql/Clob.java b/sql/src/main/java/java/sql/Clob.java
index 339d4e5..73fe7fb 100644
--- a/sql/src/main/java/java/sql/Clob.java
+++ b/sql/src/main/java/java/sql/Clob.java
@@ -31,8 +31,6 @@ import java.io.Writer;
* The {@code java.sql.Clob} interface provides methods for setting and
* retrieving data in the {@code Clob}, for querying {@code Clob} data length,
* for searching for data within the {@code Clob}.
- *
- * @since Android 1.0
*/
public interface Clob {
@@ -43,7 +41,6 @@ public interface Clob {
* {@code Clob} data.
* @throws SQLException
* if an error occurs accessing the {@code Clob}.
- * @since Android 1.0
*/
public InputStream getAsciiStream() throws SQLException;
@@ -54,7 +51,6 @@ public interface Clob {
* Clob} data.
* @throws SQLException
* if an error occurs accessing the {@code Clob}.
- * @since Android 1.0
*/
public Reader getCharacterStream() throws SQLException;
@@ -68,7 +64,6 @@ public interface Clob {
* @return A string containing the requested data.
* @throws SQLException
* if an error occurs accessing the {@code Clob}.
- * @since Android 1.0
*/
public String getSubString(long pos, int length) throws SQLException;
@@ -78,7 +73,6 @@ public interface Clob {
* @return a long value with the number of character in this {@code Clob}.
* @throws SQLException
* if an error occurs accessing the {@code Clob}.
- * @since Android 1.0
*/
public long length() throws SQLException;
@@ -94,7 +88,6 @@ public interface Clob {
* Clob} occurs within this {@code Clob}.
* @throws SQLException
* if an error occurs accessing the {@code Clob}.
- * @since Android 1.0
*/
public long position(Clob searchstr, long start) throws SQLException;
@@ -111,7 +104,6 @@ public interface Clob {
* occurs within this {@code Clob}.
* @throws SQLException
* if an error occurs accessing the {@code Clob}.
- * @since Android 1.0
*/
public long position(String searchstr, long start) throws SQLException;
@@ -125,7 +117,6 @@ public interface Clob {
* this {@code Clob}.
* @throws SQLException
* if an error occurs accessing the {@code Clob}.
- * @since Android 1.0
*/
public OutputStream setAsciiStream(long pos) throws SQLException;
@@ -139,7 +130,6 @@ public interface Clob {
* {@code Clob}.
* @throws SQLException
* if an error occurs accessing the {@code Clob}.
- * @since Android 1.0
*/
public Writer setCharacterStream(long pos) throws SQLException;
@@ -154,7 +144,6 @@ public interface Clob {
* @return the number of characters written.
* @throws SQLException
* if an error occurs accessing the {@code Clob}.
- * @since Android 1.0
*/
public int setString(long pos, String str) throws SQLException;
@@ -173,7 +162,6 @@ public interface Clob {
* @return the number of characters written.
* @throws SQLException
* if an error occurs accessing the {@code Clob}.
- * @since Android 1.0
*/
public int setString(long pos, String str, int offset, int len)
throws SQLException;
@@ -186,7 +174,6 @@ public interface Clob {
* truncate this {@code Clob}.
* @throws SQLException
* if an error occurs accessing the {@code Clob}.
- * @since Android 1.0
*/
public void truncate(long len) throws SQLException;
}
diff --git a/sql/src/main/java/java/sql/Connection.java b/sql/src/main/java/java/sql/Connection.java
index 523071c..0704cca 100644
--- a/sql/src/main/java/java/sql/Connection.java
+++ b/sql/src/main/java/java/sql/Connection.java
@@ -23,8 +23,10 @@ import java.util.Map;
* A connection represents a link from a Java application to a database. All SQL
* statements and results are returned within the context of a connection.
* Database statements that are executed within this context form a
- * database session which forms one or more closed transactions. Especially In distributed applications, multiple concurrent connections may exist accessing the same values of the database.
- * which may lead to the following phenomena (referred to as <i>transaction isolation levels</i>):
+ * database session which forms one or more closed transactions. Especially in
+ * distributed applications, multiple concurrent connections may exist accessing
+ * the same values of the database. which may lead to the following phenomena
+ * (referred to as <i>transaction isolation levels</i>):
* <ul>
* <li><i>dirty reads</i>:<br>
* reading values from table rows that are not committed.</br></li>
@@ -36,15 +38,11 @@ import java.util.Map;
* because other transactions have inserted additional rows that satisfy an
* SQL {@code WHERE} clause</br></li>
* </ul>
- *
- * @since Android 1.0
*/
public interface Connection {
/**
* A constant indicating that transactions are not supported.
- *
- * @since Android 1.0
*/
public static final int TRANSACTION_NONE = 0;
@@ -52,8 +50,6 @@ public interface Connection {
* No <i>dirty reads</i> are permitted, therefore transactions may not read
* a row containing uncommitted values - but does not prevent an application
* from <i>non-repeatable reads</i> and <i>phantom reads</i>.
- *
- * @since Android 1.0
*/
public static final int TRANSACTION_READ_COMMITTED = 2;
@@ -65,16 +61,12 @@ public interface Connection {
* <li><i>non-repeatable reads</i></li>
* <li><i>phantom reads</i></li>
* </ul>
- *
- * @since Android 1.0
*/
public static final int TRANSACTION_READ_UNCOMMITTED = 1;
/**
* A constant indicating that <i>dirty reads</i> and <i>non-repeatable
* reads</i> are <b>prevented</b> but <i>phantom reads</i> can occur.
- *
- * @since Android 1.0
*/
public static final int TRANSACTION_REPEATABLE_READ = 4;
@@ -86,8 +78,6 @@ public interface Connection {
* <li><i>non-repeatable reads</i></li>
* <li><i>phantom reads</i></li>
* </ul>
- *
- * @since Android 1.0
*/
public static final int TRANSACTION_SERIALIZABLE = 8;
@@ -112,8 +102,7 @@ public interface Connection {
* connection before garbage collection takes place, it is not advisable to
* leave the {@code close} operation to take place in this way. Mainly
* because undesired side-effects may appear.
- * </p>
- *
+ *
* @throws SQLException
* if there is a problem accessing the database.
*/
@@ -217,7 +206,6 @@ public interface Connection {
* false}.
* @throws SQLException
* if there is a problem accessing the database.
- * @since Android 1.0
*/
public boolean getAutoCommit() throws SQLException;
@@ -242,7 +230,6 @@ public interface Connection {
* </ul>
* @throws SQLException
* if there is a problem accessing the a database.
- * @since Android 1.0
*/
public int getHoldability() throws SQLException;
@@ -255,7 +242,6 @@ public interface Connection {
* description.
* @throws SQLException
* if there is a problem accessing the a database.
- * @since Android 1.0
*/
public DatabaseMetaData getMetaData() throws SQLException;
@@ -270,7 +256,6 @@ public interface Connection {
* @see #TRANSACTION_READ_UNCOMMITTED
* @see #TRANSACTION_REPEATABLE_READ
* @see #TRANSACTION_SERIALIZABLE
- * @since Android 1.0
*/
public int getTransactionIsolation() throws SQLException;
@@ -281,7 +266,6 @@ public interface Connection {
* @return the Type Map as a {@code java.util.Map}.
* @throws SQLException
* if there is a problem accessing the database.
- * @since Android 1.0
*/
public Map<String, Class<?>> getTypeMap() throws SQLException;
@@ -294,14 +278,12 @@ public interface Connection {
* By invoking the {@link SQLWarning#getNextWarning()} method of the
* returned {@code SQLWarning} object it is possible to obtain all of
* this connection's warning objects.
- * </p>
- *
+ *
* @return the first warning as an SQLWarning object (may be {@code null}).
* @throws SQLException
* if there is a problem accessing the database or if the call
* has been made on a connection which has been previously
* closed.
- * @since Android 1.0
*/
public SQLWarning getWarnings() throws SQLException;
@@ -315,7 +297,6 @@ public interface Connection {
* @return {@code true} if closed, otherwise {@code false}.
* @throws SQLException
* if there is a problem accessing the database.
- * @since Android 1.0
*/
public boolean isClosed() throws SQLException;
@@ -326,7 +307,6 @@ public interface Connection {
* @return {@code true} if in read-only state, otherwise {@code false}.
* @throws SQLException
* if there is a problem accessing the database.
- * @since Android 1.0
*/
public boolean isReadOnly() throws SQLException;
@@ -356,7 +336,6 @@ public interface Connection {
* {@link ResultSet#CONCUR_READ_ONLY}.
* @throws SQLException
* if a problem occurs accessing the database.
- * @since Android 1.0
*/
public CallableStatement prepareCall(String sql) throws SQLException;
@@ -387,7 +366,6 @@ public interface Connection {
* resultSetType} and {@code resultSetConcurrency} values.
* @throws SQLException
* if a problem occurs accessing the database
- * @since Android 1.0
*/
public CallableStatement prepareCall(String sql, int resultSetType,
int resultSetConcurrency) throws SQLException;
@@ -426,7 +404,6 @@ public interface Connection {
* resultSetHoldability} values.
* @throws SQLException
* if a problem occurs accessing the database.
- * @since Android 1.0
*/
public CallableStatement prepareCall(String sql, int resultSetType,
int resultSetConcurrency, int resultSetHoldability)
@@ -441,7 +418,7 @@ public interface Connection {
* the driver does not support precompiled statements, the statement will
* not reach the database server until it is executed. This distinction
* determines the moment when {@code SQLException}s get raised.
- * </p>
+ * <p>
* By default, {@code ResultSet}s from the returned object will be
* {@link ResultSet#TYPE_FORWARD_ONLY} type with a
* {@link ResultSet#CONCUR_READ_ONLY} mode of concurrency.
@@ -452,7 +429,6 @@ public interface Connection {
* statement.
* @throws SQLException
* if there is a problem accessing the database.
- * @since Android 1.0
*/
public PreparedStatement prepareStatement(String sql) throws SQLException;
@@ -467,7 +443,7 @@ public interface Connection {
* precompiled in a {@code PreparedStatement}. The {@code PreparedStatement}
* can then be then be used to execute the statement multiple times in an
* efficient way.
- * </p>
+ * <p>
* Subject to JDBC driver support, this operation will attempt to send the
* precompiled version of the statement to the database. If
* the driver does not support precompiled statements, the statement will
@@ -477,8 +453,7 @@ public interface Connection {
* By default, {@code ResultSet}s from the returned object will be
* {@link ResultSet#TYPE_FORWARD_ONLY} type with a
* {@link ResultSet#CONCUR_READ_ONLY} mode of concurrency.
- * </p>
- *
+ *
* @param sql
* the SQL statement.
* @param autoGeneratedKeys
@@ -491,7 +466,6 @@ public interface Connection {
* SQL statement.
* @throws SQLException
* if there is a problem accessing the database.
- * @since Android 1.0
*/
public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys)
throws SQLException;
@@ -509,13 +483,11 @@ public interface Connection {
* the driver does not support precompiled statements, the statement will
* not reach the database server until it is executed. This distinction
* determines the moment when {@code SQLException}s get raised.
- * </p>
* <p>
* By default, {@code ResultSet}s from the returned object will be
* {@link ResultSet#TYPE_FORWARD_ONLY} type with a
* {@link ResultSet#CONCUR_READ_ONLY} concurrency mode.
- * </p>
- *
+ *
* @param sql
* the SQL statement.
* @param columnIndexes
@@ -524,7 +496,6 @@ public interface Connection {
* @return the PreparedStatement containing the supplied SQL statement.
* @throws SQLException
* if a problem occurs accessing the database.
- * @since Android 1.0
*/
public PreparedStatement prepareStatement(String sql, int[] columnIndexes)
throws SQLException;
@@ -556,7 +527,6 @@ public interface Connection {
* resultSetType} and {@code resultSetConcurrency} values.
* @throws SQLException
* if a problem occurs accessing the database.
- * @since Android 1.0
*/
public PreparedStatement prepareStatement(String sql, int resultSetType,
int resultSetConcurrency) throws SQLException;
@@ -594,7 +564,6 @@ public interface Connection {
* resultSetHoldability} values.
* @throws SQLException
* if a problem occurs accessing the database.
- * @since Android 1.0
*/
public PreparedStatement prepareStatement(String sql, int resultSetType,
int resultSetConcurrency, int resultSetHoldability)
@@ -614,13 +583,11 @@ public interface Connection {
* statement will not reach the database server until it is executed. This
* will have a bearing on precisely <i>when</i> {@code SQLException}
* instances get raised.
- * </p>
* <p>
* By default, ResultSets from the returned object will be
* {@link ResultSet#TYPE_FORWARD_ONLY} type with a
* {@link ResultSet#CONCUR_READ_ONLY} concurrency mode.
- * </p>
- *
+ *
* @param sql
* the SQL statement.
* @param columnNames
@@ -629,7 +596,6 @@ public interface Connection {
* @return the PreparedStatement containing the supplied SQL statement.
* @throws SQLException
* if a problem occurs accessing the database.
- * @since Android 1.0
*/
public PreparedStatement prepareStatement(String sql, String[] columnNames)
throws SQLException;
@@ -645,7 +611,6 @@ public interface Connection {
* if there is a problem with accessing the database or if
* {@code savepoint} is considered not valid in this
* transaction.
- * @since Android 1.0
*/
public void releaseSavepoint(Savepoint savepoint) throws SQLException;
@@ -657,7 +622,6 @@ public interface Connection {
* @throws SQLException
* if there is a problem with the database or if the method is
* called while in auto-commit mode of operation.
- * @since Android 1.0
*/
public void rollback() throws SQLException;
@@ -669,7 +633,6 @@ public interface Connection {
* the Savepoint to roll back to
* @throws SQLException
* if there is a problem accessing the database.
- * @since Android 1.0
*/
public void rollback(Savepoint savepoint) throws SQLException;
@@ -682,26 +645,23 @@ public interface Connection {
* statements get grouped into transactions that need to be completed by
* explicit calls to either the {@link #commit()} or {@link #rollback()}
* methods.
- * </p>
+ * <p>
* Auto-commit is the default mode for new connection instances.
* <p>
* When in this mode, commits will automatically occur upon successful SQL
* statement completion or upon successful completion of an execute.
* Statements are not considered successfully completed until all associated
* {@code ResultSet}s and output parameters have been obtained or closed.
- * </p>
* <p>
* Calling this operation during an uncommitted transaction will result in
* it being committed.
- * </p>
- *
+ *
* @param autoCommit
* {@code boolean} indication of whether to put the target
* connection into auto-commit mode ({@code true}) or not (
* {@code false}).
* @throws SQLException
* if there is a problem accessing the database.
- * @since Android 1.0
*/
public void setAutoCommit(boolean autoCommit) throws SQLException;
@@ -714,7 +674,6 @@ public interface Connection {
* the catalog name to use.
* @throws SQLException
* if there is a problem accessing the database.
- * @since Android 1.0
*/
public void setCatalog(String catalog) throws SQLException;
@@ -738,14 +697,12 @@ public interface Connection {
* <p>
* This serves as a hint to the driver, which can enable database
* optimizations.
- * </p>
- *
+ *
* @param readOnly
* {@code true} to set the Connection to read only mode. {@code
* false} disables read-only mode.
* @throws SQLException
* if there is a problem accessing the database.
- * @since Android 1.0
*/
public void setReadOnly(boolean readOnly) throws SQLException;
@@ -755,7 +712,6 @@ public interface Connection {
* @return a {@code Savepoint} object for this savepoint.
* @throws SQLException
* if there is a problem accessing the database.
- * @since Android 1.0
*/
public Savepoint setSavepoint() throws SQLException;
@@ -767,7 +723,6 @@ public interface Connection {
* @return a {@code Savepoint} object for this savepoint.
* @throws SQLException
* if there is a problem accessing the database.
- * @since Android 1.0
*/
public Savepoint setSavepoint(String name) throws SQLException;
@@ -776,8 +731,7 @@ public interface Connection {
* <p>
* If this method is called during a transaction, the results are
* implementation defined.
- * </p>
- *
+ *
* @param level
* the new transaction isolation level to use from the following
* list of possible values:
@@ -790,7 +744,6 @@ public interface Connection {
* @throws SQLException
* if there is a problem with the database or if the value of
* {@code level} is not one of the expected constant values.
- * @since Android 1.0
*/
public void setTransactionIsolation(int level) throws SQLException;
@@ -803,7 +756,6 @@ public interface Connection {
* @throws SQLException
* if there is a problem accessing the database or if {@code
* map} is not an instance of {@link Map}.
- * @since Android 1.0
*/
public void setTypeMap(Map<String, Class<?>> map) throws SQLException;
}
diff --git a/sql/src/main/java/java/sql/DataTruncation.java b/sql/src/main/java/java/sql/DataTruncation.java
index a472cc5..20da727 100644
--- a/sql/src/main/java/java/sql/DataTruncation.java
+++ b/sql/src/main/java/java/sql/DataTruncation.java
@@ -24,8 +24,6 @@ import java.io.Serializable;
* value either when reading (resulting in warning), or when writing data
* (resulting in an error). The {@code SQLState} error code for truncated data
* is {@code 01004}.
- *
- * @since Android 1.0
*/
public class DataTruncation extends SQLWarning implements Serializable {
@@ -66,7 +64,6 @@ public class DataTruncation extends SQLWarning implements Serializable {
* the original size of the truncated data.
* @param transferSize
* the size of the data after truncation.
- * @since Android 1.0
*/
public DataTruncation(int index, boolean parameter, boolean read,
int dataSize, int transferSize) {
@@ -83,7 +80,6 @@ public class DataTruncation extends SQLWarning implements Serializable {
*
* @return the number of bytes that should have been read or written. The
* value is set to {@code -1} if the size is unknown.
- * @since Android 1.0
*/
public int getDataSize() {
return dataSize;
@@ -93,7 +89,6 @@ public class DataTruncation extends SQLWarning implements Serializable {
* Gets the index of the column or of the parameter that was truncated.
*
* @return the index number of the column or of the parameter.
- * @since Android 1.0
*/
public int getIndex() {
return index;
@@ -104,7 +99,6 @@ public class DataTruncation extends SQLWarning implements Serializable {
*
* @return {@code true} if the value truncated was a parameter value,
* {@code false} if it was a column value.
- * @since Android 1.0
*/
public boolean getParameter() {
return parameter;
@@ -116,7 +110,6 @@ public class DataTruncation extends SQLWarning implements Serializable {
*
* @return {@code true} if the value was truncated on a read operation,
* {@code false} otherwise.
- * @since Android 1.0
*/
public boolean getRead() {
return read;
@@ -127,7 +120,6 @@ public class DataTruncation extends SQLWarning implements Serializable {
*
* @return the number of bytes actually read/written. The value may be set
* to {@code -1} if the size is unknown.
- * @since Android 1.0
*/
public int getTransferSize() {
return transferSize;
diff --git a/sql/src/main/java/java/sql/DatabaseMetaData.java b/sql/src/main/java/java/sql/DatabaseMetaData.java
index 82219c5..aca03c0 100644
--- a/sql/src/main/java/java/sql/DatabaseMetaData.java
+++ b/sql/src/main/java/java/sql/DatabaseMetaData.java
@@ -24,7 +24,6 @@ package java.sql;
* This interface is implemented by JDBC driver vendors in order to provide
* information about the underlying database capabilities in association with
* the JDBC driver.
- * </p>
* <p>
* Some of the methods in this interface take string parameters which are
* patterns. Within these string patterns, {@code '%'} and {@code '_'}
@@ -33,144 +32,105 @@ package java.sql;
* "match any character". Only metadata entries that match the pattern are
* returned. If such a search pattern string is set to {@code null}, that
* argument's criteria are dropped from the search.
- * </p>
- *
- * @since Android 1.0
*/
public interface DatabaseMetaData {
/**
* States that it may not be permitted to store {@code NULL} values.
- *
- * @since Android 1.0
*/
public static final short attributeNoNulls = 0;
/**
* States that {@code NULL} values are definitely permitted.
- *
- * @since Android 1.0
*/
public static final short attributeNullable = 1;
/**
* States that whether {@code NULL} values are permitted is unknown.
- *
- * @since Android 1.0
*/
public static final short attributeNullableUnknown = 2;
/**
* States the best row identifier is <em>NOT</em> a pseudo column.
- *
- * @since Android 1.0
*/
public static final int bestRowNotPseudo = 1;
/**
* States that the best row identifier is a pseudo column.
- *
- * @since Android 1.0
*/
public static final int bestRowPseudo = 2;
/**
* States that the remainder of the current session is used as the scope for
* the best row identifier.
- *
- * @since Android 1.0
*/
public static final int bestRowSession = 2;
/**
* States that best row identifier scope lasts only while the row is being
* used.
- *
- * @since Android 1.0
*/
public static final int bestRowTemporary = 0;
/**
* States that the remainder of the current transaction is used as the scope
* for the best row identifier.
- *
- * @since Android 1.0
*/
public static final int bestRowTransaction = 1;
/**
* States that the best row identifier may or may not be a pseudo column.
- *
- * @since Android 1.0
*/
public static final int bestRowUnknown = 0;
/**
* States that the column must not allow {@code NULL} values.
- *
- * @since Android 1.0
*/
public static final int columnNoNulls = 0;
/**
* States that the column definitely allows {@code NULL} values.
- *
- * @since Android 1.0
*/
public static final int columnNullable = 1;
/**
* States that it is unknown whether the columns may be nulled.
- *
- * @since Android 1.0
*/
public static final int columnNullableUnknown = 2;
/**
* For the column {@code UPDATE_RULE}, states that when the primary key is
* updated, the foreign key (imported key) is changed accordingly.
- *
- * @since Android 1.0
*/
public static final int importedKeyCascade = 0;
/**
* States that the evaluation of foreign key constraints is deferred (delayed
* until commit).
- *
- * @since Android 1.0
*/
public static final int importedKeyInitiallyDeferred = 5;
/**
* States that the evaluation of foreign key constraint is {@code IMMEDIATE}
* .
- *
- * @since Android 1.0
*/
public static final int importedKeyInitiallyImmediate = 6;
/**
* For the columns {@code UPDATE_RULE} and {@code DELETE_RULE}, states that
* if the primary key has been imported, it cannot be updated or deleted.
- *
- * @since Android 1.0
*/
public static final int importedKeyNoAction = 3;
/**
* States that the evaluation of foreign key constraint must not be {@code
* DEFERRED}.
- *
- * @since Android 1.0
*/
public static final int importedKeyNotDeferrable = 7;
/**
* States that a primary key must not be updated when imported as a foreign
* key by some other table. Used for the column {@code UPDATE_RULE}.
- *
- * @since Android 1.0
*/
public static final int importedKeyRestrict = 1;
@@ -178,8 +138,6 @@ public interface DatabaseMetaData {
* States that when the primary key is modified (updated or deleted) the
* foreign (imported) key is changed to its default value. Applies to the
* {@code UPDATE_RULE} and {@code DELETE_RULE} columns.
- *
- * @since Android 1.0
*/
public static final int importedKeySetDefault = 4;
@@ -187,190 +145,138 @@ public interface DatabaseMetaData {
* States that when the primary key is modified (updated or deleted) the
* foreign (imported) key is changed to {@code NULL}. Applies to the {@code
* UPDATE_RULE} and {@code DELETE_RULE} columns.
- *
- * @since Android 1.0
*/
public static final int importedKeySetNull = 2;
/**
* States that the column stores {@code IN} type parameters.
- *
- * @since Android 1.0
*/
public static final int procedureColumnIn = 1;
/**
* States that this column stores {@code INOUT} type parameters.
- *
- * @since Android 1.0
*/
public static final int procedureColumnInOut = 2;
/**
* States that this column stores {@code OUT} type parameters.
- *
- * @since Android 1.0
*/
public static final int procedureColumnOut = 4;
/**
* States that the column stores results.
- *
- * @since Android 1.0
*/
public static final int procedureColumnResult = 3;
/**
* States that the column stores return values.
- *
- * @since Android 1.0
*/
public static final int procedureColumnReturn = 5;
/**
* States that type of the column is unknown.
- *
- * @since Android 1.0
*/
public static final int procedureColumnUnknown = 0;
/**
* States that {@code NULL} values are not permitted.
- *
- * @since Android 1.0
*/
public static final int procedureNoNulls = 0;
/**
* States that the procedure does not return a result.
- *
- * @since Android 1.0
*/
public static final int procedureNoResult = 1;
/**
* States that {@code NULL} values are permitted.
- *
- * @since Android 1.0
*/
public static final int procedureNullable = 1;
/**
* States that it is unknown whether {@code NULL} values are permitted.
- *
- * @since Android 1.0
*/
public static final int procedureNullableUnknown = 2;
/**
* States that it is unknown whether or not the procedure returns a result.
- *
- * @since Android 1.0
*/
public static final int procedureResultUnknown = 0;
/**
* States that the procedure returns a result.
- *
- * @since Android 1.0
*/
public static final int procedureReturnsResult = 2;
/**
* States that the value is an SQL99 {@code SQLSTATE} value.
- *
- * @since Android 1.0
*/
public static final int sqlStateSQL99 = 2;
/**
* States that the value is an SQL {@code CLI SQLSTATE} value as defined by
* the X/Open standard.
- *
- * @since Android 1.0
*/
public static final int sqlStateXOpen = 1;
/**
* States that this table index is a clustered index.
- *
- * @since Android 1.0
*/
public static final short tableIndexClustered = 1;
/**
* States that this table index is a hashed index.
- *
- * @since Android 1.0
*/
public static final short tableIndexHashed = 2;
/**
* States this table's index is neither a clustered index, not a hashed
* index, and not a table statistics index; i.e. it is something else.
- *
- * @since Android 1.0
*/
public static final short tableIndexOther = 3;
/**
* States this column has the table's statistics, and that it is returned in
* conjunction with the table's index description.
- *
- * @since Android 1.0
*/
public static final short tableIndexStatistic = 0;
/**
* States that a {@code NULL} value is <em>NOT</em> permitted for
* this data type.
- *
- * @since Android 1.0
*/
public static final int typeNoNulls = 0;
/**
* States that a {@code NULL} value is permitted for this data type.
- *
- * @since Android 1.0
*/
public static final int typeNullable = 1;
/**
* States that it is unknown if a {@code NULL} value is permitted for
* this data type.
- *
- * @since Android 1.0
*/
public static final int typeNullableUnknown = 2;
/**
* States that this column shall not be used for {@code WHERE} statements
* with a {@code LIKE} clause.
- *
- * @since Android 1.0
*/
public static final int typePredBasic = 2;
/**
* States that this column can only be used in a {@code WHERE...LIKE}
* statement.
- *
- * @since Android 1.0
*/
public static final int typePredChar = 1;
/**
* States that this column does not support searches.
- *
- * @since Android 1.0
*/
public static final int typePredNone = 0;
/**
* States that the column is searchable.
- *
- * @since Android 1.0
*/
public static final int typeSearchable = 3;
@@ -397,7 +303,6 @@ public interface DatabaseMetaData {
* {@code false} otherwise.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public boolean allProceduresAreCallable() throws SQLException;
@@ -409,7 +314,6 @@ public interface DatabaseMetaData {
* otherwise.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public boolean allTablesAreSelectable() throws SQLException;
@@ -421,7 +325,6 @@ public interface DatabaseMetaData {
* otherwise.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public boolean dataDefinitionCausesTransactionCommit() throws SQLException;
@@ -433,7 +336,6 @@ public interface DatabaseMetaData {
* {@code false} otherwise.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public boolean dataDefinitionIgnoredInTransactions() throws SQLException;
@@ -450,7 +352,6 @@ public interface DatabaseMetaData {
* false} otherwise.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public boolean deletesAreDetected(int type) throws SQLException;
@@ -462,7 +363,6 @@ public interface DatabaseMetaData {
* and {@code LONGVARCHAR}, otherwise {@code false}.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public boolean doesMaxRowSizeIncludeBlobs() throws SQLException;
@@ -530,8 +430,7 @@ public interface DatabaseMetaData {
* generated REF type or for a Distinct type. ({@code NULL} if {@code
* DATA_TYPE} is not DISTINCT or a user generated REF)</li>
* </ol>
- * </p>
- *
+ *
* @param catalog
* a catalog name. {@code null} is used to imply no narrowing of
* the search by catalog name. Otherwise, the name must match a
@@ -551,7 +450,6 @@ public interface DatabaseMetaData {
* @return a {@code ResultSet}, where each row is an attribute description.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public ResultSet getAttributes(String catalog, String schemaPattern,
String typeNamePattern, String attributeNamePattern)
@@ -592,8 +490,7 @@ public interface DatabaseMetaData {
* </ul>
* </li>
* </ol>
- * </p>
- *
+ *
* @param catalog
* a catalog name. {@code null} is used to imply no narrowing of
* the search by catalog name. Otherwise, the name must match a
@@ -616,7 +513,6 @@ public interface DatabaseMetaData {
* and the complete set of rows is the optimal set for this table.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public ResultSet getBestRowIdentifier(String catalog, String schema,
String table, int scope, boolean nullable) throws SQLException;
@@ -630,7 +526,6 @@ public interface DatabaseMetaData {
* single column named {@code TABLE_CAT}.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public ResultSet getCatalogs() throws SQLException;
@@ -641,7 +536,6 @@ public interface DatabaseMetaData {
* @return a String containing the separator.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public String getCatalogSeparator() throws SQLException;
@@ -651,7 +545,6 @@ public interface DatabaseMetaData {
* @return a String with the vendor's term for "catalog".
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public String getCatalogTerm() throws SQLException;
@@ -674,8 +567,7 @@ public interface DatabaseMetaData {
* receiver can grant access to others, {@code "NO"} if the receiver cannot
* grant access to others, {@code null} if unknown.</li>
* </ol>
- * </p>
- *
+ *
* @param catalog
* a catalog name. {@code null} is used to imply no narrowing of
* the search by catalog name. Otherwise, the name must match a
@@ -696,7 +588,6 @@ public interface DatabaseMetaData {
* each privilege description.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public ResultSet getColumnPrivileges(String catalog, String schema,
String table, String columnNamePattern) throws SQLException;
@@ -754,8 +645,7 @@ public interface DatabaseMetaData {
* generated REF type or for a Distinct type. ({@code NULL} if {@code
* DATA_TYPE} is not DISTINCT or a user generated REF)</li>
* </ol>
- * </p>
- *
+ *
* @param catalog
* a catalog name. {@code null} is used to imply no narrowing of
* the search by catalog name. Otherwise, the name must match a
@@ -776,7 +666,6 @@ public interface DatabaseMetaData {
* defined above.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public ResultSet getColumns(String catalog, String schemaPattern,
String tableNamePattern, String columnNamePattern)
@@ -788,7 +677,6 @@ public interface DatabaseMetaData {
* @return the connection to the database.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public Connection getConnection() throws SQLException;
@@ -857,8 +745,7 @@ public interface DatabaseMetaData {
* </ul>
* </li>
* </ol>
- * </p>
- *
+ *
* @param primaryCatalog
* a catalog name for the primary key table. {@code null} is used to imply no narrowing of
* the search by catalog name. Otherwise, the name must match a
@@ -889,7 +776,6 @@ public interface DatabaseMetaData {
* foreign keys laid out according to the format defined above.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public ResultSet getCrossReference(String primaryCatalog,
String primarySchema, String primaryTable, String foreignCatalog,
@@ -901,7 +787,6 @@ public interface DatabaseMetaData {
* @return the major version number of the database software.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public int getDatabaseMajorVersion() throws SQLException;
@@ -911,7 +796,6 @@ public interface DatabaseMetaData {
* @return the minor version number of the database software.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public int getDatabaseMinorVersion() throws SQLException;
@@ -921,7 +805,6 @@ public interface DatabaseMetaData {
* @return a {@code String} with the name of the database software.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public String getDatabaseProductName() throws SQLException;
@@ -932,7 +815,6 @@ public interface DatabaseMetaData {
* software.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public String getDatabaseProductVersion() throws SQLException;
@@ -949,7 +831,6 @@ public interface DatabaseMetaData {
* </ul>
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public int getDefaultTransactionIsolation() throws SQLException;
@@ -957,7 +838,6 @@ public interface DatabaseMetaData {
* Returns the JDBC driver's major version number.
*
* @return the driver's major version number.
- * @since Android 1.0
*/
public int getDriverMajorVersion();
@@ -965,7 +845,6 @@ public interface DatabaseMetaData {
* Returns the JDBC driver's minor version number.
*
* @return the driver's minor version number.
- * @since Android 1.0
*/
public int getDriverMinorVersion();
@@ -975,7 +854,6 @@ public interface DatabaseMetaData {
* @return a {@code String} containing the name of the JDBC driver
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public String getDriverName() throws SQLException;
@@ -986,7 +864,6 @@ public interface DatabaseMetaData {
* JDBC driver.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public String getDriverVersion() throws SQLException;
@@ -1056,8 +933,7 @@ public interface DatabaseMetaData {
* </ul>
* </li>
* </ol>
- * </p>
- *
+ *
* @param catalog
* a catalog name. {@code null} is used to imply no narrowing of
* the search by catalog name. Otherwise, the name must match a
@@ -1075,7 +951,6 @@ public interface DatabaseMetaData {
* columns, as defined above
* @throws SQLException
* a database error occurred
- * @since Android 1.0
*/
public ResultSet getExportedKeys(String catalog, String schema, String table)
throws SQLException;
@@ -1088,7 +963,6 @@ public interface DatabaseMetaData {
* @return a String containing all the additional permitted characters.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public String getExtraNameCharacters() throws SQLException;
@@ -1099,7 +973,6 @@ public interface DatabaseMetaData {
* @return the String used to quote SQL identifiers.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public String getIdentifierQuoteString() throws SQLException;
@@ -1169,8 +1042,7 @@ public interface DatabaseMetaData {
* </ul>
* </li>
* </ol>
- * </p>
- *
+ *
* @param catalog
* a catalog name. {@code null} is used to imply no narrowing of
* the search by catalog name. Otherwise, the name must match a
@@ -1188,7 +1060,6 @@ public interface DatabaseMetaData {
* rows in the format defined above.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public ResultSet getImportedKeys(String catalog, String schema, String table)
throws SQLException;
@@ -1235,8 +1106,7 @@ public interface DatabaseMetaData {
* <li>{@code FILTER_CONDITION} - String - Filter condition. (possibly null)
* </li>
* </ol>
- * </p>
- *
+ *
* @param catalog
* a catalog name. {@code null} is used to imply no narrowing of
* the search by catalog name. Otherwise, the name must match a
@@ -1262,7 +1132,6 @@ public interface DatabaseMetaData {
* for the table, in the format defined above.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public ResultSet getIndexInfo(String catalog, String schema, String table,
boolean unique, boolean approximate) throws SQLException;
@@ -1273,7 +1142,6 @@ public interface DatabaseMetaData {
* @return the major JDBC version number.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public int getJDBCMajorVersion() throws SQLException;
@@ -1283,7 +1151,6 @@ public interface DatabaseMetaData {
* @return the Minor JDBC Version Number.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public int getJDBCMinorVersion() throws SQLException;
@@ -1295,7 +1162,6 @@ public interface DatabaseMetaData {
* literal. If the number is unlimited then the result is zero.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public int getMaxBinaryLiteralLength() throws SQLException;
@@ -1306,7 +1172,6 @@ public interface DatabaseMetaData {
* is unknown, or the value is unlimited, then the result is zero.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public int getMaxCatalogNameLength() throws SQLException;
@@ -1318,7 +1183,6 @@ public interface DatabaseMetaData {
* zero.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public int getMaxCharLiteralLength() throws SQLException;
@@ -1329,7 +1193,6 @@ public interface DatabaseMetaData {
* is unknown, or the value is unlimited, then the result is zero.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public int getMaxColumnNameLength() throws SQLException;
@@ -1342,7 +1205,6 @@ public interface DatabaseMetaData {
* is zero.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public int getMaxColumnsInGroupBy() throws SQLException;
@@ -1353,7 +1215,6 @@ public interface DatabaseMetaData {
* unknown, or the value is unlimited, then the result is zero.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public int getMaxColumnsInIndex() throws SQLException;
@@ -1366,7 +1227,6 @@ public interface DatabaseMetaData {
* is zero.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public int getMaxColumnsInOrderBy() throws SQLException;
@@ -1379,7 +1239,6 @@ public interface DatabaseMetaData {
* zero.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public int getMaxColumnsInSelect() throws SQLException;
@@ -1390,7 +1249,6 @@ public interface DatabaseMetaData {
* unknown, or the value is unlimited, then the result is zero.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public int getMaxColumnsInTable() throws SQLException;
@@ -1401,7 +1259,6 @@ public interface DatabaseMetaData {
* the value is unlimited, then the result is zero.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public int getMaxConnections() throws SQLException;
@@ -1412,7 +1269,6 @@ public interface DatabaseMetaData {
* is unknown, or the value is unlimited, then the result is zero.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public int getMaxCursorNameLength() throws SQLException;
@@ -1424,7 +1280,6 @@ public interface DatabaseMetaData {
* unknown, or the value is unlimited, then the result is zero.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public int getMaxIndexLength() throws SQLException;
@@ -1437,7 +1292,6 @@ public interface DatabaseMetaData {
* zero.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public int getMaxProcedureNameLength() throws SQLException;
@@ -1449,7 +1303,6 @@ public interface DatabaseMetaData {
* unknown, or the value is unlimited, then the result is zero.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public int getMaxRowSize() throws SQLException;
@@ -1461,7 +1314,6 @@ public interface DatabaseMetaData {
* is unknown, or the value is unlimited, then the result is zero.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public int getMaxSchemaNameLength() throws SQLException;
@@ -1474,7 +1326,6 @@ public interface DatabaseMetaData {
* zero.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public int getMaxStatementLength() throws SQLException;
@@ -1486,7 +1337,6 @@ public interface DatabaseMetaData {
* unknown, or the value is unlimited, then the result is zero.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public int getMaxStatements() throws SQLException;
@@ -1497,7 +1347,6 @@ public interface DatabaseMetaData {
* unknown, or the value is unlimited, then the result is zero.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public int getMaxTableNameLength() throws SQLException;
@@ -1510,7 +1359,6 @@ public interface DatabaseMetaData {
* then the result is zero.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public int getMaxTablesInSelect() throws SQLException;
@@ -1521,7 +1369,6 @@ public interface DatabaseMetaData {
* unknown, or the value is unlimited, then the result is zero.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public int getMaxUserNameLength() throws SQLException;
@@ -1534,7 +1381,6 @@ public interface DatabaseMetaData {
* separated list.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public String getNumericFunctions() throws SQLException;
@@ -1553,8 +1399,7 @@ public interface DatabaseMetaData {
* primary key</li>
* <li>{@code PK_NAME} - String - the primary key name (possibly null)</li>
* </ol>
- * </p>
- *
+ *
* @param catalog
* a catalog name. {@code null} is used to imply no narrowing of
* the search by catalog name. Otherwise, the name must match a
@@ -1572,7 +1417,6 @@ public interface DatabaseMetaData {
* defined above.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public ResultSet getPrimaryKeys(String catalog, String schema, String table)
throws SQLException;
@@ -1630,8 +1474,7 @@ public interface DatabaseMetaData {
* <li>{@code REMARKS} - String - an explanatory comment about the data item
* </li>
* </ol>
- * </p>
- *
+ *
* @param catalog
* a catalog name. {@code null} is used to imply no narrowing of
* the search by catalog name. Otherwise, the name must match a
@@ -1652,7 +1495,6 @@ public interface DatabaseMetaData {
* in the format defined above.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public ResultSet getProcedureColumns(String catalog, String schemaPattern,
String procedureNamePattern, String columnNamePattern)
@@ -1702,7 +1544,6 @@ public interface DatabaseMetaData {
* procedure in the format defined above.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public ResultSet getProcedures(String catalog, String schemaPattern,
String procedureNamePattern) throws SQLException;
@@ -1713,7 +1554,6 @@ public interface DatabaseMetaData {
* @return a String with the vendor's preferred name for "procedure".
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public String getProcedureTerm() throws SQLException;
@@ -1724,7 +1564,6 @@ public interface DatabaseMetaData {
* ResultSet.CLOSE_CURSORS_AT_COMMIT}.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public int getResultSetHoldability() throws SQLException;
@@ -1741,7 +1580,6 @@ public interface DatabaseMetaData {
* defined above.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public ResultSet getSchemas() throws SQLException;
@@ -1751,7 +1589,6 @@ public interface DatabaseMetaData {
* @return a String which is the vendor's preferred term for schema.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public String getSchemaTerm() throws SQLException;
@@ -1765,7 +1602,6 @@ public interface DatabaseMetaData {
* @return a String used to escape the wildcard characters.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public String getSearchStringEscape() throws SQLException;
@@ -1777,7 +1613,6 @@ public interface DatabaseMetaData {
* format.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public String getSQLKeywords() throws SQLException;
@@ -1791,7 +1626,6 @@ public interface DatabaseMetaData {
* DatabaseMetaData.sqlStateXOpen}.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public int getSQLStateType() throws SQLException;
@@ -1804,7 +1638,6 @@ public interface DatabaseMetaData {
* separated format.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public String getStringFunctions() throws SQLException;
@@ -1824,8 +1657,7 @@ public interface DatabaseMetaData {
* <li>{@code TABLE_NAME} - String - The table name</li>
* <li>SUPER{@code TABLE_NAME} - String - The super table name</li>
* </ol>
- * </p>
- *
+ *
* @param catalog
* a catalog name. {@code null} is used to imply no narrowing of
* the search by catalog name. Otherwise, the name must match a
@@ -1846,7 +1678,6 @@ public interface DatabaseMetaData {
* returned if the database does not support table hierarchies.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public ResultSet getSuperTables(String catalog, String schemaPattern,
String tableNamePattern) throws SQLException;
@@ -1871,8 +1702,7 @@ public interface DatabaseMetaData {
* (possibly {@code null})</li>
* <li>SUPER{@code TYPE_NAME} - String - direct supertype's name</li>
* </ol>
- * </p>
- *
+ *
* @param catalog
* the catalog name. "" means get the UDTs without a catalog.
* {@code null} means don't use the catalog name to restrict the
@@ -1889,7 +1719,6 @@ public interface DatabaseMetaData {
* returned for a database that does not support type hierarchies.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public ResultSet getSuperTypes(String catalog, String schemaPattern,
String typeNamePattern) throws SQLException;
@@ -1903,7 +1732,6 @@ public interface DatabaseMetaData {
* separated format.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public String getSystemFunctions() throws SQLException;
@@ -1930,8 +1758,7 @@ public interface DatabaseMetaData {
* access to others, {@code "NO"} implies guarantee cannot grant access to
* others, {@code null} means this status is unknown</li>
* </ol>
- * </p>
- *
+ *
* @param catalog
* a catalog name. {@code null} is used to imply no narrowing of
* the search by catalog name. Otherwise, the name must match a
@@ -1949,7 +1776,6 @@ public interface DatabaseMetaData {
* in the format defined above.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public ResultSet getTablePrivileges(String catalog, String schemaPattern,
String tableNamePattern) throws SQLException;
@@ -1982,8 +1808,7 @@ public interface DatabaseMetaData {
* "USER" | "DERIVED" - specifies how values in the {@code
* SELF_REFERENCING_COL_NAME} are created (possibly {@code null})</li>
* </ol>
- * </p>
- *
+ *
* @param catalog
* a catalog name. {@code null} is used to imply no narrowing of
* the search by catalog name. Otherwise, the name must match a
@@ -2004,7 +1829,6 @@ public interface DatabaseMetaData {
* above.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public ResultSet getTables(String catalog, String schemaPattern,
String tableNamePattern, String[] types) throws SQLException;
@@ -2020,13 +1844,11 @@ public interface DatabaseMetaData {
* {@code "TABLE"}, {@code "VIEW"}, "{@code SYSTEM TABLE"}, {@code "ALIAS"},
* {@code "SYNONYM"}, {@code "GLOBAL TEMPORARY"}</li>
* </ol>
- * </p>
- *
+ *
* @return a {@code ResultSet} with one row per table type in the format
* defined above.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public ResultSet getTableTypes() throws SQLException;
@@ -2037,7 +1859,6 @@ public interface DatabaseMetaData {
* functions.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public String getTimeDateFunctions() throws SQLException;
@@ -2096,7 +1917,6 @@ public interface DatabaseMetaData {
* @return a {@code ResultSet} which is structured as described above.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public ResultSet getTypeInfo() throws SQLException;
@@ -2122,11 +1942,9 @@ public interface DatabaseMetaData {
* This is defined in {@code java.sql.Types}, and will be {@code null} if
* the {@code DATA_TYPE} does not match these criteria.</li>
* </ol>
- * </p>
* <p>
* If the driver does not support UDTs, the {@code ResultSet} is empty.
- * </p>
- *
+ *
* @param catalog
* a catalog name. {@code null} is used to imply no narrowing of
* the search by catalog name. Otherwise, the name must match a
@@ -2146,7 +1964,6 @@ public interface DatabaseMetaData {
* @return a {@code ResultSet} in the format described above.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public ResultSet getUDTs(String catalog, String schemaPattern,
String typeNamePattern, int[] types) throws SQLException;
@@ -2157,7 +1974,6 @@ public interface DatabaseMetaData {
* @return the URL for the database. {@code null} if it cannot be generated.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public String getURL() throws SQLException;
@@ -2167,7 +1983,6 @@ public interface DatabaseMetaData {
* @return the user name.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public String getUserName() throws SQLException;
@@ -2197,8 +2012,7 @@ public interface DatabaseMetaData {
* </ul>
* </li>
* </ol>
- * </p>
- *
+ *
* @param catalog
* a catalog name. {@code null} is used to imply no narrowing of
* the search using catalog name. Otherwise, the name must match
@@ -2216,7 +2030,6 @@ public interface DatabaseMetaData {
* column, in the format defined above.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public ResultSet getVersionColumns(String catalog, String schema,
String table) throws SQLException;
@@ -2235,7 +2048,6 @@ public interface DatabaseMetaData {
* @throws SQLException
* a database error occurred.
* @see ResultSet#rowInserted()
- * @since Android 1.0
*/
public boolean insertsAreDetected(int type) throws SQLException;
@@ -2247,7 +2059,6 @@ public interface DatabaseMetaData {
* qualified table name, {@code false} otherwise.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean isCatalogAtStart() throws SQLException;
@@ -2258,7 +2069,6 @@ public interface DatabaseMetaData {
* otherwise.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean isReadOnly() throws SQLException;
@@ -2270,7 +2080,6 @@ public interface DatabaseMetaData {
* {@code false} otherwise.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean locatorsUpdateCopy() throws SQLException;
@@ -2282,7 +2091,6 @@ public interface DatabaseMetaData {
* produce a {@code NULL} result, {@code false} otherwise.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean nullPlusNonNullIsNull() throws SQLException;
@@ -2296,7 +2104,6 @@ public interface DatabaseMetaData {
* {@code false} otherwise.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean nullsAreSortedAtEnd() throws SQLException;
@@ -2309,7 +2116,6 @@ public interface DatabaseMetaData {
* {@code false} otherwise.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean nullsAreSortedAtStart() throws SQLException;
@@ -2321,7 +2127,6 @@ public interface DatabaseMetaData {
* false} otherwise.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean nullsAreSortedHigh() throws SQLException;
@@ -2333,7 +2138,6 @@ public interface DatabaseMetaData {
* otherwise.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean nullsAreSortedLow() throws SQLException;
@@ -2350,7 +2154,6 @@ public interface DatabaseMetaData {
* otherwise.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean othersDeletesAreVisible(int type) throws SQLException;
@@ -2367,7 +2170,6 @@ public interface DatabaseMetaData {
* false}.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean othersInsertsAreVisible(int type) throws SQLException;
@@ -2384,7 +2186,6 @@ public interface DatabaseMetaData {
* false}.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean othersUpdatesAreVisible(int type) throws SQLException;
@@ -2401,7 +2202,6 @@ public interface DatabaseMetaData {
* ResultSet} itself, otherwise {@code false}.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean ownDeletesAreVisible(int type) throws SQLException;
@@ -2418,7 +2218,6 @@ public interface DatabaseMetaData {
* ResultSet} itself, otherwise {@code false}.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean ownInsertsAreVisible(int type) throws SQLException;
@@ -2435,7 +2234,6 @@ public interface DatabaseMetaData {
* ResultSet} itself, otherwise {@code false}.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean ownUpdatesAreVisible(int type) throws SQLException;
@@ -2448,7 +2246,6 @@ public interface DatabaseMetaData {
* case, {@code false} otherwise.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean storesLowerCaseIdentifiers() throws SQLException;
@@ -2460,7 +2257,6 @@ public interface DatabaseMetaData {
* {@code false} otherwise.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean storesLowerCaseQuotedIdentifiers() throws SQLException;
@@ -2472,7 +2268,6 @@ public interface DatabaseMetaData {
* {@code false} otherwise.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean storesMixedCaseIdentifiers() throws SQLException;
@@ -2485,7 +2280,6 @@ public interface DatabaseMetaData {
* {@code false} otherwise.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean storesMixedCaseQuotedIdentifiers() throws SQLException;
@@ -2497,7 +2291,6 @@ public interface DatabaseMetaData {
* case, {@code false} otherwise.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean storesUpperCaseIdentifiers() throws SQLException;
@@ -2509,7 +2302,6 @@ public interface DatabaseMetaData {
* {@code false} otherwise.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean storesUpperCaseQuotedIdentifiers() throws SQLException;
@@ -2521,7 +2313,6 @@ public interface DatabaseMetaData {
* supported, {@code false} otherwise.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsAlterTableWithAddColumn() throws SQLException;
@@ -2533,7 +2324,6 @@ public interface DatabaseMetaData {
* supported, {@code false} otherwise.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsAlterTableWithDropColumn() throws SQLException;
@@ -2544,7 +2334,6 @@ public interface DatabaseMetaData {
* {@code false} otherwise.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsANSI92EntryLevelSQL() throws SQLException;
@@ -2555,7 +2344,6 @@ public interface DatabaseMetaData {
* false} otherwise.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsANSI92FullSQL() throws SQLException;
@@ -2566,7 +2354,6 @@ public interface DatabaseMetaData {
* {@code false} otherwise.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsANSI92IntermediateSQL() throws SQLException;
@@ -2577,7 +2364,6 @@ public interface DatabaseMetaData {
* otherwise.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsBatchUpdates() throws SQLException;
@@ -2589,7 +2375,6 @@ public interface DatabaseMetaData {
* statements, {@code false} otherwise.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsCatalogsInDataManipulation() throws SQLException;
@@ -2600,7 +2385,6 @@ public interface DatabaseMetaData {
* statements, {@code false} otherwise.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsCatalogsInIndexDefinitions() throws SQLException;
@@ -2612,7 +2396,6 @@ public interface DatabaseMetaData {
* statements, {@code false} otherwise.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsCatalogsInPrivilegeDefinitions() throws SQLException;
@@ -2623,7 +2406,6 @@ public interface DatabaseMetaData {
* statements.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsCatalogsInProcedureCalls() throws SQLException;
@@ -2634,7 +2416,6 @@ public interface DatabaseMetaData {
* statements, {@code false} otherwise.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsCatalogsInTableDefinitions() throws SQLException;
@@ -2643,8 +2424,7 @@ public interface DatabaseMetaData {
* <p>
* If aliasing is supported, then the SQL AS clause is used to provide names
* for computed columns and provide alias names for columns.
- * </p>
- *
+ *
* @return {@code true} if column aliasing is supported, {@code false}
* otherwise.
* @throws SQLException
@@ -2660,7 +2440,6 @@ public interface DatabaseMetaData {
* {@code false} otherwise.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsConvert() throws SQLException;
@@ -2676,7 +2455,6 @@ public interface DatabaseMetaData {
* these types, {@code false} otherwise.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsConvert(int fromType, int toType)
throws SQLException;
@@ -2688,7 +2466,6 @@ public interface DatabaseMetaData {
* otherwise.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsCoreSQLGrammar() throws SQLException;
@@ -2699,7 +2476,6 @@ public interface DatabaseMetaData {
* and {@code false} otherwise.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsCorrelatedSubqueries() throws SQLException;
@@ -2711,7 +2487,6 @@ public interface DatabaseMetaData {
* false} otherwise.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsDataDefinitionAndDataManipulationTransactions()
throws SQLException;
@@ -2724,7 +2499,6 @@ public interface DatabaseMetaData {
* {@code false} otherwise.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsDataManipulationTransactionsOnly()
throws SQLException;
@@ -2737,7 +2511,6 @@ public interface DatabaseMetaData {
* names, {@code false} otherwise.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsDifferentTableCorrelationNames() throws SQLException;
@@ -2748,7 +2521,6 @@ public interface DatabaseMetaData {
* supported.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsExpressionsInOrderBy() throws SQLException;
@@ -2759,7 +2531,6 @@ public interface DatabaseMetaData {
* false} otherwise.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsExtendedSQLGrammar() throws SQLException;
@@ -2770,7 +2541,6 @@ public interface DatabaseMetaData {
* false} otherwise.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsFullOuterJoins() throws SQLException;
@@ -2782,7 +2552,6 @@ public interface DatabaseMetaData {
* false} otherwise.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsGetGeneratedKeys() throws SQLException;
@@ -2793,7 +2562,6 @@ public interface DatabaseMetaData {
* false} otherwise.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsGroupBy() throws SQLException;
@@ -2807,7 +2575,6 @@ public interface DatabaseMetaData {
* this way, {@code false} otherwise.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsGroupByBeyondSelect() throws SQLException;
@@ -2819,7 +2586,6 @@ public interface DatabaseMetaData {
* in the {@code SELECT} statement, {@code false} otherwise.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsGroupByUnrelated() throws SQLException;
@@ -2831,7 +2597,6 @@ public interface DatabaseMetaData {
* {@code false} otherwise.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsIntegrityEnhancementFacility() throws SQLException;
@@ -2842,7 +2607,6 @@ public interface DatabaseMetaData {
* otherwise.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsLikeEscapeClause() throws SQLException;
@@ -2855,7 +2619,6 @@ public interface DatabaseMetaData {
* {@code supportsFullOuterJoins} returns {@code true}.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsLimitedOuterJoins() throws SQLException;
@@ -2866,7 +2629,6 @@ public interface DatabaseMetaData {
* false} otherwise.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsMinimumSQLGrammar() throws SQLException;
@@ -2878,7 +2640,6 @@ public interface DatabaseMetaData {
* case, {@code false} otherwise.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsMixedCaseIdentifiers() throws SQLException;
@@ -2890,7 +2651,6 @@ public interface DatabaseMetaData {
* {@code false} otherwise.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException;
@@ -2903,7 +2663,6 @@ public interface DatabaseMetaData {
* otherwise.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsMultipleOpenResults() throws SQLException;
@@ -2915,7 +2674,6 @@ public interface DatabaseMetaData {
* {@code false} otherwise.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsMultipleResultSets() throws SQLException;
@@ -2927,7 +2685,6 @@ public interface DatabaseMetaData {
* false} otherwise.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsMultipleTransactions() throws SQLException;
@@ -2938,7 +2695,6 @@ public interface DatabaseMetaData {
* statements, {@code false} otherwise.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsNamedParameters() throws SQLException;
@@ -2949,7 +2705,6 @@ public interface DatabaseMetaData {
* false} otherwise.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsNonNullableColumns() throws SQLException;
@@ -2972,7 +2727,6 @@ public interface DatabaseMetaData {
* operations, {@code false} if they might get closed.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsOpenCursorsAcrossRollback() throws SQLException;
@@ -2984,7 +2738,6 @@ public interface DatabaseMetaData {
* they might not.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsOpenStatementsAcrossCommit() throws SQLException;
@@ -2996,7 +2749,6 @@ public interface DatabaseMetaData {
* they might not.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsOpenStatementsAcrossRollback() throws SQLException;
@@ -3008,7 +2760,6 @@ public interface DatabaseMetaData {
* not in the {@code SELECT}, {@code false} otherwise.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsOrderByUnrelated() throws SQLException;
@@ -3019,7 +2770,6 @@ public interface DatabaseMetaData {
* false} otherwise.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsOuterJoins() throws SQLException;
@@ -3030,7 +2780,6 @@ public interface DatabaseMetaData {
* statements.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsPositionedDelete() throws SQLException;
@@ -3041,7 +2790,6 @@ public interface DatabaseMetaData {
* statements, {@code false} otherwise.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsPositionedUpdate() throws SQLException;
@@ -3065,7 +2813,6 @@ public interface DatabaseMetaData {
* pairing is supported otherwise {@code false}.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsResultSetConcurrency(int type, int concurrency)
throws SQLException;
@@ -3082,7 +2829,6 @@ public interface DatabaseMetaData {
* if it isn't then {@code false}.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsResultSetHoldability(int holdability)
throws SQLException;
@@ -3099,7 +2845,6 @@ public interface DatabaseMetaData {
* false} otherwise.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsResultSetType(int type) throws SQLException;
@@ -3110,7 +2855,6 @@ public interface DatabaseMetaData {
* otherwise.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsSavepoints() throws SQLException;
@@ -3122,7 +2866,6 @@ public interface DatabaseMetaData {
* otherwise {@code false}.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsSchemasInDataManipulation() throws SQLException;
@@ -3134,7 +2877,6 @@ public interface DatabaseMetaData {
* otherwise {@code false}.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsSchemasInIndexDefinitions() throws SQLException;
@@ -3146,7 +2888,6 @@ public interface DatabaseMetaData {
* definition, otherwise {@code false}
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsSchemasInPrivilegeDefinitions() throws SQLException;
@@ -3157,7 +2898,6 @@ public interface DatabaseMetaData {
* otherwise {@code false}.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsSchemasInProcedureCalls() throws SQLException;
@@ -3168,7 +2908,6 @@ public interface DatabaseMetaData {
* otherwise {@code false}.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsSchemasInTableDefinitions() throws SQLException;
@@ -3179,7 +2918,6 @@ public interface DatabaseMetaData {
* supported, otherwise {@code false}.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsSelectForUpdate() throws SQLException;
@@ -3190,7 +2928,6 @@ public interface DatabaseMetaData {
* otherwise {@code false}.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsStatementPooling() throws SQLException;
@@ -3202,7 +2939,6 @@ public interface DatabaseMetaData {
* escape syntax are supported, otherwise {@code false}.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsStoredProcedures() throws SQLException;
@@ -3213,7 +2949,6 @@ public interface DatabaseMetaData {
* expressions.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsSubqueriesInComparisons() throws SQLException;
@@ -3224,7 +2959,6 @@ public interface DatabaseMetaData {
* expressions, otherwise {@code false}.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsSubqueriesInExists() throws SQLException;
@@ -3235,7 +2969,6 @@ public interface DatabaseMetaData {
* otherwise {@code false}.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsSubqueriesInIns() throws SQLException;
@@ -3245,7 +2978,6 @@ public interface DatabaseMetaData {
* @return {@code true} if subqueries are supported, otherwise {@code false}.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsSubqueriesInQuantifieds() throws SQLException;
@@ -3256,7 +2988,6 @@ public interface DatabaseMetaData {
* {@code false}.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsTableCorrelationNames() throws SQLException;
@@ -3273,7 +3004,6 @@ public interface DatabaseMetaData {
* otherwise {@code false}.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsTransactionIsolationLevel(int level)
throws SQLException;
@@ -3284,13 +3014,11 @@ public interface DatabaseMetaData {
* If transactions are not supported, then the {@code commit} method does
* nothing and the transaction isolation level is always {@code
* TRANSACTION_NONE}.
- * </p>
- *
+ *
* @return {@code true} if transactions are supported, otherwise {@code
* false}.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsTransactions() throws SQLException;
@@ -3301,7 +3029,6 @@ public interface DatabaseMetaData {
* {@code false}.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsUnion() throws SQLException;
@@ -3312,7 +3039,6 @@ public interface DatabaseMetaData {
* otherwise {@code false}.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean supportsUnionAll() throws SQLException;
@@ -3328,7 +3054,6 @@ public interface DatabaseMetaData {
* false}.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean updatesAreDetected(int type) throws SQLException;
@@ -3339,7 +3064,6 @@ public interface DatabaseMetaData {
* otherwise {@code false}.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean usesLocalFilePerTable() throws SQLException;
@@ -3350,7 +3074,6 @@ public interface DatabaseMetaData {
* otherwise {@code false}.
* @throws SQLException
* a database error occurred.
- * @since Android 1.0
*/
public boolean usesLocalFiles() throws SQLException;
}
diff --git a/sql/src/main/java/java/sql/Date.java b/sql/src/main/java/java/sql/Date.java
index e506a43..90b5246 100644
--- a/sql/src/main/java/java/sql/Date.java
+++ b/sql/src/main/java/java/sql/Date.java
@@ -17,25 +17,20 @@
package java.sql;
-import java.text.SimpleDateFormat;
-
/**
* A class which can consume and produce dates in SQL {@code Date} format.
* <p>
* Dates are represented in SQL as {@code yyyy-mm-dd}. Note that this date
* format only deals with year, month and day values. There are no values for
* hours, minutes, seconds.
- * </p>
- * This is unlike the familiar {@code java.util.Date} object, which also includes
+ * <p>
+ * This is unlike the familiar {@code java.util.Date} object, which also includes
* values for hours, minutes, seconds, and milliseconds.
* <p>
* Time points are handled as millisecond values - milliseconds since the Epoch,
* January 1st 1970, 00:00:00.000 GMT. Time values passed to the {@code
* java.sql.Date} class are "normalized" to the time 00:00:00.000 GMT on the
* date implied by the time value.
- * </p>
- *
- * @since Android 1.0
*/
public class Date extends java.util.Date {
@@ -44,8 +39,8 @@ public class Date extends java.util.Date {
/**
* Constructs a {@code Date} object corresponding to the supplied year,
* month and day.
- *
- * @deprecated Please use the constructor {@link #Date(long)}.
+ *
+ * @deprecated Use the constructor {@link #Date(long)}.
* @param theYear
* the year, specified as the year minus 1900. Must be in the
* range {@code [0,8099]}.
@@ -54,9 +49,7 @@ public class Date extends java.util.Date {
* the range {@code [0,11]}.
* @param theDay
* the day in the month. Must be in the range {@code [1,31]}.
- * @since Android 1.0
*/
- @SuppressWarnings("deprecation")
@Deprecated
public Date(int theYear, int theMonth, int theDay) {
super(theYear, theMonth, theDay);
@@ -72,7 +65,6 @@ public class Date extends java.util.Date {
* milliseconds) stored in the {@code Date} object is adjusted to
* correspond to 00:00:00 GMT on the day determined by the supplied
* time value.
- * @since Android 1.0
*/
public Date(long theDate) {
super(normalizeTime(theDate));
@@ -84,9 +76,7 @@ public class Date extends java.util.Date {
* @return does not return anything.
* @throws IllegalArgumentException
* if this method is called.
- * @since Android 1.0
*/
- @SuppressWarnings("deprecation")
@Deprecated
@Override
public int getHours() {
@@ -99,9 +89,7 @@ public class Date extends java.util.Date {
* @return does not return anything.
* @throws IllegalArgumentException
* if this method is called.
- * @since Android 1.0
*/
- @SuppressWarnings("deprecation")
@Deprecated
@Override
public int getMinutes() {
@@ -114,9 +102,7 @@ public class Date extends java.util.Date {
* @return does not return anything.
* @throws IllegalArgumentException
* if this method is called.
- * @since Android 1.0
*/
- @SuppressWarnings("deprecation")
@Deprecated
@Override
public int getSeconds() {
@@ -130,9 +116,7 @@ public class Date extends java.util.Date {
* the number of hours to set.
* @throws IllegalArgumentException
* if this method is called.
- * @since Android 1.0
*/
- @SuppressWarnings("deprecation")
@Deprecated
@Override
public void setHours(int theHours) {
@@ -146,9 +130,7 @@ public class Date extends java.util.Date {
* the number of minutes to set.
* @throws IllegalArgumentException
* if this method is called.
- * @since Android 1.0
*/
- @SuppressWarnings("deprecation")
@Deprecated
@Override
public void setMinutes(int theMinutes) {
@@ -162,9 +144,7 @@ public class Date extends java.util.Date {
* the number of seconds to set.
* @throws IllegalArgumentException
* if this method is called.
- * @since Android 1.0
*/
- @SuppressWarnings("deprecation")
@Deprecated
@Override
public void setSeconds(int theSeconds) {
@@ -177,7 +157,6 @@ public class Date extends java.util.Date {
*
* @param theTime
* the time in milliseconds since the Epoch.
- * @since Android 1.0
*/
@Override
public void setTime(long theTime) {
@@ -193,12 +172,31 @@ public class Date extends java.util.Date {
*
* @return a string representation of the date in SQL format - {@code
* "yyyy-mm-dd"}.
- * @since Android 1.0
*/
@Override
public String toString() {
- SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); //$NON-NLS-1$
- return dateFormat.format(this);
+ StringBuilder sb = new StringBuilder(10);
+
+ format((getYear() + 1900), 4, sb);
+ sb.append('-');
+ format((getMonth() + 1), 2, sb);
+ sb.append('-');
+ format(getDate(), 2, sb);
+
+ return sb.toString();
+ }
+
+ private static final String PADDING = "0000"; //$NON-NLS-1$
+
+ /*
+ * Private method to format the time
+ */
+ private void format(int date, int digits, StringBuilder sb) {
+ String str = String.valueOf(date);
+ if (digits - str.length() > 0) {
+ sb.append(PADDING.substring(0, digits - str.length()));
+ }
+ sb.append(str);
}
/**
@@ -212,7 +210,6 @@ public class Date extends java.util.Date {
* @throws IllegalArgumentException
* if the format of the supplied string does not match the SQL
* format.
- * @since Android 1.0
*/
public static Date valueOf(String dateString) {
if (dateString == null) {
diff --git a/sql/src/main/java/java/sql/Driver.java b/sql/src/main/java/java/sql/Driver.java
index c0499cb..207aec5 100644
--- a/sql/src/main/java/java/sql/Driver.java
+++ b/sql/src/main/java/java/sql/Driver.java
@@ -27,15 +27,12 @@ import java.util.Properties;
* {@code xxxx:yyyy}" is referred to as the <i>subprotocol</i> and is normally
* the same for all of a particular driver. " {@code SpecificData}" is a string
* which identifies the particular data source that the driver should use.
- * </p>
* <p>
* A driver needs to be registered with a {@link DriverManager}. It is
* registered and instantiated by calling {@code Class.forName("DriverURL")}
* with the URL string as argument.
- * </p>
+ *
* @see DriverManager
- *
- * @since Android 1.0
*/
public interface Driver {
@@ -51,7 +48,6 @@ public interface Driver {
* the subprotocol specified by the driver.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public boolean acceptsURL(String url) throws SQLException;
@@ -70,7 +66,6 @@ public interface Driver {
* @return the connection to the database.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public Connection connect(String url, Properties info) throws SQLException;
@@ -78,7 +73,6 @@ public interface Driver {
* Gets the driver's major version number.
*
* @return the major version number of the driver - typically starts at 1.
- * @since Android 1.0
*/
public int getMajorVersion();
@@ -86,7 +80,6 @@ public interface Driver {
* Gets the driver's minor version number.
*
* @return the minor version number of the driver - typically starts at 0.
- * @since Android 1.0
*/
public int getMinorVersion();
@@ -97,8 +90,7 @@ public interface Driver {
* the client of the driver must supply in order to establish a connection
* to a database. Note that the returned array of properties may change
* depending on the supplied list of property values.
- * </p>
- *
+ *
* @param url
* the URL of the database. An application may call this method
* iteratively as the property list is built up - for example,
@@ -113,7 +105,6 @@ public interface Driver {
* connect to the database.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public DriverPropertyInfo[] getPropertyInfo(String url, Properties info)
throws SQLException;
@@ -125,11 +116,9 @@ public interface Driver {
* <p>
* A driver may not be fully compliant if the underlying database has
* limited functionality.
- * </p>
- *
+ *
* @return {@code true} if the driver is fully JDBC compliant, {@code false}
* otherwise.
- * @since Android 1.0
*/
public boolean jdbcCompliant();
diff --git a/sql/src/main/java/java/sql/DriverManager.java b/sql/src/main/java/java/sql/DriverManager.java
index afcf2f5..1c41a46 100644
--- a/sql/src/main/java/java/sql/DriverManager.java
+++ b/sql/src/main/java/java/sql/DriverManager.java
@@ -17,14 +17,16 @@
package java.sql;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Properties;
import java.util.Enumeration;
import java.util.Iterator;
-import java.util.Set;
import java.io.PrintStream;
import java.io.PrintWriter;
-import java.util.HashSet;
import java.util.Vector;
+import java.security.AccessController;
+import org.apache.harmony.luni.util.PriviAction;
import org.apache.harmony.sql.internal.nls.Messages;
// BEGIN android-changed
import dalvik.system.VMStack;
@@ -36,9 +38,6 @@ import dalvik.system.VMStack;
* The {@code DriverManager} class loads JDBC drivers during its initialization,
* from the list of drivers referenced by the system property {@code
* "jdbc.drivers"}.
- * </p>
- *
- * @since Android 1.0
*/
public class DriverManager {
@@ -57,10 +56,11 @@ public class DriverManager {
* Set to hold Registered Drivers - initial capacity 10 drivers (will expand
* automatically if necessary.
*/
- private static final Set<Driver> theDriverSet = new HashSet<Driver>(10);
+ private static final List<Driver> theDrivers = new ArrayList<Driver>(10);
// Permission for setting log
- private static final SQLPermission logPermission = new SQLPermission("setLog"); //$NON-NLS-1$
+ private static final SQLPermission logPermission = new SQLPermission(
+ "setLog"); //$NON-NLS-1$
/*
* Load drivers on initialization
@@ -74,7 +74,9 @@ public class DriverManager {
* it is defined.
*/
private static void loadInitialDrivers() {
- String theDriverList = System.getProperty("jdbc.drivers", null); //$NON-NLS-1$
+ String theDriverList = AccessController
+ .doPrivileged(new PriviAction<String>("jdbc.drivers", null)); //$NON-NLS-1$
+
if (theDriverList == null) {
return;
}
@@ -112,14 +114,12 @@ public class DriverManager {
* <p>
* If the removal succeeds, the {@code DriverManager} will not use this
* driver in the future when asked to get a {@code Connection}.
- * </p>
- *
+ *
* @param driver
* the JDBC driver to remove.
* @throws SQLException
* if there is a problem interfering with accessing the
* database.
- * @since Android 1.0
*/
public static void deregisterDriver(Driver driver) throws SQLException {
if (driver == null) {
@@ -130,11 +130,12 @@ public class DriverManager {
// END android-changed
if (!DriverManager.isClassFromClassLoader(driver, callerClassLoader)) {
- // sql.1=DriverManager: calling class not authorized to deregister JDBC driver
+ // sql.1=DriverManager: calling class not authorized to deregister
+ // JDBC driver
throw new SecurityException(Messages.getString("sql.1")); //$NON-NLS-1$
} // end if
- synchronized (theDriverSet) {
- theDriverSet.remove(driver);
+ synchronized (theDrivers) {
+ theDrivers.remove(driver);
}
}
@@ -148,7 +149,6 @@ public class DriverManager {
* @throws SQLException
* if there is an error while attempting to connect to the
* database identified by the URL.
- * @since Android 1.0
*/
public static Connection getConnection(String url) throws SQLException {
return getConnection(url, new Properties());
@@ -171,7 +171,6 @@ public class DriverManager {
* @throws SQLException
* if there is an error while attempting to connect to the
* database identified by the URL.
- * @since Android 1.0
*/
public static Connection getConnection(String url, Properties info)
throws SQLException {
@@ -182,13 +181,13 @@ public class DriverManager {
// sql.5=The url cannot be null
throw new SQLException(Messages.getString("sql.5"), sqlState); //$NON-NLS-1$
}
- synchronized (theDriverSet) {
+ synchronized (theDrivers) {
/*
* Loop over the drivers in the DriverSet checking to see if one can
* open a connection to the supplied URL - return the first
* connection which is returned
*/
- for (Driver theDriver : theDriverSet) {
+ for (Driver theDriver : theDrivers) {
Connection theConnection = theDriver.connect(url, info);
if (theConnection != null) {
return theConnection;
@@ -214,15 +213,14 @@ public class DriverManager {
* @throws SQLException
* if there is an error while attempting to connect to the
* database identified by the URL.
- * @since Android 1.0
*/
public static Connection getConnection(String url, String user,
String password) throws SQLException {
Properties theProperties = new Properties();
- if(null != user){
+ if (null != user) {
theProperties.setProperty("user", user); //$NON-NLS-1$
}
- if(null != password){
+ if (null != password) {
theProperties.setProperty("password", password); //$NON-NLS-1$
}
return getConnection(url, theProperties);
@@ -243,13 +241,13 @@ public class DriverManager {
ClassLoader callerClassLoader = VMStack.getCallingClassLoader();
// END android-changed
- synchronized (theDriverSet) {
+ synchronized (theDrivers) {
/*
* Loop over the drivers in the DriverSet checking to see if one
* does understand the supplied URL - return the first driver which
* does understand the URL
*/
- Iterator<Driver> theIterator = theDriverSet.iterator();
+ Iterator<Driver> theIterator = theDrivers.iterator();
while (theIterator.hasNext()) {
Driver theDriver = theIterator.next();
if (theDriver.acceptsURL(url)
@@ -261,8 +259,8 @@ public class DriverManager {
}
// If no drivers understand the URL, throw an SQLException
// sql.6=No suitable driver
- //SQLState: 08 - connection exception
- //001 - SQL-client unable to establish SQL-connection
+ // SQLState: 08 - connection exception
+ // 001 - SQL-client unable to establish SQL-connection
throw new SQLException(Messages.getString("sql.6"), "08001"); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -272,7 +270,6 @@ public class DriverManager {
*
* @return An {@code Enumeration} containing all the currently loaded JDBC
* {@code Drivers}.
- * @since Android 1.0
*/
public static Enumeration<Driver> getDrivers() {
// BEGIN android-changed
@@ -282,13 +279,13 @@ public class DriverManager {
* Synchronize to avoid clashes with additions and removals of drivers
* in the DriverSet
*/
- synchronized (theDriverSet) {
+ synchronized (theDrivers) {
/*
* Create the Enumeration by building a Vector from the elements of
* the DriverSet
*/
Vector<Driver> theVector = new Vector<Driver>();
- Iterator<Driver> theIterator = theDriverSet.iterator();
+ Iterator<Driver> theIterator = theDrivers.iterator();
while (theIterator.hasNext()) {
Driver theDriver = theIterator.next();
if (DriverManager.isClassFromClassLoader(theDriver,
@@ -304,7 +301,6 @@ public class DriverManager {
* Returns the login timeout when connecting to a database in seconds.
*
* @return the login timeout in seconds.
- * @since Android 1.0
*/
public static int getLoginTimeout() {
return loginTimeout;
@@ -313,10 +309,9 @@ public class DriverManager {
/**
* Gets the log {@code PrintStream} used by the {@code DriverManager} and
* all the JDBC Drivers.
- *
+ *
* @deprecated use {@link #getLogWriter()} instead.
* @return the {@code PrintStream} used for logging activities.
- * @since Android 1.0
*/
@Deprecated
public static PrintStream getLogStream() {
@@ -328,7 +323,6 @@ public class DriverManager {
*
* @return A {@code PrintWriter} object used as the log writer. {@code null}
* if no log writer is set.
- * @since Android 1.0
*/
public static PrintWriter getLogWriter() {
return thePrintWriter;
@@ -340,7 +334,6 @@ public class DriverManager {
*
* @param message
* the message to print to the JDBC log stream.
- * @since Android 1.0
*/
public static void println(String message) {
if (thePrintWriter != null) {
@@ -362,8 +355,7 @@ public class DriverManager {
* <p>
* A newly loaded JDBC driver class should register itself with the
* {@code DriverManager} by calling this method.
- * </p>
- *
+ *
* @param driver
* the {@code Driver} to register with the {@code DriverManager}.
* @throws SQLException
@@ -373,8 +365,8 @@ public class DriverManager {
if (driver == null) {
throw new NullPointerException();
}
- synchronized (theDriverSet) {
- theDriverSet.add(driver);
+ synchronized (theDrivers) {
+ theDrivers.add(driver);
}
}
@@ -383,7 +375,6 @@ public class DriverManager {
*
* @param seconds
* seconds until timeout. 0 indicates wait forever.
- * @since Android 1.0
*/
public static void setLoginTimeout(int seconds) {
loginTimeout = seconds;
@@ -393,11 +384,10 @@ public class DriverManager {
/**
* Sets the print stream to use for logging data from the {@code
* DriverManager} and the JDBC drivers.
- *
+ *
* @deprecated Use {@link #setLogWriter} instead.
* @param out
* the {@code PrintStream} to use for logging.
- * @since Android 1.0
*/
@Deprecated
public static void setLogStream(PrintStream out) {
@@ -411,7 +401,6 @@ public class DriverManager {
*
* @param out
* the {@code PrintWriter} to be used.
- * @since Android 1.0
*/
public static void setLogWriter(PrintWriter out) {
checkLogSecurity();
@@ -442,13 +431,13 @@ public class DriverManager {
*/
private static boolean isClassFromClassLoader(Object theObject,
ClassLoader theClassLoader) {
-
+
if ((theObject == null) || (theClassLoader == null)) {
return false;
}
-
+
Class<?> objectClass = theObject.getClass();
-
+
try {
Class<?> checkClass = Class.forName(objectClass.getName(), true,
theClassLoader);
diff --git a/sql/src/main/java/java/sql/DriverPropertyInfo.java b/sql/src/main/java/java/sql/DriverPropertyInfo.java
index 3875abb..aa18585 100644
--- a/sql/src/main/java/java/sql/DriverPropertyInfo.java
+++ b/sql/src/main/java/java/sql/DriverPropertyInfo.java
@@ -22,38 +22,28 @@ package java.sql;
* This class is returned by the
* {@link Driver#getPropertyInfo(String, java.util.Properties)} method and
* allows for the advanced connection handling.
- *
- * @since Android 1.0
*/
public class DriverPropertyInfo {
/**
* If the value member can be chosen from a set of possible values, they are
* contained here. Otherwise choices is {@code null}.
- *
- * @since Android 1.0
*/
public String[] choices;
/**
* A description of the property. May be {@code null}.
- *
- * @since Android 1.0
*/
public String description;
/**
* The name of the property.
- *
- * @since Android 1.0
*/
public String name;
/**
- * {@code True} when the value member must be provided during {@code
- * Driver.connect}. {@code False} otherwise.
- *
- * @since Android 1.0
+ * {@code true} when the value member must be provided during {@code
+ * Driver.connect}. {@code false} otherwise.
*/
public boolean required;
@@ -61,8 +51,6 @@ public class DriverPropertyInfo {
* The current value associated with this property. It is depending on the
* data gathered by the {@code getPropertyInfo} method, the general Java
* environment and the driver's default values.
- *
- * @since Android 1.0
*/
public String value;
@@ -74,7 +62,6 @@ public class DriverPropertyInfo {
* The property name.
* @param value
* The property value.
- * @since Android 1.0
*/
public DriverPropertyInfo(String name, String value) {
this.name = name;
diff --git a/sql/src/main/java/java/sql/ParameterMetaData.java b/sql/src/main/java/java/sql/ParameterMetaData.java
index 94901ae..1e241c6 100644
--- a/sql/src/main/java/java/sql/ParameterMetaData.java
+++ b/sql/src/main/java/java/sql/ParameterMetaData.java
@@ -20,58 +20,42 @@ package java.sql;
/**
* An interface used to get information about the types and properties of
* parameters in a {@code PreparedStatement}.
- *
- * @since Android 1.0
*/
public interface ParameterMetaData {
/**
* Indicates that the parameter mode is {@code IN}.
- *
- * @since Android 1.0
*/
public static final int parameterModeIn = 1;
/**
* Indicates that the parameter mode is {@code INOUT}.
- *
- * @since Android 1.0
*/
public static final int parameterModeInOut = 2;
/**
* Indicates that the parameter mode is {@code OUT}.
- *
- * @since Android 1.0
*/
public static final int parameterModeOut = 4;
/**
* Indicates that the parameter mode is not known.
- *
- * @since Android 1.0
*/
public static final int parameterModeUnknown = 0;
/**
* Indicates that a parameter is not permitted to be {@code NULL}.
- *
- * @since Android 1.0
*/
public static final int parameterNoNulls = 0;
/**
* Indicates that a parameter is permitted to be {@code NULL}.
- *
- * @since Android 1.0
*/
public static final int parameterNullable = 1;
/**
* Indicates that whether a parameter is allowed to be {@code null} or not
* is not known.
- *
- * @since Android 1.0
*/
public static final int parameterNullableUnknown = 2;
@@ -87,7 +71,6 @@ public interface ParameterMetaData {
* between SQL types and Java objects.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public String getParameterClassName(int paramIndex) throws SQLException;
@@ -98,7 +81,6 @@ public interface ParameterMetaData {
* @return the number of parameters.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public int getParameterCount() throws SQLException;
@@ -117,7 +99,6 @@ public interface ParameterMetaData {
* @return the parameter's mode.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public int getParameterMode(int paramIndex) throws SQLException;
@@ -131,7 +112,6 @@ public interface ParameterMetaData {
* java.sql.Types}.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public int getParameterType(int paramIndex) throws SQLException;
@@ -146,7 +126,6 @@ public interface ParameterMetaData {
* Defined Type</i> (UDT).
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public String getParameterTypeName(int paramIndex) throws SQLException;
@@ -160,7 +139,6 @@ public interface ParameterMetaData {
* {@code 0} if the parameter is not a numeric type.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public int getPrecision(int paramIndex) throws SQLException;
@@ -175,7 +153,6 @@ public interface ParameterMetaData {
* the parameter. {@code 0} if the parameter is not a numeric type.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public int getScale(int paramIndex) throws SQLException;
@@ -194,7 +171,6 @@ public interface ParameterMetaData {
* @return the int code indicating the nullability of the parameter.
* @throws SQLException
* if a database error is encountered.
- * @since Android 1.0
*/
public int isNullable(int paramIndex) throws SQLException;
@@ -208,7 +184,6 @@ public interface ParameterMetaData {
* {@code false} otherwise.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public boolean isSigned(int paramIndex) throws SQLException;
}
diff --git a/sql/src/main/java/java/sql/PreparedStatement.java b/sql/src/main/java/java/sql/PreparedStatement.java
index ab81871..1cd9668 100644
--- a/sql/src/main/java/java/sql/PreparedStatement.java
+++ b/sql/src/main/java/java/sql/PreparedStatement.java
@@ -28,14 +28,10 @@ import java.math.BigDecimal;
* <p>
* An SQL Statement is put into a {@code PreparedStatement} and is precompiled
* so that it can be executed efficiently multiple times.
- * </p>
* <p>
* Setter methods are supplied in the {@code PreparedStatement} interface for
* the setting of {@code IN} parameters for the statement. The setter method
* used for each {@code IN} parameter must match the parameter's type.
- * </p>
- *
- * @since Android 1.0
*/
public interface PreparedStatement extends Statement {
@@ -44,7 +40,6 @@ public interface PreparedStatement extends Statement {
*
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void addBatch() throws SQLException;
@@ -55,11 +50,9 @@ public interface PreparedStatement extends Statement {
* {@code Statement}. Setting a parameter value replaces the previous value. This
* method clears the values for all parameters, releasing all resources used
* by those parameters.
- * </p>
- *
+ *
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void clearParameters() throws SQLException;
@@ -72,14 +65,12 @@ public interface PreparedStatement extends Statement {
* {@code getResultSet} or {@code getUpdateCount} are used to retrieve
* the first result, and the second and subsequent results are
* retrieved with {@code getMoreResults}.
- * </p>
- *
+ *
* @return {@code true} if the result of the execution is a {@code
* ResultSet}, {@code false} if there is no result or if the result
* is an update count.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public boolean execute() throws SQLException;
@@ -91,7 +82,6 @@ public interface PreparedStatement extends Statement {
* @throws SQLException
* if a database error happens or if the SQL statement does not
* produce a {@code ResultSet}.
- * @since Android 1.0
*/
public ResultSet executeQuery() throws SQLException;
@@ -105,7 +95,6 @@ public interface PreparedStatement extends Statement {
* @throws SQLException
* if a database error happens or if the SQL statement returns a
* {@code ResultSet}.
- * @since Android 1.0
*/
public int executeUpdate() throws SQLException;
@@ -117,14 +106,12 @@ public interface PreparedStatement extends Statement {
* executing the {@code PreparedStatement}, because the {@code
* PreparedStatement} is precompiled. As a result the metadata can be
* queried ahead of time without actually executing the statement.
- * </p>
- *
+ *
* @return a {@code ResultSetMetaData} object with the information about the
* columns of the {@code ResultSet}, if the driver can return a
* {@code ResultSetMetaData}. {@code null} otherwise.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public ResultSetMetaData getMetaData() throws SQLException;
@@ -136,7 +123,6 @@ public interface PreparedStatement extends Statement {
* PreparedStatement}.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public ParameterMetaData getParameterMetaData() throws SQLException;
@@ -152,7 +138,6 @@ public interface PreparedStatement extends Statement {
* @throws SQLException
* if a database error happens.
* @see Array
- * @since Android 1.0
*/
public void setArray(int parameterIndex, Array theArray)
throws SQLException;
@@ -161,12 +146,11 @@ public interface PreparedStatement extends Statement {
* Sets the value of a specified parameter to the content of a supplied
* {@code InputStream}, which has a specified number of bytes.
* <p>
- * This is a good method for setting an SQL {@code LONVARCHAR} parameter
+ * This is a good method for setting an SQL {@code LONGVARCHAR} parameter
* where the length of the data is large. Data is read from the {@code
* InputStream} until end-of-file is reached or the specified number of
* bytes is copied.
- * </p>
- *
+ *
* @param parameterIndex
* the parameter number index, where the first parameter has
* index 1.
@@ -178,7 +162,6 @@ public interface PreparedStatement extends Statement {
* parameter.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void setAsciiStream(int parameterIndex, InputStream theInputStream,
int length) throws SQLException;
@@ -196,7 +179,6 @@ public interface PreparedStatement extends Statement {
* @throws SQLException
* if a database error happens.
* @see java.math.BigDecimal
- * @since Android 1.0
*/
public void setBigDecimal(int parameterIndex, BigDecimal theBigDecimal)
throws SQLException;
@@ -207,8 +189,7 @@ public interface PreparedStatement extends Statement {
* <p>
* Use this method when a large amount of data needs to be set into a
* {@code LONGVARBINARY} parameter.
- * </p>
- *
+ *
* @param parameterIndex
* the parameter number index, where the first parameter has
* index 1.
@@ -220,7 +201,6 @@ public interface PreparedStatement extends Statement {
* parameter.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void setBinaryStream(int parameterIndex, InputStream theInputStream,
int length) throws SQLException;
@@ -236,7 +216,6 @@ public interface PreparedStatement extends Statement {
* parameterIndex} is set.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
* @see Blob
*/
public void setBlob(int parameterIndex, Blob theBlob) throws SQLException;
@@ -253,7 +232,6 @@ public interface PreparedStatement extends Statement {
* parameterIndex} is set.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void setBoolean(int parameterIndex, boolean theBoolean)
throws SQLException;
@@ -269,7 +247,6 @@ public interface PreparedStatement extends Statement {
* parameterIndex} is set.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void setByte(int parameterIndex, byte theByte) throws SQLException;
@@ -286,7 +263,6 @@ public interface PreparedStatement extends Statement {
* parameterIndex} is set.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void setBytes(int parameterIndex, byte[] theBytes)
throws SQLException;
@@ -298,8 +274,7 @@ public interface PreparedStatement extends Statement {
* Data is read from the {@code
* Reader} until end-of-file is reached or the specified number of
* characters are copied.
- * </p>
- *
+ *
* @param parameterIndex
* the parameter number index, where the first parameter has
* index 1
@@ -309,7 +284,6 @@ public interface PreparedStatement extends Statement {
* the number of characters to be read.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void setCharacterStream(int parameterIndex, Reader reader, int length)
throws SQLException;
@@ -325,7 +299,6 @@ public interface PreparedStatement extends Statement {
* parameter at {@code parameterIndex} is set.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void setClob(int parameterIndex, Clob theClob) throws SQLException;
@@ -341,7 +314,6 @@ public interface PreparedStatement extends Statement {
* parameterIndex} is set.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void setDate(int parameterIndex, Date theDate) throws SQLException;
@@ -366,7 +338,6 @@ public interface PreparedStatement extends Statement {
* if a database error happens.
* @see Date
* @see java.util.Calendar
- * @since Android 1.0
*/
public void setDate(int parameterIndex, Date theDate, Calendar cal)
throws SQLException;
@@ -383,7 +354,6 @@ public interface PreparedStatement extends Statement {
* parameterIndex} is set.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void setDouble(int parameterIndex, double theDouble)
throws SQLException;
@@ -399,7 +369,6 @@ public interface PreparedStatement extends Statement {
* the {@code float} value to update the parameter.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void setFloat(int parameterIndex, float theFloat)
throws SQLException;
@@ -415,7 +384,6 @@ public interface PreparedStatement extends Statement {
* parameterIndex} is set.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void setInt(int parameterIndex, int theInt) throws SQLException;
@@ -430,7 +398,6 @@ public interface PreparedStatement extends Statement {
* parameterIndex} is set.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void setLong(int parameterIndex, long theLong) throws SQLException;
@@ -447,7 +414,6 @@ public interface PreparedStatement extends Statement {
* java.sql.Types}.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void setNull(int parameterIndex, int sqlType) throws SQLException;
@@ -461,8 +427,7 @@ public interface PreparedStatement extends Statement {
* SQL type name when supplying a {@code NULL} UDT or REF. For a UDT, the
* type name is the type name of the parameter itself, but for a REF
* parameter the type name is the type name of the referenced type.
- * </p>
- *
+ *
* @param paramIndex
* the parameter number index, where the first parameter has
* index 1.
@@ -475,7 +440,6 @@ public interface PreparedStatement extends Statement {
* @throws SQLException
* if a database error happens.
* @see Types
- * @since Android 1.0
*/
public void setNull(int paramIndex, int sqlType, String typeName)
throws SQLException;
@@ -493,8 +457,7 @@ public interface PreparedStatement extends Statement {
* object's class implements {@code Ref}, {@code Blob}, {@code Clob},
* {@code Struct}, or {@code Array}, the driver passes it to the database as
* a value of the corresponding SQL type.
- * </p>
- *
+ *
* @param parameterIndex
* the parameter number index, where the first parameter has
* index 1.
@@ -503,7 +466,6 @@ public interface PreparedStatement extends Statement {
* {@code parameterIndex} is set.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void setObject(int parameterIndex, Object theObject)
throws SQLException;
@@ -518,8 +480,7 @@ public interface PreparedStatement extends Statement {
* object's class implements {@code Ref}, {@code Blob}, {@code Clob},
* {@code Struct}, or {@code Array}, the driver will pass it to the database
* in the form of the relevant SQL type.
- * </p>
- *
+ *
* @param parameterIndex
* the parameter index, where the first parameter has index 1.
* @param theObject
@@ -530,7 +491,6 @@ public interface PreparedStatement extends Statement {
* java.sql.Types}.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void setObject(int parameterIndex, Object theObject,
int targetSqlType) throws SQLException;
@@ -545,8 +505,7 @@ public interface PreparedStatement extends Statement {
* object's class implements {@code Ref}, {@code Blob}, {@code Clob},
* {@code Struct}, or {@code Array}, the driver will pass it to the database
* in the form of the relevant SQL type.
- * </p>
- *
+ *
* @param parameterIndex
* the parameter index, where the first parameter has index 1.
* @param theObject
@@ -561,7 +520,6 @@ public interface PreparedStatement extends Statement {
* java.sql.Types.NUMERIC} - ignored for all other types.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void setObject(int parameterIndex, Object theObject,
int targetSqlType, int scale) throws SQLException;
@@ -579,7 +537,6 @@ public interface PreparedStatement extends Statement {
* @throws SQLException
* if a database error happens.
* @see Ref
- * @since Android 1.0
*/
public void setRef(int parameterIndex, Ref theRef) throws SQLException;
@@ -595,7 +552,6 @@ public interface PreparedStatement extends Statement {
* parameterIndex} is set.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void setShort(int parameterIndex, short theShort)
throws SQLException;
@@ -611,7 +567,6 @@ public interface PreparedStatement extends Statement {
* set.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void setString(int parameterIndex, String theString)
throws SQLException;
@@ -628,7 +583,6 @@ public interface PreparedStatement extends Statement {
* {@code parameterIndex} is set.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void setTime(int parameterIndex, Time theTime) throws SQLException;
@@ -639,8 +593,7 @@ public interface PreparedStatement extends Statement {
* The driver uses the supplied {@code Calendar} to create the SQL {@code
* TIME} value, which allows it to use a custom timezone - otherwise the
* driver uses the default timezone of the Java virtual machine.
- * </p>
- *
+ *
* @param parameterIndex
* the parameter number index, where the first parameter has
* index 1.
@@ -654,7 +607,6 @@ public interface PreparedStatement extends Statement {
* if a database error happens.
* @see Time
* @see java.util.Calendar
- * @since Android 1.0
*/
public void setTime(int parameterIndex, Time theTime, Calendar cal)
throws SQLException;
@@ -671,7 +623,6 @@ public interface PreparedStatement extends Statement {
* parameterIndex} is set.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void setTimestamp(int parameterIndex, Timestamp theTimestamp)
throws SQLException;
@@ -683,8 +634,7 @@ public interface PreparedStatement extends Statement {
* The driver uses the supplied {@code Calendar} to create the SQL {@code
* TIMESTAMP} value, which allows it to use a custom timezone - otherwise
* the driver uses the default timezone of the Java virtual machine.
- * </p>
- *
+ *
* @param parameterIndex
* the parameter number index, where the first parameter has
* index 1.
@@ -698,7 +648,6 @@ public interface PreparedStatement extends Statement {
* if a database error happens.
* @see Timestamp
* @see java.util.Calendar
- * @since Android 1.0
*/
public void setTimestamp(int parameterIndex, Timestamp theTimestamp,
Calendar cal) throws SQLException;
@@ -736,7 +685,6 @@ public interface PreparedStatement extends Statement {
* @throws SQLException
* if a database error happens.
* @see URL
- * @since Android 1.0
*/
public void setURL(int parameterIndex, URL theURL) throws SQLException;
}
diff --git a/sql/src/main/java/java/sql/Ref.java b/sql/src/main/java/java/sql/Ref.java
index 2ceac8b..cbc5454 100644
--- a/sql/src/main/java/java/sql/Ref.java
+++ b/sql/src/main/java/java/sql/Ref.java
@@ -29,11 +29,9 @@ import java.util.Map;
* the database supports the {@code Ref} type, it is not typically
* necessary to get the underlying object before using it in a method call -
* the {@code Ref} object can be used in place of the data structure.
- * </p>
+ * <p>
* A {@code Ref} object is stored into the database using the
* {@link PreparedStatement#setRef(int, Ref)} method.
- *
- * @since Android 1.0
*/
public interface Ref {
@@ -44,7 +42,6 @@ public interface Ref {
* @return the fully qualified name of the SQL structured type.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public String getBaseTypeName() throws SQLException;
@@ -55,7 +52,6 @@ public interface Ref {
* structured type.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public Object getObject() throws SQLException;
@@ -69,7 +65,6 @@ public interface Ref {
* structured type.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public Object getObject(Map<String, Class<?>> map) throws SQLException;
@@ -82,7 +77,6 @@ public interface Ref {
* that this {@code Ref} references.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public void setObject(Object value) throws SQLException;
}
diff --git a/sql/src/main/java/java/sql/ResultSet.java b/sql/src/main/java/java/sql/ResultSet.java
index f33f9de..8ecbe6c 100644
--- a/sql/src/main/java/java/sql/ResultSet.java
+++ b/sql/src/main/java/java/sql/ResultSet.java
@@ -34,7 +34,6 @@ import java.net.URL;
* use the {@code next} method. The {@code next} method returns {@code true} as
* long as there are more rows in the {@code ResultSet}, otherwise it returns
* {@code false}.
- * </p>
* <p>
* The default type of {@code ResultSet} can not be updated and its cursor can
* only advance forward through the rows of data. This means that it is only
@@ -42,7 +41,6 @@ import java.net.URL;
* are implemented: an <i>updatable</i> type and also types where the cursor can
* be <i>scrolled</i> forward and backward through the rows of data. How such a
* {@code ResultSet} is created is demonstrated in the following example:
- * </p>
* <ul>
* <dd>
* {@code Connection con;}</dd>
@@ -63,13 +61,11 @@ import java.net.URL;
* is better to use column indexes. Ideally the columns should be read
* left-to-right and read once only, since not all databases are optimized to
* handle other techniques of reading the data.
- * </p>
* <p>
* When reading data via the appropriate getter methods, the JDBC driver maps
* the SQL data retrieved from the database to the Java type implied by the
* method invoked by the application. The JDBC specification has a table for the
* mappings from SQL types to Java types.
- * </p>
* <p>
* There are also methods for writing data into the {@code ResultSet}, such as
* {@code updateInt} and {@code updateString}. The update methods can be used
@@ -80,94 +76,70 @@ import java.net.URL;
* method. For insertion of new rows, the cursor is first moved to a special row
* called the <i>Insert Row</i>, data is added using the update methods,
* followed by calling the {@code ResultSet.insertRow} method.
- * </p>
* <p>
* A {@code ResultSet} is closed if the statement which generated it closes, the
* statement is executed again, or the same statement's next {@code ResultSet}
* is retrieved (if the statement returned of multiple results).
- * </p>
- *
- * @since Android 1.0
*/
public interface ResultSet {
/**
* A constant used to indicate that a {@code ResultSet} object must be
* closed when the method {@code Connection.commit} is invoked.
- *
- * @since Android 1.0
*/
public static final int CLOSE_CURSORS_AT_COMMIT = 2;
/**
* A constant used to indicate that a {@code ResultSet} object must not be
* closed when the method {@code Connection.commit} is invoked.
- *
- * @since Android 1.0
*/
public static final int HOLD_CURSORS_OVER_COMMIT = 1;
/**
* A constant used to indicate the concurrency mode for a {@code ResultSet}
* object that cannot be updated.
- *
- * @since Android 1.0
*/
public static final int CONCUR_READ_ONLY = 1007;
/**
* A constant used to indicate the concurrency mode for a {@code ResultSet}
* object that can be updated.
- *
- * @since Android 1.0
*/
public static final int CONCUR_UPDATABLE = 1008;
/**
* A constant used to indicate processing of the rows of a {@code ResultSet}
* in the forward direction, first to last.
- *
- * @since Android 1.0
*/
public static final int FETCH_FORWARD = 1000;
/**
* A constant used to indicate processing of the rows of a {@code ResultSet}
* in the reverse direction, last to first.
- *
- * @since Android 1.0
*/
public static final int FETCH_REVERSE = 1001;
/**
* A constant used to indicate that the order of processing of the rows of a
* {@code ResultSet} is unknown.
- *
- * @since Android 1.0
*/
public static final int FETCH_UNKNOWN = 1002;
/**
* A constant used to indicate a {@code ResultSet} object whose cursor can
* only move forward.
- *
- * @since Android 1.0
*/
public static final int TYPE_FORWARD_ONLY = 1003;
/**
* A constant used to indicate a {@code ResultSet} object which is
* scrollable but is insensitive to changes made by others.
- *
- * @since Android 1.0
*/
public static final int TYPE_SCROLL_INSENSITIVE = 1004;
/**
* A constant used to indicate a {@code ResultSet} object which is
* scrollable and sensitive to changes made by others.
- *
- * @since Android 1.0
*/
public static final int TYPE_SCROLL_SENSITIVE = 1005;
@@ -181,7 +153,6 @@ public interface ResultSet {
* ResultSet}, {@code false} otherwise.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public boolean absolute(int row) throws SQLException;
@@ -190,7 +161,6 @@ public interface ResultSet {
*
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void afterLast() throws SQLException;
@@ -200,7 +170,6 @@ public interface ResultSet {
*
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void beforeFirst() throws SQLException;
@@ -209,7 +178,6 @@ public interface ResultSet {
*
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void cancelRowUpdates() throws SQLException;
@@ -218,7 +186,6 @@ public interface ResultSet {
*
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void clearWarnings() throws SQLException;
@@ -232,7 +199,6 @@ public interface ResultSet {
*
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void close() throws SQLException;
@@ -242,7 +208,6 @@ public interface ResultSet {
*
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void deleteRow() throws SQLException;
@@ -256,7 +221,6 @@ public interface ResultSet {
* name.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public int findColumn(String columnName) throws SQLException;
@@ -267,7 +231,6 @@ public interface ResultSet {
* false} if the {@code ResultSet} contains no rows.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public boolean first() throws SQLException;
@@ -280,7 +243,6 @@ public interface ResultSet {
* @return a {@code java.sql.Array} with the data from the column.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public Array getArray(int columnIndex) throws SQLException;
@@ -293,7 +255,6 @@ public interface ResultSet {
* @return a {@code java.sql.Array} with the data from the specified column.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public Array getArray(String colName) throws SQLException;
@@ -306,7 +267,6 @@ public interface ResultSet {
* @return an {@code InputStream} with the data from the column.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public InputStream getAsciiStream(int columnIndex) throws SQLException;
@@ -319,7 +279,6 @@ public interface ResultSet {
* @return an {@code InputStream} with the data from the column.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public InputStream getAsciiStream(String columnName) throws SQLException;
@@ -332,7 +291,6 @@ public interface ResultSet {
* @return a {@code BigDecimal} with the value of the column.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public BigDecimal getBigDecimal(int columnIndex) throws SQLException;
@@ -349,7 +307,6 @@ public interface ResultSet {
* @return a {@code BigDecimal} with the value of the column.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
@Deprecated
public BigDecimal getBigDecimal(int columnIndex, int scale)
@@ -364,7 +321,6 @@ public interface ResultSet {
* @return a BigDecimal with value of the column.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public BigDecimal getBigDecimal(String columnName) throws SQLException;
@@ -381,7 +337,6 @@ public interface ResultSet {
* @return a BigDecimal with value of the column.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
@Deprecated
public BigDecimal getBigDecimal(String columnName, int scale)
@@ -395,15 +350,13 @@ public interface ResultSet {
* data in the {@code InputStream} should be read before getting data from
* any other column. A further call to a getter method will implicitly close
* the {@code InputStream}.
- * </p>
- *
+ *
* @param columnIndex
* the index of the column to read.
* @return an {@code InputStream} with the data from the column. If the
* column value is SQL {@code NULL}, {@code null} is returned.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public InputStream getBinaryStream(int columnIndex) throws SQLException;
@@ -414,15 +367,13 @@ public interface ResultSet {
* data in the {@code InputStream} should be read before getting data from
* any other column. A further call to a getter method will implicitly close
* the {@code InputStream}.
- * </p>
- *
+ *
* @param columnName
* the name of the column to read.
* @return an {@code InputStream} with the data from the column if the
* column value is SQL {@code NULL}, {@code null} is returned.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public InputStream getBinaryStream(String columnName) throws SQLException;
@@ -435,7 +386,6 @@ public interface ResultSet {
* @return a {@code java.sql.Blob} with the value of the column.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public Blob getBlob(int columnIndex) throws SQLException;
@@ -448,7 +398,6 @@ public interface ResultSet {
* @return a {@code java.sql.Blob} with the value of the column.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public Blob getBlob(String columnName) throws SQLException;
@@ -462,7 +411,6 @@ public interface ResultSet {
* {@code NULL}, {@code false} is returned.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public boolean getBoolean(int columnIndex) throws SQLException;
@@ -476,7 +424,6 @@ public interface ResultSet {
* {@code NULL}, {@code false} is returned.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public boolean getBoolean(String columnName) throws SQLException;
@@ -489,7 +436,6 @@ public interface ResultSet {
* is SQL {@code NULL}.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public byte getByte(int columnIndex) throws SQLException;
@@ -502,7 +448,6 @@ public interface ResultSet {
* is SQL {@code NULL}.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public byte getByte(String columnName) throws SQLException;
@@ -515,7 +460,6 @@ public interface ResultSet {
* the column contains SQL {@code NULL}.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public byte[] getBytes(int columnIndex) throws SQLException;
@@ -528,7 +472,6 @@ public interface ResultSet {
* the column contains SQL {@code NULL}.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public byte[] getBytes(String columnName) throws SQLException;
@@ -543,7 +486,6 @@ public interface ResultSet {
* @throws SQLException
* if a database error happens.
* @see java.io.Reader
- * @since Android 1.0
*/
public Reader getCharacterStream(int columnIndex) throws SQLException;
@@ -557,7 +499,6 @@ public interface ResultSet {
* the column value is SQL {@code NULL}.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public Reader getCharacterStream(String columnName) throws SQLException;
@@ -571,7 +512,6 @@ public interface ResultSet {
* {@code null} if the value is SQL {@code NULL}.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public Clob getClob(int columnIndex) throws SQLException;
@@ -585,7 +525,6 @@ public interface ResultSet {
* {@code null} if the value is SQL {@code NULL}.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public Clob getClob(String colName) throws SQLException;
@@ -596,7 +535,6 @@ public interface ResultSet {
* , {@code ResultSet.CONCUR_UPDATABLE}.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public int getConcurrency() throws SQLException;
@@ -606,7 +544,6 @@ public interface ResultSet {
* @return the SQL cursor name.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public String getCursorName() throws SQLException;
@@ -620,7 +557,6 @@ public interface ResultSet {
* if the column is SQL {@code NULL}.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public Date getDate(int columnIndex) throws SQLException;
@@ -636,7 +572,6 @@ public interface ResultSet {
* if the column is SQL {@code NULL}.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public Date getDate(int columnIndex, Calendar cal) throws SQLException;
@@ -650,7 +585,6 @@ public interface ResultSet {
* if the column is SQL {@code NULL}.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public Date getDate(String columnName) throws SQLException;
@@ -666,7 +600,6 @@ public interface ResultSet {
* if the column is SQL {@code NULL}.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public Date getDate(String columnName, Calendar cal) throws SQLException;
@@ -680,7 +613,6 @@ public interface ResultSet {
* column is SQL {@code NULL}.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public double getDouble(int columnIndex) throws SQLException;
@@ -694,7 +626,6 @@ public interface ResultSet {
* column is SQL {@code NULL}.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public double getDouble(String columnName) throws SQLException;
@@ -709,7 +640,6 @@ public interface ResultSet {
* </ul>
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public int getFetchDirection() throws SQLException;
@@ -719,7 +649,6 @@ public interface ResultSet {
* @return the fetch size as an int
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public int getFetchSize() throws SQLException;
@@ -733,7 +662,6 @@ public interface ResultSet {
* column is SQL {@code NULL}.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public float getFloat(int columnIndex) throws SQLException;
@@ -747,7 +675,6 @@ public interface ResultSet {
* column is SQL {@code NULL}.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public float getFloat(String columnName) throws SQLException;
@@ -761,7 +688,6 @@ public interface ResultSet {
* column is SQL {@code NULL}.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public int getInt(int columnIndex) throws SQLException;
@@ -775,7 +701,6 @@ public interface ResultSet {
* column is SQL {@code NULL}.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public int getInt(String columnName) throws SQLException;
@@ -789,7 +714,6 @@ public interface ResultSet {
* column is SQL {@code NULL}.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public long getLong(int columnIndex) throws SQLException;
@@ -803,7 +727,6 @@ public interface ResultSet {
* column is SQL {@code NULL}.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public long getLong(String columnName) throws SQLException;
@@ -815,7 +738,6 @@ public interface ResultSet {
* {@code ResultSet}.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public ResultSetMetaData getMetaData() throws SQLException;
@@ -827,15 +749,13 @@ public interface ResultSet {
* For SQL User Defined Types, if a column value is Structured or Distinct,
* this method behaves the same as a call to: {@code
* getObject(columnIndex,this.getStatement().getConnection().getTypeMap())}
- * </p>
- *
+ *
* @param columnIndex
* the index of the column to read.
* @return an {@code Object} containing the value of the column. {@code
* null} if the column value is SQL {@code NULL}.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public Object getObject(int columnIndex) throws SQLException;
@@ -846,8 +766,7 @@ public interface ResultSet {
* The type of the Java object will be determined by the supplied Map to
* perform the mapping of SQL {@code Struct} or Distinct types into Java
* objects.
- * </p>
- *
+ *
* @param columnIndex
* the index of the column to read.
* @param map
@@ -857,7 +776,6 @@ public interface ResultSet {
* null} if the column value is SQL {@code NULL}.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public Object getObject(int columnIndex, Map<String, Class<?>> map)
throws SQLException;
@@ -870,15 +788,13 @@ public interface ResultSet {
* For SQL User Defined Types, if a column value is structured or distinct,
* this method behaves the same as a call to: {@code
* getObject(columnIndex,this.getStatement().getConnection().getTypeMap())}
- * </p>
- *
+ *
* @param columnName
* the name of the column to read.
* @return an {@code Object} containing the value of the column. {@code
* null} if the column value is SQL {@code NULL}.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public Object getObject(String columnName) throws SQLException;
@@ -888,8 +804,7 @@ public interface ResultSet {
* <p>
* The type of the Java object will be determined by the supplied Map to
* perform the mapping of SQL Struct or Distinct types into Java objects.
- * </p>
- *
+ *
* @param columnName
* the name of the column to read.
* @param map
@@ -899,7 +814,6 @@ public interface ResultSet {
* null} if the column value is SQL {@code NULL}.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public Object getObject(String columnName, Map<String, Class<?>> map)
throws SQLException;
@@ -913,7 +827,6 @@ public interface ResultSet {
* @return a Ref representing the value of the SQL REF in the column
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public Ref getRef(int columnIndex) throws SQLException;
@@ -926,7 +839,6 @@ public interface ResultSet {
* @return a Ref representing the value of the SQL {@code REF} in the column
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public Ref getRef(String colName) throws SQLException;
@@ -938,7 +850,6 @@ public interface ResultSet {
* there is no current row.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public int getRow() throws SQLException;
@@ -951,7 +862,6 @@ public interface ResultSet {
* the value is SQL {@code NULL}.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public short getShort(int columnIndex) throws SQLException;
@@ -964,7 +874,6 @@ public interface ResultSet {
* the value is SQL {@code NULL}.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public short getShort(String columnName) throws SQLException;
@@ -978,7 +887,6 @@ public interface ResultSet {
* null} if the {@code ResultSet} was not created by a Statement.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public Statement getStatement() throws SQLException;
@@ -991,7 +899,6 @@ public interface ResultSet {
* the column is SQL {@code NULL}.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public String getString(int columnIndex) throws SQLException;
@@ -1004,7 +911,6 @@ public interface ResultSet {
* the column is SQL {@code NULL}.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public String getString(String columnName) throws SQLException;
@@ -1018,7 +924,6 @@ public interface ResultSet {
* value is SQL {@code NULL}.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public Time getTime(int columnIndex) throws SQLException;
@@ -1035,7 +940,6 @@ public interface ResultSet {
* value is SQL {@code NULL}.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public Time getTime(int columnIndex, Calendar cal) throws SQLException;
@@ -1049,7 +953,6 @@ public interface ResultSet {
* NULL}.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public Time getTime(String columnName) throws SQLException;
@@ -1066,7 +969,6 @@ public interface ResultSet {
* value is SQL {@code NULL}.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public Time getTime(String columnName, Calendar cal) throws SQLException;
@@ -1080,7 +982,6 @@ public interface ResultSet {
* column value is SQL {@code NULL}.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public Timestamp getTimestamp(int columnIndex) throws SQLException;
@@ -1097,7 +998,6 @@ public interface ResultSet {
* column value is SQL NULL.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public Timestamp getTimestamp(int columnIndex, Calendar cal)
throws SQLException;
@@ -1112,7 +1012,6 @@ public interface ResultSet {
* column value is SQL {@code NULL}.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public Timestamp getTimestamp(String columnName) throws SQLException;
@@ -1129,7 +1028,6 @@ public interface ResultSet {
* column value is SQL {@code NULL}.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public Timestamp getTimestamp(String columnName, Calendar cal)
throws SQLException;
@@ -1145,7 +1043,6 @@ public interface ResultSet {
* </ul>
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public int getType() throws SQLException;
@@ -1160,7 +1057,6 @@ public interface ResultSet {
* null} if the column value is SQL {@code NULL}.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
@Deprecated
public InputStream getUnicodeStream(int columnIndex) throws SQLException;
@@ -1176,7 +1072,6 @@ public interface ResultSet {
* null} if the column value is SQL {@code NULL}.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
@Deprecated
public InputStream getUnicodeStream(String columnName) throws SQLException;
@@ -1190,7 +1085,6 @@ public interface ResultSet {
* @return a URL. {@code null} if the column value is SQL {@code NULL}.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public URL getURL(int columnIndex) throws SQLException;
@@ -1203,7 +1097,6 @@ public interface ResultSet {
* @return the column vaule as a URL. {@code null} if the column value is SQL {@code NULL}.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public URL getURL(String columnName) throws SQLException;
@@ -1217,15 +1110,13 @@ public interface ResultSet {
* generated by {@code ResultSet} method calls - warnings generated by
* Statement methods are held by the Statement.
* <p>
- * </p>
* An {@code SQLException} is generated if this method is called on a closed
- * {@code ResultSet}. </p>
+ * {@code ResultSet}.
*
* @return an SQLWarning which is the first warning for this {@code
* ResultSet}. {@code null} if there are no warnings.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public SQLWarning getWarnings() throws SQLException;
@@ -1239,7 +1130,6 @@ public interface ResultSet {
* cursor not being on the Insert Row or if any columns in the
* row do not have a value where the column is declared as
* not-nullable.
- * @since Android 1.0
*/
public void insertRow() throws SQLException;
@@ -1251,7 +1141,6 @@ public interface ResultSet {
* in the {@code ResultSet}.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public boolean isAfterLast() throws SQLException;
@@ -1263,7 +1152,6 @@ public interface ResultSet {
* in the {@code ResultSet}.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public boolean isBeforeFirst() throws SQLException;
@@ -1275,7 +1163,6 @@ public interface ResultSet {
* in the {@code ResultSet}.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public boolean isFirst() throws SQLException;
@@ -1287,7 +1174,6 @@ public interface ResultSet {
* in the {@code ResultSet}.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public boolean isLast() throws SQLException;
@@ -1298,7 +1184,6 @@ public interface ResultSet {
* false} if the {@code ResultSet} contains no rows.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public boolean last() throws SQLException;
@@ -1309,7 +1194,6 @@ public interface ResultSet {
*
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void moveToCurrentRow() throws SQLException;
@@ -1321,7 +1205,6 @@ public interface ResultSet {
*
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void moveToInsertRow() throws SQLException;
@@ -1330,14 +1213,12 @@ public interface ResultSet {
* <p>
* Any input streams associated with the current row are closed and any
* warnings are cleared.
- * </p>
- *
+ *
* @return {@code true} if the updated cursor position is pointing to a
* valid row, {@code false} otherwise (i.e. when the cursor is after
* the last row in the {@code ResultSet}).
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public boolean next() throws SQLException;
@@ -1349,7 +1230,6 @@ public interface ResultSet {
* false} if the cursor is now before the first row.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public boolean previous() throws SQLException;
@@ -1360,12 +1240,10 @@ public interface ResultSet {
* If any columns in the current row have been updated but the {@code
* updateRow} has not been called, then the updates are lost when this
* method is called.
- * </p>
- *
+ *
* @throws SQLException
* if a database error happens., including if the current row is
* the Insert row.
- * @since Android 1.0
*/
public void refreshRow() throws SQLException;
@@ -1381,7 +1259,6 @@ public interface ResultSet {
* false} otherwise
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public boolean relative(int rows) throws SQLException;
@@ -1393,7 +1270,6 @@ public interface ResultSet {
* detected, {@code false} otherwise.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public boolean rowDeleted() throws SQLException;
@@ -1406,7 +1282,6 @@ public interface ResultSet {
* detected, {@code false} otherwise.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public boolean rowInserted() throws SQLException;
@@ -1418,7 +1293,6 @@ public interface ResultSet {
* can be detected, {@code false} otherwise.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public boolean rowUpdated() throws SQLException;
@@ -1432,7 +1306,6 @@ public interface ResultSet {
* ResultSet.FETCH_REVERSE}, or {@code ResultSet.FETCH_UNKNOWN}
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public void setFetchDirection(int direction) throws SQLException;
@@ -1449,7 +1322,6 @@ public interface ResultSet {
* ResultSet}.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void setFetchSize(int rows) throws SQLException;
@@ -1463,7 +1335,6 @@ public interface ResultSet {
* the new value for the specified column.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void updateArray(int columnIndex, Array x) throws SQLException;
@@ -1477,7 +1348,6 @@ public interface ResultSet {
* the new value for the specified column.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void updateArray(String columnName, Array x) throws SQLException;
@@ -1492,7 +1362,6 @@ public interface ResultSet {
* the length of the data to write from the stream
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void updateAsciiStream(int columnIndex, InputStream x, int length)
throws SQLException;
@@ -1508,7 +1377,6 @@ public interface ResultSet {
* the length of the data to write from the stream
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void updateAsciiStream(String columnName, InputStream x, int length)
throws SQLException;
@@ -1523,7 +1391,6 @@ public interface ResultSet {
* the new value for the specified column.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void updateBigDecimal(int columnIndex, BigDecimal x)
throws SQLException;
@@ -1538,7 +1405,6 @@ public interface ResultSet {
* the new value for the specified column.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void updateBigDecimal(String columnName, BigDecimal x)
throws SQLException;
@@ -1554,7 +1420,6 @@ public interface ResultSet {
* the number of bytes to be read from the the stream.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void updateBinaryStream(int columnIndex, InputStream x, int length)
throws SQLException;
@@ -1570,7 +1435,6 @@ public interface ResultSet {
* he number of bytes to be read from the the stream.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void updateBinaryStream(String columnName, InputStream x, int length)
throws SQLException;
@@ -1585,7 +1449,6 @@ public interface ResultSet {
* the new value for the specified column.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void updateBlob(int columnIndex, Blob x) throws SQLException;
@@ -1599,7 +1462,6 @@ public interface ResultSet {
* the new value for the specified column.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void updateBlob(String columnName, Blob x) throws SQLException;
@@ -1613,7 +1475,6 @@ public interface ResultSet {
* the new value for the specified column.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void updateBoolean(int columnIndex, boolean x) throws SQLException;
@@ -1626,7 +1487,6 @@ public interface ResultSet {
* the new value for the specified column.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void updateBoolean(String columnName, boolean x) throws SQLException;
@@ -1639,7 +1499,6 @@ public interface ResultSet {
* the new value for the specified column.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void updateByte(int columnIndex, byte x) throws SQLException;
@@ -1652,7 +1511,6 @@ public interface ResultSet {
* the new value for the specified column.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void updateByte(String columnName, byte x) throws SQLException;
@@ -1666,7 +1524,6 @@ public interface ResultSet {
* the new value for the specified column.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void updateBytes(int columnIndex, byte[] x) throws SQLException;
@@ -1679,7 +1536,6 @@ public interface ResultSet {
* the new value for the specified column.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void updateBytes(String columnName, byte[] x) throws SQLException;
@@ -1695,7 +1551,6 @@ public interface ResultSet {
* the length of data to write from the stream
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void updateCharacterStream(int columnIndex, Reader x, int length)
throws SQLException;
@@ -1712,7 +1567,6 @@ public interface ResultSet {
* the length of data to write from the Reader
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void updateCharacterStream(String columnName, Reader reader,
int length) throws SQLException;
@@ -1727,7 +1581,6 @@ public interface ResultSet {
* the new value for the specified column.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void updateClob(int columnIndex, Clob x) throws SQLException;
@@ -1741,7 +1594,6 @@ public interface ResultSet {
* the new value for the specified column.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void updateClob(String columnName, Clob x) throws SQLException;
@@ -1755,7 +1607,6 @@ public interface ResultSet {
* the new value for the specified column.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void updateDate(int columnIndex, Date x) throws SQLException;
@@ -1769,7 +1620,6 @@ public interface ResultSet {
* the new value for the specified column.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void updateDate(String columnName, Date x) throws SQLException;
@@ -1782,7 +1632,6 @@ public interface ResultSet {
* the new value for the specified column.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void updateDouble(int columnIndex, double x) throws SQLException;
@@ -1795,7 +1644,6 @@ public interface ResultSet {
* the new value for the specified column.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void updateDouble(String columnName, double x) throws SQLException;
@@ -1808,7 +1656,6 @@ public interface ResultSet {
* the new value for the specified column.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void updateFloat(int columnIndex, float x) throws SQLException;
@@ -1821,7 +1668,6 @@ public interface ResultSet {
* the new value for the specified column.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void updateFloat(String columnName, float x) throws SQLException;
@@ -1834,7 +1680,6 @@ public interface ResultSet {
* the new value for the specified column.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void updateInt(int columnIndex, int x) throws SQLException;
@@ -1847,7 +1692,6 @@ public interface ResultSet {
* the new value for the specified column.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void updateInt(String columnName, int x) throws SQLException;
@@ -1860,7 +1704,6 @@ public interface ResultSet {
* the new value for the specified column..
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void updateLong(int columnIndex, long x) throws SQLException;
@@ -1873,7 +1716,6 @@ public interface ResultSet {
* the new value for the specified column.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void updateLong(String columnName, long x) throws SQLException;
@@ -1884,7 +1726,6 @@ public interface ResultSet {
* the index of the column to update.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void updateNull(int columnIndex) throws SQLException;
@@ -1895,7 +1736,6 @@ public interface ResultSet {
* the name of the column to update.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void updateNull(String columnName) throws SQLException;
@@ -1909,7 +1749,6 @@ public interface ResultSet {
* the new value for the specified column.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void updateObject(int columnIndex, Object x) throws SQLException;
@@ -1927,7 +1766,6 @@ public interface ResultSet {
* after the decimal point.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void updateObject(int columnIndex, Object x, int scale)
throws SQLException;
@@ -1941,7 +1779,6 @@ public interface ResultSet {
* the new value for the specified column.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void updateObject(String columnName, Object x) throws SQLException;
@@ -1958,7 +1795,6 @@ public interface ResultSet {
* after the decimal point.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void updateObject(String columnName, Object x, int scale)
throws SQLException;
@@ -1973,7 +1809,6 @@ public interface ResultSet {
* the new value for the specified column.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void updateRef(int columnIndex, Ref x) throws SQLException;
@@ -1987,7 +1822,6 @@ public interface ResultSet {
* the new value for the specified column.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void updateRef(String columnName, Ref x) throws SQLException;
@@ -1997,7 +1831,6 @@ public interface ResultSet {
*
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void updateRow() throws SQLException;
@@ -2010,7 +1843,6 @@ public interface ResultSet {
* the new value for the specified column.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void updateShort(int columnIndex, short x) throws SQLException;
@@ -2023,7 +1855,6 @@ public interface ResultSet {
* the new value for the specified column.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void updateShort(String columnName, short x) throws SQLException;
@@ -2036,7 +1867,6 @@ public interface ResultSet {
* the new value for the specified column.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void updateString(int columnIndex, String x) throws SQLException;
@@ -2049,7 +1879,6 @@ public interface ResultSet {
* the new value for the specified column.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void updateString(String columnName, String x) throws SQLException;
@@ -2062,7 +1891,6 @@ public interface ResultSet {
* the new value for the specified column.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void updateTime(int columnIndex, Time x) throws SQLException;
@@ -2075,7 +1903,6 @@ public interface ResultSet {
* the new value for the specified column.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void updateTime(String columnName, Time x) throws SQLException;
@@ -2089,7 +1916,6 @@ public interface ResultSet {
* the new timestamp value for the specified column.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void updateTimestamp(int columnIndex, Timestamp x)
throws SQLException;
@@ -2103,7 +1929,6 @@ public interface ResultSet {
* the new timestamp value for the specified column.
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public void updateTimestamp(String columnName, Timestamp x)
throws SQLException;
@@ -2116,7 +1941,6 @@ public interface ResultSet {
* NULL}, {@code false} otherwise
* @throws SQLException
* if a database error happens.
- * @since Android 1.0
*/
public boolean wasNull() throws SQLException;
}
diff --git a/sql/src/main/java/java/sql/ResultSetMetaData.java b/sql/src/main/java/java/sql/ResultSetMetaData.java
index 95c515d..097093f 100644
--- a/sql/src/main/java/java/sql/ResultSetMetaData.java
+++ b/sql/src/main/java/java/sql/ResultSetMetaData.java
@@ -19,29 +19,21 @@ package java.sql;
/**
* Provides information about the columns returned in a {@code ResultSet}.
- *
- * @since Android 1.0
*/
public interface ResultSetMetaData {
/**
* Indicates that a column cannot contain {@code NULL} values.
- *
- * @since Android 1.0
*/
public static final int columnNoNulls = 0;
/**
* Indicates that a column can contain {@code NULL} values.
- *
- * @since Android 1.0
*/
public static final int columnNullable = 1;
/**
* Indicates that it is unknown whether a column can contain {@code NULL}s or not.
- *
- * @since Android 1.0
*/
public static final int columnNullableUnknown = 2;
@@ -53,7 +45,6 @@ public interface ResultSetMetaData {
* @return the catalog title.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public String getCatalogName(int column) throws SQLException;
@@ -67,7 +58,6 @@ public interface ResultSetMetaData {
* @throws SQLException
* if there is a database error.
* @see ResultSet#getObject
- * @since Android 1.0
*/
public String getColumnClassName(int column) throws SQLException;
@@ -77,7 +67,6 @@ public interface ResultSetMetaData {
* @return the column count.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public int getColumnCount() throws SQLException;
@@ -90,7 +79,6 @@ public interface ResultSetMetaData {
* @return the column's max width.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public int getColumnDisplaySize(int column) throws SQLException;
@@ -103,7 +91,6 @@ public interface ResultSetMetaData {
* @return the column's title.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public String getColumnLabel(int column) throws SQLException;
@@ -115,7 +102,6 @@ public interface ResultSetMetaData {
* @return the column title.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public String getColumnName(int column) throws SQLException;
@@ -128,7 +114,6 @@ public interface ResultSetMetaData {
* @throws SQLException
* if there is a database error.
* @see Types
- * @since Android 1.0
*/
public int getColumnType(int column) throws SQLException;
@@ -140,7 +125,6 @@ public interface ResultSetMetaData {
* @return the type name.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public String getColumnTypeName(int column) throws SQLException;
@@ -152,7 +136,6 @@ public interface ResultSetMetaData {
* @return the precision.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public int getPrecision(int column) throws SQLException;
@@ -165,7 +148,6 @@ public interface ResultSetMetaData {
* @return number of decimal places.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public int getScale(int column) throws SQLException;
@@ -177,7 +159,6 @@ public interface ResultSetMetaData {
* @return the name of the columns schema.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public String getSchemaName(int column) throws SQLException;
@@ -189,7 +170,6 @@ public interface ResultSetMetaData {
* @return the table title.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public String getTableName(int column) throws SQLException;
@@ -203,7 +183,6 @@ public interface ResultSetMetaData {
* otherwise.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public boolean isAutoIncrement(int column) throws SQLException;
@@ -216,7 +195,6 @@ public interface ResultSetMetaData {
* @return {@code true} if case matters, {@code false} otherwise.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public boolean isCaseSensitive(int column) throws SQLException;
@@ -228,7 +206,6 @@ public interface ResultSetMetaData {
* @return {@code true} if it is a monetary value, {@code false} otherwise.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public boolean isCurrency(int column) throws SQLException;
@@ -241,7 +218,6 @@ public interface ResultSetMetaData {
* @return {@code true} if the write is guaranteed, {@code false} otherwise.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public boolean isDefinitelyWritable(int column) throws SQLException;
@@ -253,7 +229,6 @@ public interface ResultSetMetaData {
* @return {@code true} if it is nullable, {@code false} otherwise.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public int isNullable(int column) throws SQLException;
@@ -266,7 +241,6 @@ public interface ResultSetMetaData {
* @return {@code true} if the column is read-only, {@code false} otherwise.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public boolean isReadOnly(int column) throws SQLException;
@@ -279,7 +253,6 @@ public interface ResultSetMetaData {
* otherwise.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public boolean isSearchable(int column) throws SQLException;
@@ -292,7 +265,6 @@ public interface ResultSetMetaData {
* @return {@code true} if they are signed, {@code false} otherwise.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public boolean isSigned(int column) throws SQLException;
@@ -305,7 +277,6 @@ public interface ResultSetMetaData {
* @return {@code true} if it is possible to write, {@code false} otherwise.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public boolean isWritable(int column) throws SQLException;
}
diff --git a/sql/src/main/java/java/sql/SQLData.java b/sql/src/main/java/java/sql/SQLData.java
index cae9d15..f7dba05 100644
--- a/sql/src/main/java/java/sql/SQLData.java
+++ b/sql/src/main/java/java/sql/SQLData.java
@@ -31,7 +31,7 @@ package java.sql;
* and can store changes back into the database using the
* {@link PreparedStatement#setObject} method which performs the reverse mapping
* into the SQL {@code UDT}.
- * </p>
+ * <p>
* Normally the implementation of a custom mapping is generated by
* a tool requiring the name of the SQL {@code UDT}, the name
* of the class which it is going to be mapped to, and the field names to which
@@ -44,9 +44,6 @@ package java.sql;
* Ordinarily an application would not call {@code SQLData} methods directly.
* Similarly {@code SQLInput} and {@code SQLOutput} methods are not usually
* called directly.
- * </p>
- *
- * @since Android 1.0
*/
public interface SQLData {
@@ -59,7 +56,6 @@ public interface SQLData {
* {@code readSQL} when the object was created.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public String getSQLTypeName() throws SQLException;
@@ -78,12 +74,10 @@ public interface SQLData {
* distinct, then read its only data entry. For structured types, read every
* entry.</li>
* </ul>
- * </p>
* <p>
* The supplied input stream is typically initialized by the calling JDBC
* driver with the type map before {@code readSQL} is called.
- * </p>
- *
+ *
* @param stream
* the {@code SQLInput} stream from which the type map data is
* read for the custom mapping.
@@ -92,7 +86,6 @@ public interface SQLData {
* @throws SQLException
* if a database error occurs.
* @see SQLInput
- * @since Android 1.0
*/
public void readSQL(SQLInput stream, String typeName) throws SQLException;
@@ -109,7 +102,6 @@ public interface SQLData {
* Write a single data element for a distinct type. For a structured type,
* write a value for each attribute of the the SQL type.</li>
* </ul>
- * </p>
*
* @param stream
* the {@code SQLOutput} stream to use to write out the data for
@@ -117,7 +109,6 @@ public interface SQLData {
* @throws SQLException
* if a database error occurs.
* @see SQLOutput
- * @since Android 1.0
*/
public void writeSQL(SQLOutput stream) throws SQLException;
}
diff --git a/sql/src/main/java/java/sql/SQLException.java b/sql/src/main/java/java/sql/SQLException.java
index 2cea139..5022eb0 100644
--- a/sql/src/main/java/java/sql/SQLException.java
+++ b/sql/src/main/java/java/sql/SQLException.java
@@ -38,11 +38,8 @@ import java.io.Serializable;
* <li>A chain to a next {@code Exception}, if relevant, which can give access
* to additional error information.</li>
* </ul>
- * </p>
*
* @see DatabaseMetaData
- *
- * @since Android 1.0
*/
public class SQLException extends Exception implements Serializable {
@@ -84,7 +81,6 @@ public class SQLException extends Exception implements Serializable {
* the string to use as the reason string.
* @param theSQLState
* the string to use as the {@code SQLState} string.
- * @since Android 1.0
*/
public SQLException(String theReason, String theSQLState) {
this(theReason, theSQLState, 0);
@@ -102,7 +98,6 @@ public class SQLException extends Exception implements Serializable {
* the string to use as the {@code SQLState} string.
* @param theErrorCode
* the integer value for the error code.
- * @since Android 1.0
*/
public SQLException(String theReason, String theSQLState, int theErrorCode) {
super(theReason);
@@ -115,7 +110,6 @@ public class SQLException extends Exception implements Serializable {
*
* @return The integer error code for this {@code SQLException}. The meaning
* of the code is specific to the vendor of the database.
- * @since Android 1.0
*/
public int getErrorCode() {
return vendorCode;
@@ -156,7 +150,6 @@ public class SQLException extends Exception implements Serializable {
* @param ex
* the new {@code SQLException} to be added to the end of the
* chain.
- * @since Android 1.0
*/
public void setNextException(SQLException ex) {
if (next != null) {
diff --git a/sql/src/main/java/java/sql/SQLInput.java b/sql/src/main/java/java/sql/SQLInput.java
index b72c839..cd77a91 100644
--- a/sql/src/main/java/java/sql/SQLInput.java
+++ b/sql/src/main/java/java/sql/SQLInput.java
@@ -32,7 +32,7 @@ import java.net.URL;
* application programmers do not normally use the {@code SQLInput} methods
* directly. Reader methods such as {@code readLong} and {@code readBytes}
* provide means to read values from an {@code SQLInput} stream.
- * </p><p>
+ * <p>
* When the {@code getObject} method is called with an object which implements
* the {@code SQLData} interface, the JDBC driver determines the SQL type of the
* UDT being mapped by calling the {@code SQLData.getSQLType} method. The driver
@@ -40,11 +40,8 @@ import java.net.URL;
* the attributes of the UDT. The {@code SQLInput} stream is passed to the
* {@code SQLData.readSQL} method which then calls the {@code SQLInput} reader
* methods to read the attributes.
- * </p>
- *
+ *
* @see SQLData
- *
- * @since Android 1.0
*/
public interface SQLInput {
@@ -55,7 +52,6 @@ public interface SQLInput {
*
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public String readString() throws SQLException;
@@ -67,7 +63,6 @@ public interface SQLInput {
* value is SQL {@code NULL}.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public boolean readBoolean() throws SQLException;
@@ -78,7 +73,6 @@ public interface SQLInput {
* {@code NULL}.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public byte readByte() throws SQLException;
@@ -89,7 +83,6 @@ public interface SQLInput {
* {@code NULL}.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public short readShort() throws SQLException;
@@ -100,7 +93,6 @@ public interface SQLInput {
* {@code NULL}.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public int readInt() throws SQLException;
@@ -111,7 +103,6 @@ public interface SQLInput {
* {@code NULL}.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public long readLong() throws SQLException;
@@ -122,7 +113,6 @@ public interface SQLInput {
* {@code NULL}.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public float readFloat() throws SQLException;
@@ -133,7 +123,6 @@ public interface SQLInput {
* {@code NULL}.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public double readDouble() throws SQLException;
@@ -146,7 +135,6 @@ public interface SQLInput {
* @throws SQLException
* if there is a database error.
* @see java.math.BigDecimal
- * @since Android 1.0
*/
public BigDecimal readBigDecimal() throws SQLException;
@@ -157,7 +145,6 @@ public interface SQLInput {
* SQL {@code NULL}.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public byte[] readBytes() throws SQLException;
@@ -170,7 +157,6 @@ public interface SQLInput {
* @throws SQLException
* if there is a database error.
* @see Date
- * @since Android 1.0
*/
public Date readDate() throws SQLException;
@@ -183,7 +169,6 @@ public interface SQLInput {
* @throws SQLException
* if there is a database error.
* @see Time
- * @since Android 1.0
*/
public Time readTime() throws SQLException;
@@ -196,7 +181,6 @@ public interface SQLInput {
* @throws SQLException
* if there is a database error.
* @see Timestamp
- * @since Android 1.0
*/
public Timestamp readTimestamp() throws SQLException;
@@ -209,7 +193,6 @@ public interface SQLInput {
* @throws SQLException
* if there is a database error.
* @see java.io.Reader
- * @since Android 1.0
*/
public Reader readCharacterStream() throws SQLException;
@@ -222,7 +205,6 @@ public interface SQLInput {
* @throws SQLException
* if there is a database error.
* @see java.io.InputStream
- * @since Android 1.0
*/
public InputStream readAsciiStream() throws SQLException;
@@ -235,7 +217,6 @@ public interface SQLInput {
* @throws SQLException
* if there is a database error.
* @see java.io.InputStream
- * @since Android 1.0
*/
public InputStream readBinaryStream() throws SQLException;
@@ -247,20 +228,17 @@ public interface SQLInput {
* for this JDBC driver, including any customized mappings, if present. A
* type map is given to the {@code SQLInput} by the JDBC driver before the
* {@code SQLInput} is given to the application.
- * </p>
* <p>
* If the attribute is an SQL structured or distinct type, its SQL type is
* determined. If the stream's type map contains an element for that SQL
* type, the driver creates an object for the relevant type and invokes the
* method {@code SQLData.readSQL} on it, which reads supplementary data from
* the stream using whichever protocol is defined for that method.
- * </p>
*
* @return the next attribute as an Object. {@code null} if the value is SQL
* {@code NULL}.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public Object readObject() throws SQLException;
@@ -273,7 +251,6 @@ public interface SQLInput {
* @throws SQLException
* if there is a database error.
* @see Ref
- * @since Android 1.0
*/
public Ref readRef() throws SQLException;
@@ -285,7 +262,6 @@ public interface SQLInput {
* the value is SQL {@code NULL}.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public Blob readBlob() throws SQLException;
@@ -298,7 +274,6 @@ public interface SQLInput {
* @throws SQLException
* if there is a database error.
* @see Clob
- * @since Android 1.0
*/
public Clob readClob() throws SQLException;
@@ -311,7 +286,6 @@ public interface SQLInput {
* @throws SQLException
* if there is a database error.
* @see Array
- * @since Android 1.0
*/
public Array readArray() throws SQLException;
@@ -322,7 +296,6 @@ public interface SQLInput {
* false} otherwise.
* @throws SQLException
* if there is a database error.
- * @since Android 1.0
*/
public boolean wasNull() throws SQLException;
@@ -335,7 +308,6 @@ public interface SQLInput {
* @throws SQLException
* if there is a database error.
* @see java.net.URL
- * @since Android 1.0
*/
public URL readURL() throws SQLException;
}
diff --git a/sql/src/main/java/java/sql/SQLOutput.java b/sql/src/main/java/java/sql/SQLOutput.java
index 9fded5e..6710d4f 100644
--- a/sql/src/main/java/java/sql/SQLOutput.java
+++ b/sql/src/main/java/java/sql/SQLOutput.java
@@ -35,11 +35,8 @@ import java.net.URL;
* the {@code SQLData.writeSQL} method, which in turn uses the appropriate
* {@code SQLOutput} writer methods to write the data from the {@code SQLData}
* object into the stream according to the defined mapping.
- * </p>
- *
+ *
* @see SQLData
- *
- * @since Android 1.0
*/
public interface SQLOutput {
@@ -50,7 +47,6 @@ public interface SQLOutput {
* the {@code String} to write.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public void writeString(String theString) throws SQLException;
@@ -61,7 +57,6 @@ public interface SQLOutput {
* the {@code boolean} value to write.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public void writeBoolean(boolean theFlag) throws SQLException;
@@ -72,7 +67,6 @@ public interface SQLOutput {
* the {@code byte} value to write.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public void writeByte(byte theByte) throws SQLException;
@@ -83,7 +77,6 @@ public interface SQLOutput {
* the {@code short} value to write.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public void writeShort(short theShort) throws SQLException;
@@ -94,7 +87,6 @@ public interface SQLOutput {
* the {@code int} value to write.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public void writeInt(int theInt) throws SQLException;
@@ -105,7 +97,6 @@ public interface SQLOutput {
* the {@code long} value to write.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public void writeLong(long theLong) throws SQLException;
@@ -116,7 +107,6 @@ public interface SQLOutput {
* the {@code float} value to write.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public void writeFloat(float theFloat) throws SQLException;
@@ -127,7 +117,6 @@ public interface SQLOutput {
* the {@code double} value to write.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public void writeDouble(double theDouble) throws SQLException;
@@ -138,7 +127,6 @@ public interface SQLOutput {
* the {@code BigDecimal} value to write.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public void writeBigDecimal(BigDecimal theBigDecimal) throws SQLException;
@@ -149,7 +137,6 @@ public interface SQLOutput {
* the array of bytes to write.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public void writeBytes(byte[] theBytes) throws SQLException;
@@ -161,7 +148,6 @@ public interface SQLOutput {
* @throws SQLException
* if a database error occurs.
* @see Date
- * @since Android 1.0
*/
public void writeDate(Date theDate) throws SQLException;
@@ -173,7 +159,6 @@ public interface SQLOutput {
* @throws SQLException
* if a database error occurs.
* @see Time
- * @since Android 1.0
*/
public void writeTime(Time theTime) throws SQLException;
@@ -185,7 +170,6 @@ public interface SQLOutput {
* @throws SQLException
* if a database error occurs.
* @see Timestamp
- * @since Android 1.0
*/
public void writeTimestamp(Timestamp theTimestamp) throws SQLException;
@@ -197,7 +181,6 @@ public interface SQLOutput {
* java.io.Reader} object.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public void writeCharacterStream(Reader theStream) throws SQLException;
@@ -209,7 +192,6 @@ public interface SQLOutput {
* java.io.InputStream} object
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public void writeAsciiStream(InputStream theStream) throws SQLException;
@@ -221,7 +203,6 @@ public interface SQLOutput {
* object
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public void writeBinaryStream(InputStream theStream) throws SQLException;
@@ -229,21 +210,18 @@ public interface SQLOutput {
* Write an {@code SQLData} object into the output stream.
* <p>
* If the {@code SQLData} object is null, writes {@code NULL} to the stream.
- * </p>
* <p>
* Otherwise, calls the {@code SQLData.writeSQL} method of the object, which
* writes the object's attributes to the stream by calling the appropriate
* SQLOutput writer methods for each attribute, in order. The order of the
* attributes is the order they are listed in the SQL definition of the User
* Defined Type.
- * </p>
*
* @param theObject
* the {@code SQLData} object to write.
* @throws SQLException
* if a database error occurs.
* @see SQLData
- * @since Android 1.0
*/
public void writeObject(SQLData theObject) throws SQLException;
@@ -255,7 +233,6 @@ public interface SQLOutput {
* @throws SQLException
* if a database error occurs.
* @see Ref
- * @since Android 1.0
*/
public void writeRef(Ref theRef) throws SQLException;
@@ -267,7 +244,6 @@ public interface SQLOutput {
* @throws SQLException
* if a database error occurs.
* @see Blob
- * @since Android 1.0
*/
public void writeBlob(Blob theBlob) throws SQLException;
@@ -279,7 +255,6 @@ public interface SQLOutput {
* @throws SQLException
* if a database error occurs.
* @see Clob
- * @since Android 1.0
*/
public void writeClob(Clob theClob) throws SQLException;
@@ -291,7 +266,6 @@ public interface SQLOutput {
* @throws SQLException
* if a database error occurs.
* @see Struct
- * @since Android 1.0
*/
public void writeStruct(Struct theStruct) throws SQLException;
@@ -303,7 +277,6 @@ public interface SQLOutput {
* @throws SQLException
* if a database error occurs.
* @see Array
- * @since Android 1.0
*/
public void writeArray(Array theArray) throws SQLException;
@@ -315,7 +288,6 @@ public interface SQLOutput {
* @throws SQLException
* if a database error occurs.
* @see java.net.URL
- * @since Android 1.0
*/
public void writeURL(URL theURL) throws SQLException;
}
diff --git a/sql/src/main/java/java/sql/SQLPermission.java b/sql/src/main/java/java/sql/SQLPermission.java
index a9f82d1..85dff72 100644
--- a/sql/src/main/java/java/sql/SQLPermission.java
+++ b/sql/src/main/java/java/sql/SQLPermission.java
@@ -31,11 +31,8 @@ import java.security.Guard;
* the {@code DriverManager.setLogStream} method. This is a potentially
* dangerous operation since the logging stream can contain sensitive
* information such as usernames and passwords.
- * </p>
*
* @see DriverManager
- *
- * @since Android 1.0
*/
public final class SQLPermission extends BasicPermission implements Guard,
Serializable {
diff --git a/sql/src/main/java/java/sql/SQLWarning.java b/sql/src/main/java/java/sql/SQLWarning.java
index de94da5..3ef67f5 100644
--- a/sql/src/main/java/java/sql/SQLWarning.java
+++ b/sql/src/main/java/java/sql/SQLWarning.java
@@ -23,8 +23,6 @@ import org.apache.harmony.sql.internal.nls.Messages;
/**
* An exception class that holds information about Database access warnings.
- *
- * @since Android 1.0
*/
public class SQLWarning extends SQLException implements Serializable {
@@ -34,8 +32,6 @@ public class SQLWarning extends SQLException implements Serializable {
* Creates an {@code SQLWarning} object. The reason string is set to {@code
* null}, the {@code SQLState} string is set to {@code null} and the error
* code is set to 0.
- *
- * @since Android 1.0
*/
public SQLWarning() {
super();
@@ -48,7 +44,6 @@ public class SQLWarning extends SQLException implements Serializable {
*
* @param theReason
* the reason why this warning is issued.
- * @since Android 1.0
*/
public SQLWarning(String theReason) {
super(theReason);
@@ -80,7 +75,6 @@ public class SQLWarning extends SQLException implements Serializable {
* the X/Open standard specifc error code.
* @param theErrorCode
* a vendor specific error code.
- * @since Android 1.0
*/
public SQLWarning(String theReason, String theSQLState, int theErrorCode) {
super(theReason, theSQLState, theErrorCode);
@@ -92,7 +86,6 @@ public class SQLWarning extends SQLException implements Serializable {
* @return the {@code SQLWarning} chained to this {@code SQLWarning}.
* {@code null} if no {@code SQLWarning} is chained to this {@code
* SQLWarning}.
- * @since Android 1.0
*/
public SQLWarning getNextWarning() {
SQLException next = super.getNextException();
@@ -110,7 +103,6 @@ public class SQLWarning extends SQLException implements Serializable {
*
* @param w
* the {@code SQLWarning} linked to this {@code SQLWarning}.
- * @since Android 1.0
*/
public void setNextWarning(SQLWarning w) {
super.setNextException(w);
diff --git a/sql/src/main/java/java/sql/Savepoint.java b/sql/src/main/java/java/sql/Savepoint.java
index 42b4a17..0c65515 100644
--- a/sql/src/main/java/java/sql/Savepoint.java
+++ b/sql/src/main/java/java/sql/Savepoint.java
@@ -22,8 +22,6 @@ package java.sql;
* by a rollback via the {@link Connection#rollback} command. Rolling back to a
* particular savepoint means that all changes that occurred after that
* savepoint are undone.
- *
- * @since Android 1.0
*/
public interface Savepoint {
@@ -33,7 +31,6 @@ public interface Savepoint {
* @return the ID for this savepoint.
* @throws SQLException
* if an error occurrs accessing the database.
- * @since Android 1.0
*/
public int getSavepointId() throws SQLException;
@@ -43,7 +40,6 @@ public interface Savepoint {
* @return the name of this savepoint.
* @throws SQLException
* if an error occurrs accessing the database.
- * @since Android 1.0
*/
public String getSavepointName() throws SQLException;
}
diff --git a/sql/src/main/java/java/sql/Statement.java b/sql/src/main/java/java/sql/Statement.java
index 4985a9e..6f2a1ed 100644
--- a/sql/src/main/java/java/sql/Statement.java
+++ b/sql/src/main/java/java/sql/Statement.java
@@ -27,70 +27,52 @@ package java.sql;
* <p>
* To have multiple {@code ResultSet} objects opened concurrently, multiple
* {@code Statement} objects must be created and then executed.
- * </p>
* <p>
* To obtain such an executable statement one needs to invoke {@code
* Connection#createStatement}.
- * </p>
- *
+ *
* @see ResultSet
* @see Connection#createStatement
- *
- * @since Android 1.0
*/
public interface Statement {
/**
* Passing this constant to {@link #getMoreResults} implies that all {@code
* ResultSet} objects previously kept open should be closed.
- *
- * @since Android 1.0
*/
public static final int CLOSE_ALL_RESULTS = 3;
/**
* Passing this constant to {@link #getMoreResults} implies that the current
* {@code ResultSet} object should be closed.
- *
- * @since Android 1.0
*/
public static final int CLOSE_CURRENT_RESULT = 1;
/**
* Indicates that an error was encountered during execution of a batch
* statement.
- *
- * @since Android 1.0
*/
public static final int EXECUTE_FAILED = -3;
/**
* Passing this constant to <i>getMoreResults</i> implies that the current
* {@code ResultSet} object should not be closed.
- *
- * @since Android 1.0
*/
public static final int KEEP_CURRENT_RESULT = 2;
/**
* Indicates that generated keys should not be accessible for retrieval.
- *
- * @since Android 1.0
*/
public static final int NO_GENERATED_KEYS = 2;
/**
* Indicates that generated keys should be accessible for retrieval.
- *
- * @since Android 1.0
*/
public static final int RETURN_GENERATED_KEYS = 1;
/**
* Indicates that a batch statement was executed with a successful result,
* but a count of the number of rows it affected is unavailable.
- *
- * @since Android 1.0
*/
public static final int SUCCESS_NO_INFO = -2;
@@ -100,15 +82,13 @@ public interface Statement {
* <p>
* The list of commands is executed by invoking the {@code executeBatch}
* method.
- * </p>
- *
+ *
* @param sql
* the SQL command as a String. Typically an {@code INSERT} or
* {@code UPDATE} statement.
* @throws SQLException
* if an error occurs accessing the database or the database
* does not support batch updates.
- * @since Android 1.0
*/
public void addBatch(String sql) throws SQLException;
@@ -120,7 +100,6 @@ public interface Statement {
*
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public void cancel() throws SQLException;
@@ -130,7 +109,6 @@ public interface Statement {
* @throws SQLException
* if an error occurs accessing the database or the database
* does not support batch updates.
- * @since Android 1.0
*/
public void clearBatch() throws SQLException;
@@ -139,7 +117,6 @@ public interface Statement {
*
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public void clearWarnings() throws SQLException;
@@ -148,13 +125,11 @@ public interface Statement {
* <p>
* Using this method to release these resources as soon as possible is
* strongly recommended.
- * </p>
* <p>
* One should not rely on the resources being automatically released when
* finalized during garbage collection. Doing so can result in unpredictable
* behavior for the application.
- * </p>
- *
+ *
* @throws SQLException
* if an error occurs accessing the database.
*/
@@ -166,8 +141,7 @@ public interface Statement {
* <p>
* Use the {@code getResultSet} or {@code getUpdateCount} methods to get the
* first result and {@code getMoreResults} to get any subsequent results.
- * </p>
- *
+ *
* @param sql
* the SQL statement to execute
* @return {@code true} if the first result is a {@code ResultSet}, {@code
@@ -175,7 +149,6 @@ public interface Statement {
* result.
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public boolean execute(String sql) throws SQLException;
@@ -187,8 +160,7 @@ public interface Statement {
* <p>
* Use the {@code getResultSet} or {@code getUpdateCount} methods to get the
* first result and {@code getMoreResults} to get any subsequent results.
- * </p>
- *
+ *
* @param sql
* the SQL statement to execute.
* @param autoGeneratedKeys
@@ -201,7 +173,6 @@ public interface Statement {
* or if there is no result.
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public boolean execute(String sql, int autoGeneratedKeys)
throws SQLException;
@@ -214,8 +185,7 @@ public interface Statement {
* <p>
* Use the {@code getResultSet} or {@code getUpdateCount} methods to get the
* first result and {@code getMoreResults} to get any subsequent results.
- * </p>
- *
+ *
* @param sql
* the SQL statement to execute.
* @param columnIndexes
@@ -227,7 +197,6 @@ public interface Statement {
* result.
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public boolean execute(String sql, int[] columnIndexes) throws SQLException;
@@ -239,8 +208,7 @@ public interface Statement {
* <p>
* Use the {@code getResultSet} or {@code getUpdateCount} methods to get the
* first result and {@code getMoreResults} to get any subsequent results.
- * </p>
- *
+ *
* @param sql
* the SQL statement to execute.
* @param columnNames
@@ -252,7 +220,6 @@ public interface Statement {
* result
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public boolean execute(String sql, String[] columnNames)
throws SQLException;
@@ -300,7 +267,6 @@ public interface Statement {
* @throws SQLException
* if an error occurs accessing the database or if the statement
* produces anything other than a single {@code ResultSet}.
- * @since Android 1.0
*/
public ResultSet executeQuery(String sql) throws SQLException;
@@ -317,7 +283,6 @@ public interface Statement {
* @throws SQLException
* if an error occurs accessing the database or if the statement
* produces a {@code ResultSet}.
- * @since Android 1.0
*/
public int executeUpdate(String sql) throws SQLException;
@@ -339,7 +304,6 @@ public interface Statement {
* @throws SQLException
* if an error occurs accessing the database or if the statement
* produces a {@code ResultSet}.
- * @since Android 1.0
*/
public int executeUpdate(String sql, int autoGeneratedKeys)
throws SQLException;
@@ -360,7 +324,6 @@ public interface Statement {
* @throws SQLException
* if an error occurs accessing the database or if the statement
* produces a {@code ResultSet}.
- * @since Android 1.0
*/
public int executeUpdate(String sql, int[] columnIndexes)
throws SQLException;
@@ -381,7 +344,6 @@ public interface Statement {
* @throws SQLException
* if an error occurs accessing the database or if the statement
* produces a {@code ResultSet}.
- * @since Android 1.0
*/
public int executeUpdate(String sql, String[] columnNames)
throws SQLException;
@@ -393,7 +355,6 @@ public interface Statement {
* transmitted to the database.
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public Connection getConnection() throws SQLException;
@@ -408,7 +369,6 @@ public interface Statement {
* </ul>
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public int getFetchDirection() throws SQLException;
@@ -420,7 +380,6 @@ public interface Statement {
* statement.
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public int getFetchSize() throws SQLException;
@@ -431,7 +390,6 @@ public interface Statement {
* no keys are generated by this statement.
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public ResultSet getGeneratedKeys() throws SQLException;
@@ -447,7 +405,6 @@ public interface Statement {
* limit.
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public int getMaxFieldSize() throws SQLException;
@@ -460,7 +417,6 @@ public interface Statement {
* limit.
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public int getMaxRows() throws SQLException;
@@ -476,7 +432,6 @@ public interface Statement {
* return -1.
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public boolean getMoreResults() throws SQLException;
@@ -499,7 +454,6 @@ public interface Statement {
* will return -1.
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public boolean getMoreResults(int current) throws SQLException;
@@ -512,7 +466,6 @@ public interface Statement {
* there is no current timeout.
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public int getQueryTimeout() throws SQLException;
@@ -523,7 +476,6 @@ public interface Statement {
* result is an update count or if there are no more results.
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public ResultSet getResultSet() throws SQLException;
@@ -535,7 +487,6 @@ public interface Statement {
* ResultSet.CONCUR_UPDATABLE}.
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public int getResultSetConcurrency() throws SQLException;
@@ -547,7 +498,6 @@ public interface Statement {
* ResultSet.CLOSE_CURSORS_AT_COMMIT}
* @throws SQLException
* if there is an error while accessing the database.
- * @since Android 1.0
*/
public int getResultSetHoldability() throws SQLException;
@@ -563,7 +513,6 @@ public interface Statement {
* which is scrollable but is sensitive to changes made by others.
* @throws SQLException
* if there is an error accessing the database.
- * @since Android 1.0
*/
public int getResultSetType() throws SQLException;
@@ -575,7 +524,6 @@ public interface Statement {
* result is a {@code ResultSet} or if there are no more results.
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public int getUpdateCount() throws SQLException;
@@ -588,12 +536,10 @@ public interface Statement {
* Warnings associated with reads from the {@code ResultSet} returned from
* executing the statement will be attached to the {@code ResultSet}, not the
* statement object.
- * </p>
- *
+ *
* @return an SQLWarning, null if there are no warnings
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public SQLWarning getWarnings() throws SQLException;
@@ -602,19 +548,16 @@ public interface Statement {
* execute methods.
* <p>
* Cursor names must be unique within one Connection.
- * </p>
* <p>
* With the cursor name set, it can then be used in SQL positioned
* update or delete statements to determine the current row in a {@code
* ResultSet} generated from this statement. The positioned update or delete
* must be done with a different statement than this one.
- * </p>
- *
+ *
* @param name
* the Cursor name as a string,
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public void setCursorName(String name) throws SQLException;
@@ -625,14 +568,12 @@ public interface Statement {
* on an SQL statement before sending it for execution. This does not apply
* to {@link PreparedStatement}s since they are processed when created,
* before this method can be called.
- * </p>
- *
+ *
* @param enable
* {@code true} to set escape processing mode <i>on</i>, {@code
* false} to turn it <i>off</i>.
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public void setEscapeProcessing(boolean enable) throws SQLException;
@@ -666,7 +607,6 @@ public interface Statement {
* @throws SQLException
* if an error occurs accessing the database, or if the rows
* parameter is out of range.
- * @since Android 1.0
*/
public void setFetchSize(int rows) throws SQLException;
@@ -682,7 +622,6 @@ public interface Statement {
* @throws SQLException
* if an error occurs accessing the database or the {@code max}
* value is &lt; {@code 0}.
- * @since Android 1.0
*/
public void setMaxFieldSize(int max) throws SQLException;
@@ -696,7 +635,6 @@ public interface Statement {
* @throws SQLException
* if an error occurs accessing the database or if max < {@code
* 0}.
- * @since Android 1.0
*/
public void setMaxRows(int max) throws SQLException;
@@ -710,7 +648,6 @@ public interface Statement {
* @throws SQLException
* if an error occurs accessing the database or if seconds <
* {@code 0}.
- * @since Android 1.0
*/
public void setQueryTimeout(int seconds) throws SQLException;
}
diff --git a/sql/src/main/java/java/sql/Struct.java b/sql/src/main/java/java/sql/Struct.java
index 1167cdf..4d94d49 100644
--- a/sql/src/main/java/java/sql/Struct.java
+++ b/sql/src/main/java/java/sql/Struct.java
@@ -23,8 +23,6 @@ import java.util.Map;
* An interface which provides facilities for manipulating an SQL structured type
* as a Java object. The {@code Struct} object has a value for each attribute of the SQL structured
* type.
- *
- * @since Android 1.0
*/
public interface Struct {
@@ -35,7 +33,6 @@ public interface Struct {
* @return the fully qualified name of SQL structured type.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public String getSQLTypeName() throws SQLException;
@@ -49,7 +46,6 @@ public interface Struct {
* @return an {@code Object} array containing the ordered attributes.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public Object[] getAttributes() throws SQLException;
@@ -66,7 +62,6 @@ public interface Struct {
* @return an Object array containing the ordered attributes,.
* @throws SQLException
* if a database error occurs.
- * @since Android 1.0
*/
public Object[] getAttributes(Map<String, Class<?>> theMap)
throws SQLException;
diff --git a/sql/src/main/java/java/sql/Time.java b/sql/src/main/java/java/sql/Time.java
index 7fb28e1..d522ef8 100644
--- a/sql/src/main/java/java/sql/Time.java
+++ b/sql/src/main/java/java/sql/Time.java
@@ -17,14 +17,11 @@
package java.sql;
-import java.text.SimpleDateFormat;
import java.util.Date;
/**
* Java representation of an SQL {@code TIME} value. Provides utilities to
* format and parse the time's representation as a String in JDBC escape format.
- *
- * @since Android 1.0
*/
public class Time extends Date {
@@ -33,24 +30,22 @@ public class Time extends Date {
/**
* Constructs a {@code Time} object using the supplied values for <i>Hour</i>,
* <i>Minute</i> and <i>Second</i>. The <i>Year</i>, <i>Month</i> and
- * <i>Day</i> elements of the {@code Time} object are set to the date
+ * <i>Day</i> elements of the {@code Time} object are set to the date
* of the Epoch (January 1, 1970).
* <p>
* Any attempt to access the <i>Year</i>, <i>Month</i> or <i>Day</i>
* elements of a {@code Time} object will result in an {@code
* IllegalArgumentException}.
- * </p><p>
+ * <p>
* The result is undefined if any argument is out of bounds.
- * </p>
- *
- * @deprecated Please use the constructor {@link #Time(long)}.
+ *
+ * @deprecated Use the constructor {@link #Time(long)}.
* @param theHour
* a value in the range {@code [0,23]}.
* @param theMinute
* a value in the range {@code [0,59]}.
* @param theSecond
* a value in the range {@code [0,59]}.
- * @since Android 1.0
*/
@SuppressWarnings("deprecation")
@Deprecated
@@ -65,7 +60,6 @@ public class Time extends Date {
* @param theTime
* a {@code Time} specified in milliseconds since the
* <i>Epoch</i> (January 1st 1970, 00:00:00.000).
- * @since Android 1.0
*/
public Time(long theTime) {
super(theTime);
@@ -77,7 +71,6 @@ public class Time extends Date {
* @return does not return anything.
* @throws IllegalArgumentException
* if this method is called.
- * @since Android 1.0
*/
@SuppressWarnings("deprecation")
@Deprecated
@@ -92,7 +85,6 @@ public class Time extends Date {
* @return does not return anything.
* @throws IllegalArgumentException
* if this method is called.
- * @since Android 1.0
*/
@SuppressWarnings("deprecation")
@Deprecated
@@ -107,7 +99,6 @@ public class Time extends Date {
* @return does not return anything.
* @throws IllegalArgumentException
* if this method is called.
- * @since Android 1.0
*/
@SuppressWarnings("deprecation")
@Deprecated
@@ -122,7 +113,6 @@ public class Time extends Date {
* @return does not return anything.
* @throws IllegalArgumentException
* if this method is called.
- * @since Android 1.0
*/
@SuppressWarnings("deprecation")
@Deprecated
@@ -136,7 +126,6 @@ public class Time extends Date {
* {@code Time} object does not have a {@code Date} component.
* @throws IllegalArgumentException
* if this method is called.
- * @since Android 1.0
*/
@SuppressWarnings("deprecation")
@Deprecated
@@ -150,7 +139,6 @@ public class Time extends Date {
* {@code Time} object does not have a <i>Month</i> component.
* @throws IllegalArgumentException
* if this method is called.
- * @since Android 1.0
*/
@SuppressWarnings("deprecation")
@Deprecated
@@ -180,7 +168,6 @@ public class Time extends Date {
* A time value expressed as milliseconds since the <i>Epoch</i>.
* Negative values are milliseconds before the Epoch. The Epoch
* is January 1 1970, 00:00:00.000.
- * @since Android 1.0
*/
@Override
public void setTime(long time) {
@@ -193,12 +180,31 @@ public class Time extends Date {
*
* @return A String representing the {@code Time} value in JDBC escape
* format: {@code HH:mm:ss}
- * @since Android 1.0
*/
@Override
public String toString() {
- SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss"); //$NON-NLS-1$
- return dateFormat.format(this);
+ StringBuilder sb = new StringBuilder(8);
+
+ format(getHours(), 2, sb);
+ sb.append(':');
+ format(getMinutes(), 2, sb);
+ sb.append(':');
+ format(getSeconds(), 2, sb);
+
+ return sb.toString();
+ }
+
+ private static final String PADDING = "00"; //$NON-NLS-1$
+
+ /*
+ * Private method to format the time
+ */
+ private void format(int date, int digits, StringBuilder sb) {
+ String str = String.valueOf(date);
+ if (digits - str.length() > 0) {
+ sb.append(PADDING.substring(0, digits - str.length()));
+ }
+ sb.append(str);
}
/**
@@ -206,8 +212,7 @@ public class Time extends Date {
* JDBC escape format: {@code hh:mm:ss}.
* <p>
* An exception occurs if the input string does not comply with this format.
- * </p>
- *
+ *
* @param timeString
* A String representing the time value in JDBC escape format:
* {@code hh:mm:ss}.
@@ -215,7 +220,6 @@ public class Time extends Date {
* time.
* @throws IllegalArgumentException
* if the supplied time string is not in JDBC escape format.
- * @since Android 1.0
*/
public static Time valueOf(String timeString) {
if (timeString == null) {
@@ -223,18 +227,21 @@ public class Time extends Date {
}
int firstIndex = timeString.indexOf(':');
int secondIndex = timeString.indexOf(':', firstIndex + 1);
- // secondIndex == -1 means none or only one separator '-' has been found.
+ // secondIndex == -1 means none or only one separator '-' has been
+ // found.
// The string is separated into three parts by two separator characters,
// if the first or the third part is null string, we should throw
// IllegalArgumentException to follow RI
- if (secondIndex == -1|| firstIndex == 0 || secondIndex + 1 == timeString.length()) {
+ if (secondIndex == -1 || firstIndex == 0
+ || secondIndex + 1 == timeString.length()) {
throw new IllegalArgumentException();
}
// parse each part of the string
int hour = Integer.parseInt(timeString.substring(0, firstIndex));
- int minute = Integer.parseInt(timeString.substring(firstIndex + 1, secondIndex));
- int second = Integer.parseInt(timeString.substring(secondIndex + 1, timeString
- .length()));
+ int minute = Integer.parseInt(timeString.substring(firstIndex + 1,
+ secondIndex));
+ int second = Integer.parseInt(timeString.substring(secondIndex + 1,
+ timeString.length()));
return new Time(hour, minute, second);
}
}
diff --git a/sql/src/main/java/java/sql/Timestamp.java b/sql/src/main/java/java/sql/Timestamp.java
index b526fb3..f16d93a 100644
--- a/sql/src/main/java/java/sql/Timestamp.java
+++ b/sql/src/main/java/java/sql/Timestamp.java
@@ -17,10 +17,10 @@
package java.sql;
-import java.text.DecimalFormat;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.Date;
+import java.util.regex.Pattern;
import org.apache.harmony.sql.internal.nls.Messages;
@@ -32,18 +32,16 @@ import org.apache.harmony.sql.internal.nls.Messages;
* The {@code Timestamp} class consists of a regular date/time value, where only
* the integral seconds value is stored, plus a nanoseconds value where the
* fractional seconds are stored.
- * </p><p>
+ * <p>
* The addition of the nanosecond value field to the {@code Timestamp} object
* makes it significantly different from the {@code java.util.Date} object which
* it extends. Users should be aware that {@code Timestamp} objects are not
* interchangable with {@code java.util.Date} objects when used outside the
* confines of the {@code java.sql} package.
- * </p>
- *
+ *
* @see Date
* @see Time
* @see java.util.Date
- * @since Android 1.0
*/
public class Timestamp extends Date {
@@ -52,12 +50,15 @@ public class Timestamp extends Date {
// The nanoseconds time value of the Timestamp
private int nanos;
+ // The regex pattern of yyyy-mm-dd hh:mm:ss
+ private static final String TIME_FORMAT_REGEX = "[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}.*"; //$NON-NLS-1$
+
/**
* Returns a {@code Timestamp} corresponding to the time specified by the
* supplied values for <i>Year</i>, <i>Month</i>, <i>Date</i>, <i>Hour</i>,
* <i>Minutes</i>, <i>Seconds</i> and <i>Nanoseconds</i>.
- *
- * @deprecated Please use the constructor {@link #Timestamp(long)}.
+ *
+ * @deprecated Use the constructor {@link #Timestamp(long)}.
* @param theYear
* specified as the year minus 1900.
* @param theMonth
@@ -75,7 +76,6 @@ public class Timestamp extends Date {
* as an integer in the range [0,999'999'999]
* @throws IllegalArgumentException
* if any of the parameters is out of range.
- * @since Android 1.0
*/
@SuppressWarnings("deprecation")
@Deprecated
@@ -96,7 +96,6 @@ public class Timestamp extends Date {
* @param theTime
* a time value in the format of milliseconds since the Epoch
* (January 1 1970 00:00:00.000 GMT).
- * @since Android 1.0
*/
public Timestamp(long theTime) {
super(theTime);
@@ -104,7 +103,7 @@ public class Timestamp extends Date {
* Now set the time for this Timestamp object - which deals with the
* nanosecond value as well as the base time
*/
- this.setTime(theTime);
+ setTimeImpl(theTime);
}
/**
@@ -115,7 +114,6 @@ public class Timestamp extends Date {
* the timestamp to compare with this timestamp object.
* @return {@code true} if this {@code Timestamp} object is later than the
* supplied timestamp, {@code false} otherwise.
- * @since Android 1.0
*/
public boolean after(Timestamp theTimestamp) {
long thisTime = this.getTime();
@@ -148,7 +146,6 @@ public class Timestamp extends Date {
* the timestamp to compare with this {@code Timestamp} object.
* @return {@code true} if this {@code Timestamp} object is earlier than the
* supplied timestamp, {@code false} otherwise.
- * @since Android 1.0
*/
public boolean before(Timestamp theTimestamp) {
long thisTime = this.getTime();
@@ -195,7 +192,6 @@ public class Timestamp extends Date {
* </dd>
* @throws ClassCastException
* if the supplied object is not a {@code Timestamp} object.
- * @since Android 1.0
*/
@Override
public int compareTo(Date theObject) throws ClassCastException {
@@ -218,7 +214,6 @@ public class Timestamp extends Date {
* <li> {@code > 0}, if this {@code Timestamp} object is after the
* supplied {@code Timestamp}</li>
* </ul>
- * @since Android 1.0
*/
public int compareTo(Timestamp theTimestamp) {
int result = super.compareTo(theTimestamp);
@@ -245,7 +240,6 @@ public class Timestamp extends Date {
* supplied {@code Timestamp} object<br>{@code false} if the object
* is not a {@code Timestamp} object or if the object is a {@code
* Timestamp} but represents a different instant in time.
- * @since Android 1.0
*/
@Override
public boolean equals(Object theObject) {
@@ -263,7 +257,6 @@ public class Timestamp extends Date {
* passed as an {@code Object}.
* @return {@code true} if this {@code Timestamp} object is equal to the
* supplied {@code Timestamp} object, {@code false} otherwise.
- * @since Android 1.0
*/
public boolean equals(Timestamp theTimestamp) {
if (theTimestamp == null) {
@@ -278,7 +271,6 @@ public class Timestamp extends Date {
*
* @return The timestamp's nanosecond value, an integer between 0 and
* 999,999,999.
- * @since Android 1.0
*/
public int getNanos() {
return nanos;
@@ -288,10 +280,9 @@ public class Timestamp extends Date {
* Returns the time represented by this {@code Timestamp} object, as a long
* value containing the number of milliseconds since the Epoch (January 1
* 1970, 00:00:00.000 GMT).
- *
+ *
* @return the number of milliseconds that have passed since January 1 1970,
* 00:00:00.000 GMT.
- * @since Android 1.0
*/
@Override
public long getTime() {
@@ -302,13 +293,12 @@ public class Timestamp extends Date {
/**
* Sets the nanosecond value for this {@code Timestamp}.
- *
+ *
* @param n
* number of nanoseconds.
* @throws IllegalArgumentException
* if number of nanoseconds smaller than 0 or greater than
* 999,999,999.
- * @since Android 1.0
*/
public void setNanos(int n) throws IllegalArgumentException {
if ((n < 0) || (n > 999999999)) {
@@ -322,14 +312,17 @@ public class Timestamp extends Date {
* Sets the time represented by this {@code Timestamp} object to the
* supplied time, defined as the number of milliseconds since the Epoch
* (January 1 1970, 00:00:00.000 GMT).
- *
+ *
* @param theTime
* number of milliseconds since the Epoch (January 1 1970,
* 00:00:00.000 GMT).
- * @since Android 1.0
*/
@Override
public void setTime(long theTime) {
+ setTimeImpl(theTime);
+ }
+
+ private void setTimeImpl(long theTime) {
/*
* Deal with the nanoseconds value. The supplied time is in milliseconds -
* so we must extract the milliseconds value and multiply by 1000000 to
@@ -356,67 +349,47 @@ public class Timestamp extends Date {
*
* @return A string representing the instant defined by the {@code
* Timestamp}, in JDBC Timestamp escape format.
- * @since Android 1.0
*/
@SuppressWarnings("deprecation")
@Override
public String toString() {
- /*
- * Use a DecimalFormat to lay out the nanosecond value as a simple
- * string of 9 integers, with leading Zeros
- */
- DecimalFormat decimalFormat = new DecimalFormat("0"); //$NON-NLS-1$
- decimalFormat.setMinimumIntegerDigits(9);
- decimalFormat.setMaximumIntegerDigits(9);
- String theNanos = decimalFormat.format(nanos);
- theNanos = stripTrailingZeros(theNanos);
-
- String year = format((getYear() + 1900), 4);
- String month = format((getMonth() + 1), 2);
- String date = format(getDate(), 2);
- String hours = format(getHours(), 2);
- String minutes = format(getMinutes(), 2);
- String seconds = format(getSeconds(), 2);
-
- return year + '-' + month + '-' + date + ' ' + hours + ':' + minutes
- + ':' + seconds + '.' + theNanos;
- }
-
- /*
- * Private method to format the time
- */
- private String format(int date, int digits) {
- StringBuilder dateStringBuffer = new StringBuilder(String.valueOf(date));
- while (dateStringBuffer.length() < digits) {
- dateStringBuffer = dateStringBuffer.insert(0,'0');
+ StringBuilder sb = new StringBuilder(29);
+
+ format((getYear() + 1900), 4, sb);
+ sb.append('-');
+ format((getMonth() + 1), 2, sb);
+ sb.append('-');
+ format(getDate(), 2, sb);
+ sb.append(' ');
+ format(getHours(), 2, sb);
+ sb.append(':');
+ format(getMinutes(), 2, sb);
+ sb.append(':');
+ format(getSeconds(), 2, sb);
+ sb.append('.');
+ if (nanos == 0) {
+ sb.append('0');
+ } else {
+ format(nanos, 9, sb);
+ while (sb.charAt(sb.length() - 1) == '0') {
+ sb.setLength(sb.length() - 1);
+ }
}
- return dateStringBuffer.toString();
+
+ return sb.toString();
}
-
- /*
- * Private method to strip trailing '0' characters from a string. @param
- * inputString the starting string @return a string with the trailing zeros
- * stripped - will leave a single 0 at the beginning of the string
- */
- private String stripTrailingZeros(String inputString) {
- String finalString;
- int i;
- for (i = inputString.length(); i > 0; i--) {
- if (inputString.charAt(i - 1) != '0') {
- break;
- }
- /*
- * If the string has a 0 as its first character, return a string
- * with a single '0'
- */
- if (i == 1) {
- return "0"; //$NON-NLS-1$
- }
- }
+ private static final String PADDING = "000000000"; //$NON-NLS-1$
- finalString = inputString.substring(0, i);
- return finalString;
+ /*
+ * Private method to format the time
+ */
+ private void format(int date, int digits, StringBuilder sb) {
+ String str = String.valueOf(date);
+ if (digits - str.length() > 0) {
+ sb.append(PADDING.substring(0, digits - str.length()));
+ }
+ sb.append(str);
}
/**
@@ -431,7 +404,6 @@ public class Timestamp extends Date {
* supplied {@code String}.
* @throws IllegalArgumentException
* if the provided string is {@code null}.
- * @since Android 1.0
*/
public static Timestamp valueOf(String s) throws IllegalArgumentException {
if (s == null) {
@@ -439,6 +411,12 @@ public class Timestamp extends Date {
throw new IllegalArgumentException(Messages.getString("sql.3")); //$NON-NLS-1$
}
+ // omit trailing whitespaces
+ s = s.trim();
+ if (!Pattern.matches(TIME_FORMAT_REGEX, s)) {
+ throw new IllegalArgumentException(Messages.getString("sql.2")); //$NON-NLS-1$
+ }
+
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); //$NON-NLS-1$
ParsePosition pp = new ParsePosition(0);
@@ -495,7 +473,8 @@ public class Timestamp extends Date {
// Require the next character to be a "."
if (s.charAt(position) != '.') {
// sql.4=Bad input string format: expected '.' not {0}
- throw new NumberFormatException(Messages.getString("sql.4", s.charAt(position))); //$NON-NLS-1$
+ throw new NumberFormatException(Messages.getString(
+ "sql.4", s.charAt(position))); //$NON-NLS-1$
}
// Get the length of the number string - need to account for the '.'
int nanoLength = s.length() - position - 1;
diff --git a/sql/src/main/java/java/sql/Types.java b/sql/src/main/java/java/sql/Types.java
index 8ce0421..fed8671 100644
--- a/sql/src/main/java/java/sql/Types.java
+++ b/sql/src/main/java/java/sql/Types.java
@@ -21,8 +21,6 @@ package java.sql;
* A class which defines constants used to identify generic SQL types, also
* called JDBC types. The type constant values are equivalent to those defined
* by X/OPEN.
- *
- * @since Android 1.0
*/
public class Types {
@@ -35,141 +33,101 @@ public class Types {
/**
* The type code that identifies the SQL type {@code ARRAY}.
- *
- * @since Android 1.0
*/
public static final int ARRAY = 2003;
/**
* The type code that identifies the SQL type {@code BIGINT}.
- *
- * @since Android 1.0
*/
public static final int BIGINT = -5;
/**
* The type code that identifies the SQL type {@code BINARY}.
- *
- * @since Android 1.0
*/
public static final int BINARY = -2;
/**
* The type code that identifies the SQL type {@code BIT}.
- *
- * @since Android 1.0
*/
public static final int BIT = -7;
/**
* The type code that identifies the SQL type {@code BLOB}.
- *
- * @since Android 1.0
*/
public static final int BLOB = 2004;
/**
* The type code that identifies the SQL type {@code BOOLEAN}.
- *
- * @since Android 1.0
*/
public static final int BOOLEAN = 16;
/**
* The type code that identifies the SQL type {@code CHAR}.
- *
- * @since Android 1.0
*/
public static final int CHAR = 1;
/**
* The type code that identifies the SQL type {@code CLOB}.
- *
- * @since Android 1.0
*/
public static final int CLOB = 2005;
/**
* The type code that identifies the SQL type {@code DATALINK}.
- *
- * @since Android 1.0
*/
public static final int DATALINK = 70;
/**
* The type code that identifies the SQL type {@code DATE}.
- *
- * @since Android 1.0
*/
public static final int DATE = 91;
/**
* The type code that identifies the SQL type {@code DECIMAL}.
- *
- * @since Android 1.0
*/
public static final int DECIMAL = 3;
/**
* The type code that identifies the SQL type {@code DISTINCT}.
- *
- * @since Android 1.0
*/
public static final int DISTINCT = 2001;
/**
* The type code that identifies the SQL type {@code DOUBLE}.
- *
- * @since Android 1.0
*/
public static final int DOUBLE = 8;
/**
* The type code that identifies the SQL type {@code FLOAT}.
- *
- * @since Android 1.0
*/
public static final int FLOAT = 6;
/**
* The type code that identifies the SQL type {@code INTEGER}.
- *
- * @since Android 1.0
*/
public static final int INTEGER = 4;
/**
* The type code that identifies the SQL type {@code JAVA_OBJECT}.
- *
- * @since Android 1.0
*/
public static final int JAVA_OBJECT = 2000;
/**
* The type code that identifies the SQL type {@code LONGVARBINARY}.
- *
- * @since Android 1.0
*/
public static final int LONGVARBINARY = -4;
/**
* The type code that identifies the SQL type {@code LONGVARCHAR}.
- *
- * @since Android 1.0
*/
public static final int LONGVARCHAR = -1;
/**
* The type code that identifies the SQL type {@code NULL}.
- *
- * @since Android 1.0
*/
public static final int NULL = 0;
/**
* The type code that identifies the SQL type {@code NUMERIC}.
- *
- * @since Android 1.0
*/
public static final int NUMERIC = 2;
@@ -177,71 +135,51 @@ public class Types {
* The type code that identifies that the SQL type is database specific and
* is mapped to a Java object, accessed via the methods
* {@code getObject} and {@code setObject}.
- *
- * @since Android 1.0
*/
public static final int OTHER = 1111;
/**
* The type code that identifies the SQL type {@code REAL}.
- *
- * @since Android 1.0
*/
public static final int REAL = 7;
/**
* The type code that identifies the SQL type {@code REF}.
- *
- * @since Android 1.0
*/
public static final int REF = 2006;
/**
* The type code that identifies the SQL type {@code SMALLINT}.
- *
- * @since Android 1.0
*/
public static final int SMALLINT = 5;
/**
* The type code that identifies the SQL type {@code STRUCT}.
- *
- * @since Android 1.0
*/
public static final int STRUCT = 2002;
/**
* The type code that identifies the SQL type {@code TIME}.
- *
- * @since Android 1.0
*/
public static final int TIME = 92;
/**
* The type code that identifies the SQL type {@code TIMESTAMP}.
- *
- * @since Android 1.0
*/
public static final int TIMESTAMP = 93;
/**
* The type code that identifies the SQL type {@code TINYINT}.
- *
- * @since Android 1.0
*/
public static final int TINYINT = -6;
/**
* The type code that identifies the SQL type {@code VARBINARY}.
- *
- * @since Android 1.0
*/
public static final int VARBINARY = -3;
/**
* The type code that identifies the SQL type {@code VARCHAR}.
- *
- * @since Android 1.0
*/
public static final int VARCHAR = 12;
}
diff --git a/sql/src/main/java/javax/sql/ConnectionEvent.java b/sql/src/main/java/javax/sql/ConnectionEvent.java
index e07e7c1..cce8a78 100644
--- a/sql/src/main/java/javax/sql/ConnectionEvent.java
+++ b/sql/src/main/java/javax/sql/ConnectionEvent.java
@@ -25,23 +25,20 @@ import java.io.Serializable;
* Sent when specific events happen on a {@link PooledConnection} object. These
* events are a facility to report when an application closes the pooled
* connection or when an error occurs in the pooled connection.
- *
- * @since Android 1.0
*/
public class ConnectionEvent extends EventObject implements Serializable {
private static final long serialVersionUID = -4843217645290030002L;
- private SQLException theSQLException;
+ private SQLException ex;
/**
* Creates a connection event initialized with the supplied {@code
* PooledConnection} reporting that the application has closed the
* connection.
- *
+ *
* @param theConnection
* the connection for which this event is created.
- * @since Android 1.0
*/
public ConnectionEvent(PooledConnection theConnection) {
super(theConnection);
@@ -51,29 +48,27 @@ public class ConnectionEvent extends EventObject implements Serializable {
* Creates a {@code ConnectionEvent} initialized with the supplied {@code
* PooledConnection} and with the supplied {@code SQLException} indicating
* that an error has occurred within the {@code PooledConnection}.
- *
+ *
* @param theConnection
* the connection for which this event is created.
* @param theException
* information about the state of error that has occurred on the
* application side.
- * @since Android 1.0
*/
public ConnectionEvent(PooledConnection theConnection,
SQLException theException) {
super(theConnection);
- theSQLException = theException;
+ ex = theException;
}
/**
* Gets the {@code SQLException} which holds information about the error
* which occurred in the {@code PooledConnection}.
- *
+ *
* @return a {@code SQLException} containing information about the error.
* May be {@code null} if no error has occurred.
- * @since Android 1.0
*/
public SQLException getSQLException() {
- return theSQLException;
+ return ex;
}
}
diff --git a/sql/src/main/java/javax/sql/ConnectionEventListener.java b/sql/src/main/java/javax/sql/ConnectionEventListener.java
index 1333814..eec0d5b 100644
--- a/sql/src/main/java/javax/sql/ConnectionEventListener.java
+++ b/sql/src/main/java/javax/sql/ConnectionEventListener.java
@@ -27,13 +27,9 @@ import java.util.EventListener;
* to a {@code ConnectionEventListener} either when the application closes a
* connection it has been using or when a significant error occurs while the
* connection is being used.
- * </p>
* <p>
* The connection pool manager can return closed connections to the pool for
* later reuse. Connections experiencing an error should be discarded.
- * </p>
- *
- * @since Android 1.0
*/
public interface ConnectionEventListener extends EventListener {
@@ -44,7 +40,6 @@ public interface ConnectionEventListener extends EventListener {
* @param theEvent
* a {@code ConnectionEvent} containing details about the source
* of the event.
- * @since Android 1.0
*/
public void connectionClosed(ConnectionEvent theEvent);
@@ -57,7 +52,6 @@ public interface ConnectionEventListener extends EventListener {
* @param theEvent
* a {@code ConnectionEvent} containing details about the source
* of the event and the {@code SQLException} that has occurred.
- * @since Android 1.0
*/
public void connectionErrorOccurred(ConnectionEvent theEvent);
}
diff --git a/sql/src/main/java/javax/sql/ConnectionPoolDataSource.java b/sql/src/main/java/javax/sql/ConnectionPoolDataSource.java
index d73128b..379fde0 100644
--- a/sql/src/main/java/javax/sql/ConnectionPoolDataSource.java
+++ b/sql/src/main/java/javax/sql/ConnectionPoolDataSource.java
@@ -27,9 +27,6 @@ import java.io.PrintWriter;
* A class which implements the {@code ConnectionPoolDataSource} interface is
* typically registered with a JNDI naming service directory and is retrieved
* from there by name.
- * </p>
- *
- * @since Android 1.0
*/
public interface ConnectionPoolDataSource {
@@ -44,7 +41,6 @@ public interface ConnectionPoolDataSource {
* @return the login timeout value in seconds.
* @throws SQLException
* if there is a problem accessing the database.
- * @since Android 1.0
*/
public int getLoginTimeout() throws SQLException;
@@ -58,14 +54,12 @@ public interface ConnectionPoolDataSource {
* created is {@code null}. Note that the log writer for an {@code
* ConnectionPoolDataSource} is not the same as the log writer used by a
* {@code DriverManager}.
- * </p>
- *
+ *
* @return a {@code PrintWriter} which is the log writer for this {@code
* ConnectionPoolDataSource}. Can be {@code null}, in which case log
* writing is disabled for this {@code ConnectionPoolDataSource}.
* @throws SQLException
* if there is a problem accessing the database.
- * @since Android 1.0
*/
public PrintWriter getLogWriter() throws SQLException;
@@ -77,7 +71,6 @@ public interface ConnectionPoolDataSource {
* database.
* @throws SQLException
* if there is a problem accessing the database.
- * @since Android 1.0
*/
public PooledConnection getPooledConnection() throws SQLException;
@@ -94,7 +87,6 @@ public interface ConnectionPoolDataSource {
* to the database.
* @throws SQLException
* if there is a problem accessing the database.
- * @since Android 1.0
*/
public PooledConnection getPooledConnection(String theUser,
String thePassword) throws SQLException;
@@ -111,7 +103,6 @@ public interface ConnectionPoolDataSource {
* the new login timeout value in seconds.
* @throws SQLException
* if there is a problem accessing the database.
- * @since Android 1.0
*/
public void setLoginTimeout(int theTimeout) throws SQLException;
@@ -125,13 +116,11 @@ public interface ConnectionPoolDataSource {
* is {@code null}. Note that the log writer for a {@code
* ConnectionPoolDataSource} is not the same as the log writer used by a
* {@code DriverManager}.
- * </p>
*
* @param theWriter
* is the log writer for this {@code ConnectionPoolDataSource}.
* @throws SQLException
* if there is a problem accessing the database.
- * @since Android 1.0
*/
public void setLogWriter(PrintWriter theWriter) throws SQLException;
}
diff --git a/sql/src/main/java/javax/sql/DataSource.java b/sql/src/main/java/javax/sql/DataSource.java
index 98be761..7f73947 100644
--- a/sql/src/main/java/javax/sql/DataSource.java
+++ b/sql/src/main/java/javax/sql/DataSource.java
@@ -29,12 +29,10 @@ import java.io.PrintWriter;
* A class which implements the {@code DataSource} interface is typically
* registered with a JNDI naming service directory and is retrieved from there
* by name.
- * </p>
* <p>
* The {@code DataSource} interface is typically implemented by the writer of a
* JDBC driver. There are three variants of the {@code DataSource} interface,
* which produce connections with different characteristics:
- * </p>
* <ol>
* <li><i>Standard {@code DataSource}</i>: produces standard {@code Connection}
* objects with no special features.</li>
@@ -51,9 +49,6 @@ import java.io.PrintWriter;
* Note that a JDBC driver which is accessed via the {@code DataSource}
* interface is loaded via a JNDI lookup process. A driver loaded in this way
* does not register itself with the {@code DriverManager}.
- * </p>
- *
- * @since Android 1.0
*/
public interface DataSource {
@@ -65,7 +60,6 @@ public interface DataSource {
* database.
* @throws SQLException
* if there is a problem accessing the database.
- * @since Android 1.0
*/
public Connection getConnection() throws SQLException;
@@ -82,7 +76,6 @@ public interface DataSource {
* database.
* @throws SQLException
* if there is a problem accessing the database.
- * @since Android 1.0
*/
public Connection getConnection(String theUsername, String thePassword)
throws SQLException;
@@ -97,7 +90,6 @@ public interface DataSource {
* @return the login timeout value in seconds.
* @throws SQLException
* if there is a problem accessing the database.
- * @since Android 1.0
*/
public int getLoginTimeout() throws SQLException;
@@ -110,14 +102,12 @@ public interface DataSource {
* log writer when an {@code DataSource} is created is {@code null}. Note
* that the log writer for a {@code DataSource} is not the same as the log
* writer used by a {@code DriverManager}.
- * </p>
- *
+ *
* @return a {@code PrintWriter} which is the log writer for this {@code
* DataSource}. Can be {@code null}, in which case log writing is
* disabled for this {@code DataSource}.
* @throws SQLException
* if there is a problem accessing the database.
- * @since Android 1.0
*/
public PrintWriter getLogWriter() throws SQLException;
@@ -132,7 +122,6 @@ public interface DataSource {
* the new login timeout value in seconds.
* @throws SQLException
* if there is a problem accessing the database.
- * @since Android 1.0
*/
public void setLoginTimeout(int theTimeout) throws SQLException;
@@ -145,14 +134,12 @@ public interface DataSource {
* log writer when a {@code DataSource} is created is {@code null}. Note
* that the log writer for a {@code DataSource} is not the same as the log
* writer used by a {@code DriverManager}.
- * </p>
*
* @param theWriter
* a {@code PrintWriter} to use as the log writer for this
* {@code DataSource}.
* @throws SQLException
* if there is a problem accessing the database.
- * @since Android 1.0
*/
public void setLogWriter(PrintWriter theWriter) throws SQLException;
}
diff --git a/sql/src/main/java/javax/sql/PooledConnection.java b/sql/src/main/java/javax/sql/PooledConnection.java
index b4c5616..b268e0c 100644
--- a/sql/src/main/java/javax/sql/PooledConnection.java
+++ b/sql/src/main/java/javax/sql/PooledConnection.java
@@ -30,13 +30,11 @@ import java.sql.Connection;
* process both to establish a connection to a database and to destroy the
* connection. Reusing connections through a pool is a way of improving system
* performance and reducing overhead.
- * </p>
* <p>
* It is not intended that an application uses the {@code PooledConnection}
* interface directly. The {@code PooledConnection} interface is intended for
* use by a component called a connection pool manager, typically part of the
* infrastructure that supports use of the database by applications.
- * </p>
* <p>
* Applications obtain connections to the database by calling the
* {@link DataSource#getConnection} method. Behind the scenes, the connection
@@ -44,7 +42,6 @@ import java.sql.Connection;
* pool and passes back a connection object that wraps or references the {@code
* PooledConnection} object. A new {@code PooledConnection} object will only be
* created if the pool is empty.
- * </p>
* <p>
* When the application is finished using a {@code PooledConnection}, the
* application calls the {@link Connection#close} method. The connection pool
@@ -54,7 +51,6 @@ import java.sql.Connection;
* the underlying {@code PooledConnection} object from the connection and
* returns it to the pool for reuse - the {@code PooledConnection} is thus
* recycled rather than being destroyed.
- * </p>
* <p>
* The connection to the database represented by the {@code PooledConnection} is
* kept open until the {@code PooledConnection} object itself is deactivated by
@@ -62,9 +58,6 @@ import java.sql.Connection;
* This is typically done if there are too many inactive connections in the
* pool, if the {@code PooledConnection} encounters a problem that makes it
* unusable or if the whole system is being shut down.
- * </p>
- *
- * @since Android 1.0
*/
public interface PooledConnection {
@@ -77,7 +70,6 @@ public interface PooledConnection {
* @param theListener
* an object which implements the {@code ConnectionEventListener}
* interface.
- * @since Android 1.0
*/
public void addConnectionEventListener(ConnectionEventListener theListener);
@@ -89,7 +81,6 @@ public interface PooledConnection {
*
* @throws SQLException
* if there is a problem accessing the database.
- * @since Android 1.0
*/
public void close() throws SQLException;
@@ -102,7 +93,6 @@ public interface PooledConnection {
* @return a {@code Connection} object.
* @throws SQLException
* if there is a problem accessing the database.
- * @since Android 1.0
*/
public Connection getConnection() throws SQLException;
@@ -116,7 +106,6 @@ public interface PooledConnection {
* interface. This object should have previously been registered
* with the {@code PooledConnection} using the {@code
* addConnectionEventListener} method.
- * @since Android 1.0
*/
public void removeConnectionEventListener(
ConnectionEventListener theListener);
diff --git a/sql/src/main/java/javax/sql/RowSet.java b/sql/src/main/java/javax/sql/RowSet.java
index 4edc3d3..77321a2 100644
--- a/sql/src/main/java/javax/sql/RowSet.java
+++ b/sql/src/main/java/javax/sql/RowSet.java
@@ -43,14 +43,12 @@ import java.math.BigDecimal;
* distinct data values which constitute the row set. The {@code RowSet} class
* supports JavaBean events so that other components in an application can be
* informed when changes happen such as changes in data values.
- * </p>
* <p>
* {@code RowSet} is a facility implemented on top of the remainder of the JDBC
* API. It may be <i>connected</i>, maintaining a connection to the database
* throughout its lifecycle. The changes made on a <i>disconnected</i> {@code
* RowSet} on the other hand can be persisted only establishing a new connection
* with the database each time.
- * </p>
* <p>
* Disconnected {@code RowSets} make use of {@code RowSetReaders} to populate
* the {@code RowSet} with data, possibly from a non-relational database source.
@@ -58,11 +56,9 @@ import java.math.BigDecimal;
* data store. There is considerable freedom in the way that {@code
* RowSetReaders} and {@code RowSetWriters} may be implemented to retrieve and
* store data.
- * </p>
- *
+ *
* @see RowSetReader
* @see RowSetWriter
- * @since Android 1.0
*/
public interface RowSet extends ResultSet {
@@ -74,7 +70,6 @@ public interface RowSet extends ResultSet {
* @param theListener
* an object which implements the {@code rowSetListener}
* interface.
- * @since Android 1.0
*/
public void addRowSetListener(RowSetListener theListener);
@@ -85,11 +80,9 @@ public interface RowSet extends ResultSet {
* a parameter is set or its value is actively reset. {@code
* clearParameters} provides a facility to clear the values for all
* parameters with one method call.
- * </p>
- *
+ *
* @throws SQLException
* if a problem occurs accessing the database.
- * @since Android 1.0
*/
public void clearParameters() throws SQLException;
@@ -104,20 +97,17 @@ public interface RowSet extends ResultSet {
* transaction isolation, type map; plus some or all of the properties:
* command, read only, maximum field size, maximum rows, escape processing,
* and query timeout.
- * </p>
* <p>
* The {@code RowSet} may use a {@code RowSetReader} to access the database
* it will then invoke the {@link RowSetReader#readData} method on the
* reader to fetch the data. When the new data is fetched all the listeners
* are notified to take appropriate measures.
- * </p>
- *
+ *
* @throws SQLException
* if a problem occurs accessing the database or if the
* properties needed to access the database have not been set.
* @see RowSetMetaData
* @see RowSetReader
- * @since Android 1.0
*/
public void execute() throws SQLException;
@@ -127,7 +117,6 @@ public interface RowSet extends ResultSet {
* @return a string containing the {@code RowSet}'s command property. A
* command is a SQL statement which is executed to fetch required
* data into the {@code RowSet}.
- * @since Android 1.0
*/
public String getCommand();
@@ -138,7 +127,6 @@ public interface RowSet extends ResultSet {
* can then be used to create a connection to the database.
*
* @return the name of the database.
- * @since Android 1.0
*/
public String getDataSourceName();
@@ -152,7 +140,6 @@ public interface RowSet extends ResultSet {
* false} otherwise.
* @throws SQLException
* if a problem occurs accessing the database.
- * @since Android 1.0
*/
public boolean getEscapeProcessing() throws SQLException;
@@ -166,7 +153,6 @@ public interface RowSet extends ResultSet {
* @return the current maximum size in bytes. 0 implies no size limit.
* @throws SQLException
* if a problem occurs accessing the database.
- * @since Android 1.0
*/
public int getMaxFieldSize() throws SQLException;
@@ -177,7 +163,6 @@ public interface RowSet extends ResultSet {
* @return the previous maximum number of rows. 0 implies no row limit.
* @throws SQLException
* if a problem occurs accessing the database.
- * @since Android 1.0
*/
public int getMaxRows() throws SQLException;
@@ -187,7 +172,6 @@ public interface RowSet extends ResultSet {
* Therefore it should be set prior to invoking the {@link #execute} method.
*
* @return the value of the password property.
- * @since Android 1.0
*/
public String getPassword();
@@ -199,7 +183,6 @@ public interface RowSet extends ResultSet {
* @return the timeout value in seconds.
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public int getQueryTimeout() throws SQLException;
@@ -217,7 +200,6 @@ public interface RowSet extends ResultSet {
* <li>{@code Connection.TRANSACTION_SERIALIZABLE}</li>
* </ul>
* @see java.sql.Connection
- * @since Android 1.0
*/
public int getTransactionIsolation();
@@ -228,7 +210,6 @@ public interface RowSet extends ResultSet {
* @return the custom mappings of SQL types to Java classes.
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public Map<String, Class<?>> getTypeMap() throws SQLException;
@@ -241,7 +222,6 @@ public interface RowSet extends ResultSet {
* @return a String holding the value of the URL property.
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public String getUrl() throws SQLException;
@@ -252,7 +232,6 @@ public interface RowSet extends ResultSet {
*
* @return a {@code String} holding the value of the {@code username}
* property.
- * @since Android 1.0
*/
public String getUsername();
@@ -261,7 +240,6 @@ public interface RowSet extends ResultSet {
*
* @return {@code true} if this {@code RowSet} is read-only, {@code false}
* if it is updatable.
- * @since Android 1.0
*/
public boolean isReadOnly();
@@ -272,7 +250,6 @@ public interface RowSet extends ResultSet {
* @param theListener
* the {@link RowSetListener} to remove from the set of listeners
* for this {@code RowSet}.
- * @since Android 1.0
*/
public void removeRowSetListener(RowSetListener theListener);
@@ -287,7 +264,6 @@ public interface RowSet extends ResultSet {
* the {@code Array} data value to which the parameter is set.
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public void setArray(int parameterIndex, Array theArray)
throws SQLException;
@@ -306,7 +282,6 @@ public interface RowSet extends ResultSet {
* the length of the data in bytes.
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public void setAsciiStream(int parameterIndex, InputStream theInputStream,
int length) throws SQLException;
@@ -323,7 +298,6 @@ public interface RowSet extends ResultSet {
* the big decimal value to which the parameter is set.
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public void setBigDecimal(int parameterIndex, BigDecimal theBigDecimal)
throws SQLException;
@@ -342,7 +316,6 @@ public interface RowSet extends ResultSet {
* the length of the data in bytes.
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public void setBinaryStream(int parameterIndex, InputStream theInputStream,
int length) throws SQLException;
@@ -358,7 +331,6 @@ public interface RowSet extends ResultSet {
* the {@code Blob} value to which the parameter is set.
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public void setBlob(int parameterIndex, Blob theBlob) throws SQLException;
@@ -373,7 +345,6 @@ public interface RowSet extends ResultSet {
* the {@code boolean} value to which the parameter is set.
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public void setBoolean(int parameterIndex, boolean theBoolean)
throws SQLException;
@@ -389,7 +360,6 @@ public interface RowSet extends ResultSet {
* the {@code byte} value to which the parameter is set.
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public void setByte(int parameterIndex, byte theByte) throws SQLException;
@@ -404,7 +374,6 @@ public interface RowSet extends ResultSet {
* the {@code Array} of {@code bytes} to which the parameter is set.
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public void setBytes(int parameterIndex, byte[] theByteArray)
throws SQLException;
@@ -424,7 +393,6 @@ public interface RowSet extends ResultSet {
* the length of the data in the {@code Reader} in characters.
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public void setCharacterStream(int parameterIndex, Reader theReader,
int length) throws SQLException;
@@ -440,7 +408,6 @@ public interface RowSet extends ResultSet {
* the {@code Clob} value to which the parameter is set.
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public void setClob(int parameterIndex, Clob theClob) throws SQLException;
@@ -453,7 +420,6 @@ public interface RowSet extends ResultSet {
* the SQL query. Can be {@code null}.
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public void setCommand(String cmd) throws SQLException;
@@ -470,7 +436,6 @@ public interface RowSet extends ResultSet {
* @throws SQLException
* if an error occurs accessing the database.
* @see java.sql.ResultSet
- * @since Android 1.0
*/
public void setConcurrency(int concurrency) throws SQLException;
@@ -480,13 +445,11 @@ public interface RowSet extends ResultSet {
* The database name can be used to find a {@link DataSource} which has been
* registered with a naming service - the {@link DataSource} can then be
* used to create a connection to the database.
- * </p>
- *
+ *
* @param name
* the database name.
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public void setDataSourceName(String name) throws SQLException;
@@ -501,7 +464,6 @@ public interface RowSet extends ResultSet {
* the date value to which the parameter is set.
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public void setDate(int parameterIndex, Date theDate) throws SQLException;
@@ -521,7 +483,6 @@ public interface RowSet extends ResultSet {
* {@code DATE} value.
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public void setDate(int parameterIndex, Date theDate, Calendar theCalendar)
throws SQLException;
@@ -537,7 +498,6 @@ public interface RowSet extends ResultSet {
* the {@code double} value to which the parameter is set.
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public void setDouble(int parameterIndex, double theDouble)
throws SQLException;
@@ -553,7 +513,6 @@ public interface RowSet extends ResultSet {
* turn it off.
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public void setEscapeProcessing(boolean enable) throws SQLException;
@@ -568,7 +527,6 @@ public interface RowSet extends ResultSet {
* the {@code float} value to which the parameter is set.
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public void setFloat(int parameterIndex, float theFloat)
throws SQLException;
@@ -584,7 +542,6 @@ public interface RowSet extends ResultSet {
* the {@code integer} value to which the parameter is set.
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public void setInt(int parameterIndex, int theInteger) throws SQLException;
@@ -599,7 +556,6 @@ public interface RowSet extends ResultSet {
* the {@code long} value value to which the parameter is set.
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public void setLong(int parameterIndex, long theLong) throws SQLException;
@@ -615,7 +571,6 @@ public interface RowSet extends ResultSet {
* implies no size limit.
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public void setMaxFieldSize(int max) throws SQLException;
@@ -628,7 +583,6 @@ public interface RowSet extends ResultSet {
* RowSet}. 0 means no limit.
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public void setMaxRows(int max) throws SQLException;
@@ -644,7 +598,6 @@ public interface RowSet extends ResultSet {
* java.sql.Types}.
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public void setNull(int parameterIndex, int sqlType) throws SQLException;
@@ -665,7 +618,6 @@ public interface RowSet extends ResultSet {
* type. Ignored if the sqlType is not a UDT or REF type.
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public void setNull(int parameterIndex, int sqlType, String typeName)
throws SQLException;
@@ -677,8 +629,7 @@ public interface RowSet extends ResultSet {
* The JDBC specification provides a standard mapping for Java objects to
* SQL data types. Database specific types can be mapped by JDBC driver
* specific Java types.
- * </p>
- *
+ *
* @param parameterIndex
* the index of the parameter to set; the first parameter's index
* is 1.
@@ -687,7 +638,6 @@ public interface RowSet extends ResultSet {
* parameter is set.
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public void setObject(int parameterIndex, Object theObject)
throws SQLException;
@@ -706,7 +656,6 @@ public interface RowSet extends ResultSet {
* java.sql.Types}.
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public void setObject(int parameterIndex, Object theObject,
int targetSqlType) throws SQLException;
@@ -729,7 +678,6 @@ public interface RowSet extends ResultSet {
* types. Ignored for all other types.
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public void setObject(int parameterIndex, Object theObject,
int targetSqlType, int scale) throws SQLException;
@@ -743,7 +691,6 @@ public interface RowSet extends ResultSet {
* a {@code String} holding the password.
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public void setPassword(String password) throws SQLException;
@@ -755,7 +702,6 @@ public interface RowSet extends ResultSet {
* the number of seconds for the timeout.
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public void setQueryTimeout(int seconds) throws SQLException;
@@ -767,7 +713,6 @@ public interface RowSet extends ResultSet {
* {@code false} to allow updates.
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public void setReadOnly(boolean readOnly) throws SQLException;
@@ -784,7 +729,6 @@ public interface RowSet extends ResultSet {
* @throws SQLException
* if an error occurs accessing the database.
* @see java.sql.Ref
- * @since Android 1.0
*/
public void setRef(int parameterIndex, Ref theRef) throws SQLException;
@@ -799,7 +743,6 @@ public interface RowSet extends ResultSet {
* the value to which the parameter is set.
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public void setShort(int parameterIndex, short theShort)
throws SQLException;
@@ -817,7 +760,6 @@ public interface RowSet extends ResultSet {
* the value to which the parameter is set.
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public void setString(int parameterIndex, String theString)
throws SQLException;
@@ -836,7 +778,6 @@ public interface RowSet extends ResultSet {
* if an error occurs accessing the database.
* @see java.util.Calendar
* @see java.sql.Time
- * @since Android 1.0
*/
public void setTime(int parameterIndex, Time theTime) throws SQLException;
@@ -856,7 +797,6 @@ public interface RowSet extends ResultSet {
* if an error occurs accessing the database.
* @see java.util.Calendar
* @see java.sql.Time
- * @since Android 1.0
*/
public void setTime(int parameterIndex, Time theTime, Calendar theCalendar)
throws SQLException;
@@ -875,7 +815,6 @@ public interface RowSet extends ResultSet {
* if an error occurs accessing the database.
* @see java.util.Calendar
* @see java.sql.Timestamp
- * @since Android 1.0
*/
public void setTimestamp(int parameterIndex, Timestamp theTimestamp)
throws SQLException;
@@ -896,7 +835,6 @@ public interface RowSet extends ResultSet {
* if an error occurs accessing the database.
* @see java.util.Calendar
* @see java.sql.Timestamp
- * @since Android 1.0
*/
public void setTimestamp(int parameterIndex, Timestamp theTimestamp,
Calendar theCalendar) throws SQLException;
@@ -909,8 +847,7 @@ public interface RowSet extends ResultSet {
* <p>
* Keep in mind that setting a transaction isolation level has no effect
* unless your driver and DBMS support it.
- * </p>
- *
+ *
* @param level
* the transaction isolation level. One of:
* <ul>
@@ -922,7 +859,6 @@ public interface RowSet extends ResultSet {
* @throws SQLException
* if an error occurs accessing the database.
* @see java.sql.Connection
- * @since Android 1.0
*/
public void setTransactionIsolation(int level) throws SQLException;
@@ -939,7 +875,6 @@ public interface RowSet extends ResultSet {
* </ul>
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public void setType(int type) throws SQLException;
@@ -953,7 +888,6 @@ public interface RowSet extends ResultSet {
* mapped.
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public void setTypeMap(Map<String, Class<?>> theTypeMap)
throws SQLException;
@@ -967,7 +901,6 @@ public interface RowSet extends ResultSet {
* the URL for the database. Can be {@code null}.
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public void setUrl(String theURL) throws SQLException;
@@ -979,7 +912,6 @@ public interface RowSet extends ResultSet {
* the new user name for this row set.
* @throws SQLException
* if an error occurs accessing the database.
- * @since Android 1.0
*/
public void setUsername(String theUsername) throws SQLException;
}
diff --git a/sql/src/main/java/javax/sql/RowSetEvent.java b/sql/src/main/java/javax/sql/RowSetEvent.java
index 9d4c98c..d18e9ce 100644
--- a/sql/src/main/java/javax/sql/RowSetEvent.java
+++ b/sql/src/main/java/javax/sql/RowSetEvent.java
@@ -33,9 +33,6 @@ import java.io.Serializable;
* The event contains a reference to the {@code RowSet} object which generated
* the message so that the listeners can extract whatever information they need
* from that reference.
- * </p>
- *
- * @since Android 1.0
*/
public class RowSetEvent extends EventObject implements Serializable {
@@ -50,7 +47,6 @@ public class RowSetEvent extends EventObject implements Serializable {
*
* @param theSource
* the {@code RowSet} which generated the event.
- * @since Android 1.0
*/
public RowSetEvent(RowSet theSource) {
super(theSource);
diff --git a/sql/src/main/java/javax/sql/RowSetInternal.java b/sql/src/main/java/javax/sql/RowSetInternal.java
index baa261d..78de4b0 100644
--- a/sql/src/main/java/javax/sql/RowSetInternal.java
+++ b/sql/src/main/java/javax/sql/RowSetInternal.java
@@ -22,9 +22,9 @@ import java.sql.Connection;
import java.sql.ResultSet;
/**
- * An interface provided by a {@code RowSet} object to let either a {@code RowSetReader} or a
- * {@code RowSetWriter} access its internal state, thereby providing facilities to read and update the state of
- * the {@code RowSet}.
+ * An interface provided by a {@code RowSet} object to let either a {@code
+ * RowSetReader} or a {@code RowSetWriter} access its internal state, thereby
+ * providing facilities to read and update the state of the {@code RowSet}.
*/
public interface RowSetInternal {
@@ -34,7 +34,6 @@ public interface RowSetInternal {
* @return the connection or {@code null}.
* @throws SQLException
* if there is a problem accessing the database.
- * @since Android 1.0
*/
public Connection getConnection() throws SQLException;
@@ -44,13 +43,11 @@ public interface RowSetInternal {
* <p>
* The {@code ResultSet}'s cursor is positioned before the first row of
* data.
- * </p>
*
* @return the {@code ResultSet} that contained the original data value of
* the {@code RowSet}.
* @throws SQLException
* if there is a problem accessing the database.
- * @since Android 1.0
*/
public ResultSet getOriginal() throws SQLException;
@@ -63,7 +60,6 @@ public interface RowSetInternal {
* if there is a problem accessing the database, or if the
* cursor is not on a valid row (before the first row, after the
* last one or pointing to the insert row).
- * @since Android 1.0
*/
public ResultSet getOriginalRow() throws SQLException;
@@ -74,7 +70,6 @@ public interface RowSetInternal {
* @return the values of parameters that have been set.
* @throws SQLException
* if there is a problem accessing the database.
- * @since Android 1.0
*/
public Object[] getParams() throws SQLException;
@@ -87,7 +82,6 @@ public interface RowSetInternal {
* holds the metadata about the {@code RowSet}'s columns.
* @throws SQLException
* if there is a problem accessing the database.
- * @since Android 1.0
*/
public void setMetaData(RowSetMetaData theMetaData) throws SQLException;
}
diff --git a/sql/src/main/java/javax/sql/RowSetListener.java b/sql/src/main/java/javax/sql/RowSetListener.java
index 06a7253..ede0197 100644
--- a/sql/src/main/java/javax/sql/RowSetListener.java
+++ b/sql/src/main/java/javax/sql/RowSetListener.java
@@ -25,8 +25,6 @@ import java.util.EventListener;
* implement the {@code RowSetListener} interface and then register itself with
* the {@code RowSet} of interest using the
* {@link RowSet#addRowSetListener(RowSetListener)} method.
- *
- * @since Android 1.0
*/
public interface RowSetListener extends EventListener {
@@ -39,7 +37,6 @@ public interface RowSetListener extends EventListener {
* {@code RowSet} involved. This information can be used to
* retrieve information about the change, such as the updated
* data values.
- * @since Android 1.0
*/
public void cursorMoved(RowSetEvent theEvent);
@@ -52,7 +49,6 @@ public interface RowSetListener extends EventListener {
* {@code RowSet} involved. This information can be used to
* retrieve information about the change, such as the new cursor
* position.
- * @since Android 1.0
*/
public void rowChanged(RowSetEvent theEvent);
@@ -66,7 +62,6 @@ public interface RowSetListener extends EventListener {
* {@code RowSet} involved. This information can be used to
* retrieve information about the change, such as the updated
* rows of data.
- * @since Android 1.0
*/
public void rowSetChanged(RowSetEvent theEvent);
}
diff --git a/sql/src/main/java/javax/sql/RowSetMetaData.java b/sql/src/main/java/javax/sql/RowSetMetaData.java
index 3051876..ad07199 100644
--- a/sql/src/main/java/javax/sql/RowSetMetaData.java
+++ b/sql/src/main/java/javax/sql/RowSetMetaData.java
@@ -26,14 +26,11 @@ import java.sql.SQLException;
* <p>
* {@code RowSetMetaData} extends {@link java.sql.ResultSetMetaData}, adding new
* operations for carrying out value sets.
- * </p>
* <p>
* Application code would not normally call this interface directly. It would be
* called internally when {@code RowSet.execute} is called.
- * </p>
- *
+ *
* @see RowSetInternal#setMetaData(RowSetMetaData)
- * @since Android 1.0
*/
public interface RowSetMetaData extends ResultSetMetaData {
@@ -50,7 +47,6 @@ public interface RowSetMetaData extends ResultSetMetaData {
* turn it off (default).
* @throws SQLException
* if a problem occurs accessing the database.
- * @since Android 1.0
*/
public void setAutoIncrement(int columnIndex, boolean autoIncrement)
throws SQLException;
@@ -67,7 +63,6 @@ public interface RowSetMetaData extends ResultSetMetaData {
* to make it case insensitive (default).
* @throws SQLException
* if a problem occurs accessing the database.
- * @since Android 1.0
*/
public void setCaseSensitive(int columnIndex, boolean caseSensitive)
throws SQLException;
@@ -82,7 +77,6 @@ public interface RowSetMetaData extends ResultSetMetaData {
* the new catalog's name.
* @throws SQLException
* if a problem occurs accessing the database.
- * @since Android 1.0
*/
public void setCatalogName(int columnIndex, String catalogName)
throws SQLException;
@@ -94,7 +88,6 @@ public interface RowSetMetaData extends ResultSetMetaData {
* the number of columns contained in the {@code RowSet}.
* @throws SQLException
* if a problem occurs accessing the database.
- * @since Android 1.0
*/
public void setColumnCount(int columnCount) throws SQLException;
@@ -109,7 +102,6 @@ public interface RowSetMetaData extends ResultSetMetaData {
* the normal maximum column width in characters.
* @throws SQLException
* if a problem occurs accessing the database.
- * @since Android 1.0
*/
public void setColumnDisplaySize(int columnIndex, int displaySize)
throws SQLException;
@@ -125,7 +117,6 @@ public interface RowSetMetaData extends ResultSetMetaData {
* the alias name for the column.
* @throws SQLException
* if a problem occurs accessing the database.
- * @since Android 1.0
*/
public void setColumnLabel(int columnIndex, String theLabel)
throws SQLException;
@@ -140,7 +131,6 @@ public interface RowSetMetaData extends ResultSetMetaData {
* the column's label.
* @throws SQLException
* if a problem occurs accessing the database.
- * @since Android 1.0
*/
public void setColumnName(int columnIndex, String theColumnName)
throws SQLException;
@@ -155,7 +145,6 @@ public interface RowSetMetaData extends ResultSetMetaData {
* the SQL Type, as defined by {@code java.sql.Types}.
* @throws SQLException
* if a problem occurs accessing the database.
- * @since Android 1.0
*/
public void setColumnType(int columnIndex, int theSQLType)
throws SQLException;
@@ -171,7 +160,6 @@ public interface RowSetMetaData extends ResultSetMetaData {
* the SQL type name for the column.
* @throws SQLException
* if a problem occurs accessing the database.
- * @since Android 1.0
*/
public void setColumnTypeName(int columnIndex, String theTypeName)
throws SQLException;
@@ -189,7 +177,6 @@ public interface RowSetMetaData extends ResultSetMetaData {
* value (default).
* @throws SQLException
* if a problem occurs accessing the database.
- * @since Android 1.0
*/
public void setCurrency(int columnIndex, boolean isCurrency)
throws SQLException;
@@ -210,10 +197,8 @@ public interface RowSetMetaData extends ResultSetMetaData {
* <p>
* The default value is {@code
* ResultSetMetaData.columnNullableUnknown}.
- * </p>
* @throws SQLException
* if a problem occurs accessing the database.
- * @since Android 1.0
*/
public void setNullable(int columnIndex, int nullability)
throws SQLException;
@@ -229,7 +214,6 @@ public interface RowSetMetaData extends ResultSetMetaData {
* the number of decimal digits.
* @throws SQLException
* if a problem occurs accessing the database.
- * @since Android 1.0
*/
public void setPrecision(int columnIndex, int thePrecision)
throws SQLException;
@@ -245,7 +229,6 @@ public interface RowSetMetaData extends ResultSetMetaData {
* the number of digits after the decimal point.
* @throws SQLException
* if a problem occurs accessing the database.
- * @since Android 1.0
*/
public void setScale(int columnIndex, int theScale) throws SQLException;
@@ -259,7 +242,6 @@ public interface RowSetMetaData extends ResultSetMetaData {
* a {@code String} containing the schema name.
* @throws SQLException
* if a problem occurs accessing the database.
- * @since Android 1.0
*/
public void setSchemaName(int columnIndex, String theSchemaName)
throws SQLException;
@@ -276,7 +258,6 @@ public interface RowSetMetaData extends ResultSetMetaData {
* clause search, {@code false} otherwise.
* @throws SQLException
* if a problem occurs accessing the database.
- * @since Android 1.0
*/
public void setSearchable(int columnIndex, boolean isSearchable)
throws SQLException;
@@ -292,7 +273,6 @@ public interface RowSetMetaData extends ResultSetMetaData {
* false} otherwise.
* @throws SQLException
* if a problem occurs accessing the database.
- * @since Android 1.0
*/
public void setSigned(int columnIndex, boolean isSigned)
throws SQLException;
@@ -307,7 +287,6 @@ public interface RowSetMetaData extends ResultSetMetaData {
* the table name for the column.
* @throws SQLException
* if a problem occurs accessing the database.
- * @since Android 1.0
*/
public void setTableName(int columnIndex, String theTableName)
throws SQLException;
diff --git a/sql/src/main/java/javax/sql/RowSetReader.java b/sql/src/main/java/javax/sql/RowSetReader.java
index d4a902f..0ff5c90 100644
--- a/sql/src/main/java/javax/sql/RowSetReader.java
+++ b/sql/src/main/java/javax/sql/RowSetReader.java
@@ -27,7 +27,6 @@ import java.sql.SQLException;
* RowSet} for this to work.
*
* @see RowSet
- * @since Android 1.0
*/
public interface RowSetReader {
@@ -44,7 +43,6 @@ public interface RowSetReader {
* events are sent to listeners - any listeners are informed by the calling
* {@code RowSet}'s {@code execute} method once the reader returns from the
* {@code readData} method.
- * </p>
*
* @param theCaller
* must be the calling {@code RowSet} object, which must have
@@ -53,7 +51,6 @@ public interface RowSetReader {
* if a problem occurs accessing the database or if the reader
* calls the {@link RowSet#execute()} method.
* @see RowSetInternal
- * @since Android 1.0
*/
public void readData(RowSetInternal theCaller) throws SQLException;
}
diff --git a/sql/src/main/java/javax/sql/RowSetWriter.java b/sql/src/main/java/javax/sql/RowSetWriter.java
index 34473b2..8e56d50 100644
--- a/sql/src/main/java/javax/sql/RowSetWriter.java
+++ b/sql/src/main/java/javax/sql/RowSetWriter.java
@@ -28,16 +28,13 @@ import java.sql.SQLException;
* The writer must establish a connection to the {@code RowSet}'s database
* before writing the data. The {@code RowSet} calling this interface must
* implement the {@code RowSetInternal} interface.
- * </p>
* <p>
* The writer may encounter a situation where the updated data needs to be
* written back to the database, but has already been updated there in the mean
* time. How a conflict of this kind is handled is determined by the
* implementation of this writer.
- * </p>
- *
+ *
* @see RowSetInternal
- * @since Android 1.0
*/
public interface RowSetWriter {
@@ -56,7 +53,6 @@ public interface RowSetWriter {
* otherwise (which typically implies some form of conflict).
* @throws SQLException
* if a problem occurs accessing the database.
- * @since Android 1.0
*/
public boolean writeData(RowSetInternal theRowSet) throws SQLException;
}
diff --git a/sql/src/main/java/org/apache/harmony/sql/internal/nls/Messages.java b/sql/src/main/java/org/apache/harmony/sql/internal/nls/Messages.java
index b3dbd32..234bdc9 100644
--- a/sql/src/main/java/org/apache/harmony/sql/internal/nls/Messages.java
+++ b/sql/src/main/java/org/apache/harmony/sql/internal/nls/Messages.java
@@ -27,7 +27,6 @@
package org.apache.harmony.sql.internal.nls;
-
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Locale;
diff --git a/sql/src/main/java/org/apache/harmony/sql/internal/nls/messages.properties b/sql/src/main/java/org/apache/harmony/sql/internal/nls/messages.properties
index 3e6ff1d..6927cf2 100644
--- a/sql/src/main/java/org/apache/harmony/sql/internal/nls/messages.properties
+++ b/sql/src/main/java/org/apache/harmony/sql/internal/nls/messages.properties
@@ -40,3 +40,22 @@ sql.22=Invalid position and substring length
sql.23=Buffer is not sufficient to hold the value
sql.24=Invalid length for truncate
sql.25=Unsupported operation. SerialClob is not instantiated with a fully implemented Clob object.
+sql.26=Invalid column count. Cannot be less or equal to zero
+sql.27=Invalid column index :{0}
+sql.28=Invalid SQL type for column
+sql.29=Invalid nullable constant set. Must be either columnNoNulls, columnNullable or columnNullableUnknown
+sql.30=Invalid column display size. Cannot be less than zero
+sql.31=Invalid precision value. Cannot be less than zero
+sql.32=Invalid scale size. Cannot be less than zero
+sql.33=Cannot instantiate a SQLOutputImpl instance with null parameters
+sql.34=Cannot instantiate a SQLInputImpl instance with null parameters
+sql.35=SQLInputImpl exception: Invalid read position
+sql.36=No more attributes
+sql.37=Operation not supported
+sql.38=Object is invalid
+sql.39=Cannot instantiate a SerialArray object with a null Array object
+sql.40=ClassNotFoundException: {0}
+sql.41=Invalid JNDI context supplied
+sql.42=Illegal Argument
+sql.43=The object is not serializable
+sql.44=No logger has been set
diff --git a/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/DateTest.java b/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/DateTest.java
index 3b833c4..39f5074 100644
--- a/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/DateTest.java
+++ b/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/DateTest.java
@@ -293,17 +293,27 @@ public class DateTest extends TestCase {
args = {}
)
public void testToString() {
- // This test is set up for GMT time zone, so need to set the time zone
- // to GMT first
- TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
-
- for (int i = 0; i < TIME_ARRAY.length; i++) {
- Date theDate = new Date(TIME_ARRAY[i]);
- assertEquals(SQL_DATEARRAY[i], theDate.toString());
+ // Loop through the timezones testing the String conversion for each
+ for (int i = 0; i < TIMEZONES.length; i++) {
+ testToString(TIMEZONES[i], TIME_ARRAY, SQL_TZ_DATEARRAYS[i]);
} // end for
} // end method testToString()
+ private void testToString(String timeZone, long[] theDates, String[] theDateStrings) {
+ // Set the timezone
+ TimeZone.setDefault(TimeZone.getTimeZone(timeZone));
+
+ for (int i = 0; i < theDates.length; i++) {
+ // Create the Date object
+ Date theDate = new Date(theDates[i]);
+ // Convert to a date string ... and compare
+ String JDBCString = theDate.toString();
+ assertEquals(theDateStrings[i], JDBCString);
+ } // end for
+
+ } // end testToString( String, long[], String[] )
+
/*
* Test of the void setTime(int) method This does depend on the Time Zone
* settings and sets up the time zone to one of a group of specific time
@@ -372,7 +382,7 @@ public class DateTest extends TestCase {
theDate = Date.valueOf(element);
fail("Should throw IllegalArgumentException.");
} catch (IllegalArgumentException e) {
- //expected
+ // expected
} // end try
} // end for
@@ -388,70 +398,77 @@ public class DateTest extends TestCase {
args = {java.lang.String.class}
)
public void test_valueOf_IllegalArgumentException() {
- try{
+ try {
Date.valueOf("1996-10-07-01");
fail("should throw NumberFormatException");
} catch (NumberFormatException e) {
- //expected
+ // expected
}
- try{
+ try {
Date.valueOf("-10-07-01");
fail("should throw IllegalArgumentException");
} catch (IllegalArgumentException e) {
- //expected
+ // expected
}
- try{
+ try {
Date.valueOf("--01");
fail("should throw IllegalArgumentException");
} catch (IllegalArgumentException e) {
- //expected
+ // expected
}
- try{
+ try {
Date.valueOf("1991--");
fail("should throw IllegalArgumentException");
} catch (IllegalArgumentException e) {
- //expected
+ // expected
}
- try{
+ try {
Date.valueOf("-01-");
fail("should throw IllegalArgumentException");
} catch (IllegalArgumentException e) {
- //expected
+ // expected
}
- try{
+ try {
Date.valueOf("-10-w2-01");
fail("should throw IllegalArgumentException");
} catch (IllegalArgumentException e) {
- //expected
+ // expected
}
- try{
+ try {
Date.valueOf("07-w2-");
fail("should throw IllegalArgumentException");
} catch (IllegalArgumentException e) {
- //expected
+ // expected
}
- try{
+ try {
Date.valueOf("1997-w2-w2");
fail("should throw NumberFormatException");
} catch (NumberFormatException e) {
- //expected
+ // expected
}
- try{
+ try {
Date.valueOf("1996--01");
fail("should throw NumberFormatException");
} catch (NumberFormatException e) {
- //expected
+ // expected
}
}
+ // Reset defualt timezone
+ static TimeZone defaultTimeZone = TimeZone.getDefault();
+
+ protected void tearDown(){
+ TimeZone.setDefault(defaultTimeZone);
+ }
+
} // end class DateTest
diff --git a/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/DriverManagerTest.java b/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/DriverManagerTest.java
index 7e08db9..68ac6c5 100644
--- a/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/DriverManagerTest.java
+++ b/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/DriverManagerTest.java
@@ -24,6 +24,7 @@ import dalvik.annotation.TestLevel;
import dalvik.annotation.TestTargetNew;
import java.io.ByteArrayOutputStream;
+import java.io.IOException;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.lang.reflect.Method;
@@ -31,10 +32,12 @@ import java.security.Permission;
import java.sql.Connection;
import java.sql.Driver;
import java.sql.DriverManager;
+import java.sql.DriverPropertyInfo;
import java.sql.SQLException;
import java.sql.SQLPermission;
import java.util.Enumeration;
import java.util.Properties;
+import tests.support.Support_Exec;
import junit.framework.TestCase;
@TestTargetClass(DriverManager.class)
@@ -684,6 +687,76 @@ public class DriverManagerTest extends TestCase {
} // end class TestSecurityManager
+ /**
+ * @tests {@link java.sql.DriverManager#registerDriver(Driver)}
+ *
+ * Registers a driver for multiple times and deregisters it only once.
+ *
+ * Regression for HARMONY-4205
+ */
+ public void test_registerDriver_MultiTimes() throws SQLException {
+ int register_count = 10;
+ int deregister_count = 1;
+
+ Driver dummy = new DummyDriver();
+ DriverManager.registerDriver(new BadDummyDriver());
+ for (int i = 0; i < register_count; i++) {
+ DriverManager.registerDriver(dummy);
+ }
+ DriverManager.registerDriver(new BadDummyDriver());
+ for (int i = 0; i < deregister_count; i++) {
+ DriverManager.deregisterDriver(dummy);
+ }
+ Driver d = DriverManager.getDriver("jdbc:dummy_protocol:dummy_subname");
+ assertNotNull(d);
+ }
+
+ /**
+ * Regression for HARMONY-4303
+ */
+ public void test_initClass() throws Exception {
+ String[] arg = new String[1];
+ arg[0] = "org/apache/harmony/sql/tests/java/sql/TestMainForDriver";
+ String result = Support_Exec.execJava(arg, null, true);
+ assertEquals("", result);
+ }
+
+ private static class BadDummyDriver extends DummyDriver {
+ public boolean acceptsURL(String url) {
+ return false;
+ }
+ }
+
+ private static class DummyDriver implements Driver {
+
+ String goodurl = "jdbc:dummy_protocol:dummy_subname";
+
+ public boolean acceptsURL(String url) {
+ return url.equals(goodurl);
+ }
+
+ public Connection connect(String url, Properties info) {
+ return null;
+ }
+
+ public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) {
+ return null;
+ }
+
+ public int getMajorVersion() {
+ return 0;
+ }
+
+ public int getMinorVersion() {
+ return 0;
+ }
+
+ public boolean jdbcCompliant() {
+ return true;
+ }
+
+ }
+
} // end class DriverManagerTest
diff --git a/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TestHelper_Connection1.java b/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TestHelper_Connection1.java
index 8b1fd60..d782444 100644
--- a/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TestHelper_Connection1.java
+++ b/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TestHelper_Connection1.java
@@ -46,8 +46,9 @@ public class TestHelper_Connection1 implements Connection {
return null;
}
- public Statement createStatement(int resultSetType, int resultSetConcurrency,
- int resultSetHoldability) throws SQLException {
+ public Statement createStatement(int resultSetType,
+ int resultSetConcurrency, int resultSetHoldability)
+ throws SQLException {
return null;
}
@@ -97,12 +98,13 @@ public class TestHelper_Connection1 implements Connection {
}
public CallableStatement prepareCall(String sql, int resultSetType,
- int resultSetConcurrency, int resultSetHoldability) throws SQLException {
+ int resultSetConcurrency, int resultSetHoldability)
+ throws SQLException {
return null;
}
- public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency)
- throws SQLException {
+ public CallableStatement prepareCall(String sql, int resultSetType,
+ int resultSetConcurrency) throws SQLException {
return null;
}
@@ -111,7 +113,8 @@ public class TestHelper_Connection1 implements Connection {
}
public PreparedStatement prepareStatement(String sql, int resultSetType,
- int resultSetConcurrency, int resultSetHoldability) throws SQLException {
+ int resultSetConcurrency, int resultSetHoldability)
+ throws SQLException {
return null;
}
diff --git a/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TestHelper_Driver1.java b/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TestHelper_Driver1.java
index ae09f94..8638d2b 100644
--- a/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TestHelper_Driver1.java
+++ b/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TestHelper_Driver1.java
@@ -104,7 +104,8 @@ public class TestHelper_Driver1 implements Driver {
public DriverPropertyInfo[] getPropertyInfo(String url, Properties info)
throws SQLException {
- DriverPropertyInfo[] theInfos = { new DriverPropertyInfo(userProperty, "*"),
+ DriverPropertyInfo[] theInfos = {
+ new DriverPropertyInfo(userProperty, "*"),
new DriverPropertyInfo(passwordProperty, "*"), };
return theInfos;
}
diff --git a/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TestHelper_Driver3.java b/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TestHelper_Driver3.java
index f02bdc3..f78bb31 100644
--- a/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TestHelper_Driver3.java
+++ b/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TestHelper_Driver3.java
@@ -17,7 +17,6 @@
package org.apache.harmony.sql.tests.java.sql;
-
/**
* TODO Type description
*
diff --git a/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TestHelper_Driver4.java b/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TestHelper_Driver4.java
index 655436d..3e7000c 100644
--- a/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TestHelper_Driver4.java
+++ b/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TestHelper_Driver4.java
@@ -92,10 +92,13 @@ public class TestHelper_Driver4 implements Driver {
String user = (String) info.get(userProperty);
String password = (String) info.get(passwordProperty);
if (user == null || password == null) {
- throw new SQLException("Userid and/or password not supplied");
+ throw new SQLException(
+ "Userid and/or password not supplied");
}
- if (!user.equals(validuser) || !password.equals(validpassword)) {
- throw new SQLException("Userid and/or password not valid");
+ if (!user.equals(validuser)
+ || !password.equals(validpassword)) {
+ throw new SQLException(
+ "Userid and/or password not valid");
} // end if
} // end if
// It all checks out - so return a connection
@@ -117,7 +120,8 @@ public class TestHelper_Driver4 implements Driver {
public DriverPropertyInfo[] getPropertyInfo(String url, Properties info)
throws SQLException {
- DriverPropertyInfo[] theInfos = { new DriverPropertyInfo(userProperty, "*"),
+ DriverPropertyInfo[] theInfos = {
+ new DriverPropertyInfo(userProperty, "*"),
new DriverPropertyInfo(passwordProperty, "*"), };
return theInfos;
}
diff --git a/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TestMainForDriver.java b/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TestMainForDriver.java
new file mode 100644
index 0000000..0fe7f67
--- /dev/null
+++ b/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TestMainForDriver.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.apache.harmony.sql.tests.java.sql;
+
+/*
+ * Load DriverManager class and initialize the class with SecurityManager
+ * Regression for HARMONY-4303
+ */
+public class TestMainForDriver {
+ public static void main(String[] args) throws Throwable {
+ // Install SecurityManager
+ System.setSecurityManager(new SecurityManager());
+ // Load java.sql.DriverManager and it will invoke its <clinit> method
+ try {
+ Class.forName("java.sql.DriverManager");
+ } catch (ExceptionInInitializerError e) {
+ // ExceptionInInitializerError is caused by AccessControlException
+ throw e.getException();
+ }
+ }
+}
diff --git a/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TimestampTest.java b/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TimestampTest.java
index bc1a9d5..c1c09a0 100644
--- a/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TimestampTest.java
+++ b/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TimestampTest.java
@@ -37,6 +37,22 @@ import junit.framework.TestCase;
public class TimestampTest extends TestCase {
+ static class MockTimestamp extends Timestamp{
+ private String holiday;
+
+ public MockTimestamp(long theTime) {
+ super(theTime);
+ holiday = "Christmas";
+ }
+
+ // Constructor should not call this public API,
+ // since it may be overrided to use variables uninitialized.
+ public void setTime(long theTime){
+ super.setTime(theTime);
+ holiday.hashCode();
+ }
+ }
+
static long TIME_TEST1 = 38720231; // 10:45:20.231 GMT
static long TIME_TEST2 = 80279000; // 22:17:59.000 GMT
@@ -126,6 +142,9 @@ public class TimestampTest extends TestCase {
// The Timestamp should have been created
assertNotNull(theTimestamp);
+
+ Timestamp mockTimestamp = new MockTimestamp(TIME_TEST1);
+ assertNotNull(mockTimestamp);
} // end method testTimestamplong
/*
@@ -277,6 +296,7 @@ public class TimestampTest extends TestCase {
)
@SuppressWarnings("deprecation")
public void testGetDate() {
+ TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
for (int i = 0; i < TIME_ARRAY.length; i++) {
Timestamp theTimestamp = new Timestamp(TIME_ARRAY[i]);
assertEquals(DATE_ARRAY[i], theTimestamp.getDate());
@@ -295,6 +315,7 @@ public class TimestampTest extends TestCase {
)
@SuppressWarnings("deprecation")
public void testGetHours() {
+ TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
for (int i = 0; i < TIME_ARRAY.length; i++) {
Timestamp theTimestamp = new Timestamp(TIME_ARRAY[i]);
assertEquals(HOURS_ARRAY[i], theTimestamp.getHours());
@@ -350,6 +371,7 @@ public class TimestampTest extends TestCase {
args = {java.lang.String.class}
)
public void testValueOfString() {
+ TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
for (int i = 0; i < TIME_ARRAY.length; i++) {
Timestamp theTimestamp = new Timestamp(TIME_ARRAY[i]);
Timestamp theTimestamp2 = Timestamp.valueOf(STRING_GMT_ARRAY[i]);
@@ -370,7 +392,7 @@ public class TimestampTest extends TestCase {
Timestamp.valueOf(element);
fail("Should throw IllegalArgumentException.");
} catch (IllegalArgumentException e) {
- //expected
+ // expected
} // end try
} // end for
@@ -387,6 +409,7 @@ public class TimestampTest extends TestCase {
args = {java.lang.String.class}
)
public void testValueOfString1() {
+ TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
Timestamp theReturn;
@@ -439,8 +462,37 @@ public class TimestampTest extends TestCase {
}
}
+ // Regression test for HARMONY-5506
+ String date = "1970-01-01 22:17:59.0 ";
+ Timestamp t = Timestamp.valueOf(date);
+ assertEquals(80279000,t.getTime());
+
} // end method testValueOfString
+ public void testValueOf_IAE() {
+ try {
+ java.sql.Timestamp.valueOf("2008-12-22 15:00:01.");
+ fail("should throw IllegalArgumentException");
+ } catch (IllegalArgumentException e) {
+ // Expected
+ }
+
+ try {
+ // bug of RI 5, passed on RI 6
+ java.sql.Timestamp.valueOf("178548938-12-22 15:00:01.000000001");
+ fail("should throw IllegalArgumentException");
+ } catch (IllegalArgumentException e) {
+ // Expected
+ }
+
+ try {
+ java.sql.Timestamp.valueOf("2008-12-22 15:00:01.0000000011");
+ fail("should throw IllegalArgumentException");
+ } catch (IllegalArgumentException e) {
+ // Expected
+ }
+ }
+
/*
* Method test for toString
*/
@@ -451,14 +503,36 @@ public class TimestampTest extends TestCase {
args = {}
)
public void testToString() {
+ TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
+
for (int i = 0; i < TIME_ARRAY.length; i++) {
Timestamp theTimestamp = new Timestamp(TIME_ARRAY[i]);
assertEquals("Wrong conversion for test " + i, STRING_GMT_ARRAY[i],
theTimestamp.toString());
} // end for
+ Timestamp t1 = new Timestamp(Long.MIN_VALUE);
+ assertEquals("292278994-08-17 07:12:55.192", t1.toString()); //$NON-NLS-1$
+
+ Timestamp t2 = new Timestamp(Long.MIN_VALUE + 1);
+ assertEquals("292278994-08-17 07:12:55.193", t2.toString()); //$NON-NLS-1$
+
+ Timestamp t3 = new Timestamp(Long.MIN_VALUE + 807);
+ assertEquals("292278994-08-17 07:12:55.999", t3.toString()); //$NON-NLS-1$
+
+ Timestamp t4 = new Timestamp(Long.MIN_VALUE + 808);
+ assertEquals("292269055-12-02 16:47:05.0", t4.toString()); //$NON-NLS-1$
} // end method testtoString
+ private void testToString(String timeZone, long[] theTimeStamps, String[] theTimeStampStrings) {
+ TimeZone.setDefault(TimeZone.getTimeZone(timeZone));
+ for (int i = 0; i < TIME_ARRAY.length; i++) {
+ Timestamp theTimestamp = new Timestamp(theTimeStamps[i]);
+ assertEquals(theTimeStampStrings[i], theTimestamp.toString());
+ } // end for
+
+ }
+
/*
* Method test for getNanos
*/
@@ -487,6 +561,8 @@ public class TimestampTest extends TestCase {
args = {int.class}
)
public void testSetNanosint() {
+ TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
+
int[] NANOS_INVALID = { -137891990, 1635665198, -1 };
for (int i = 0; i < TIME_ARRAY.length; i++) {
Timestamp theTimestamp = new Timestamp(TIME_ARRAY[i]);
@@ -787,5 +863,11 @@ public class TimestampTest extends TestCase {
Timestamp t4 = new Timestamp(Long.MIN_VALUE + 808);
assertEquals("292269055-12-02 16:47:05.0", t4.toString()); //$NON-NLS-1$
}
-
+
+ // Reset defualt timezone
+ TimeZone defaultTimeZone = TimeZone.getDefault();
+
+ protected void tearDown() {
+ TimeZone.setDefault(defaultTimeZone);
+ }
} // end class TimestampTest
diff --git a/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/ConnectionEventTest.java b/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/ConnectionEventTest.java
index 376b173..12d4364 100644
--- a/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/ConnectionEventTest.java
+++ b/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/ConnectionEventTest.java
@@ -25,10 +25,14 @@ import dalvik.annotation.TestTargetClass;
import junit.framework.TestCase;
import java.sql.SQLException;
+import java.io.Serializable;
import javax.sql.ConnectionEvent;
import javax.sql.PooledConnection;
+import org.apache.harmony.testframework.serialization.SerializationTest;
+import org.apache.harmony.testframework.serialization.SerializationTest.SerializableAssert;
+
@TestTargetClass(ConnectionEvent.class)
public class ConnectionEventTest extends TestCase {
@@ -112,5 +116,63 @@ public class ConnectionEventTest extends TestCase {
assertNotSame(ce3.getSQLException(), ce2.getSQLException());
}
-}
+ @TestTargetNew(
+ level = TestLevel.SUFFICIENT,
+ notes = "",
+ method = "!SerializationSelf",
+ args = {}
+ )
+ public void testSerializationSelf() throws Exception {
+ Impl_PooledConnection ipc = new Impl_PooledConnection();
+ SQLException e = new SQLException();
+ ConnectionEvent ce = new ConnectionEvent(ipc, e);
+ SerializationTest.verifySelf(ce, CONNECTIONEVENT_COMPARATOR);
+ }
+
+ @TestTargetNew(
+ level = TestLevel.SUFFICIENT,
+ notes = "",
+ method = "!Serialization",
+ args = {}
+ )
+ public void testSerializationCompatibility() throws Exception {
+ Impl_PooledConnection ipc = new Impl_PooledConnection();
+ SQLException nextSQLException = new SQLException("nextReason",
+ "nextSQLState", 33);
+
+ int vendorCode = 10;
+ SQLException sqlException = new SQLException("reason", "SQLState",
+ vendorCode);
+
+ sqlException.setNextException(nextSQLException);
+
+ ConnectionEvent ce = new ConnectionEvent(ipc, sqlException);
+
+ SerializationTest.verifyGolden(this, ce, CONNECTIONEVENT_COMPARATOR);
+ }
+
+ private static final SerializableAssert CONNECTIONEVENT_COMPARATOR = new SerializableAssert() {
+
+ public void assertDeserialized(Serializable initial,
+ Serializable deserialized) {
+ ConnectionEvent ceInitial = (ConnectionEvent) initial;
+ ConnectionEvent ceDeser = (ConnectionEvent) deserialized;
+
+ SQLException initThr = ceInitial.getSQLException();
+ SQLException dserThr = ceDeser.getSQLException();
+
+ // verify SQLState
+ assertEquals(initThr.getSQLState(), dserThr.getSQLState());
+
+ // verify vendorCode
+ assertEquals(initThr.getErrorCode(), dserThr.getErrorCode());
+
+ // verify next
+ if (initThr.getNextException() == null) {
+ assertNull(dserThr.getNextException());
+ }
+ }
+
+ };
+}
diff --git a/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/Impl_PooledConnection.java b/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/Impl_PooledConnection.java
index d135ced..0eca2d2 100644
--- a/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/Impl_PooledConnection.java
+++ b/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/Impl_PooledConnection.java
@@ -33,6 +33,7 @@ class Impl_PooledConnection implements PooledConnection {
return null;
}
- public void removeConnectionEventListener(ConnectionEventListener theListener) {
+ public void removeConnectionEventListener(
+ ConnectionEventListener theListener) {
}
}
diff --git a/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/Impl_RowSet.java b/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/Impl_RowSet.java
index ace6b9a..946c40d 100644
--- a/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/Impl_RowSet.java
+++ b/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/Impl_RowSet.java
@@ -99,34 +99,38 @@ class Impl_RowSet implements RowSet {
public void removeRowSetListener(RowSetListener theListener) {
}
- public void setArray(int parameterIndex, Array theArray) throws SQLException {
- }
-
- public void setAsciiStream(int parameterIndex, InputStream theInputStream, int length)
+ public void setArray(int parameterIndex, Array theArray)
throws SQLException {
}
- public void setBigDecimal(int parameterIndex, BigDecimal theBigDecimal) throws SQLException {
+ public void setAsciiStream(int parameterIndex, InputStream theInputStream,
+ int length) throws SQLException {
}
- public void setBinaryStream(int parameterIndex, InputStream theInputStream, int length)
+ public void setBigDecimal(int parameterIndex, BigDecimal theBigDecimal)
throws SQLException {
}
+ public void setBinaryStream(int parameterIndex, InputStream theInputStream,
+ int length) throws SQLException {
+ }
+
public void setBlob(int parameterIndex, Blob theBlob) throws SQLException {
}
- public void setBoolean(int parameterIndex, boolean theBoolean) throws SQLException {
+ public void setBoolean(int parameterIndex, boolean theBoolean)
+ throws SQLException {
}
public void setByte(int parameterIndex, byte theByte) throws SQLException {
}
- public void setBytes(int parameterIndex, byte[] theByteArray) throws SQLException {
+ public void setBytes(int parameterIndex, byte[] theByteArray)
+ throws SQLException {
}
- public void setCharacterStream(int parameterIndex, Reader theReader, int length)
- throws SQLException {
+ public void setCharacterStream(int parameterIndex, Reader theReader,
+ int length) throws SQLException {
}
public void setClob(int parameterIndex, Clob theClob) throws SQLException {
@@ -148,13 +152,15 @@ class Impl_RowSet implements RowSet {
public void setDate(int parameterIndex, Date theDate) throws SQLException {
}
- public void setDouble(int parameterIndex, double theDouble) throws SQLException {
+ public void setDouble(int parameterIndex, double theDouble)
+ throws SQLException {
}
public void setEscapeProcessing(boolean enable) throws SQLException {
}
- public void setFloat(int parameterIndex, float theFloat) throws SQLException {
+ public void setFloat(int parameterIndex, float theFloat)
+ throws SQLException {
}
public void setInt(int parameterIndex, int theInteger) throws SQLException {
@@ -169,21 +175,23 @@ class Impl_RowSet implements RowSet {
public void setMaxRows(int max) throws SQLException {
}
- public void setNull(int parameterIndex, int sqlType, String typeName) throws SQLException {
+ public void setNull(int parameterIndex, int sqlType, String typeName)
+ throws SQLException {
}
public void setNull(int parameterIndex, int sqlType) throws SQLException {
}
- public void setObject(int parameterIndex, Object theObject, int targetSqlType, int scale)
- throws SQLException {
+ public void setObject(int parameterIndex, Object theObject,
+ int targetSqlType, int scale) throws SQLException {
}
- public void setObject(int parameterIndex, Object theObject, int targetSqlType)
- throws SQLException {
+ public void setObject(int parameterIndex, Object theObject,
+ int targetSqlType) throws SQLException {
}
- public void setObject(int parameterIndex, Object theObject) throws SQLException {
+ public void setObject(int parameterIndex, Object theObject)
+ throws SQLException {
}
public void setPassword(String password) throws SQLException {
@@ -198,10 +206,12 @@ class Impl_RowSet implements RowSet {
public void setRef(int parameterIndex, Ref theRef) throws SQLException {
}
- public void setShort(int parameterIndex, short theShort) throws SQLException {
+ public void setShort(int parameterIndex, short theShort)
+ throws SQLException {
}
- public void setString(int parameterIndex, String theString) throws SQLException {
+ public void setString(int parameterIndex, String theString)
+ throws SQLException {
}
public void setTime(int parameterIndex, Time theTime, Calendar theCalendar)
@@ -211,11 +221,12 @@ class Impl_RowSet implements RowSet {
public void setTime(int parameterIndex, Time theTime) throws SQLException {
}
- public void setTimestamp(int parameterIndex, Timestamp theTimestamp, Calendar theCalendar)
- throws SQLException {
+ public void setTimestamp(int parameterIndex, Timestamp theTimestamp,
+ Calendar theCalendar) throws SQLException {
}
- public void setTimestamp(int parameterIndex, Timestamp theTimestamp) throws SQLException {
+ public void setTimestamp(int parameterIndex, Timestamp theTimestamp)
+ throws SQLException {
}
public void setTransactionIsolation(int level) throws SQLException {
@@ -224,7 +235,8 @@ class Impl_RowSet implements RowSet {
public void setType(int type) throws SQLException {
}
- public void setTypeMap(Map<String, Class<?>> theTypeMap) throws SQLException {
+ public void setTypeMap(Map<String, Class<?>> theTypeMap)
+ throws SQLException {
}
public void setUrl(String theURL) throws SQLException {
@@ -279,7 +291,8 @@ class Impl_RowSet implements RowSet {
return null;
}
- public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException {
+ public BigDecimal getBigDecimal(int columnIndex, int scale)
+ throws SQLException {
return null;
}
@@ -287,7 +300,8 @@ class Impl_RowSet implements RowSet {
return null;
}
- public BigDecimal getBigDecimal(String columnName, int scale) throws SQLException {
+ public BigDecimal getBigDecimal(String columnName, int scale)
+ throws SQLException {
return null;
}
@@ -419,7 +433,8 @@ class Impl_RowSet implements RowSet {
return null;
}
- public Object getObject(int columnIndex, Map<String, Class<?>> map) throws SQLException {
+ public Object getObject(int columnIndex, Map<String, Class<?>> map)
+ throws SQLException {
return null;
}
@@ -427,7 +442,8 @@ class Impl_RowSet implements RowSet {
return null;
}
- public Object getObject(String columnName, Map<String, Class<?>> map) throws SQLException {
+ public Object getObject(String columnName, Map<String, Class<?>> map)
+ throws SQLException {
return null;
}
@@ -483,7 +499,8 @@ class Impl_RowSet implements RowSet {
return null;
}
- public Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException {
+ public Timestamp getTimestamp(int columnIndex, Calendar cal)
+ throws SQLException {
return null;
}
@@ -491,7 +508,8 @@ class Impl_RowSet implements RowSet {
return null;
}
- public Timestamp getTimestamp(String columnName, Calendar cal) throws SQLException {
+ public Timestamp getTimestamp(String columnName, Calendar cal)
+ throws SQLException {
return null;
}
@@ -599,10 +617,12 @@ class Impl_RowSet implements RowSet {
throws SQLException {
}
- public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException {
+ public void updateBigDecimal(int columnIndex, BigDecimal x)
+ throws SQLException {
}
- public void updateBigDecimal(String columnName, BigDecimal x) throws SQLException {
+ public void updateBigDecimal(String columnName, BigDecimal x)
+ throws SQLException {
}
public void updateBinaryStream(int columnIndex, InputStream x, int length)
@@ -641,8 +661,8 @@ class Impl_RowSet implements RowSet {
throws SQLException {
}
- public void updateCharacterStream(String columnName, Reader reader, int length)
- throws SQLException {
+ public void updateCharacterStream(String columnName, Reader reader,
+ int length) throws SQLException {
}
public void updateClob(int columnIndex, Clob x) throws SQLException {
@@ -687,13 +707,15 @@ class Impl_RowSet implements RowSet {
public void updateNull(String columnName) throws SQLException {
}
- public void updateObject(int columnIndex, Object x, int scale) throws SQLException {
+ public void updateObject(int columnIndex, Object x, int scale)
+ throws SQLException {
}
public void updateObject(int columnIndex, Object x) throws SQLException {
}
- public void updateObject(String columnName, Object x, int scale) throws SQLException {
+ public void updateObject(String columnName, Object x, int scale)
+ throws SQLException {
}
public void updateObject(String columnName, Object x) throws SQLException {
@@ -726,10 +748,12 @@ class Impl_RowSet implements RowSet {
public void updateTime(String columnName, Time x) throws SQLException {
}
- public void updateTimestamp(int columnIndex, Timestamp x) throws SQLException {
+ public void updateTimestamp(int columnIndex, Timestamp x)
+ throws SQLException {
}
- public void updateTimestamp(String columnName, Timestamp x) throws SQLException {
+ public void updateTimestamp(String columnName, Timestamp x)
+ throws SQLException {
}
public boolean wasNull() throws SQLException {
diff --git a/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/RowSetEventTest.java b/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/RowSetEventTest.java
index bf30fbc..9f048f7 100644
--- a/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/RowSetEventTest.java
+++ b/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/RowSetEventTest.java
@@ -45,7 +45,7 @@ public class RowSetEventTest extends TestCase {
fail("illegal argument exception expected");
} catch (IllegalArgumentException e) {
}
-
+
Impl_RowSet irs = new Impl_RowSet();
RowSetEvent rse = new RowSetEvent(irs);
assertSame(irs, rse.getSource());
diff --git a/support/src/test/java/tests/support/Support_Configuration.java b/support/src/test/java/tests/support/Support_Configuration.java
index 9294ae9..19af32e 100644
--- a/support/src/test/java/tests/support/Support_Configuration.java
+++ b/support/src/test/java/tests/support/Support_Configuration.java
@@ -75,8 +75,6 @@ public class Support_Configuration {
public static byte[] InetTestCaddr = { 9, 26, -56, -111 };
- public static int InetTestHashcode = 2130706433;
-
public static final String HomeAddress6 = "jcltest6.apache.org";
public static String IPv6GlobalAddressJcl4 = "FE80:0000:0000:0000:020D:60FF:FE0F:A776%4"; // this
@@ -92,13 +90,6 @@ public class Support_Configuration {
// this allows us to check the timeouts for connect
public static String ResolvedNotExistingHost = "9.26.194.72";
- /**
- * You can compute the hash code with the following code: try { String name =
- * "whatever.xxx.com";
- * System.out.println(InetAddress.getByName(name).hashCode()); } catch
- * (UnknownHostException e) {}
- */
-
// BEGIN android-changed
/**
* An address that resolves to more than one IP address so that the
@@ -292,11 +283,6 @@ public class Support_Configuration {
InetTestIP2 = value;
}
- value = props.get("InetTestHashcode");
- if (value != null) {
- InetTestHashcode = Integer.parseInt(value);
- }
-
value = props.get("SpecialInetTestAddress");
if (value != null) {
SpecialInetTestAddress = value;
diff --git a/support/src/test/java/tests/util/PrefsTester.java b/support/src/test/java/tests/util/PrefsTester.java
new file mode 100644
index 0000000..047b357
--- /dev/null
+++ b/support/src/test/java/tests/util/PrefsTester.java
@@ -0,0 +1,73 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 tests.util;
+
+import java.util.prefs.BackingStoreException;
+import java.util.prefs.Preferences;
+import java.util.Arrays;
+
+/**
+ * Prepares the shared preferences store for a test by wiping preference data
+ * before and after the test. Sample usage:
+ * <pre>
+ * public void MyPreferencesTest extends TestCase {
+ * private final PrefsTester prefsTester = new PrefsTester();
+ *
+ * public void setUp() throws BackingStoreException {
+ * super.setUp();
+ * prefsTester.setUp();
+ * }
+ *
+ * public void tearDown() throws BackingStoreException {
+ * prefsTester.tearDown();
+ * super.tearDown();
+ * }
+ *
+ * ...
+ * }</pre>
+ *
+ * <p>Once the preferences classes have been initialized, the path where their
+ * data is stored is fixed. For that reason, every test that reads or writes
+ * preferences must first prepare preferences for testing by using this class.
+ */
+public final class PrefsTester {
+
+ static {
+ String tmp = System.getProperty("java.io.tmpdir");
+ System.setProperty("user.home", tmp);
+ System.setProperty("java.home", tmp);
+ }
+
+ public void setUp() throws BackingStoreException {
+ clear();
+ }
+
+ public void tearDown() throws BackingStoreException {
+ clear();
+ }
+
+ private void clear() throws BackingStoreException {
+ for (Preferences root : Arrays .asList(
+ Preferences.systemRoot(), Preferences.userRoot())) {
+ for (String child : root.childrenNames()) {
+ root.node(child).removeNode();
+ }
+ root.clear();
+ root.flush();
+ }
+ }
+}
diff --git a/x-net/src/main/java/javax/net/DefaultServerSocketFactory.java b/x-net/src/main/java/javax/net/DefaultServerSocketFactory.java
index 0b309df..9e31be4 100644
--- a/x-net/src/main/java/javax/net/DefaultServerSocketFactory.java
+++ b/x-net/src/main/java/javax/net/DefaultServerSocketFactory.java
@@ -15,11 +15,6 @@
* limitations under the License.
*/
-/**
-* @author Boris V. Kuznetsov
-* @version $Revision$
-*/
-
package javax.net;
import java.io.IOException;
@@ -27,24 +22,27 @@ import java.net.InetAddress;
import java.net.ServerSocket;
/**
- * Default implementation of javax.net.ServerSocketFactory.
- *
- * @since Android 1.0
- *
+ * Default implementation of {@link javax.net.ServerSocketFactory}
*/
-class DefaultServerSocketFactory extends ServerSocketFactory {
+final class DefaultServerSocketFactory extends ServerSocketFactory {
+
+ DefaultServerSocketFactory() {
+ super();
+ }
+ @Override
public ServerSocket createServerSocket(int port) throws IOException {
return new ServerSocket(port);
}
- public ServerSocket createServerSocket(int port, int backlog)
- throws IOException {
+ @Override
+ public ServerSocket createServerSocket(int port, int backlog) throws IOException {
return new ServerSocket(port, backlog);
}
- public ServerSocket createServerSocket(int port, int backlog,
- InetAddress iAddress) throws IOException {
+ @Override
+ public ServerSocket createServerSocket(int port, int backlog, InetAddress iAddress)
+ throws IOException {
return new ServerSocket(port, backlog, iAddress);
}
diff --git a/x-net/src/main/java/javax/net/DefaultSocketFactory.java b/x-net/src/main/java/javax/net/DefaultSocketFactory.java
index 8aa82d9..010c720 100644
--- a/x-net/src/main/java/javax/net/DefaultSocketFactory.java
+++ b/x-net/src/main/java/javax/net/DefaultSocketFactory.java
@@ -15,11 +15,6 @@
* limitations under the License.
*/
-/**
-* @author Boris V. Kuznetsov
-* @version $Revision$
-*/
-
package javax.net;
import java.io.IOException;
@@ -28,32 +23,38 @@ import java.net.Socket;
import java.net.UnknownHostException;
/**
- * Default implementation of javax.net.SocketFactory
- *
- * @since Android 1.0
+ * Default implementation of {@link javax.net.SocketFactory}
*/
-class DefaultSocketFactory extends SocketFactory {
+final class DefaultSocketFactory extends SocketFactory {
+
+ DefaultSocketFactory() {
+ super();
+ }
+ @Override
public Socket createSocket() throws IOException {
return new Socket();
}
- public Socket createSocket(String host, int port) throws IOException,
- UnknownHostException {
+ @Override
+ public Socket createSocket(String host, int port) throws IOException, UnknownHostException {
return new Socket(host, port);
}
- public Socket createSocket(String host, int port, InetAddress localHost,
- int localPort) throws IOException, UnknownHostException {
+ @Override
+ public Socket createSocket(String host, int port, InetAddress localHost, int localPort)
+ throws IOException, UnknownHostException {
return new Socket(host, port, localHost, localPort);
}
+ @Override
public Socket createSocket(InetAddress host, int port) throws IOException {
return new Socket(host, port);
}
- public Socket createSocket(InetAddress address, int port,
- InetAddress localAddress, int localPort) throws IOException {
+ @Override
+ public Socket createSocket(InetAddress address, int port, InetAddress localAddress,
+ int localPort) throws IOException {
return new Socket(address, port, localAddress, localPort);
}
}
diff --git a/x-net/src/main/java/javax/net/ServerSocketFactory.java b/x-net/src/main/java/javax/net/ServerSocketFactory.java
index 28a79f6..f2d2c0d 100644
--- a/x-net/src/main/java/javax/net/ServerSocketFactory.java
+++ b/x-net/src/main/java/javax/net/ServerSocketFactory.java
@@ -15,11 +15,6 @@
* limitations under the License.
*/
-/**
-* @author Boris V. Kuznetsov
-* @version $Revision$
-*/
-
package javax.net;
import java.io.IOException;
@@ -30,66 +25,59 @@ import java.net.SocketException;
/**
* This abstract class defines methods to create server sockets. It can be
* subclassed to create specific server socket types.
- *
- * @since Android 1.0
*/
public abstract class ServerSocketFactory {
- static ServerSocketFactory defaultFactory;
-
- /**
- * Creates a new {@code ServerSocketFactory} instance.
- *
- * @since Android 1.0
- */
- protected ServerSocketFactory() {
- }
+ private static ServerSocketFactory defaultFactory;
/**
* Gets the default server socket factory of the system which can be used to
* create new server sockets without creating a subclass of this factory.
- *
+ *
* @return the system default server socket factory.
- * @since Android 1.0
*/
public static synchronized ServerSocketFactory getDefault() {
if (defaultFactory == null) {
- defaultFactory = new DefaultServerSocketFactory();
+ defaultFactory = new DefaultServerSocketFactory();
}
return defaultFactory;
}
/**
+ * Creates a new {@code ServerSocketFactory} instance.
+ */
+ protected ServerSocketFactory() {
+ super();
+ }
+
+ /**
* Creates a new server socket which is not bound to any local address. This
* method has to be overridden by a subclass otherwise a {@code
* SocketException} is thrown.
- *
+ *
* @return the created unbound server socket.
* @throws IOException
* if an error occurs while creating a new server socket.
- * @since Android 1.0
*/
public ServerSocket createServerSocket() throws IOException {
- // follow RI's behavior
+ // follow RI's behavior
throw new SocketException("Unbound server sockets not implemented");
}
/**
* Creates a new server socket which is bound to the given port.
- *
+ *
* @param port
* the port on which the created socket has to listen.
* @return the created bound server socket.
* @throws IOException
* if an error occurs while creating a new server socket.
- * @since Android 1.0
*/
- public abstract ServerSocket createServerSocket(int port)
- throws IOException;
+ public abstract ServerSocket createServerSocket(int port) throws IOException;
/**
* Creates a new server socket which is bound to the given port and
* configures its maximum of queued connections.
- *
+ *
* @param port
* the port on which the created socket has to listen.
* @param backlog
@@ -97,15 +85,13 @@ public abstract class ServerSocketFactory {
* @return the created bound server socket.
* @throws IOException
* if an error occurs while creating a new server socket.
- * @since Android 1.0
*/
- public abstract ServerSocket createServerSocket(int port, int backlog)
- throws IOException;
+ public abstract ServerSocket createServerSocket(int port, int backlog) throws IOException;
/**
* Creates a new server socket which is bound to the given address on the
* specified port and configures its maximum of queued connections.
- *
+ *
* @param port
* the port on which the created socket has to listen.
* @param backlog
@@ -116,9 +102,8 @@ public abstract class ServerSocketFactory {
* @return the created bound server socket.
* @throws IOException
* if an error occurs while creating a new server socket.
- * @since Android 1.0
*/
- public abstract ServerSocket createServerSocket(int port, int backlog,
- InetAddress iAddress) throws IOException;
+ public abstract ServerSocket createServerSocket(int port, int backlog, InetAddress iAddress)
+ throws IOException;
-} \ No newline at end of file
+}
diff --git a/x-net/src/main/java/javax/net/SocketFactory.java b/x-net/src/main/java/javax/net/SocketFactory.java
index 6e5017e..eb0cfcb 100644
--- a/x-net/src/main/java/javax/net/SocketFactory.java
+++ b/x-net/src/main/java/javax/net/SocketFactory.java
@@ -15,11 +15,6 @@
* limitations under the License.
*/
-/**
-* @author Boris V. Kuznetsov
-* @version $Revision$
-*/
-
package javax.net;
import java.io.IOException;
@@ -31,27 +26,16 @@ import java.net.UnknownHostException;
/**
* This abstract class defines methods to create sockets. It can be subclassed
* to create specific socket types with additional socket-level functionality.
- *
- * @since Android 1.0
*/
public abstract class SocketFactory {
- static SocketFactory defaultFactory;
-
- /**
- * Creates a new {@code SocketFactory} instance.
- *
- * @since Android 1.0
- */
- protected SocketFactory() {
- }
+ private static SocketFactory defaultFactory;
/**
* Gets the default socket factory of the system which can be used to create
* new sockets without creating a subclass of this factory.
- *
+ *
* @return the system default socket factory.
- * @since Android 1.0
*/
public static synchronized SocketFactory getDefault() {
if (defaultFactory == null) {
@@ -61,17 +45,23 @@ public abstract class SocketFactory {
}
/**
+ * Creates a new {@code SocketFactory} instance.
+ */
+ protected SocketFactory() {
+ super();
+ }
+
+ /**
* Creates a new socket which is not connected to any remote host. This
* method has to be overridden by a subclass otherwise a {@code
* SocketException} is thrown.
- *
+ *
* @return the created unconnected socket.
* @throws IOException
* if an error occurs while creating a new socket.
- * @since Android 1.0
*/
public Socket createSocket() throws IOException {
- // follow RI's behavior
+ // follow RI's behavior
throw new SocketException("Unconnected sockets not implemented");
}
@@ -79,7 +69,7 @@ public abstract class SocketFactory {
* Creates a new socket which is connected to the remote host specified by
* the parameters {@code host} and {@code port}. The socket is bound to any
* available local address and port.
- *
+ *
* @param host
* the remote host address the socket has to be connected to.
* @param port
@@ -91,17 +81,16 @@ public abstract class SocketFactory {
* @throws UnknownHostException
* if the specified host is unknown or the IP address could not
* be resolved.
- * @since Android 1.0
*/
- public abstract Socket createSocket(String host, int port)
- throws IOException, UnknownHostException;
+ public abstract Socket createSocket(String host, int port) throws IOException,
+ UnknownHostException;
/**
* Creates a new socket which is connected to the remote host specified by
* the parameters {@code host} and {@code port}. The socket is bound to the
* local network interface specified by the InetAddress {@code localHost} on
* port {@code localPort}.
- *
+ *
* @param host
* the remote host address the socket has to be connected to.
* @param port
@@ -118,17 +107,15 @@ public abstract class SocketFactory {
* @throws UnknownHostException
* if the specified host is unknown or the IP address could not
* be resolved.
- * @since Android 1.0
*/
- public abstract Socket createSocket(String host, int port,
- InetAddress localHost, int localPort) throws IOException,
- UnknownHostException;
+ public abstract Socket createSocket(String host, int port, InetAddress localHost, int localPort)
+ throws IOException, UnknownHostException;
/**
* Creates a new socket which is connected to the remote host specified by
* the InetAddress {@code host}. The socket is bound to any available local
* address and port.
- *
+ *
* @param host
* the host address the socket has to be connected to.
* @param port
@@ -137,17 +124,16 @@ public abstract class SocketFactory {
* @return the created connected socket.
* @throws IOException
* if an error occurs while creating a new socket.
- * @since Android 1.0
*/
- public abstract Socket createSocket(InetAddress host, int port)
- throws IOException;
+ public abstract Socket createSocket(InetAddress host, int port) throws IOException;
+
/**
* Creates a new socket which is connected to the remote host specified by
* the InetAddress {@code address}. The socket is bound to the local network
* interface specified by the InetAddress {@code localHost} on port {@code
* localPort}.
- *
+ *
* @param address
* the remote host address the socket has to be connected to.
* @param port
@@ -161,8 +147,7 @@ public abstract class SocketFactory {
* @return the created connected socket.
* @throws IOException
* if an error occurs while creating a new socket.
- * @since Android 1.0
*/
- public abstract Socket createSocket(InetAddress address, int port,
- InetAddress localAddress, int localPort) throws IOException;
+ public abstract Socket createSocket(InetAddress address, int port, InetAddress localAddress,
+ int localPort) throws IOException;
}
diff --git a/x-net/src/main/java/javax/net/ssl/CertPathTrustManagerParameters.java b/x-net/src/main/java/javax/net/ssl/CertPathTrustManagerParameters.java
index 5903663..dcf7a4d 100644
--- a/x-net/src/main/java/javax/net/ssl/CertPathTrustManagerParameters.java
+++ b/x-net/src/main/java/javax/net/ssl/CertPathTrustManagerParameters.java
@@ -22,11 +22,12 @@ import java.security.cert.CertPathParameters;
/**
* Certification path parameters to provide to certification path
* based {@link TrustManager}.
- * @since Android 1.0
+ *
+ * @since 1.5
*/
public class CertPathTrustManagerParameters implements ManagerFactoryParameters {
- private CertPathParameters param;
+ private final CertPathParameters param;
/**
* Creates a new {@code CertPathTrustManagerParameters} with the specified
@@ -34,7 +35,6 @@ public class CertPathTrustManagerParameters implements ManagerFactoryParameters
*
* @param parameters
* the certification path parameters.
- * @since Android 1.0
*/
public CertPathTrustManagerParameters(CertPathParameters parameters) {
param = (CertPathParameters) parameters.clone();
@@ -44,10 +44,9 @@ public class CertPathTrustManagerParameters implements ManagerFactoryParameters
* Returns a copy of the certification path parameters.
*
* @return a copy of the certification path parameters.
- * @since Android 1.0
*/
public CertPathParameters getParameters() {
return (CertPathParameters) param.clone();
}
-} \ No newline at end of file
+}
diff --git a/x-net/src/main/java/javax/net/ssl/ContextImpl.java b/x-net/src/main/java/javax/net/ssl/ContextImpl.java
deleted file mode 100644
index 096cbba..0000000
--- a/x-net/src/main/java/javax/net/ssl/ContextImpl.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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 javax.net.ssl;
-
-import java.security.Provider;
-
-/**
- * Support class for this package.
- *
- * @since Android 1.0
- */
-
-class ContextImpl extends SSLContext {
- public ContextImpl(SSLContextSpi contextSpi, Provider provider,
- String protocol) {
- super(contextSpi, provider, protocol);
- }
-} \ No newline at end of file
diff --git a/x-net/src/main/java/javax/net/ssl/DefaultSSLContext.java b/x-net/src/main/java/javax/net/ssl/DefaultSSLContext.java
index d2ab2f4..a12d385 100644
--- a/x-net/src/main/java/javax/net/ssl/DefaultSSLContext.java
+++ b/x-net/src/main/java/javax/net/ssl/DefaultSSLContext.java
@@ -19,28 +19,24 @@ package javax.net.ssl;
import java.io.FileInputStream;
import java.security.AccessController;
+import java.security.KeyStore;
+import java.security.PrivilegedAction;
import java.security.Provider;
import java.security.Security;
-import java.security.KeyStore;
-import java.util.Iterator;
import org.apache.harmony.security.fortress.Engine;
import org.apache.harmony.security.fortress.Services;
-
/**
* Support class for this package.
- *
- * @since Android 1.0
*/
-
-class DefaultSSLContext {
+final class DefaultSSLContext {
private static SSLContext defaultSSLContext;
- public static SSLContext getContext() {
+ static synchronized SSLContext getContext() {
if (defaultSSLContext == null) {
defaultSSLContext = AccessController
- .doPrivileged(new java.security.PrivilegedAction<SSLContext>() {
+ .doPrivileged(new PrivilegedAction<SSLContext>() {
public SSLContext run() {
return findDefault();
}
@@ -51,40 +47,37 @@ class DefaultSSLContext {
private static SSLContext findDefault() {
// FIXME EXPORT CONTROL
- Provider.Service service;
- for (Iterator it1 = Services.getProvidersList().iterator(); it1
- .hasNext();) {
- service = Engine.door.getService((Provider) it1.next(),
- "SSLContext");
+ for (Provider provider : Services.getProvidersList()) {
+ final Provider.Service service = Engine.door.getService(provider, "SSLContext");
if (service != null) {
try {
- SSLContext con = new ContextImpl(
- (SSLContextSpi) service.newInstance(null),
- service.getProvider(),
- service.getAlgorithm());
+ SSLContext con = new SSLContext((SSLContextSpi) service.newInstance(null),
+ service.getProvider(), service.getAlgorithm());
- //TODO javax.net.ssl.keyStoreProvider, javax.net.ssl.trustStoreProvider system property
+ /*
+ * TODO
+ * javax.net.ssl.keyStoreProvider,
+ * javax.net.ssl.trustStoreProvider system property
+ */
+
// find KeyStore, KeyManagers
KeyManager[] keyManagers = null;
- KeyStore ks = KeyStore.getInstance(KeyStore
- .getDefaultType());
- String keystore = System
- .getProperty("javax.net.ssl.keyStore");
- String keystorepwd = System
- .getProperty("javax.net.ssl.keyStorePassword");
+ KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
+ String keystore = System.getProperty("javax.net.ssl.keyStore");
+ String keystorepwd = System.getProperty("javax.net.ssl.keyStorePassword");
char[] pwd = null;
if (keystorepwd != null) {
pwd = keystorepwd.toCharArray();
}
if (keystore != null) {
- FileInputStream fis = new java.io.FileInputStream(
- keystore);
- ks.load(fis, pwd);
- fis.close();
-
+ FileInputStream fis = new FileInputStream(keystore);
+ try {
+ ks.load(fis, pwd);
+ } finally {
+ fis.close();
+ }
KeyManagerFactory kmf;
- String kmfAlg = Security
- .getProperty("ssl.KeyManagerFactory.algorithm");
+ String kmfAlg = Security.getProperty("ssl.KeyManagerFactory.algorithm");
if (kmfAlg == null) {
kmfAlg = "SunX509";
}
@@ -96,21 +89,21 @@ class DefaultSSLContext {
// find TrustStore, TrustManagers
TrustManager[] trustManagers = null;
keystore = System.getProperty("javax.net.ssl.trustStore");
- keystorepwd = System
- .getProperty("javax.net.ssl.trustStorePassword");
+ keystorepwd = System.getProperty("javax.net.ssl.trustStorePassword");
pwd = null;
if (keystorepwd != null) {
pwd = keystorepwd.toCharArray();
}
- //TODO Defaults: jssecacerts; cacerts
+ // TODO Defaults: jssecacerts; cacerts
if (keystore != null) {
- FileInputStream fis = new java.io.FileInputStream(
- keystore);
- ks.load(fis, pwd);
- fis.close();
+ FileInputStream fis = new FileInputStream(keystore);
+ try {
+ ks.load(fis, pwd);
+ } finally {
+ fis.close();
+ }
TrustManagerFactory tmf;
- String tmfAlg = Security
- .getProperty("ssl.TrustManagerFactory.algorithm");
+ String tmfAlg = Security.getProperty("ssl.TrustManagerFactory.algorithm");
if (tmfAlg == null) {
tmfAlg = "PKIX";
}
@@ -122,7 +115,6 @@ class DefaultSSLContext {
con.init(keyManagers, trustManagers, null);
return con;
} catch (Exception e) {
- // e.printStackTrace();
// ignore and try another
}
}
diff --git a/x-net/src/main/java/javax/net/ssl/DefaultSSLServerSocketFactory.java b/x-net/src/main/java/javax/net/ssl/DefaultSSLServerSocketFactory.java
index c41f61a..6620841 100644
--- a/x-net/src/main/java/javax/net/ssl/DefaultSSLServerSocketFactory.java
+++ b/x-net/src/main/java/javax/net/ssl/DefaultSSLServerSocketFactory.java
@@ -29,33 +29,36 @@ import java.net.SocketException;
*/
class DefaultSSLServerSocketFactory extends SSLServerSocketFactory {
- private String errMessage;
-
+ private final String errMessage;
+
+ DefaultSSLServerSocketFactory(String mes) {
+ errMessage = mes;
+ }
+
+ @Override
public String[] getDefaultCipherSuites() {
return new String[0];
}
+ @Override
public String[] getSupportedCipherSuites() {
return new String[0];
}
+ @Override
public ServerSocket createServerSocket(int port) throws IOException {
throw new SocketException(errMessage);
}
-
- public ServerSocket createServerSocket(int port, int backlog)
- throws IOException {
+ @Override
+ public ServerSocket createServerSocket(int port, int backlog) throws IOException {
throw new SocketException(errMessage);
}
- public ServerSocket createServerSocket(int port, int backlog,
- InetAddress iAddress) throws IOException {
+ @Override
+ public ServerSocket createServerSocket(int port, int backlog, InetAddress iAddress)
+ throws IOException {
throw new SocketException(errMessage);
}
-
- DefaultSSLServerSocketFactory(String mes) {
- errMessage = mes;
- }
}
diff --git a/x-net/src/main/java/javax/net/ssl/DefaultSSLSocketFactory.java b/x-net/src/main/java/javax/net/ssl/DefaultSSLSocketFactory.java
index fc4e340..4035a0e 100644
--- a/x-net/src/main/java/javax/net/ssl/DefaultSSLSocketFactory.java
+++ b/x-net/src/main/java/javax/net/ssl/DefaultSSLSocketFactory.java
@@ -26,61 +26,51 @@ import java.net.UnknownHostException;
/**
* Default inoperative implementation of javax.net.ssl.SSLSocketFactory
*
- * @since Android 1.0
*/
class DefaultSSLSocketFactory extends SSLSocketFactory {
-
- private String errMessage;
-
+
+ private final String errMessage;
+
+ DefaultSSLSocketFactory(String mes) {
+ errMessage = mes;
+ }
+
+ @Override
public String[] getDefaultCipherSuites() {
return new String[0];
}
+ @Override
public String[] getSupportedCipherSuites() {
return new String[0];
}
- /**
- * @see javax.net.ssl.SSLSocketFactory#createSocket(java.net.Socket, java.lang.String, int, boolean)
- */
- public Socket createSocket(Socket s, String host, int port,
- boolean autoClose) throws IOException {
+ @Override
+ public Socket createSocket(Socket s, String host, int port, boolean autoClose)
+ throws IOException {
throw new SocketException(errMessage);
}
- /**
- * @see javax.net.SocketFactory#createSocket(java.lang.String, int)
- */
- public Socket createSocket(String host, int port) throws IOException,
- UnknownHostException {
+ @Override
+ public Socket createSocket(String host, int port) throws IOException, UnknownHostException {
throw new SocketException(errMessage);
}
- /**
- * @see javax.net.SocketFactory#createSocket(java.lang.String, int, java.net.InetAddress, int)
- */
- public Socket createSocket(String host, int port, InetAddress localHost,
- int localPort) throws IOException, UnknownHostException {
+ @Override
+ public Socket createSocket(String host, int port, InetAddress localHost, int localPort)
+ throws IOException, UnknownHostException {
throw new SocketException(errMessage);
}
- /**
- * @see javax.net.SocketFactory#createSocket(java.net.InetAddress, int)
- */
+ @Override
public Socket createSocket(InetAddress host, int port) throws IOException {
throw new SocketException(errMessage);
}
- /**
- * @see javax.net.SocketFactory#createSocket(java.net.InetAddress, int, java.net.InetAddress, int)
- */
- public Socket createSocket(InetAddress address, int port,
- InetAddress localAddress, int localPort) throws IOException {
+ @Override
+ public Socket createSocket(InetAddress address, int port, InetAddress localAddress,
+ int localPort) throws IOException {
throw new SocketException(errMessage);
}
-
- DefaultSSLSocketFactory(String mes) {
- errMessage = mes;
- }
}
diff --git a/x-net/src/main/java/javax/net/ssl/HandshakeCompletedEvent.java b/x-net/src/main/java/javax/net/ssl/HandshakeCompletedEvent.java
index 5ec5666..4618280 100644
--- a/x-net/src/main/java/javax/net/ssl/HandshakeCompletedEvent.java
+++ b/x-net/src/main/java/javax/net/ssl/HandshakeCompletedEvent.java
@@ -26,11 +26,8 @@ import java.util.EventObject;
/**
* The event object encapsulating the information about a completed SSL
* handshake on a SSL connection.
- *
- * @since Android 1.0
*/
-public class HandshakeCompletedEvent extends EventObject implements
- Serializable {
+public class HandshakeCompletedEvent extends EventObject implements Serializable {
/**
* The 5.0 spec. doesn't declare this serialVersionUID field In order to be
@@ -43,12 +40,11 @@ public class HandshakeCompletedEvent extends EventObject implements
/**
* Creates a new {@code HandshakeCompletedEvent} with the specified SSL
* socket and SSL session.
- *
+ *
* @param sock
* the SSL socket.
* @param s
* the SSL session.
- * @since Android 1.0
*/
public HandshakeCompletedEvent(SSLSocket sock, SSLSession s) {
super(sock);
@@ -57,9 +53,8 @@ public class HandshakeCompletedEvent extends EventObject implements
/**
* Returns the SSL session associated with this event.
- *
+ *
* @return the SSL session associated with this event.
- * @since Android 1.0
*/
public SSLSession getSession() {
return session;
@@ -67,9 +62,8 @@ public class HandshakeCompletedEvent extends EventObject implements
/**
* Returns the name of the cipher suite negotiated during this handshake.
- *
+ *
* @return the name of the cipher suite negotiated during this handshake.
- * @since Android 1.0
*/
public String getCipherSuite() {
return session.getCipherSuite();
@@ -78,11 +72,10 @@ public class HandshakeCompletedEvent extends EventObject implements
/**
* Returns the list of local certificates used during the handshake. These
* certificates were sent to the peer.
- *
+ *
* @return Returns the list of certificates used during the handshake with
* the local identity certificate followed by CAs, or {@code null}
* if no certificates were used during the handshake.
- * @since Android 1.0
*/
public Certificate[] getLocalCertificates() {
return session.getLocalCertificates();
@@ -91,15 +84,13 @@ public class HandshakeCompletedEvent extends EventObject implements
/**
* Return the list of certificates identifying the peer during the
* handshake.
- *
+ *
* @return the list of certificates identifying the peer with the peer's
* identity certificate followed by CAs.
* @throws SSLPeerUnverifiedException
* if the identity of the peer has not been verified.
- * @since Android 1.0
*/
- public Certificate[] getPeerCertificates()
- throws SSLPeerUnverifiedException {
+ public Certificate[] getPeerCertificates() throws SSLPeerUnverifiedException {
return session.getPeerCertificates();
}
@@ -109,48 +100,42 @@ public class HandshakeCompletedEvent extends EventObject implements
* certificates.
* <p>
* <b>Replaced by:</b> {@link #getPeerCertificates()}
- * </p>
- *
+ *
* @return the list of certificates identifying the peer
* @throws SSLPeerUnverifiedException
* if the identity of the peer has not been verified.
- * @since Android 1.0
*/
- public X509Certificate[] getPeerCertificateChain()
- throws SSLPeerUnverifiedException {
+ public X509Certificate[] getPeerCertificateChain() throws SSLPeerUnverifiedException {
return session.getPeerCertificateChain();
}
/**
* Returns the {@code Principal} identifying the peer.
- *
+ *
* @return the {@code Principal} identifying the peer.
* @throws SSLPeerUnverifiedException
* if the identity of the peer has not been verified.
- * @since Android 1.0
*/
public Principal getPeerPrincipal() throws SSLPeerUnverifiedException {
return session.getPeerPrincipal();
}
-
+
/**
* Returns the {@code Principal} used to identify during the handshake.
- *
+ *
* @return the {@code Principal} used to identify during the handshake.
- * @since Android 1.0
*/
public Principal getLocalPrincipal() {
return session.getLocalPrincipal();
}
-
+
/**
* Returns the SSL socket that produced this event.
- *
+ *
* @return the SSL socket that produced this event.
- * @since Android 1.0
*/
public SSLSocket getSocket() {
- return (SSLSocket)this.source;
+ return (SSLSocket) this.source;
}
-} \ No newline at end of file
+}
diff --git a/x-net/src/main/java/javax/net/ssl/HandshakeCompletedListener.java b/x-net/src/main/java/javax/net/ssl/HandshakeCompletedListener.java
index 9ffcbc1..5032c63 100644
--- a/x-net/src/main/java/javax/net/ssl/HandshakeCompletedListener.java
+++ b/x-net/src/main/java/javax/net/ssl/HandshakeCompletedListener.java
@@ -22,17 +22,13 @@ import java.util.EventListener;
/**
* The listener to be implemented to receive event notifications on completion
* of SSL handshake on an SSL connection.
- *
- * @since Android 1.0
*/
public interface HandshakeCompletedListener extends EventListener {
-
/**
* The callback method that is invoked when a SSL handshake is completed.
- *
+ *
* @param event
* the information on the completed SSL handshake event.
- * @since Android 1.0
*/
- public void handshakeCompleted(HandshakeCompletedEvent event);
-} \ No newline at end of file
+ void handshakeCompleted(HandshakeCompletedEvent event);
+}
diff --git a/x-net/src/main/java/javax/net/ssl/HostnameVerifier.java b/x-net/src/main/java/javax/net/ssl/HostnameVerifier.java
index fe767ef..805762e 100644
--- a/x-net/src/main/java/javax/net/ssl/HostnameVerifier.java
+++ b/x-net/src/main/java/javax/net/ssl/HostnameVerifier.java
@@ -23,23 +23,18 @@ package javax.net.ssl;
* This is an extended verification option that implementers can provide. It is to be used
* during a handshake if the URL's hostname does not match the peer's
* identification hostname.
- * </p>
- *
- * @since Android 1.0
*/
public interface HostnameVerifier {
-
/**
* Verifies that the specified hostname is allowed within the specified SSL
* session.
- *
+ *
* @param hostname
* the hostname.
* @param session
* the SSL session of the connection.
* @return {@code true} if the specified hostname is allowed, otherwise
* {@code false}.
- * @since Android 1.0
*/
- public boolean verify(String hostname, SSLSession session);
-} \ No newline at end of file
+ boolean verify(String hostname, SSLSession session);
+}
diff --git a/x-net/src/main/java/javax/net/ssl/HttpsURLConnection.java b/x-net/src/main/java/javax/net/ssl/HttpsURLConnection.java
index 0a95fb1..8c49690 100644
--- a/x-net/src/main/java/javax/net/ssl/HttpsURLConnection.java
+++ b/x-net/src/main/java/javax/net/ssl/HttpsURLConnection.java
@@ -26,8 +26,6 @@ import java.security.cert.X509Certificate;
/**
* This abstract subclass of {@code HttpURLConnection} defines methods for
* managing HTTPS connections according to the description given by RFC 2818.
- *
- * @since Android 1.0
*/
public abstract class HttpsURLConnection extends HttpURLConnection {
@@ -37,140 +35,149 @@ public abstract class HttpsURLConnection extends HttpURLConnection {
.getDefault();
/**
+ * Sets the default hostname verifier to be used by new instances.
+ *
+ * @param v
+ * the new default hostname verifier
+ * @throws IllegalArgumentException
+ * if the specified verifier is {@code null}.
+ */
+ public static void setDefaultHostnameVerifier(HostnameVerifier v) {
+ if (v == null) {
+ throw new IllegalArgumentException("HostnameVerifier is null");
+ }
+ defaultHostnameVerifier = v;
+ }
+
+ /**
+ * Returns the default hostname verifier.
+ *
+ * @return the default hostname verifier.
+ */
+ public static HostnameVerifier getDefaultHostnameVerifier() {
+ return defaultHostnameVerifier;
+ }
+
+ /**
+ * Sets the default SSL socket factory to be used by new instances.
+ *
+ * @param sf
+ * the new default SSL socket factory.
+ * @throws IllegalArgumentException
+ * if the specified socket factory is {@code null}.
+ */
+ public static void setDefaultSSLSocketFactory(SSLSocketFactory sf) {
+ if (sf == null) {
+ throw new IllegalArgumentException("SSLSocketFactory is null");
+ }
+ defaultSSLSocketFactory = sf;
+ }
+
+ /**
+ * Returns the default SSL socket factory for new instances.
+ *
+ * @return the default SSL socket factory for new instances.
+ */
+ public static SSLSocketFactory getDefaultSSLSocketFactory() {
+ return defaultSSLSocketFactory;
+ }
+
+ /**
* The host name verifier used by this connection. It is initialized from
* the default hostname verifier
* {@link #setDefaultHostnameVerifier(HostnameVerifier)} or
* {@link #getDefaultHostnameVerifier()}.
- *
- * @since Android 1.0
*/
protected HostnameVerifier hostnameVerifier;
- private static SSLSocketFactory socketFactory;
+ private SSLSocketFactory sslSocketFactory;
/**
* Creates a new {@code HttpsURLConnection} with the specified {@code URL}.
- *
+ *
* @param url
* the {@code URL} to connect to.
- * @since Android 1.0
*/
protected HttpsURLConnection(URL url) {
super(url);
hostnameVerifier = defaultHostnameVerifier;
- socketFactory = defaultSSLSocketFactory;
+ sslSocketFactory = defaultSSLSocketFactory;
}
/**
* Returns the name of the cipher suite negotiated during the SSL handshake.
- *
+ *
* @return the name of the cipher suite negotiated during the SSL handshake.
* @throws IllegalStateException
* if no connection has been established yet.
- * @since Android 1.0
*/
public abstract String getCipherSuite();
/**
* Returns the list of local certificates used during the handshake. These
* certificates were sent to the peer.
- *
+ *
* @return Returns the list of certificates used during the handshake with
* the local identity certificate followed by CAs, or {@code null}
* if no certificates were used during the handshake.
* @throws IllegalStateException
* if no connection has been established yet.
- * @since Android 1.0
- */
+ */
public abstract Certificate[] getLocalCertificates();
/**
* Return the list of certificates identifying the peer during the
* handshake.
- *
+ *
* @return the list of certificates identifying the peer with the peer's
* identity certificate followed by CAs.
* @throws SSLPeerUnverifiedException
* if the identity of the peer has not been verified..
* @throws IllegalStateException
* if no connection has been established yet.
- * @since Android 1.0
- */
- public abstract Certificate[] getServerCertificates()
- throws SSLPeerUnverifiedException;
+ */
+ public abstract Certificate[] getServerCertificates() throws SSLPeerUnverifiedException;
/**
* Returns the {@code Principal} identifying the peer.
- *
+ *
* @return the {@code Principal} identifying the peer.
* @throws SSLPeerUnverifiedException
* if the identity of the peer has not been verified.
* @throws IllegalStateException
* if no connection has been established yet.
- * @since Android 1.0
*/
public Principal getPeerPrincipal() throws SSLPeerUnverifiedException {
Certificate[] certs = getServerCertificates();
- if (certs == null || certs.length == 0 ||
- (!(certs[0] instanceof X509Certificate))) {
- throw new SSLPeerUnverifiedException(
- "No server's end-entity certificate");
+ if (certs == null || certs.length == 0 || (!(certs[0] instanceof X509Certificate))) {
+ throw new SSLPeerUnverifiedException("No server's end-entity certificate");
}
return ((X509Certificate) certs[0]).getSubjectX500Principal();
}
/**
* Returns the {@code Principal} used to identify the local host during the handshake.
- *
+ *
* @return the {@code Principal} used to identify the local host during the handshake, or
* {@code null} if none was used.
* @throws IllegalStateException
* if no connection has been established yet.
- * @since Android 1.0
- */
+ */
public Principal getLocalPrincipal() {
Certificate[] certs = getLocalCertificates();
- if (certs == null || certs.length == 0
- || (!(certs[0] instanceof X509Certificate))) {
+ if (certs == null || certs.length == 0 || (!(certs[0] instanceof X509Certificate))) {
return null;
}
return ((X509Certificate) certs[0]).getSubjectX500Principal();
}
/**
- * Sets the default hostname verifier to be used by new instances.
- *
- * @param v
- * the new default hostname verifier
- * @throws IllegalArgumentException
- * if the specified verifier is {@code null}.
- * @since Android 1.0
- */
- public static void setDefaultHostnameVerifier(HostnameVerifier v) {
- if (v == null) {
- throw new IllegalArgumentException("HostnameVerifier is null");
- }
- defaultHostnameVerifier = v;
- }
-
- /**
- * Returns the default hostname verifier.
- *
- * @return the default hostname verifier.
- * @since Android 1.0
- */
- public static HostnameVerifier getDefaultHostnameVerifier() {
- return defaultHostnameVerifier;
- }
-
- /**
* Sets the hostname verifier for this instance.
- *
+ *
* @param v
* the hostname verifier for this instance.
* @throws IllegalArgumentException
* if the specified verifier is {@code null}.
- * @since Android 1.0
*/
public void setHostnameVerifier(HostnameVerifier v) {
if (v == null) {
@@ -181,64 +188,35 @@ public abstract class HttpsURLConnection extends HttpURLConnection {
/**
* Returns the hostname verifier used by this instance.
- *
+ *
* @return the hostname verifier used by this instance.
- * @since Android 1.0
*/
public HostnameVerifier getHostnameVerifier() {
return hostnameVerifier;
}
/**
- * Sets the default SSL socket factory to be used by new instances.
- *
- * @param sf
- * the new default SSL socket factory.
- * @throws IllegalArgumentException
- * if the specified socket factory is {@code null}.
- * @since Android 1.0
- */
- public static void setDefaultSSLSocketFactory(SSLSocketFactory sf) {
- if (sf == null) {
- throw new IllegalArgumentException("SSLSocketFactory is null");
- }
- defaultSSLSocketFactory = sf;
- }
-
- /**
- * Returns the default SSL socket factory for new instances.
- *
- * @return the default SSL socket factory for new instances.
- * @since Android 1.0
- */
- public static SSLSocketFactory getDefaultSSLSocketFactory() {
- return defaultSSLSocketFactory;
- }
-
- /**
* Sets the SSL socket factory for this instance.
- *
+ *
* @param sf
* the SSL socket factory to be used by this instance.
* @throws IllegalArgumentException
* if the specified socket factory is {@code null}.
- * @since Android 1.0
*/
public void setSSLSocketFactory(SSLSocketFactory sf) {
if (sf == null) {
throw new IllegalArgumentException("SSLSocketFactory is null");
}
- socketFactory = sf;
+ sslSocketFactory = sf;
}
/**
* Returns the SSL socket factory used by this instance.
- *
+ *
* @return the SSL socket factory used by this instance.
- * @since Android 1.0
*/
public SSLSocketFactory getSSLSocketFactory() {
- return socketFactory;
+ return sslSocketFactory;
}
}
diff --git a/x-net/src/main/java/javax/net/ssl/KeyManager.java b/x-net/src/main/java/javax/net/ssl/KeyManager.java
index 08939f7..30c8032 100644
--- a/x-net/src/main/java/javax/net/ssl/KeyManager.java
+++ b/x-net/src/main/java/javax/net/ssl/KeyManager.java
@@ -18,12 +18,10 @@
package javax.net.ssl;
/**
- * This is the interface to implement in order to mark a class as a JSSE key managers
- * so that key managers can be easily grouped.
- * The key managers are responsible for handling the keys used to
- * authenticate the local side to its peer,
- *
- * @since Android 1.0
+ * This is the interface to implement in order to mark a class as a JSSE key
+ * managers so that key managers can be easily grouped. The key managers are
+ * responsible for handling the keys used to authenticate the local side to its
+ * peer,
*/
public interface KeyManager {
-} \ No newline at end of file
+}
diff --git a/x-net/src/main/java/javax/net/ssl/KeyManagerFactory.java b/x-net/src/main/java/javax/net/ssl/KeyManagerFactory.java
index a47d736..99a37a8 100644
--- a/x-net/src/main/java/javax/net/ssl/KeyManagerFactory.java
+++ b/x-net/src/main/java/javax/net/ssl/KeyManagerFactory.java
@@ -17,23 +17,21 @@
package javax.net.ssl;
-import org.apache.harmony.security.fortress.Engine;
-
import java.security.AccessController;
import java.security.InvalidAlgorithmParameterException;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
+import java.security.PrivilegedAction;
import java.security.Provider;
import java.security.Security;
import java.security.UnrecoverableKeyException;
+import org.apache.harmony.security.fortress.Engine;
/**
* The public API for {@code KeyManagerFactory} implementations.
- *
- * @since Android 1.0
*/
public class KeyManagerFactory {
// Store KeyManagerFactory service name
@@ -45,47 +43,26 @@ public class KeyManagerFactory {
// Store default property name
private static final String PROPERTY_NAME = "ssl.KeyManagerFactory.algorithm";
- // Store used provider
- private final Provider provider;
-
- // Store used KeyManagerFactorySpi implementation
- private final KeyManagerFactorySpi spiImpl;
-
- // Store used algorithm
- private final String algorithm;
-
- /**
- * Creates a new {@code KeyManagerFactory}.
- *
- * @param factorySpi
- * the implementation delegate.
- * @param provider
- * the provider.
- * @param algorithm
- * the key management algorithm name.
- * @since Android 1.0
- */
- protected KeyManagerFactory(KeyManagerFactorySpi factorySpi,
- Provider provider, String algorithm) {
- this.provider = provider;
- this.algorithm = algorithm;
- this.spiImpl = factorySpi;
- }
-
/**
- * Returns the name of the key management algorithm.
- *
- * @return the name of the key management algorithm.
- * @since Android 1.0
+ * Returns the default key manager factory algorithm name.
+ * <p>
+ * The default algorithm name is specified by the security property:
+ * {@code 'ssl.KeyManagerFactory.algorithm'}.
+ *
+ * @return the default algorithm name.
*/
- public final String getAlgorithm() {
- return algorithm;
+ public static final String getDefaultAlgorithm() {
+ return AccessController.doPrivileged(new PrivilegedAction<String>() {
+ public String run() {
+ return Security.getProperty(PROPERTY_NAME);
+ }
+ });
}
/**
* Creates a new {@code KeyManagerFactory} instance for the specified key
* management algorithm.
- *
+ *
* @param algorithm
* the name of the requested key management algorithm.
* @return a key manager factory for the requested algorithm.
@@ -94,24 +71,23 @@ public class KeyManagerFactory {
* @throws NullPointerException
* if {@code algorithm} is {@code null} (instead of
* NoSuchAlgorithmException as in 1.4 release)
- * @since Android 1.0
*/
public static final KeyManagerFactory getInstance(String algorithm)
throws NoSuchAlgorithmException {
if (algorithm == null) {
- throw new NullPointerException("algorith is null");
+ throw new NullPointerException("algorithm is null");
}
synchronized (engine) {
engine.getInstance(algorithm, null);
- return new KeyManagerFactory((KeyManagerFactorySpi) engine.spi,
- engine.provider, algorithm);
+ return new KeyManagerFactory((KeyManagerFactorySpi) engine.spi, engine.provider,
+ algorithm);
}
}
/**
* Creates a new {@code KeyManagerFactory} instance for the specified key
* management algorithm from the specified provider.
- *
+ *
* @param algorithm
* the name of the requested key management algorithm name.
* @param provider
@@ -126,11 +102,9 @@ public class KeyManagerFactory {
* @throws NullPointerException
* if {@code algorithm} is {@code null} (instead of
* NoSuchAlgorithmException as in 1.4 release)
- * @since Android 1.0
*/
- public static final KeyManagerFactory getInstance(String algorithm,
- String provider) throws NoSuchAlgorithmException,
- NoSuchProviderException {
+ public static final KeyManagerFactory getInstance(String algorithm, String provider)
+ throws NoSuchAlgorithmException, NoSuchProviderException {
if ((provider == null) || (provider.length() == 0)) {
throw new IllegalArgumentException("Provider is null or empty");
}
@@ -144,7 +118,7 @@ public class KeyManagerFactory {
/**
* Creates a new {@code KeyManagerFactory} instance for the specified key
* management algorithm from the specified provider.
- *
+ *
* @param algorithm
* the name of the requested key management algorithm name.
* @param provider
@@ -156,28 +130,60 @@ public class KeyManagerFactory {
* @throws NullPointerException
* if {@code algorithm} is {@code null} (instead of
* NoSuchAlgorithmException as in 1.4 release)
- * @since Android 1.0
*/
- public static final KeyManagerFactory getInstance(String algorithm,
- Provider provider) throws NoSuchAlgorithmException {
+ public static final KeyManagerFactory getInstance(String algorithm, Provider provider)
+ throws NoSuchAlgorithmException {
if (provider == null) {
throw new IllegalArgumentException("Provider is null");
}
if (algorithm == null) {
- throw new NullPointerException("algorith is null");
+ throw new NullPointerException("algorithm is null");
}
synchronized (engine) {
engine.getInstance(algorithm, provider, null);
- return new KeyManagerFactory((KeyManagerFactorySpi) engine.spi,
- provider, algorithm);
+ return new KeyManagerFactory((KeyManagerFactorySpi) engine.spi, provider, algorithm);
}
}
+ // Store used provider
+ private final Provider provider;
+
+ // Store used KeyManagerFactorySpi implementation
+ private final KeyManagerFactorySpi spiImpl;
+
+ // Store used algorithm
+ private final String algorithm;
+
+ /**
+ * Creates a new {@code KeyManagerFactory}.
+ *
+ * @param factorySpi
+ * the implementation delegate.
+ * @param provider
+ * the provider.
+ * @param algorithm
+ * the key management algorithm name.
+ */
+ protected KeyManagerFactory(KeyManagerFactorySpi factorySpi, Provider provider, String algorithm) {
+ super();
+ this.provider = provider;
+ this.algorithm = algorithm;
+ this.spiImpl = factorySpi;
+ }
+
+ /**
+ * Returns the name of the key management algorithm.
+ *
+ * @return the name of the key management algorithm.
+ */
+ public final String getAlgorithm() {
+ return algorithm;
+ }
+
/**
* Returns the provider for this {@code KeyManagerFactory} instance.
- *
+ *
* @return the provider for this {@code KeyManagerFactory} instance.
- * @since Android 1.0
*/
public final Provider getProvider() {
return provider;
@@ -185,7 +191,7 @@ public class KeyManagerFactory {
/**
* Initializes this instance with the specified key store and password.
- *
+ *
* @param ks
* the key store or {@code null} to use the default key store.
* @param password
@@ -197,55 +203,31 @@ public class KeyManagerFactory {
* if a required algorithm is not available.
* @throws UnrecoverableKeyException
* if a key cannot be recovered.
- * @since Android 1.0
*/
- public final void init(KeyStore ks, char[] password)
- throws KeyStoreException, NoSuchAlgorithmException,
- UnrecoverableKeyException {
+ public final void init(KeyStore ks, char[] password) throws KeyStoreException,
+ NoSuchAlgorithmException, UnrecoverableKeyException {
spiImpl.engineInit(ks, password);
}
/**
* Initializes this instance with the specified factory parameters.
- *
+ *
* @param spec
* the factory parameters.
* @throws InvalidAlgorithmParameterException
* if an error occurs.
- * @since Android 1.0
*/
- public final void init(ManagerFactoryParameters spec)
- throws InvalidAlgorithmParameterException {
+ public final void init(ManagerFactoryParameters spec) throws InvalidAlgorithmParameterException {
spiImpl.engineInit(spec);
}
/**
* Returns a list of key managers, one instance for each type of key in the
* key store.
- *
+ *
* @return a list of key managers.
- * @since Android 1.0
*/
public final KeyManager[] getKeyManagers() {
return spiImpl.engineGetKeyManagers();
}
-
- /**
- * Returns the default key manager factory algorithm name.
- * <p>
- * The default algorithm name is specified by the security property:
- * {@code 'ssl.KeyManagerFactory.algorithm'}.
- * </p>
- *
- * @return the default algorithm name.
- * @since Android 1.0
- */
- public static final String getDefaultAlgorithm() {
- return AccessController
- .doPrivileged(new java.security.PrivilegedAction<String>() {
- public String run() {
- return Security.getProperty(PROPERTY_NAME);
- }
- });
- }
-} \ No newline at end of file
+}
diff --git a/x-net/src/main/java/javax/net/ssl/KeyManagerFactorySpi.java b/x-net/src/main/java/javax/net/ssl/KeyManagerFactorySpi.java
index 7cdccf8..39925f9 100644
--- a/x-net/src/main/java/javax/net/ssl/KeyManagerFactorySpi.java
+++ b/x-net/src/main/java/javax/net/ssl/KeyManagerFactorySpi.java
@@ -26,23 +26,19 @@ import java.security.UnrecoverableKeyException;
/**
* The <i>Service Provider Interface</i> (SPI) for the
* {@code KeyManagerFactory} class.
- *
- * @since Android 1.0
*/
-
public abstract class KeyManagerFactorySpi {
-
+
/**
* Creates a new {@code KeyManagerFactorySpi} instance.
- *
- * @since Android 1.0
*/
public KeyManagerFactorySpi() {
+ super();
}
/**
* Initializes this instance with the specified key store and password.
- *
+ *
* @param ks
* the key store or {@code null} to use the default key store.
* @param password
@@ -53,20 +49,17 @@ public abstract class KeyManagerFactorySpi {
* if a required algorithm is not available.
* @throws UnrecoverableKeyException
* if a key cannot be recovered.
- * @since Android 1.0
*/
- protected abstract void engineInit(KeyStore ks, char[] password)
- throws KeyStoreException, NoSuchAlgorithmException,
- UnrecoverableKeyException;
+ protected abstract void engineInit(KeyStore ks, char[] password) throws KeyStoreException,
+ NoSuchAlgorithmException, UnrecoverableKeyException;
/**
* Initializes this instance with the specified factory parameters.
- *
+ *
* @param spec
* the factory parameters.
* @throws InvalidAlgorithmParameterException
* if an error occurs.
- * @since Android 1.0
*/
protected abstract void engineInit(ManagerFactoryParameters spec)
throws InvalidAlgorithmParameterException;
@@ -74,9 +67,8 @@ public abstract class KeyManagerFactorySpi {
/**
* Returns a list of key managers, one instance for each type of key in the
* key store.
- *
+ *
* @return a list of key managers.
- * @since Android 1.0
*/
protected abstract KeyManager[] engineGetKeyManagers();
-} \ No newline at end of file
+}
diff --git a/x-net/src/main/java/javax/net/ssl/KeyStoreBuilderParameters.java b/x-net/src/main/java/javax/net/ssl/KeyStoreBuilderParameters.java
index b000fd5..d30cc8a 100644
--- a/x-net/src/main/java/javax/net/ssl/KeyStoreBuilderParameters.java
+++ b/x-net/src/main/java/javax/net/ssl/KeyStoreBuilderParameters.java
@@ -25,12 +25,13 @@ import java.security.KeyStore;
/**
* The parameters for {@code KeyManager}s. The parameters are a list of
* {@code KeyStore.Builder}s.
- *
- * @since Android 1.0
+ *
+ * @since 1.5
+ * @see KeyStore.Builder
*/
public class KeyStoreBuilderParameters implements ManagerFactoryParameters {
- private List ksbuilders;
+ private final List<KeyStore.Builder> ksbuilders;
/**
* Creates a new {@code KeyStoreBuilderParameters} with the specified key
@@ -38,13 +39,10 @@ public class KeyStoreBuilderParameters implements ManagerFactoryParameters {
*
* @param builder
* the key store builder.
- * @since Android 1.0
*/
public KeyStoreBuilderParameters(KeyStore.Builder builder) {
- ksbuilders = new ArrayList();
- if (builder != null) {
- ksbuilders.add(builder);
- }
+ super();
+ ksbuilders = Collections.singletonList(builder);
}
/**
@@ -55,16 +53,17 @@ public class KeyStoreBuilderParameters implements ManagerFactoryParameters {
* the list of key store builders
* @throws IllegalArgumentException
* if the specified list is empty.
- * @since Android 1.0
*/
+ @SuppressWarnings("unchecked")
public KeyStoreBuilderParameters(List parameters) {
+ super();
if (parameters == null) {
throw new NullPointerException("Builders list is null");
}
if (parameters.isEmpty()) {
throw new IllegalArgumentException("Builders list is empty");
}
- ksbuilders = new ArrayList(parameters);
+ ksbuilders = Collections.unmodifiableList(new ArrayList<KeyStore.Builder>(parameters));
}
/**
@@ -72,9 +71,9 @@ public class KeyStoreBuilderParameters implements ManagerFactoryParameters {
* with this parameters instance.
*
* @return the unmodifiable list of {@code KeyStore.Builder}s.
- * @since Android 1.0
*/
+ @SuppressWarnings("unchecked")
public List getParameters() {
- return Collections.unmodifiableList(ksbuilders);
+ return ksbuilders;
}
}
diff --git a/x-net/src/main/java/javax/net/ssl/ManagerFactoryParameters.java b/x-net/src/main/java/javax/net/ssl/ManagerFactoryParameters.java
index 8909e62..b90deeb 100644
--- a/x-net/src/main/java/javax/net/ssl/ManagerFactoryParameters.java
+++ b/x-net/src/main/java/javax/net/ssl/ManagerFactoryParameters.java
@@ -20,8 +20,8 @@ package javax.net.ssl;
/**
* The marker interface for key manager factory parameters. Its purpose is to
* group key manager factory parameters objects.
- *
- * @since Android 1.0
+ *
+ * @since 1.4
*/
public interface ManagerFactoryParameters {
-} \ No newline at end of file
+}
diff --git a/x-net/src/main/java/javax/net/ssl/SSLContext.java b/x-net/src/main/java/javax/net/ssl/SSLContext.java
index 10d3a60..8a0a157 100644
--- a/x-net/src/main/java/javax/net/ssl/SSLContext.java
+++ b/x-net/src/main/java/javax/net/ssl/SSLContext.java
@@ -30,10 +30,7 @@ import org.apache.harmony.security.fortress.Engine;
/**
* The public API for secure socket protocol implementations. It acts as factory
* for {@code SSLSocketFactory}'s and {@code SSLEngine}s.
- *
- * @since Android 1.0
*/
-
public class SSLContext {
// StoreSSLContext service name
private static final String SERVICE = "SSLContext";
@@ -41,36 +38,9 @@ public class SSLContext {
// Used to access common engine functionality
private static Engine engine = new Engine(SERVICE);
- // Storeused provider
- private final Provider provider;
-
- // Storeused SSLContextSpi implementation
- private final SSLContextSpi spiImpl;
-
- // Storeused protocol
- private final String protocol;
-
- /**
- * Creates a new {@code SSLContext}.
- *
- * @param contextSpi
- * the implementation delegate.
- * @param provider
- * the provider.
- * @param protocol
- * the protocol name.
- * @since Android 1.0
- */
- protected SSLContext(SSLContextSpi contextSpi, Provider provider,
- String protocol) {
- this.provider = provider;
- this.protocol = protocol;
- this.spiImpl = contextSpi;
- }
-
/**
* Creates a new {@code SSLContext} instance for the specified protocol.
- *
+ *
* @param protocol
* the requested protocol to create a context for.
* @return the created {@code SSLContext} instance.
@@ -79,24 +49,21 @@ public class SSLContext {
* @throws NullPointerException
* if {@code protocol} is {@code null} (instead of
* NoSuchAlgorithmException as in 1.4 release)
- * @since Android 1.0
*/
- public static SSLContext getInstance(String protocol)
- throws NoSuchAlgorithmException {
+ public static SSLContext getInstance(String protocol) throws NoSuchAlgorithmException {
if (protocol == null) {
throw new NullPointerException("protocol is null");
}
synchronized (engine) {
engine.getInstance(protocol, null);
- return new SSLContext((SSLContextSpi) engine.spi, engine.provider,
- protocol);
+ return new SSLContext((SSLContextSpi) engine.spi, engine.provider, protocol);
}
}
/**
* Creates a new {@code SSLContext} instance for the specified protocol from
* the specified provider.
- *
+ *
* @param protocol
* the requested protocol to create a context for.
* @param provider
@@ -110,7 +77,6 @@ public class SSLContext {
* @throws NullPointerException
* if {@code protocol} is {@code null} (instead of
* NoSuchAlgorithmException as in 1.4 release)
- * @since Android 1.0
*/
public static SSLContext getInstance(String protocol, String provider)
throws NoSuchAlgorithmException, NoSuchProviderException {
@@ -130,7 +96,7 @@ public class SSLContext {
/**
* Creates a new {@code SSLContext} instance for the specified protocol from
* the specified provider.
- *
+ *
* @param protocol
* the requested protocol to create a context for
* @param provider
@@ -142,7 +108,6 @@ public class SSLContext {
* @throws NullPointerException
* if {@code protocol} is {@code null} (instead of
* NoSuchAlgorithmException as in 1.4 release)
- * @since Android 1.0
*/
public static SSLContext getInstance(String protocol, Provider provider)
throws NoSuchAlgorithmException {
@@ -158,11 +123,32 @@ public class SSLContext {
}
}
+ private final Provider provider;
+
+ private final SSLContextSpi spiImpl;
+
+ private final String protocol;
+
+ /**
+ * Creates a new {@code SSLContext}.
+ *
+ * @param contextSpi
+ * the implementation delegate.
+ * @param provider
+ * the provider.
+ * @param protocol
+ * the protocol name.
+ */
+ protected SSLContext(SSLContextSpi contextSpi, Provider provider, String protocol) {
+ this.provider = provider;
+ this.protocol = protocol;
+ this.spiImpl = contextSpi;
+ }
+
/**
* Returns the name of the secure socket protocol of this instance.
- *
+ *
* @return the name of the secure socket protocol of this instance.
- * @since Android 1.0
*/
public final String getProtocol() {
return protocol;
@@ -170,9 +156,8 @@ public class SSLContext {
/**
* Returns the provider of this {@code SSLContext} instance.
- *
+ *
* @return the provider of this {@code SSLContext} instance.
- * @since Android 1.0
*/
public final Provider getProvider() {
return provider;
@@ -182,7 +167,7 @@ public class SSLContext {
* Initializes this {@code SSLContext} instance. All of the arguments are
* optional, and the security providers will be searched for the required
* implementations of the needed algorithms.
- *
+ *
* @param km
* the key sources or {@code null}.
* @param tm
@@ -191,7 +176,6 @@ public class SSLContext {
* the randomness source or {@code null.}
* @throws KeyManagementException
* if initializing this instance fails.
- * @since Android 1.0
*/
public final void init(KeyManager[] km, TrustManager[] tm, SecureRandom sr)
throws KeyManagementException {
@@ -200,9 +184,8 @@ public class SSLContext {
/**
* Returns a socket factory for this instance.
- *
+ *
* @return a socket factory for this instance.
- * @since Android 1.0
*/
public final SSLSocketFactory getSocketFactory() {
return spiImpl.engineGetSocketFactory();
@@ -210,9 +193,8 @@ public class SSLContext {
/**
* Returns a server socket factory for this instance.
- *
+ *
* @return a server socket factory for this instance.
- * @since Android 1.0
*/
public final SSLServerSocketFactory getServerSocketFactory() {
return spiImpl.engineGetServerSocketFactory();
@@ -220,11 +202,10 @@ public class SSLContext {
/**
* Creates an {@code SSLEngine} instance from this context.
- *
+ *
* @return an {@code SSLEngine} instance from this context.
* @throws UnsupportedOperationException
* if the provider does not support the operation.
- * @since Android 1.0
*/
public final SSLEngine createSSLEngine() {
return spiImpl.engineCreateSSLEngine();
@@ -233,7 +214,7 @@ public class SSLContext {
/**
* Creates an {@code SSLEngine} instance from this context with the
* specified hostname and port.
- *
+ *
* @param peerHost
* the name of the host
* @param peerPort
@@ -241,7 +222,6 @@ public class SSLContext {
* @return an {@code SSLEngine} instance from this context.
* @throws UnsupportedOperationException
* if the provider does not support the operation.
- * @since Android 1.0
*/
public final SSLEngine createSSLEngine(String peerHost, int peerPort) {
return spiImpl.engineCreateSSLEngine(peerHost, peerPort);
@@ -250,11 +230,10 @@ public class SSLContext {
/**
* Returns the SSL session context that encapsulates the set of SSL sessions
* that can be used for handshake of server-side SSL sockets.
- *
+ *
* @return the SSL server session context for this context or {@code null}
* if the underlying provider does not provide an implementation of
* the {@code SSLSessionContext} interface.
- * @since Android 1.0
*/
public final SSLSessionContext getServerSessionContext() {
return spiImpl.engineGetServerSessionContext();
@@ -263,13 +242,12 @@ public class SSLContext {
/**
* Returns the SSL session context that encapsulates the set of SSL sessions
* that can be used for handshake of client-side SSL sockets.
- *
+ *
* @return the SSL client session context for this context or {@code null}
* if the underlying provider does not provide an implementation of
* the {@code SSLSessionContext} interface.
- * @since Android 1.0
*/
public final SSLSessionContext getClientSessionContext() {
return spiImpl.engineGetClientSessionContext();
}
-} \ No newline at end of file
+}
diff --git a/x-net/src/main/java/javax/net/ssl/SSLContextSpi.java b/x-net/src/main/java/javax/net/ssl/SSLContextSpi.java
index 6b2a60e..44d2c59 100644
--- a/x-net/src/main/java/javax/net/ssl/SSLContextSpi.java
+++ b/x-net/src/main/java/javax/net/ssl/SSLContextSpi.java
@@ -20,28 +20,23 @@ package javax.net.ssl;
import java.security.KeyManagementException;
import java.security.SecureRandom;
-
/**
* The <i>Service Provider Interface</i> (SPI) for the {@code SSLContext} class.
- *
- * @since Android 1.0
*/
-
public abstract class SSLContextSpi {
/**
* Creates a new {@code SSLContextSpi} instance.
- *
- * @since Android 1.0
*/
public SSLContextSpi() {
+ super();
}
/**
* Initializes this {@code SSLContext} instance. All of the arguments are
* optional, and the security providers will be searched for the required
* implementations of the needed algorithms.
- *
+ *
* @param km
* the key sources or {@code null}.
* @param tm
@@ -50,31 +45,28 @@ public abstract class SSLContextSpi {
* the randomness source or {@code null.}
* @throws KeyManagementException
* if initializing this instance fails.
- * @since Android 1.0
- */
- protected abstract void engineInit(KeyManager[] km, TrustManager[] tm,
- SecureRandom sr) throws KeyManagementException;
+ */
+ protected abstract void engineInit(KeyManager[] km, TrustManager[] tm, SecureRandom sr)
+ throws KeyManagementException;
/**
* Returns a socket factory for this instance.
- *
+ *
* @return a socket factory for this instance.
- * @since Android 1.0
*/
protected abstract SSLSocketFactory engineGetSocketFactory();
/**
* Returns a server socket factory for this instance.
- *
+ *
* @return a server socket factory for this instance.
- * @since Android 1.0
*/
protected abstract SSLServerSocketFactory engineGetServerSocketFactory();
/**
* Creates an {@code SSLEngine} instance from this context with the
* specified hostname and port.
- *
+ *
* @param host
* the name of the host
* @param port
@@ -82,40 +74,36 @@ public abstract class SSLContextSpi {
* @return an {@code SSLEngine} instance from this context.
* @throws UnsupportedOperationException
* if the provider does not support the operation.
- * @since Android 1.0
*/
protected abstract SSLEngine engineCreateSSLEngine(String host, int port);
/**
* Creates an {@code SSLEngine} instance from this context.
- *
+ *
* @return an {@code SSLEngine} instance from this context.
* @throws UnsupportedOperationException
* if the provider does not support the operation.
- * @since Android 1.0
*/
protected abstract SSLEngine engineCreateSSLEngine();
/**
* Returns the SSL session context that encapsulates the set of SSL sessions
* that can be used for the server side of the SSL handshake.
- *
+ *
* @return the SSL server session context for this context or {@code null}
* if the underlying provider does not provide an implementation of
* the {@code SSLSessionContext} interface.
- * @since Android 1.0
*/
protected abstract SSLSessionContext engineGetServerSessionContext();
/**
* Returns the SSL session context that encapsulates the set of SSL sessions
* that can be used for the client side of the SSL handshake.
- *
+ *
* @return the SSL client session context for this context or {@code null}
* if the underlying provider does not provide an implementation of
* the {@code SSLSessionContext} interface.
- * @since Android 1.0
*/
protected abstract SSLSessionContext engineGetClientSessionContext();
-} \ No newline at end of file
+}
diff --git a/x-net/src/main/java/javax/net/ssl/SSLEngine.java b/x-net/src/main/java/javax/net/ssl/SSLEngine.java
index be5d266..46e11a4 100644
--- a/x-net/src/main/java/javax/net/ssl/SSLEngine.java
+++ b/x-net/src/main/java/javax/net/ssl/SSLEngine.java
@@ -15,48 +15,62 @@
* limitations under the License.
*/
- package javax.net.ssl;
+package javax.net.ssl;
import java.nio.ByteBuffer;
-import java.nio.ReadOnlyBufferException;
/**
* The abstract implementation of secure communications using SSL, TLS, or other
- * protocols. It includes the setup, handshake, and encrypt/decrypt functionality
- * needed to create a secure connection.
- *
- * @since Android 1.0
+ * protocols. It includes the setup, handshake, and encrypt/decrypt
+ * functionality needed to create a secure connection.
+ *
+ * @since 1.5
*/
public abstract class SSLEngine {
- // Store host value
- private final String host;
-
- // Store port value
- private final int port;
+ private final String peerHost;
+ private final int peerPort;
/**
* Creates a new {@code SSLEngine} instance.
- *
- * @since Android 1.0
*/
protected SSLEngine() {
- host = null;
- port = -1;
+ super();
+ peerHost = null;
+ peerPort = -1;
}
/**
* Creates a new {@code SSLEngine} instance with the specified host and
* port.
- *
+ *
* @param host
* the name of the host.
* @param port
* the port of the host.
- * @since Android 1.0
*/
protected SSLEngine(String host, int port) {
- this.host = host;
- this.port = port;
+ super();
+ this.peerHost = host;
+ this.peerPort = port;
+ }
+
+ /**
+ * Returns the name of the peer host.
+ *
+ * @return the name of the peer host, or {@code null} if none is available.
+ */
+ public String getPeerHost() {
+ return peerHost;
+ }
+
+ /**
+ * Returns the port number of the peer host.
+ *
+ * @return the port number of the peer host, or {@code -1} is none is
+ * available.
+ */
+ public int getPeerPort() {
+ return peerPort;
}
/**
@@ -65,33 +79,28 @@ public abstract class SSLEngine {
* Calling this method is not needed for the initial handshake: it will be
* called by {@code wrap} or {@code unwrap} if the initial handshake has not
* been started yet.
- * </p>
- *
+ *
* @throws SSLException
* if starting the handshake fails.
* @throws IllegalStateException
* if the engine does not have all the needed settings (e.g.
* client/server mode not set).
- * @since Android 1.0
*/
public abstract void beginHandshake() throws SSLException;
/**
* Notifies this engine instance that no more inbound network data will be
* sent to this engine.
- *
+ *
* @throws SSLException
* if this engine did not receive a needed protocol specific
* close notification message from the peer.
- * @since Android 1.0
*/
public abstract void closeInbound() throws SSLException;
/**
* Notifies this engine instance that no more outbound application data will
* be sent to this engine.
- *
- * @since Android 1.0
*/
public abstract void closeOutbound();
@@ -102,84 +111,56 @@ public abstract class SSLEngine {
* that a delegated task result is needed. In this case the
* {@link Runnable#run() run} method of the returned {@code Runnable}
* delegated task must be called.
- *
+ *
* @return a delegate task, or {@code null} if none are available.
- * @since Android 1.0
*/
public abstract Runnable getDelegatedTask();
/**
* Returns the SSL cipher suite names that are enabled in this engine
* instance.
- *
+ *
* @return the SSL cipher suite names that are enabled in this engine
* instance.
- * @since Android 1.0
*/
public abstract String[] getEnabledCipherSuites();
/**
* Returns the protocol version names that are enabled in this engine
* instance.
- *
+ *
* @return the protocol version names that are enabled in this engine
* instance.
- * @since Android 1.0
*/
public abstract String[] getEnabledProtocols();
/**
* Returns whether new SSL sessions may be established by this engine.
- *
+ *
* @return {@code true} if new session may be established, {@code false} if
* existing sessions must be reused.
- * @since Android 1.0
*/
public abstract boolean getEnableSessionCreation();
/**
* Returns the status of the handshake of this engine instance.
- *
+ *
* @return the status of the handshake of this engine instance.
- * @since Android 1.0
*/
public abstract SSLEngineResult.HandshakeStatus getHandshakeStatus();
/**
* Returns whether this engine instance will require client authentication.
- *
+ *
* @return {@code true} if this engine will require client authentication,
* {@code false} if no client authentication is needed.
- * @since Android 1.0
*/
public abstract boolean getNeedClientAuth();
/**
- * Returns the name of the peer host.
- *
- * @return the name of the peer host, or {@code null} if none is available.
- * @since Android 1.0
- */
- public String getPeerHost() {
- return host;
- }
-
- /**
- * Returns the port number of the peer host.
- *
- * @return the port number of the peer host, or {@code -1} is none is
- * available.
- * @since Android 1.0
- */
- public int getPeerPort() {
- return port;
- }
-
- /**
* Returns the SSL session for this engine instance.
- *
+ *
* @return the SSL session for this engine instance.
- * @since Android 1.0
*/
public abstract SSLSession getSession();
@@ -187,55 +168,49 @@ public abstract class SSLEngine {
* Returns the SSL cipher suite names that are supported by this engine.
* These cipher suites can be enabled using
* {@link #setEnabledCipherSuites(String[])}.
- *
+ *
* @return the SSL cipher suite names that are supported by this engine.
- * @since Android 1.0
*/
public abstract String[] getSupportedCipherSuites();
/**
* Returns the protocol names that are supported by this engine. These
* protocols can be enables using {@link #setEnabledProtocols(String[])}.
- *
+ *
* @return the protocol names that are supported by this engine.
- * @since Android 1.0
*/
public abstract String[] getSupportedProtocols();
/**
* Returns whether this engine is set to act in client mode when
* handshaking.
- *
+ *
* @return {@code true} if the engine is set to do handshaking in client
* mode.
- * @since Android 1.0
*/
public abstract boolean getUseClientMode();
/**
* Returns whether this engine will request client authentication.
- *
+ *
* @return {@code true} if client authentication will be requested,
* {@code false} otherwise.
- * @since Android 1.0
*/
public abstract boolean getWantClientAuth();
/**
* Returns whether no more inbound data will be accepted by this engine.
- *
+ *
* @return {@code true} if no more inbound data will be accepted by this
* engine, {@code false} otherwise.
- * @since Android 1.0
*/
public abstract boolean isInboundDone();
/**
* Returns whether no more outbound data will be produced by this engine.
- *
+ *
* @return {@code true} if no more outbound data will be producted by this
* engine, {@code otherwise} false.
- * @since Android 1.0
*/
public abstract boolean isOutboundDone();
@@ -243,13 +218,12 @@ public abstract class SSLEngine {
* Sets the SSL cipher suite names that should be enabled in this engine
* instance. Only cipher suites listed by {@code getSupportedCipherSuites()}
* are allowed.
- *
+ *
* @param suites
* the SSL cipher suite names to be enabled.
* @throws IllegalArgumentException
* if one of the specified cipher suites is not supported, or if
* {@code suites} is {@code null}.
- * @since Android 1.0
*/
public abstract void setEnabledCipherSuites(String[] suites);
@@ -257,23 +231,21 @@ public abstract class SSLEngine {
* Sets the protocol version names that should be enabled in this engine
* instance. Only protocols listed by {@code getSupportedProtocols()} are
* allowed.
- *
+ *
* @param protocols
* the protocol version names to be enabled.
* @throws IllegalArgumentException
* if one of the protocol version names is not supported, or if
* {@code protocols} is {@code null}.
- * @since Android 1.0
*/
public abstract void setEnabledProtocols(String[] protocols);
/**
* Sets whether new SSL sessions may be established by this engine instance.
- *
+ *
* @param flag
* {@code true} if new SSL sessions may be established,
* {@code false} if existing SSL sessions must be reused.
- * @since Android 1.0
*/
public abstract void setEnableSessionCreation(boolean flag);
@@ -286,25 +258,23 @@ public abstract class SSLEngine {
* <li>no authentication needed</li>
* </ul>
* This method overrides the setting of {@link #setWantClientAuth(boolean)}.
- *
+ *
* @param need
* {@code true} if client authentication is required,
* {@code false} if no authentication is needed.
- * @since Android 1.0
*/
public abstract void setNeedClientAuth(boolean need);
/**
* Sets whether this engine should act in client (or server) mode when
* handshaking.
- *
+ *
* @param mode
* {@code true} if this engine should act in client mode,
* {@code false} if not.
* @throws IllegalArgumentException
* if this method is called after starting the initial
* handshake.
- * @since Android 1.0
*/
public abstract void setUseClientMode(boolean mode);
@@ -317,11 +287,10 @@ public abstract class SSLEngine {
* <li>no authentication needed</li>
* </ul>
* This method overrides the setting of {@link #setNeedClientAuth(boolean)}.
- *
+ *
* @param want
* {@code true} if client authentication should be requested,
* {@code false} if no authentication is needed.
- * @since Android 1.0
*/
public abstract void setWantClientAuth(boolean want);
@@ -329,7 +298,7 @@ public abstract class SSLEngine {
* Decodes the incoming network data buffer into application data buffers.
* If a handshake has not been started yet, it will automatically be
* started.
- *
+ *
* @param src
* the buffer with incoming network data
* @param dsts
@@ -339,14 +308,14 @@ public abstract class SSLEngine {
* the offset in the array of destination buffers to which data
* is to be transferred.
* @param length
- * the maximum number of destination buffers to be used.
+ * the maximum number of destination buffers to be used.
* @return the result object of this operation.
* @throws SSLException
* if a problem occurred while processing the data.
* @throws IndexOutOfBoundsException
* if {@code length} is greater than
* {@code dsts.length - offset}.
- * @throws ReadOnlyBufferException
+ * @throws java.nio.ReadOnlyBufferException
* if one of the destination buffers is read-only.
* @throws IllegalArgumentException
* if {@code src}, {@code dsts}, or one of the entries in
@@ -354,16 +323,15 @@ public abstract class SSLEngine {
* @throws IllegalStateException
* if the engine does not have all the needed settings (e.g.
* client/server mode not set).
- * @since Android 1.0
*/
- public abstract SSLEngineResult unwrap(ByteBuffer src, ByteBuffer[] dsts,
- int offset, int length) throws SSLException;
+ public abstract SSLEngineResult unwrap(ByteBuffer src, ByteBuffer[] dsts, int offset, int length)
+ throws SSLException;
/**
* Encodes the outgoing application data buffers into the network data
* buffer. If a handshake has not been started yet, it will automatically be
* started.
- *
+ *
* @param srcs
* the array of source buffers of outgoing application data.
* @param offset
@@ -379,7 +347,7 @@ public abstract class SSLEngine {
* @throws IndexOutOfBoundsException
* if {@code length} is greater than
* {@code srcs.length - offset}.
- * @throws ReadOnlyBufferException
+ * @throws java.nio.ReadOnlyBufferException
* if the destination buffer is readonly.
* @throws IllegalArgumentException
* if {@code srcs}, {@code dst}, or one the entries in
@@ -387,10 +355,9 @@ public abstract class SSLEngine {
* @throws IllegalStateException
* if the engine does not have all the needed settings (e.g.
* client/server mode not set).
- * @since Android 1.0
*/
- public abstract SSLEngineResult wrap(ByteBuffer[] srcs, int offset,
- int length, ByteBuffer dst) throws SSLException;
+ public abstract SSLEngineResult wrap(ByteBuffer[] srcs, int offset, int length, ByteBuffer dst)
+ throws SSLException;
/**
* Decodes the incoming network data buffer into the application data
@@ -404,26 +371,15 @@ public abstract class SSLEngine {
* @return the result object of this operation.
* @throws SSLException
* if a problem occurred while processing the data.
- * @throws ReadOnlyBufferException
+ * @throws java.nio.ReadOnlyBufferException
* if one of the destination buffers is read-only.
* @throws IllegalArgumentException
* if {@code src} or {@code dst} is {@code null}.
* @throws IllegalStateException
* if the engine does not have all the needed settings (e.g.
* client/server mode not set).
- * @since Android 1.0
- */
- public SSLEngineResult unwrap(ByteBuffer src, ByteBuffer dst)
- throws SSLException {
-// if (src == null) {
-// throw new IllegalArgumentException("Byte buffer src is null");
-// }
-// if (dst == null) {
-// throw new IllegalArgumentException("Byte buffer dst is null");
-// }
-// if (dst.isReadOnly()) {
-// throw new ReadOnlyBufferException();
-// }
+ */
+ public SSLEngineResult unwrap(ByteBuffer src, ByteBuffer dst) throws SSLException {
return unwrap(src, new ByteBuffer[] { dst }, 0, 1);
}
@@ -431,7 +387,7 @@ public abstract class SSLEngine {
* Decodes the incoming network data buffer into the application data
* buffers. If a handshake has not been started yet, it will automatically
* be started.
- *
+ *
* @param src
* the buffer with incoming network data
* @param dsts
@@ -440,32 +396,18 @@ public abstract class SSLEngine {
* @return the result object of this operation.
* @throws SSLException
* if a problem occurred while processing the data.
- * @throws ReadOnlyBufferException
+ * @throws java.nio.ReadOnlyBufferException
* if one of the destination buffers is read-only.
* @throws IllegalArgumentException
* if {@code src} or {@code dsts} is {@code null}.
* @throws IllegalStateException
* if the engine does not have all the needed settings (e.g.
* client/server mode not set).
- * @since Android 1.0
*/
- public SSLEngineResult unwrap(ByteBuffer src, ByteBuffer[] dsts)
- throws SSLException {
-// if (src == null) {
-// throw new IllegalArgumentException("Byte buffer src is null");
-// }
+ public SSLEngineResult unwrap(ByteBuffer src, ByteBuffer[] dsts) throws SSLException {
if (dsts == null) {
throw new IllegalArgumentException("Byte buffer array dsts is null");
}
-// for (int i = 0; i < dsts.length; i++) {
-// if (dsts[i] == null) {
-// throw new IllegalArgumentException("Byte buffer dsts[" + i
-// + "] is null");
-// }
-// if (dsts[i].isReadOnly()) {
-// throw new ReadOnlyBufferException();
-// }
-// }
return unwrap(src, dsts, 0, dsts.length);
}
@@ -481,32 +423,18 @@ public abstract class SSLEngine {
* @return the result object of this operation.
* @throws SSLException
* if a problem occurred while processing the data.
- * @throws ReadOnlyBufferException
+ * @throws java.nio.ReadOnlyBufferException
* if the destination buffer is readonly.
* @throws IllegalArgumentException
* if {@code srcs} or {@code dst} is {@code null}.
* @throws IllegalStateException
* if the engine does not have all the needed settings (e.g.
* client/server mode not set).
- * @since Android 1.0
*/
- public SSLEngineResult wrap(ByteBuffer[] srcs, ByteBuffer dst)
- throws SSLException {
+ public SSLEngineResult wrap(ByteBuffer[] srcs, ByteBuffer dst) throws SSLException {
if (srcs == null) {
throw new IllegalArgumentException("Byte buffer array srcs is null");
}
-// for (int i = 0; i < srcs.length; i++) {
-// if (srcs[i] == null) {
-// throw new IllegalArgumentException("Byte buffer srcs[" + i
-// + "] is null");
-// }
-// }
-// if (dst == null) {
-// throw new IllegalArgumentException("Byte buffer array dst is null");
-// }
-// if (dst.isReadOnly()) {
-// throw new ReadOnlyBufferException();
-// }
return wrap(srcs, 0, srcs.length, dst);
}
@@ -522,26 +450,15 @@ public abstract class SSLEngine {
* @return the result object of this operation.
* @throws SSLException
* if a problem occurred while processing the data.
- * @throws ReadOnlyBufferException
+ * @throws java.nio.ReadOnlyBufferException
* if the destination buffer is readonly.
* @throws IllegalArgumentException
* if {@code src} or {@code dst} is {@code null}.
* @throws IllegalStateException
* if the engine does not have all the needed settings (e.g.
* client/server mode not set).
- * @since Android 1.0
- */
- public SSLEngineResult wrap(ByteBuffer src, ByteBuffer dst)
- throws SSLException {
-// if (src == null) {
-// throw new IllegalArgumentException("Byte buffer src is null");
-// }
-// if (dst == null) {
-// throw new IllegalArgumentException("Byte buffer dst is null");
-// }
-// if (dst.isReadOnly()) {
-// throw new ReadOnlyBufferException();
-// }
+ */
+ public SSLEngineResult wrap(ByteBuffer src, ByteBuffer dst) throws SSLException {
return wrap(new ByteBuffer[] { src }, 0, 1, dst);
}
}
diff --git a/x-net/src/main/java/javax/net/ssl/SSLEngineResult.java b/x-net/src/main/java/javax/net/ssl/SSLEngineResult.java
index dc55836..8a98831 100644
--- a/x-net/src/main/java/javax/net/ssl/SSLEngineResult.java
+++ b/x-net/src/main/java/javax/net/ssl/SSLEngineResult.java
@@ -20,11 +20,64 @@ package javax.net.ssl;
/**
* The result object describing the state of the {@code SSLEngine} produced
* by the {@code wrap()} and {@code unwrap()} operations.
- *
- * @since Android 1.0
*/
public class SSLEngineResult {
-
+
+ /**
+ * The {@code enum} describing the state of the current handshake.
+ */
+ public enum HandshakeStatus {
+ /**
+ * No handshake in progress.
+ */
+ NOT_HANDSHAKING,
+ /**
+ * The handshake is finished.
+ */
+ FINISHED,
+ /**
+ * The results of one (or more) delegated tasks are needed to continue
+ * the handshake.
+ */
+ NEED_TASK,
+ /**
+ * The engine must send data to the remote side to continue the
+ * handshake.
+ */
+ NEED_WRAP,
+ /**
+ * The engine needs to receive data from the remote side to continue the
+ * handshake.
+ */
+ NEED_UNWRAP
+ }
+
+ /**
+ * The {@code enum} describing the result of the {@code SSLEngine}
+ * operation.
+ */
+ public static enum Status {
+ /**
+ * The size of the destination buffer is too small to hold the result of
+ * the current operation.
+ */
+ BUFFER_OVERFLOW,
+ /**
+ * There were not enough bytes available in the source buffer to
+ * complete the current operation.
+ */
+ BUFFER_UNDERFLOW,
+ /**
+ * The operation closed this side of the communication or was already
+ * closed.
+ */
+ CLOSED,
+ /**
+ * The operation completed successfully.
+ */
+ OK
+ }
+
// Store Status object
private final SSLEngineResult.Status status;
@@ -40,7 +93,7 @@ public class SSLEngineResult {
/**
* Creates a new {@code SSLEngineResult} instance with the specified state
* values.
- *
+ *
* @param status
* the return value of the {@code SSLEngine} operation.
* @param handshakeStatus
@@ -53,11 +106,9 @@ public class SSLEngineResult {
* if {@code status} or {@code handshakeStatus} is {@code null},
* or if {@code bytesConsumed} or {@code bytesProduces} are
* negative.
- * @since Android 1.0
*/
public SSLEngineResult(SSLEngineResult.Status status,
- SSLEngineResult.HandshakeStatus handshakeStatus, int bytesConsumed,
- int bytesProduced) {
+ SSLEngineResult.HandshakeStatus handshakeStatus, int bytesConsumed, int bytesProduced) {
if (status == null) {
throw new IllegalArgumentException("status is null");
}
@@ -78,9 +129,8 @@ public class SSLEngineResult {
/**
* Returns the return value of the {@code SSLEngine} operation.
- *
+ *
* @return the return value of the {@code SSLEngine} operation.
- * @since Android 1.0
*/
public final Status getStatus() {
return status;
@@ -88,9 +138,8 @@ public class SSLEngineResult {
/**
* Returns the status of the current handshake.
- *
+ *
* @return the status of the current handshake.
- * @since Android 1.0
*/
public final HandshakeStatus getHandshakeStatus() {
return handshakeStatus;
@@ -98,9 +147,8 @@ public class SSLEngineResult {
/**
* Returns the number of bytes retrieved from the source buffer(s).
- *
+ *
* @return the number of bytes retrieved from the source buffer(s).
- * @since Android 1.0
*/
public final int bytesConsumed() {
return bytesConsumed;
@@ -108,106 +156,17 @@ public class SSLEngineResult {
/**
* Returns the number of bytes transferred to the destination buffer(s).
- *
+ *
* @return the number of bytes transferred to the destination buffer(s).
- * @since Android 1.0
*/
public final int bytesProduced() {
return bytesProduced;
}
- /**
- * Returns a string representation of this instance.
- *
- * @return a string representation of this instance.
- * @since Android 1.0
- */
+ @Override
public String toString() {
- StringBuffer sb = new StringBuffer("SSLEngineReport: Status = ");
- sb.append(status.toString());
- sb.append(" HandshakeStatus = ");
- sb.append(handshakeStatus.toString());
- sb.append("\n bytesConsumed = ");
- sb.append(Integer.toString(bytesConsumed));
- sb.append(" bytesProduced = ");
- sb.append(Integer.toString(bytesProduced));
- return sb.toString();
- }
-
- /**
- * The {@code enum} describing the state of the current handshake.
- *
- * @since Android 1.0
- */
- public enum HandshakeStatus {
- /**
- * No handshake in progress.
- *
- * @since Android 1.0
- */
- NOT_HANDSHAKING,
- /**
- * The handshake is finished.
- *
- * @since Android 1.0
- */
- FINISHED,
- /**
- * The results of one (or more) delegated tasks are needed to continue
- * the handshake.
- *
- * @since Android 1.0
- */
- NEED_TASK,
- /**
- * The engine must send data to the remote side to continue the
- * handshake.
- *
- * @since Android 1.0
- */
- NEED_WRAP,
- /**
- * The engine needs to receive data from the remote side to continue the
- * handshake.
- *
- * @since Android 1.0
- */
- NEED_UNWRAP
- }
-
- /**
- * The {@code enum} describing the result of the {@code SSLEngine}
- * operation.
- *
- * @since Android 1.0
- */
- public static enum Status {
- /**
- * The size of the destination buffer is too small to hold the result of
- * the current operation.
- *
- * @since Android 1.0
- */
- BUFFER_OVERFLOW,
- /**
- * There were not enough bytes available in the source buffer to
- * complete the current operation.
- *
- * @since Android 1.0
- */
- BUFFER_UNDERFLOW,
- /**
- * The operation closed this side of the communication or was already
- * closed.
- *
- * @since Android 1.0
- */
- CLOSED,
- /**
- * The operation completed successfully.
- *
- * @since Android 1.0
- */
- OK
+ return "SSLEngineReport: Status = " + status + " HandshakeStatus = " + handshakeStatus
+ + "\n bytesConsumed = " + bytesConsumed + " bytesProduced = "
+ + bytesProduced;
}
-} \ No newline at end of file
+}
diff --git a/x-net/src/main/java/javax/net/ssl/SSLException.java b/x-net/src/main/java/javax/net/ssl/SSLException.java
index 43ba493..5d716f7 100644
--- a/x-net/src/main/java/javax/net/ssl/SSLException.java
+++ b/x-net/src/main/java/javax/net/ssl/SSLException.java
@@ -21,19 +21,15 @@ import java.io.IOException;
/**
* The base class for all SSL related exceptions.
- *
- * @since Android 1.0
*/
public class SSLException extends IOException {
-
private static final long serialVersionUID = 4511006460650708967L;
/**
* Creates a new {@code SSLException} with the specified reason.
- *
+ *
* @param reason
* the reason for the exception.
- * @since Android 1.0
*/
public SSLException(String reason) {
super(reason);
@@ -41,12 +37,11 @@ public class SSLException extends IOException {
/**
* Creates a new {@code SSLException} with the specified message and cause.
- *
+ *
* @param message
* the detail message for the exception.
* @param cause
* the cause.
- * @since Android 1.0
*/
public SSLException(String message, Throwable cause) {
super(message);
@@ -55,10 +50,9 @@ public class SSLException extends IOException {
/**
* Creates a new {@code SSLException} with the specified cause.
- *
+ *
* @param cause
* the cause
- * @since Android 1.0
*/
public SSLException(Throwable cause) {
super(cause == null ? null : cause.toString());
diff --git a/x-net/src/main/java/javax/net/ssl/SSLHandshakeException.java b/x-net/src/main/java/javax/net/ssl/SSLHandshakeException.java
index 81e44dc..1c17ae7 100644
--- a/x-net/src/main/java/javax/net/ssl/SSLHandshakeException.java
+++ b/x-net/src/main/java/javax/net/ssl/SSLHandshakeException.java
@@ -20,19 +20,16 @@ package javax.net.ssl;
/**
* The exception that is thrown when a handshake could not be completed
* successfully.
- *
- * @since Android 1.0
*/
public class SSLHandshakeException extends SSLException {
-
+
private static final long serialVersionUID = -5045881315018326890L;
/**
* Creates a new {@code SSLHandshakeException} with the specified message.
- *
+ *
* @param reason
* the detail message for the exception.
- * @since Android 1.0
*/
public SSLHandshakeException(String reason) {
super(reason);
diff --git a/x-net/src/main/java/javax/net/ssl/SSLKeyException.java b/x-net/src/main/java/javax/net/ssl/SSLKeyException.java
index cc4bc84..6d81676 100644
--- a/x-net/src/main/java/javax/net/ssl/SSLKeyException.java
+++ b/x-net/src/main/java/javax/net/ssl/SSLKeyException.java
@@ -18,22 +18,19 @@
package javax.net.ssl;
/**
- * The exception that is thrown when an invalid SSL key is encountered.
- *
- * @since Android 1.0
+ * The exception that is thrown when an invalid SSL key is encountered.
*/
public class SSLKeyException extends SSLException {
private static final long serialVersionUID = -8071664081941937874L;
-
+
/**
* Creates a new {@code SSLKeyException} with the specified message.
- *
+ *
* @param reason
* the detail message for the exception.
- * @since Android 1.0
*/
public SSLKeyException(String reason) {
super(reason);
}
-} \ No newline at end of file
+}
diff --git a/x-net/src/main/java/javax/net/ssl/SSLPeerUnverifiedException.java b/x-net/src/main/java/javax/net/ssl/SSLPeerUnverifiedException.java
index 6e5734a..bb5bd64 100644
--- a/x-net/src/main/java/javax/net/ssl/SSLPeerUnverifiedException.java
+++ b/x-net/src/main/java/javax/net/ssl/SSLPeerUnverifiedException.java
@@ -20,22 +20,19 @@ package javax.net.ssl;
/**
* The exception that is thrown when the identity of a peer has not beed
* verified.
- *
- * @since Android 1.0
*/
public class SSLPeerUnverifiedException extends SSLException {
-
+
private static final long serialVersionUID = -8919512675000600547L;
/**
* Creates a new {@code SSLPeerUnverifiedException} with the specified
* message.
- *
+ *
* @param reason
* the detail message for the exception.
- * @since Android 1.0
*/
public SSLPeerUnverifiedException(String reason) {
super(reason);
}
-} \ No newline at end of file
+}
diff --git a/x-net/src/main/java/javax/net/ssl/SSLPermission.java b/x-net/src/main/java/javax/net/ssl/SSLPermission.java
index afc1abb..5b5c76f 100644
--- a/x-net/src/main/java/javax/net/ssl/SSLPermission.java
+++ b/x-net/src/main/java/javax/net/ssl/SSLPermission.java
@@ -23,26 +23,22 @@ import java.security.BasicPermission;
* The class representing a network permission.
* <p>
* The following permissions are defined, allowing the specified action:
- * </p>
* <dl>
* <dt> {@code "setHostnameVerifier"} </dt>
- * <dd> setting a callback object for additional verification of a hostname mismatch.</dd>
+ * <dd> setting a callback object for additional verification of a hostname mismatch.</dd>
* <dt> {@code "getSSLSessionContext"} </dt>
* <dd> getting the {@code SSLSessionContext} of an {@code SSLSession}.</dd>
- * </dl>
- *
- * @since Android 1.0
+ * </dl>
*/
public final class SSLPermission extends BasicPermission {
-
+
private static final long serialVersionUID = -3456898025505876775L;
-
+
/**
* Creates a new {@code SSLPermission} with the specified name.
- *
+ *
* @param name
* the permission name.
- * @since Android 1.0
*/
public SSLPermission(String name) {
super(name);
@@ -50,14 +46,13 @@ public final class SSLPermission extends BasicPermission {
/**
* Creates a new {@code SSLPermission} with the specified name.
- *
+ *
* @param name
* the permission name.
* @param actions
* is ignored and should be {@code null}.
- * @since Android 1.0
*/
public SSLPermission(String name, String actions) {
super(name, actions);
}
-} \ No newline at end of file
+}
diff --git a/x-net/src/main/java/javax/net/ssl/SSLProtocolException.java b/x-net/src/main/java/javax/net/ssl/SSLProtocolException.java
index ef49ced..50ed74d 100644
--- a/x-net/src/main/java/javax/net/ssl/SSLProtocolException.java
+++ b/x-net/src/main/java/javax/net/ssl/SSLProtocolException.java
@@ -20,21 +20,18 @@ package javax.net.ssl;
/**
* The exception that is thrown when an error in the operation of the SSL
* protocol is encountered.
- *
- * @since Android 1.0
*/
public class SSLProtocolException extends SSLException {
-
+
private static final long serialVersionUID = 5445067063799134928L;
/**
* Creates a new {@code SSLProtocolException} with the specified message.
- *
+ *
* @param reason
* the detail message for the exception.
- * @since Android 1.0
*/
public SSLProtocolException(String reason) {
super(reason);
}
-} \ No newline at end of file
+}
diff --git a/x-net/src/main/java/javax/net/ssl/SSLServerSocket.java b/x-net/src/main/java/javax/net/ssl/SSLServerSocket.java
index dc41556..8bd8918 100644
--- a/x-net/src/main/java/javax/net/ssl/SSLServerSocket.java
+++ b/x-net/src/main/java/javax/net/ssl/SSLServerSocket.java
@@ -24,20 +24,16 @@ import java.net.ServerSocket;
/**
* The extension of {@code ServerSocket} which provides secure server sockets
* based on protocols like SSL, TLS, or others.
- *
- * @since Android 1.0
*/
public abstract class SSLServerSocket extends ServerSocket {
-
+
/**
* Only to be used by subclasses.
* <p>
* Creates a TCP server socket with the default authentication context.
- * </p>
- *
+ *
* @throws IOException
* if creating the socket fails.
- * @since Android 1.0
*/
protected SSLServerSocket() throws IOException {
super();
@@ -49,12 +45,10 @@ public abstract class SSLServerSocket extends ServerSocket {
* Creates a TCP server socket on the specified port with the default
* authentication context. The connection's default backlog size is 50
* connections.
- * </p>
* @param port
* the port to listen on.
* @throws IOException
* if creating the socket fails.
- * @since Android 1.0
*/
protected SSLServerSocket(int port) throws IOException {
super(port);
@@ -65,14 +59,13 @@ public abstract class SSLServerSocket extends ServerSocket {
* <p>
* Creates a TCP server socket on the specified port using the specified
* backlog and the default authentication context.
- *
+ *
* @param port
* the port to listen on.
* @param backlog
* the number of pending connections to queue.
* @throws IOException
* if creating the socket fails.
- * @since Android 1.0
*/
protected SSLServerSocket(int port, int backlog) throws IOException {
super(port, backlog);
@@ -84,8 +77,7 @@ public abstract class SSLServerSocket extends ServerSocket {
* Creates a TCP server socket on the specified port, using the specified
* backlog, listening on the specified interface, and using the default
* authentication context.
- * </p>
- *
+ *
* @param port
* the port the listen on.
* @param backlog
@@ -94,20 +86,17 @@ public abstract class SSLServerSocket extends ServerSocket {
* the address of the interface to accept connections on.
* @throws IOException
* if creating the socket fails.
- * @since Android 1.0
*/
- protected SSLServerSocket(int port, int backlog, InetAddress address)
- throws IOException {
+ protected SSLServerSocket(int port, int backlog, InetAddress address) throws IOException {
super(port, backlog, address);
}
-
+
/**
* Returns the names of the enabled cipher suites to be used for new
* connections.
- *
+ *
* @return the names of the enabled cipher suites to be used for new
* connections.
- * @since Android 1.0
*/
public abstract String[] getEnabledCipherSuites();
@@ -115,50 +104,45 @@ public abstract class SSLServerSocket extends ServerSocket {
* Sets the names of the cipher suites to be enabled for new connections.
* Only cipher suites returned by {@link #getSupportedCipherSuites()} are
* allowed.
- *
+ *
* @param suites
* the names of the to be enabled cipher suites.
* @throws IllegalArgumentException
* if one of the cipher suite names is not supported.
- * @since Android 1.0
*/
public abstract void setEnabledCipherSuites(String[] suites);
/**
* Returns the names of the supported cipher suites.
- *
+ *
* @return the names of the supported cipher suites.
- * @since Android 1.0
*/
public abstract String[] getSupportedCipherSuites();
/**
* Returns the names of the supported protocols.
- *
+ *
* @return the names of the supported protocols.
- * @since Android 1.0
*/
public abstract String[] getSupportedProtocols();
/**
* Returns the names of the enabled protocols to be used for new
* connections.
- *
+ *
* @return the names of the enabled protocols to be used for new
* connections.
- * @since Android 1.0
*/
public abstract String[] getEnabledProtocols();
/**
* Sets the names of the protocols to be enabled for new connections. Only
* protocols returned by {@link #getSupportedProtocols()} are allowed.
- *
+ *
* @param protocols
* the names of the to be enabled protocols.
* @throws IllegalArgumentException
* if one of the protocols is not supported.
- * @since Android 1.0
*/
public abstract void setEnabledProtocols(String[] protocols);
@@ -171,21 +155,19 @@ public abstract class SSLServerSocket extends ServerSocket {
* <li>no authentication needed</li>
* </ul>
* This method overrides the setting of {@link #setWantClientAuth(boolean)}.
- *
+ *
* @param need
* {@code true} if client authentication is required,
* {@code false} if no authentication is needed.
- * @since Android 1.0
*/
public abstract void setNeedClientAuth(boolean need);
/**
* Returns whether server-mode connections will be configured to require
* client authentication.
- *
+ *
* @return {@code true} if client authentication is required, {@code false}
* if no client authentication is needed.
- * @since Android 1.0
*/
public abstract boolean getNeedClientAuth();
@@ -198,59 +180,53 @@ public abstract class SSLServerSocket extends ServerSocket {
* <li>no authentication needed</li>
* </ul>
* This method overrides the setting of {@link #setNeedClientAuth(boolean)}.
- *
+ *
* @param want
* {@code true} if client authentication should be requested,
* {@code false} if no authentication is needed.
- * @since Android 1.0
*/
public abstract void setWantClientAuth(boolean want);
/**
* Returns whether server-mode connections will be configured to request
* client authentication.
- *
+ *
* @return {@code true} is client authentication will be requested,
* {@code false} if no client authentication is needed.
- * @since Android 1.0
*/
public abstract boolean getWantClientAuth();
/**
* Sets whether new connections should act in client mode when handshaking.
- *
+ *
* @param mode
* {@code true} if new connections should act in client mode,
* {@code false} if not.
- * @since Android 1.0
*/
public abstract void setUseClientMode(boolean mode);
/**
* Returns whether new connection will act in client mode when handshaking.
- *
+ *
* @return {@code true} if new connections will act in client mode when
* handshaking, {@code false} if not.
- * @since Android 1.0
*/
public abstract boolean getUseClientMode();
/**
* Sets whether new SSL sessions may be established for new connections.
- *
+ *
* @param flag
* {@code true} if new SSL sessions may be established,
* {@code false} if existing SSL sessions must be reused.
- * @since Android 1.0
*/
public abstract void setEnableSessionCreation(boolean flag);
-
+
/**
* Returns whether new SSL sessions may be established for new connections.
- *
+ *
* @return {@code true} if new SSL sessions may be established,
* {@code false} if existing SSL sessions must be reused.
- * @since Android 1.0
*/
public abstract boolean getEnableSessionCreation();
}
diff --git a/x-net/src/main/java/javax/net/ssl/SSLServerSocketFactory.java b/x-net/src/main/java/javax/net/ssl/SSLServerSocketFactory.java
index 14f467c..ccb2c5d 100644
--- a/x-net/src/main/java/javax/net/ssl/SSLServerSocketFactory.java
+++ b/x-net/src/main/java/javax/net/ssl/SSLServerSocketFactory.java
@@ -18,59 +18,46 @@
package javax.net.ssl;
import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.security.Security;
import javax.net.ServerSocketFactory;
/**
* The factory for SSL server sockets.
- *
- * @since Android 1.0
*/
public abstract class SSLServerSocketFactory extends ServerSocketFactory {
-// TODO EXPORT CONTROL
-
+ // TODO EXPORT CONTROL
+
// The default SSL socket factory
private static ServerSocketFactory defaultServerSocketFactory;
private static String defaultName;
-
- /**
- * Creates a new {@code SSLServerSocketFactory} instance.
- *
- * @since Android 1.0
- */
- protected SSLServerSocketFactory() {
- super();
- }
/**
* Returns the default {@code SSLServerSocketFactory} instance. The default
* implementation is defined by the security property
* "ssl.ServerSocketFactory.provider".
- *
+ *
* @return the default {@code SSLServerSocketFactory} instance.
- * @since Android 1.0
*/
- public static ServerSocketFactory getDefault() {
+ public static synchronized ServerSocketFactory getDefault() {
if (defaultServerSocketFactory != null) {
return defaultServerSocketFactory;
}
if (defaultName == null) {
- AccessController.doPrivileged(new java.security.PrivilegedAction(){
- public Object run() {
+ AccessController.doPrivileged(new PrivilegedAction<Void>() {
+ public Void run() {
defaultName = Security.getProperty("ssl.ServerSocketFactory.provider");
- if (defaultName != null) {
+ if (defaultName != null) {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
if (cl == null) {
cl = ClassLoader.getSystemClassLoader();
}
try {
- defaultServerSocketFactory = (ServerSocketFactory) Class
- .forName(defaultName, true, cl)
- .newInstance();
+ final Class<?> ssfc = Class.forName(defaultName, true, cl);
+ defaultServerSocketFactory = (ServerSocketFactory) ssfc.newInstance();
} catch (Exception e) {
- return e;
}
}
return null;
@@ -81,31 +68,36 @@ public abstract class SSLServerSocketFactory extends ServerSocketFactory {
// Try to find in providers
SSLContext context = DefaultSSLContext.getContext();
if (context != null) {
- defaultServerSocketFactory = context.getServerSocketFactory();
+ defaultServerSocketFactory = context.getServerSocketFactory();
}
}
if (defaultServerSocketFactory == null) {
// Use internal dummy implementation
- defaultServerSocketFactory = new DefaultSSLServerSocketFactory("No ServerSocketFactory installed");
- }
+ defaultServerSocketFactory = new DefaultSSLServerSocketFactory(
+ "No ServerSocketFactory installed");
+ }
return defaultServerSocketFactory;
}
-
+
+ /**
+ * Creates a new {@code SSLServerSocketFactory} instance.
+ */
+ protected SSLServerSocketFactory() {
+ super();
+ }
+
/**
* Returns the names of the cipher suites that are enabled by default.
- *
+ *
* @return the names of the cipher suites that are enabled by default
- * @since Android 1.0
*/
public abstract String[] getDefaultCipherSuites();
-
+
/**
* Returns the list of supported cipher suites that could be enabled for an
* SSL connection created by this factory.
- *
+ *
* @return the list of supported cipher suites
- * @since Android 1.0
*/
public abstract String[] getSupportedCipherSuites();
-
}
diff --git a/x-net/src/main/java/javax/net/ssl/SSLSession.java b/x-net/src/main/java/javax/net/ssl/SSLSession.java
index 553d74f..14a312a 100644
--- a/x-net/src/main/java/javax/net/ssl/SSLSession.java
+++ b/x-net/src/main/java/javax/net/ssl/SSLSession.java
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-
package javax.net.ssl;
import java.security.Principal;
@@ -24,78 +23,68 @@ import javax.security.cert.X509Certificate;
/**
* The interface representing an SSL session.
- *
- * @since Android 1.0
*/
public interface SSLSession {
/**
* Returns the maximum size that an application buffer can be for this
* session.
- *
+ *
* @return the maximum application buffer size.
- * @since Android 1.0
*/
public int getApplicationBufferSize();
/**
* Returns the name of the cipher suite used in this session.
- *
+ *
* @return the name of the cipher suite used in this session.
- * @since Android 1.0
*/
public String getCipherSuite();
/**
* Returns the time this session was created, in milliseconds since midnight
* January 1st 1970 UTC.
- *
+ *
* @return the time the session was created.
- * @since Android 1.0
*/
public long getCreationTime();
/**
* Returns this sessions identifier.
- *
+ *
* @return this sessions identifier.
- * @since Android 1.0
*/
public byte[] getId();
/**
* Returns the time this session was last accessed, in milliseconds since
* midnight January 1st 1970 UTC.
- *
+ *
* @return the time this session was last accessed.
- * @since Android 1.0
*/
public long getLastAccessedTime();
/**
* Returns the list of certificates that were used to identify the local
* side to the peer during the handshake.
- *
+ *
* @return the list of certificates, ordered from local certificate to
* CA's certificates.
- * @since Android 1.0
*/
public Certificate[] getLocalCertificates();
/**
* Returns the principal used to identify the local side to the peer during
* the handshake.
- *
+ *
* @return the principal used to identify the local side.
- * @since Android 1.0
*/
public Principal getLocalPrincipal();
/**
* Returns the maximum size that a network buffer can be for this session.
- *
+ *
* @return the maximum network buffer size.
- * @since Android 1.0
*/
public int getPacketBufferSize();
@@ -105,67 +94,58 @@ public interface SSLSession {
* <p>
* Note: this method exists for compatility reasons, use
* {@link #getPeerCertificates()} instead.
- * </p>
- *
+ *
* @return the list of certificates, ordered from the identity certificate to
* the CA's certificates
* @throws SSLPeerUnverifiedException
* if the identity of the peer is not verified.
- * @since Android 1.0
*/
- public X509Certificate[] getPeerCertificateChain()
- throws SSLPeerUnverifiedException;
+ public X509Certificate[] getPeerCertificateChain() throws SSLPeerUnverifiedException;
/**
* Returns the list of certificates the peer used to identify itself during
* the handshake.
- *
+ *
* @return the list of certificates, ordered from the identity certificate to
* the CA's certificates.
* @throws SSLPeerUnverifiedException
* if the identity of the peer is not verified.
- * @since Android 1.0
*/
- public Certificate[] getPeerCertificates()
- throws SSLPeerUnverifiedException;
+ public Certificate[] getPeerCertificates() throws SSLPeerUnverifiedException;
/**
* Returns the host name of the peer of this session. The host name is not
* authenticated.
- *
+ *
* @return the host name of the peer of this session, or {@code null} if no
* host name is available.
- * @since Android 1.0
*/
public String getPeerHost();
/**
* Returns the port number of the peer of this session. The port number is
* not authenticated.
- *
+ *
* @return the port number of the peer, of {@code -1} is no port number is
* available.
- * @since Android 1.0
*/
public int getPeerPort();
/**
* Returns the principal identifying the peer during the handshake.
- *
+ *
* @return the principal identifying the peer.
* @throws SSLPeerUnverifiedException
* if the identity of the peer has not been verified.
- * @since Android 1.0
*/
public Principal getPeerPrincipal() throws SSLPeerUnverifiedException;
/**
* Returns the protocol name that is used for all connections in this
* session.
- *
+ *
* @return the protocol name that is used for all connections in this
* session.
- * @since Android 1.0
*/
public String getProtocol();
@@ -174,17 +154,16 @@ public interface SSLSession {
* security manager is installed, the
* {@code SSLPermission("getSSLSessionContext"} is checked with the security
* manager.
- *
+ *
* @return the context of this session or {@code null} if no context is
* available.
- * @since Android 1.0
*/
public SSLSessionContext getSessionContext();
/**
* Returns the object bound to the specified name in this session's
* application layer data.
- *
+ *
* @param name
* the name of the bound value.
* @return the value bound to the specified name, or {@code null} if the
@@ -192,7 +171,6 @@ public interface SSLSession {
* access control context.
* @throws IllegalArgumentException
* if {@code name} is {@code null}.
- * @since Android 1.0
*/
public Object getValue(String name);
@@ -202,11 +180,9 @@ public interface SSLSession {
* <p>
* Depending on the current access control context, the list of object names
* may be different.
- * </p>
- *
+ *
* @return the list of the object names bound to this session's application
* layer data.
- * @since Android 1.0
*/
public String[] getValueNames();
@@ -215,17 +191,13 @@ public interface SSLSession {
* <p>
* No new connections can be created, but any existing connection remains
* valid until it is closed.
- * </p>
- *
- * @since Android 1.0
*/
public void invalidate();
/**
* Returns whether this session is valid.
- *
+ *
* @return {@code true} if this session is valid, otherwise {@code false}.
- * @since Android 1.0
*/
public boolean isValid();
@@ -235,15 +207,13 @@ public interface SSLSession {
* <p>
* For bindings (new or existing) implementing the
* {@code SSLSessionBindingListener} interface the object will be notified.
- * </p>
- *
+ *
* @param name
* the name to bind the object to.
* @param value
* the object to bind.
* @throws IllegalArgumentException
* if either {@code name} or {@code value} is {@code null}.
- * @since Android 1.0
*/
public void putValue(String name, Object value);
@@ -251,12 +221,11 @@ public interface SSLSession {
* Removes the binding for the specified name in this session's application
* layer data. If the existing binding implements the
* {@code SSLSessionBindingListener} interface the object will be notified.
- *
+ *
* @param name
* the binding to remove.
* @throws IllegalArgumentException
* if {@code name} is {@code null}.
- * @since Android 1.0
*/
public void removeValue(String name);
-} \ No newline at end of file
+}
diff --git a/x-net/src/main/java/javax/net/ssl/SSLSessionBindingEvent.java b/x-net/src/main/java/javax/net/ssl/SSLSessionBindingEvent.java
index dbda787..19ae835 100644
--- a/x-net/src/main/java/javax/net/ssl/SSLSessionBindingEvent.java
+++ b/x-net/src/main/java/javax/net/ssl/SSLSessionBindingEvent.java
@@ -22,54 +22,54 @@ import java.util.EventObject;
/**
* The event sent to an {@code SSLSessionBindingListener} when the listener
- * object is bound ({@link SSLSession#putValue(String, Object)}) or unbound
+ * object is bound ({@link SSLSession#putValue(String, Object)}) or unbound
* ({@link SSLSession#removeValue(String)}) to an {@code SSLSession}.
- *
- * @since Android 1.0
*/
public class SSLSessionBindingEvent extends EventObject implements Serializable {
+ /**
+ * The 5.0 spec. doesn't declare this serialVersionUID field In order to be compatible it is
+ * explicitly declared here
+ */
private static final long serialVersionUID = 3989172637106345L;
- private String name;
+ /**
+ * @serial include
+ */
+ private final String name;
/**
* Creates a new {@code SSLSessionBindingEvent} for the specified session
* indicating a binding event for the specified name.
- *
+ *
* @param session
* the session for which the event occurs.
* @param name
* the name of the object being (un)bound.
- * @since Android 1.0
*/
public SSLSessionBindingEvent(SSLSession session, String name) {
super(session);
this.name = name;
}
-
+
/**
* Returns the name of the binding being added or removed.
- *
+ *
* @return the name of the binding.
- * @since Android 1.0
*/
public String getName() {
return name;
}
-
+
/**
* Returns the session to which the binding is added or from which it is
* removed.
- *
+ *
* @return the session to which the binding is added or from which it is
* removed.
- * @since Android 1.0
*/
public SSLSession getSession() {
- return (SSLSession)this.source;
+ return (SSLSession) this.source;
}
-
-
-} \ No newline at end of file
+}
diff --git a/x-net/src/main/java/javax/net/ssl/SSLSessionBindingListener.java b/x-net/src/main/java/javax/net/ssl/SSLSessionBindingListener.java
index 7781c53..43ad745 100644
--- a/x-net/src/main/java/javax/net/ssl/SSLSessionBindingListener.java
+++ b/x-net/src/main/java/javax/net/ssl/SSLSessionBindingListener.java
@@ -21,28 +21,24 @@ import java.util.EventListener;
/**
* The interface to be implemented by any object that requires notification when
- * data objects are bound to (or unbound from) an {@code SSLSession}.
- *
- * @since Android 1.0
+ * data objects are bound to (or unbound from) an {@code SSLSession}.
*/
public interface SSLSessionBindingListener extends EventListener {
/**
* Notifies this listener when a value is bound to an {@code SSLSession}.
- *
+ *
* @param event
* the event data.
- * @since Android 1.0
*/
public void valueBound(SSLSessionBindingEvent event);
/**
* Notifies this listener when a value is unbound from an {@code SSLSession}.
- *
+ *
* @param event
* the event data.
- * @since Android 1.0
*/
public void valueUnbound(SSLSessionBindingEvent event);
-} \ No newline at end of file
+}
diff --git a/x-net/src/main/java/javax/net/ssl/SSLSessionContext.java b/x-net/src/main/java/javax/net/ssl/SSLSessionContext.java
index 9d831f3..154376e 100644
--- a/x-net/src/main/java/javax/net/ssl/SSLSessionContext.java
+++ b/x-net/src/main/java/javax/net/ssl/SSLSessionContext.java
@@ -20,72 +20,63 @@ package javax.net.ssl;
import java.util.Enumeration;
/**
- * A collection of {@code SSLSession}s.
- *
- * @since Android 1.0
+ * A collection of {@code SSLSession}s.
*/
public interface SSLSessionContext {
-
/**
* Returns an iterable of all session identifiers in this session context.
- *
+ *
* @return an iterable of all session identifiers in this session context.
- * @since Android 1.0
*/
+ @SuppressWarnings("unchecked")
public Enumeration getIds();
/**
* Returns the session for the specified session identifier.
- *
+ *
* @param sessionId
* the session identifier of the session to look up.
* @return the session for the specified session identifier, or {@code null}
* if the specified session identifier does not refer to a session
* in this context.
- * @since Android 1.0
*/
public SSLSession getSession(byte[] sessionId);
/**
* Returns the size of the session cache for this session context.
- *
+ *
* @return the size of the session cache for this session context, or
* {@code zero} if unlimited.
- * @since Android 1.0
*/
public int getSessionCacheSize();
/**
* Returns the timeout for sessions in this session context. Sessions
* exceeding the timeout are invalidated.
- *
+ *
* @return the timeout in seconds, or {@code zero} if unlimited.
- * @since Android 1.0
*/
public int getSessionTimeout();
/**
* Sets the size of the session cache for this session context.
- *
+ *
* @param size
* the size of the session cache, or {@code zero} for unlimited
* cache size.
* @throws IllegalArgumentException
* if {@code size} is negative.
- * @since Android 1.0
*/
public void setSessionCacheSize(int size) throws IllegalArgumentException;
/**
* Sets the timeout for sessions in this context. Sessions exceeding the
* timeout are invalidated.
- *
+ *
* @param seconds
* the timeout in seconds, or {@code zero} if unlimited.
* @throws IllegalArgumentException
* if {@code seconds} is negative.
- * @since Android 1.0
*/
public void setSessionTimeout(int seconds) throws IllegalArgumentException;
-
-} \ No newline at end of file
+}
diff --git a/x-net/src/main/java/javax/net/ssl/SSLSocket.java b/x-net/src/main/java/javax/net/ssl/SSLSocket.java
index 7320416..4a70843 100644
--- a/x-net/src/main/java/javax/net/ssl/SSLSocket.java
+++ b/x-net/src/main/java/javax/net/ssl/SSLSocket.java
@@ -24,19 +24,14 @@ import java.net.UnknownHostException;
/**
* The extension of {@code Socket} providing secure protocols like SSL (Secure
- * Socket Layer") or TLS (Transport Layer Security).
- *
- * @since Android 1.0
+ * Socket Layer") or TLS (Transport Layer Security).
*/
public abstract class SSLSocket extends Socket {
-
+
/**
* Only to be used by subclasses.
* <p>
* Creates a TCP socket.
- * </p>
- *
- * @since Android 1.0
*/
protected SSLSocket() {
super();
@@ -47,8 +42,7 @@ public abstract class SSLSocket extends Socket {
* <p>
* Creates a TCP socket connection to the specified host at the specified
* port.
- * </p>
- *
+ *
* @param host
* the host name to connect to.
* @param port
@@ -57,10 +51,8 @@ public abstract class SSLSocket extends Socket {
* if creating the socket fails.
* @throws UnknownHostException
* if the specified host is not known.
- * @since Android 1.0
*/
- protected SSLSocket(String host, int port) throws IOException,
- UnknownHostException {
+ protected SSLSocket(String host, int port) throws IOException, UnknownHostException {
super(host, port);
}
@@ -69,15 +61,13 @@ public abstract class SSLSocket extends Socket {
* <p>
* Creates a TCP socket connection to the specified address at the specified
* port.
- * </p>
- *
+ *
* @param address
* the address to connect to.
* @param port
* the port number to connect to.
* @throws IOException
* if creating the socket fails.
- * @since Android 1.0
*/
protected SSLSocket(InetAddress address, int port) throws IOException {
super(address, port);
@@ -88,8 +78,7 @@ public abstract class SSLSocket extends Socket {
* <p>
* Creates a TCP socket connection to the specified host at the specified
* port with the client side bound to the specified address and port.
- * </p>
- *
+ *
* @param host
* the host name to connect to.
* @param port
@@ -102,10 +91,9 @@ public abstract class SSLSocket extends Socket {
* if creating the socket fails.
* @throws UnknownHostException
* if the specified host is not known.
- * @since Android 1.0
*/
- protected SSLSocket(String host, int port, InetAddress clientAddress,
- int clientPort) throws IOException, UnknownHostException {
+ protected SSLSocket(String host, int port, InetAddress clientAddress, int clientPort)
+ throws IOException, UnknownHostException {
super(host, port, clientAddress, clientPort);
}
@@ -114,8 +102,7 @@ public abstract class SSLSocket extends Socket {
* <p>
* Creates a TCP socket connection to the specified address at the specified
* port with the client side bound to the specified address and port.
- * </p>
- *
+ *
* @param address
* the address to connect to.
* @param port
@@ -126,132 +113,119 @@ public abstract class SSLSocket extends Socket {
* the client port number to bind to.
* @throws IOException
* if creating the socket fails.
- * @since Android 1.0
*/
- protected SSLSocket(InetAddress address, int port,
- InetAddress clientAddress, int clientPort) throws IOException {
+ protected SSLSocket(InetAddress address, int port, InetAddress clientAddress, int clientPort)
+ throws IOException {
super(address, port, clientAddress, clientPort);
}
-
+
/**
* Returns the names of the supported cipher suites.
- *
+ *
* @return the names of the supported cipher suites.
- * @since Android 1.0
*/
public abstract String[] getSupportedCipherSuites();
-
+
/**
* Returns the names of the enabled cipher suites.
- *
+ *
* @return the names of the enabled cipher suites.
- * @since Android 1.0
*/
public abstract String[] getEnabledCipherSuites();
-
+
/**
* Sets the names of the cipher suites to be enabled.
* Only cipher suites returned by {@link #getSupportedCipherSuites()} are
* allowed.
- *
+ *
* @param suites
* the names of the to be enabled cipher suites.
* @throws IllegalArgumentException
* if one of the cipher suite names is not supported.
- * @since Android 1.0
*/
public abstract void setEnabledCipherSuites(String[] suites);
-
+
/**
* Returns the names of the supported protocols.
- *
+ *
* @return the names of the supported protocols.
- * @since Android 1.0
*/
public abstract String[] getSupportedProtocols();
-
+
/**
* Returns the names of the enabled protocols.
- *
+ *
* @return the names of the enabled protocols.
- * @since Android 1.0
*/
public abstract String[] getEnabledProtocols();
-
+
/**
* Sets the names of the protocols to be enabled. Only
* protocols returned by {@link #getSupportedProtocols()} are allowed.
- *
+ *
* @param protocols
* the names of the to be enabled protocols.
* @throws IllegalArgumentException
* if one of the protocols is not supported.
- * @since Android 1.0
*/
public abstract void setEnabledProtocols(String[] protocols);
-
+
/**
* Returns the {@code SSLSession} for this connection. If necessary, a
* handshake will be initiated, in which case this method will block until the handshake
* has been established. If the handshake fails, an invalid session object
* will be returned.
- *
+ *
* @return the session object.
- * @since Android 1.0
*/
public abstract SSLSession getSession();
-
+
/**
* Registers the specified listener to receive notification on completion of a
* handshake on this connection.
- *
+ *
* @param listener
* the listener to register.
* @throws IllegalArgumentException
* if {@code listener} is {@code null}.
- * @since Android 1.0
*/
public abstract void addHandshakeCompletedListener(HandshakeCompletedListener listener);
-
+
/**
* Removes the specified handshake completion listener.
- *
+ *
* @param listener
* the listener to remove.
* @throws IllegalArgumentException
* if the specified listener is not registered or {@code null}.
- * @since Android 1.0
*/
public abstract void removeHandshakeCompletedListener(HandshakeCompletedListener listener);
-
+
/**
* Starts a new SSL handshake on this connection.
- *
+ *
* @throws IOException
* if an error occurs.
- * @since Android 1.0
*/
public abstract void startHandshake() throws IOException;
-
+
/**
* Sets whether this connection should act in client mode when handshaking.
- *
+ *
* @param mode
* {@code true} if this connection should act in client mode,
* {@code false} if not.
- * @since Android 1.0
*/
public abstract void setUseClientMode(boolean mode);
-
+
/**
* Returns whether this connection will act in client mode when handshaking.
- *
+ *
* @return {@code true} if this connections will act in client mode when
* handshaking, {@code false} if not.
- * @since Android 1.0
*/
public abstract boolean getUseClientMode();
-
+
/**
* Sets whether this connection should require client authentication. This
* is only useful for sockets in server mode. The client authentication is
@@ -262,24 +236,22 @@ public abstract class SSLSocket extends Socket {
* <li>no authentication needed</li>
* </ul>
* This method overrides the setting of {@link #setWantClientAuth(boolean)}.
- *
+ *
* @param need
* {@code true} if client authentication is required,
* {@code false} if no authentication is needed.
- * @since Android 1.0
*/
public abstract void setNeedClientAuth(boolean need);
-
+
/**
* Returns whether this connection requires client authentication.
* This is only useful for sockets in server mode.
- *
+ *
* @return {@code true} if client authentication is required, {@code false}
* if no client authentication is needed.
- * @since Android 1.0
*/
public abstract boolean getNeedClientAuth();
-
+
/**
* Sets whether this connections should request client authentication. This
* is only useful for sockets in server mode. The client authentication is
@@ -290,42 +262,38 @@ public abstract class SSLSocket extends Socket {
* <li>no authentication needed</li>
* </ul>
* This method overrides the setting of {@link #setNeedClientAuth(boolean)}.
- *
+ *
* @param want
* {@code true} if client authentication should be requested,
* {@code false} if not authentication is needed.
- * @since Android 1.0
*/
public abstract void setWantClientAuth(boolean want);
-
+
/**
* Returns whether this connections will request client authentication.
- *
+ *
* @return {@code true} is client authentication will be requested,
* {@code false} if no client authentication is needed.
- * @since Android 1.0
*/
public abstract boolean getWantClientAuth();
-
+
/**
* Sets whether new SSL sessions may be created by this socket or if
* existing sessions must be reused.
- *
+ *
* @param flag
* {@code true} if new sessions may be created, otherwise
* {@code false}.
- * @since Android 1.0
*/
public abstract void setEnableSessionCreation(boolean flag);
-
+
/**
* Returns whether new SSL sessions may be created by this socket or if
* existing sessions must be reused.
- *
+ *
* @return {@code true} if new sessions may be created, otherwise
* {@code false}.
- * @since Android 1.0
*/
public abstract boolean getEnableSessionCreation();
-
-} \ No newline at end of file
+
+}
diff --git a/x-net/src/main/java/javax/net/ssl/SSLSocketFactory.java b/x-net/src/main/java/javax/net/ssl/SSLSocketFactory.java
index 2b7c03e..d9db099 100644
--- a/x-net/src/main/java/javax/net/ssl/SSLSocketFactory.java
+++ b/x-net/src/main/java/javax/net/ssl/SSLSocketFactory.java
@@ -20,10 +20,9 @@ package javax.net.ssl;
import java.io.IOException;
import java.net.Socket;
import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.security.Security;
// BEGIN android-added
-import java.lang.reflect.Method;
-import java.net.UnknownHostException;
import java.util.logging.Logger;
// END android-added
@@ -31,10 +30,9 @@ import javax.net.SocketFactory;
/**
* The abstract factory implementation to create {@code SSLSocket}s.
- *
- * @since Android 1.0
*/
public abstract class SSLSocketFactory extends SocketFactory {
+ // FIXME EXPORT CONTROL
// The default SSL socket factory
private static SocketFactory defaultSocketFactory;
@@ -42,66 +40,53 @@ public abstract class SSLSocketFactory extends SocketFactory {
private static String defaultName;
/**
- * Creates a new {@code SSLSocketFactory}.
- *
- * @since Android 1.0
- */
- public SSLSocketFactory() {
- super();
- }
-
- /**
* Returns the default {@code SSLSocketFactory} instance. The default is
* defined by the security property {@code 'ssl.SocketFactory.provider'}.
- *
+ *
* @return the default ssl socket factory instance.
- * @since Android 1.0
*/
- public static SocketFactory getDefault() {
- synchronized (SSLSocketFactory.class) {
- if (defaultSocketFactory != null) {
- // BEGIN android-added
- log("SSLSocketFactory", "Using factory " + defaultSocketFactory);
- // END android-added
- return defaultSocketFactory;
- }
- if (defaultName == null) {
- AccessController.doPrivileged(new java.security.PrivilegedAction(){
- public Object run() {
- defaultName = Security.getProperty("ssl.SocketFactory.provider");
- if (defaultName != null) {
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
- if (cl == null) {
- cl = ClassLoader.getSystemClassLoader();
- }
- try {
- defaultSocketFactory = (SocketFactory) Class.forName(
- defaultName, true, cl).newInstance();
- } catch (Exception e) {
- return e;
- }
+ public static synchronized SocketFactory getDefault() {
+ if (defaultSocketFactory != null) {
+ // BEGIN android-added
+ log("SSLSocketFactory", "Using factory " + defaultSocketFactory);
+ // END android-added
+ return defaultSocketFactory;
+ }
+ if (defaultName == null) {
+ AccessController.doPrivileged(new PrivilegedAction<Void>() {
+ public Void run() {
+ defaultName = Security.getProperty("ssl.SocketFactory.provider");
+ if (defaultName != null) {
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ if (cl == null) {
+ cl = ClassLoader.getSystemClassLoader();
+ }
+ try {
+ final Class<?> sfc = Class.forName(defaultName, true, cl);
+ defaultSocketFactory = (SocketFactory) sfc.newInstance();
+ } catch (Exception e) {
}
- return null;
}
- });
- }
-
- if (defaultSocketFactory == null) {
- // Try to find in providers
- SSLContext context = DefaultSSLContext.getContext();
- if (context != null) {
- defaultSocketFactory = context.getSocketFactory();
+ return null;
}
+ });
+ }
+
+ if (defaultSocketFactory == null) {
+ // Try to find in providers
+ SSLContext context = DefaultSSLContext.getContext();
+ if (context != null) {
+ defaultSocketFactory = context.getSocketFactory();
}
- if (defaultSocketFactory == null) {
- // Use internal implementation
- defaultSocketFactory = new DefaultSSLSocketFactory("No SSLSocketFactory installed");
- }
+ }
+ if (defaultSocketFactory == null) {
+ // Use internal implementation
+ defaultSocketFactory = new DefaultSSLSocketFactory("No SSLSocketFactory installed");
+ }
// BEGIN android-added
log("SSLSocketFactory", "Using factory " + defaultSocketFactory);
// END android-added
- return defaultSocketFactory;
- }
+ return defaultSocketFactory;
}
// BEGIN android-added
@@ -112,26 +97,31 @@ public abstract class SSLSocketFactory extends SocketFactory {
// END android-added
/**
+ * Creates a new {@code SSLSocketFactory}.
+ */
+ public SSLSocketFactory() {
+ super();
+ }
+
+ /**
* Returns the names of the cipher suites that are enabled by default.
- *
+ *
* @return the names of the cipher suites that are enabled by default.
- * @since Android 1.0
*/
public abstract String[] getDefaultCipherSuites();
/**
* Returns the names of the cipher suites that are supported and could be
* enabled for an SSL connection.
- *
+ *
* @return the names of the cipher suites that are supported.
- * @since Android 1.0
*/
public abstract String[] getSupportedCipherSuites();
/**
* Creates an {@code SSLSocket} over the specified socket that is connected
* to the specified host at the specified port.
- *
+ *
* @param s
* the socket.
* @param host
@@ -145,11 +135,9 @@ public abstract class SSLSocketFactory extends SocketFactory {
* @return the creates ssl socket.
* @throws IOException
* if creating the socket fails.
- * @throws UnknownHostException
+ * @throws java.net.UnknownHostException
* if the host is unknown.
- * @since Android 1.0
*/
- public abstract Socket createSocket(Socket s, String host, int port,
- boolean autoClose) throws IOException;
-
+ public abstract Socket createSocket(Socket s, String host, int port, boolean autoClose)
+ throws IOException;
}
diff --git a/x-net/src/main/java/javax/net/ssl/TrustManager.java b/x-net/src/main/java/javax/net/ssl/TrustManager.java
index 5d8afcd..9bdb16b 100644
--- a/x-net/src/main/java/javax/net/ssl/TrustManager.java
+++ b/x-net/src/main/java/javax/net/ssl/TrustManager.java
@@ -20,11 +20,9 @@ package javax.net.ssl;
/**
* The marker interface for JSSE trust managers. The purpose is to group trust
* managers. The responsibility a trust manager is to handle the trust data used to
- * make trust decisions for deciding whether credentials of a peer should be
+ * make trust decisions for deciding whether credentials of a peer should be
* accepted,
* @see TrustManagerFactory
- *
- * @since Android 1.0
*/
public interface TrustManager {
-} \ No newline at end of file
+}
diff --git a/x-net/src/main/java/javax/net/ssl/TrustManagerFactory.java b/x-net/src/main/java/javax/net/ssl/TrustManagerFactory.java
index 480eb26..6d9e4c9 100644
--- a/x-net/src/main/java/javax/net/ssl/TrustManagerFactory.java
+++ b/x-net/src/main/java/javax/net/ssl/TrustManagerFactory.java
@@ -23,18 +23,15 @@ import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
+import java.security.PrivilegedAction;
import java.security.Provider;
import java.security.Security;
import org.apache.harmony.security.fortress.Engine;
-
-
/**
* The factory for {@code TrustManager}s based on {@code KeyStore} or provider
* specific implementation.
- *
- * @since Android 1.0
*/
public class TrustManagerFactory {
// Store TrustManager service name
@@ -46,49 +43,25 @@ public class TrustManagerFactory {
// Store default property name
private static final String PROPERTYNAME = "ssl.TrustManagerFactory.algorithm";
- // Store used provider
- private final Provider provider;
-
- // Storeused TrustManagerFactorySpi implementation
- private final TrustManagerFactorySpi spiImpl;
-
- // Store used algorithm
- private final String algorithm;
-
- /**
- * Creates a new {@code TrustManagerFactory} instance.
- *
- * @param factorySpi
- * the implementation delegate.
- * @param provider
- * the provider
- * @param algorithm
- * the algorithm name.
- * @since Android 1.0
- */
- protected TrustManagerFactory(TrustManagerFactorySpi factorySpi,
- Provider provider, String algorithm) {
- this.provider = provider;
- this.algorithm = algorithm;
- this.spiImpl = factorySpi;
- }
-
/**
- * Returns the name of this {@code TrustManagerFactory} algorithm
- * implementation.
- *
- * @return the name of this {@code TrustManagerFactory} algorithm
- * implementation.
- * @since Android 1.0
+ * Returns the default algorithm name for the {@code TrustManagerFactory}. The
+ * default algorithm name is specified by the security property
+ * {@code 'ssl.TrustManagerFactory.algorithm'}.
+ *
+ * @return the default algorithm name.
*/
- public final String getAlgorithm() {
- return algorithm;
+ public static final String getDefaultAlgorithm() {
+ return AccessController.doPrivileged(new PrivilegedAction<String>() {
+ public String run() {
+ return Security.getProperty(PROPERTYNAME);
+ }
+ });
}
/**
* Creates a new {@code TrustManagerFactory} instance for the specified
* trust management algorithm.
- *
+ *
* @param algorithm
* the name of the requested trust management algorithm.
* @return a trust manager factory for the requested algorithm.
@@ -97,7 +70,6 @@ public class TrustManagerFactory {
* @throws NullPointerException
* if {@code algorithm} is {@code null} (instead of
* NoSuchAlgorithmException as in 1.4 release)
- * @since Android 1.0
*/
public static final TrustManagerFactory getInstance(String algorithm)
throws NoSuchAlgorithmException {
@@ -106,15 +78,15 @@ public class TrustManagerFactory {
}
synchronized (engine) {
engine.getInstance(algorithm, null);
- return new TrustManagerFactory((TrustManagerFactorySpi) engine.spi,
- engine.provider, algorithm);
+ return new TrustManagerFactory((TrustManagerFactorySpi) engine.spi, engine.provider,
+ algorithm);
}
}
/**
* Creates a new {@code TrustManagerFactory} instance for the specified
* trust management algorithm from the specified provider.
- *
+ *
* @param algorithm
* the name of the requested trust management algorithm name.
* @param provider
@@ -129,11 +101,9 @@ public class TrustManagerFactory {
* @throws NullPointerException
* if {@code algorithm} is {@code null} (instead of
* NoSuchAlgorithmException as in 1.4 release)
- * @since Android 1.0
*/
- public static final TrustManagerFactory getInstance(String algorithm,
- String provider) throws NoSuchAlgorithmException,
- NoSuchProviderException {
+ public static final TrustManagerFactory getInstance(String algorithm, String provider)
+ throws NoSuchAlgorithmException, NoSuchProviderException {
if ((provider == null) || (provider.length() == 0)) {
throw new IllegalArgumentException("Provider is null oe empty");
}
@@ -147,7 +117,7 @@ public class TrustManagerFactory {
/**
* Creates a new {@code TrustManagerFactory} instance for the specified
* trust management algorithm from the specified provider.
- *
+ *
* @param algorithm
* the name of the requested key management algorithm name.
* @param provider
@@ -159,10 +129,9 @@ public class TrustManagerFactory {
* @throws NullPointerException
* if {@code algorithm} is {@code null} (instead of
* NoSuchAlgorithmException as in 1.4 release)
- * @since Android 1.0
*/
- public static final TrustManagerFactory getInstance(String algorithm,
- Provider provider) throws NoSuchAlgorithmException {
+ public static final TrustManagerFactory getInstance(String algorithm, Provider provider)
+ throws NoSuchAlgorithmException {
if (provider == null) {
throw new IllegalArgumentException("Provider is null");
}
@@ -171,16 +140,51 @@ public class TrustManagerFactory {
}
synchronized (engine) {
engine.getInstance(algorithm, provider, null);
- return new TrustManagerFactory((TrustManagerFactorySpi) engine.spi,
- provider, algorithm);
+ return new TrustManagerFactory((TrustManagerFactorySpi) engine.spi, provider, algorithm);
}
}
+ // Store used provider
+ private final Provider provider;
+
+ // Store used TrustManagerFactorySpi implementation
+ private final TrustManagerFactorySpi spiImpl;
+
+ // Store used algorithm
+ private final String algorithm;
+
+ /**
+ * Creates a new {@code TrustManagerFactory} instance.
+ *
+ * @param factorySpi
+ * the implementation delegate.
+ * @param provider
+ * the provider
+ * @param algorithm
+ * the algorithm name.
+ */
+ protected TrustManagerFactory(TrustManagerFactorySpi factorySpi, Provider provider,
+ String algorithm) {
+ this.provider = provider;
+ this.algorithm = algorithm;
+ this.spiImpl = factorySpi;
+ }
+
+ /**
+ * Returns the name of this {@code TrustManagerFactory} algorithm
+ * implementation.
+ *
+ * @return the name of this {@code TrustManagerFactory} algorithm
+ * implementation.
+ */
+ public final String getAlgorithm() {
+ return algorithm;
+ }
+
/**
* Returns the provider for this {@code TrustManagerFactory} instance.
- *
+ *
* @return the provider for this {@code TrustManagerFactory} instance.
- * @since Android 1.0
*/
public final Provider getProvider() {
return provider;
@@ -189,12 +193,11 @@ public class TrustManagerFactory {
/**
* Initializes this factory instance with the specified keystore as source
* of certificate authorities and trust material.
- *
+ *
* @param ks
* the keystore or {@code null}.
* @throws KeyStoreException
* if the initialization fails.
- * @since Android 1.0
*/
public final void init(KeyStore ks) throws KeyStoreException {
spiImpl.engineInit(ks);
@@ -203,43 +206,24 @@ public class TrustManagerFactory {
/**
* Initializes this factory instance with the specified provider-specific
* parameters for a source of trust material.
- *
+ *
* @param spec
* the provider-specific parameters.
* @throws InvalidAlgorithmParameterException
* if the initialization fails.
- * @since Android 1.0
*/
- public final void init(ManagerFactoryParameters spec)
- throws InvalidAlgorithmParameterException {
+ public final void init(ManagerFactoryParameters spec) throws InvalidAlgorithmParameterException {
spiImpl.engineInit(spec);
}
/**
* Returns the list of {@code TrustManager}s with one entry for each type
* of trust material.
- *
+ *
* @return the list of {@code TrustManager}s
- * @since Android 1.0
*/
public final TrustManager[] getTrustManagers() {
return spiImpl.engineGetTrustManagers();
}
- /**
- * Returns the default algorithm name for the {@code TrustManagerFactory}. The
- * default algorithm name is specified by the security property
- * {@code 'ssl.TrustManagerFactory.algorithm'}.
- *
- * @return the default algorithm name.
- * @since Android 1.0
- */
- public static final String getDefaultAlgorithm() {
- return AccessController
- .doPrivileged(new java.security.PrivilegedAction<String>() {
- public String run() {
- return Security.getProperty(PROPERTYNAME);
- }
- });
- }
-} \ No newline at end of file
+}
diff --git a/x-net/src/main/java/javax/net/ssl/TrustManagerFactorySpi.java b/x-net/src/main/java/javax/net/ssl/TrustManagerFactorySpi.java
index 08e213e..1b04c5b 100644
--- a/x-net/src/main/java/javax/net/ssl/TrustManagerFactorySpi.java
+++ b/x-net/src/main/java/javax/net/ssl/TrustManagerFactorySpi.java
@@ -24,40 +24,35 @@ import java.security.KeyStoreException;
/**
* The <i>Service Provider Interface</i> (SPI) for the
* {@code TrustManagerFactory} class.
- *
- * @since Android 1.0
*/
public abstract class TrustManagerFactorySpi {
/**
* Creates a new {@code TrustManagerFactorySpi} instance.
- *
- * @since Android 1.0
*/
public TrustManagerFactorySpi() {
+ super();
}
/**
* Initializes this factory instance with the specified keystore as source
* of certificate authorities and trust material.
- *
+ *
* @param ks
* the keystore or {@code null}.
* @throws KeyStoreException
* if the initialization fails.
- * @since Android 1.0
*/
protected abstract void engineInit(KeyStore ks) throws KeyStoreException;
/**
* Initializes this factory instance with the specified provider-specific
* parameters for a source of trust material.
- *
+ *
* @param spec
* the provider-specific parameters.
* @throws InvalidAlgorithmParameterException
* if the initialization fails.
- * @since Android 1.0
*/
protected abstract void engineInit(ManagerFactoryParameters spec)
throws InvalidAlgorithmParameterException;
@@ -65,9 +60,8 @@ public abstract class TrustManagerFactorySpi {
/**
* Returns the list of {@code TrustManager}s with one entry for each type
* of trust material.
- *
+ *
* @return the list of {@code TrustManager}s
- * @since Android 1.0
*/
protected abstract TrustManager[] engineGetTrustManagers();
-} \ No newline at end of file
+}
diff --git a/x-net/src/main/java/javax/net/ssl/X509ExtendedKeyManager.java b/x-net/src/main/java/javax/net/ssl/X509ExtendedKeyManager.java
index bd5570d..3298d8e 100644
--- a/x-net/src/main/java/javax/net/ssl/X509ExtendedKeyManager.java
+++ b/x-net/src/main/java/javax/net/ssl/X509ExtendedKeyManager.java
@@ -21,27 +21,22 @@ import java.security.Principal;
/**
* The abstract extension for the {@code X509KeyManager} interface.
- *
- * @since Android 1.0
*/
public abstract class X509ExtendedKeyManager implements X509KeyManager {
-
+
/**
* To be used by subclasses only.
* <p>
* Creates a new {@code X509ExtendedKeyManager} instance.
- * </p>
- *
- * @since Android 1.0
*/
protected X509ExtendedKeyManager() {
super();
}
/**
- * Chooses a alias for the client side of an SSL connection to authenticate
+ * Chooses an alias for the client side of an SSL connection to authenticate
* it with the specified public key type and certificate issuers.
- *
+ *
* @param keyType
* the list of public key algorithm names.
* @param issuers
@@ -52,7 +47,6 @@ public abstract class X509ExtendedKeyManager implements X509KeyManager {
* no engine is predefined.
* @return the alias name of a matching key or {@code null} if there are no
* matches.
- * @since Android 1.0
*/
public String chooseEngineClientAlias(String[] keyType,
Principal[] issuers, SSLEngine engine) {
@@ -60,9 +54,9 @@ public abstract class X509ExtendedKeyManager implements X509KeyManager {
}
/**
- * Chooses a alias for the server side of an SSL connection to authenticate
+ * Chooses an alias for the server side of an SSL connection to authenticate
* it with the specified public key type and certificate issuers.
- *
+ *
* @param keyType
* the list of public key algorithm names.
* @param issuers
@@ -73,11 +67,10 @@ public abstract class X509ExtendedKeyManager implements X509KeyManager {
* no engine is predefined.
* @return the alias name of a matching key or {@code null} if there are no
* matches.
- * @since Android 1.0
*/
public String chooseEngineServerAlias(String keyType, Principal[] issuers,
SSLEngine engine) {
return null;
}
-} \ No newline at end of file
+}
diff --git a/x-net/src/main/java/javax/net/ssl/X509KeyManager.java b/x-net/src/main/java/javax/net/ssl/X509KeyManager.java
index f65ae4e..aebc427 100644
--- a/x-net/src/main/java/javax/net/ssl/X509KeyManager.java
+++ b/x-net/src/main/java/javax/net/ssl/X509KeyManager.java
@@ -24,15 +24,13 @@ import java.security.cert.X509Certificate;
/**
* A Key Manager for X509 certificate-based key pairs.
- *
- * @since Android 1.0
*/
public interface X509KeyManager extends KeyManager {
/**
* Chooses an alias for the client side of an SSL connection to authenticate
* it with the specified public key type and certificate issuers.
- *
+ *
* @param keyType
* the list of public key algorithm names.
* @param issuers
@@ -43,7 +41,6 @@ public interface X509KeyManager extends KeyManager {
* the alias selected does not depend on a specific socket.
* @return the alias name of a matching key or {@code null} if there are no
* matches.
- * @since Android 1.0
*/
public String chooseClientAlias(String[] keyType, Principal[] issuers,
Socket socket);
@@ -51,7 +48,7 @@ public interface X509KeyManager extends KeyManager {
/**
* Chooses an alias for the server side of an SSL connection to authenticate
* it with the specified public key type and certificate issuers.
- *
+ *
* @param keyType
* the list of public key algorithm type names.
* @param issuers
@@ -62,26 +59,24 @@ public interface X509KeyManager extends KeyManager {
* the alias selected does not depend on a specific socket.
* @return the alias name of a matching key or {@code null} if there are no
* matches.
- * @since Android 1.0
*/
public String chooseServerAlias(String keyType, Principal[] issuers,
Socket socket);
/**
* Returns the certificate chain for the specified alias.
- *
+ *
* @param alias
* the alias to get the certificate chain for.
* @return the certificate chain for the specified alias, or {@code null} if
* the alias cannot be found.
- * @since Android 1.0
*/
public X509Certificate[] getCertificateChain(String alias);
/**
* Returns the client aliases for the specified public key type and list of
* certificate issuers.
- *
+ *
* @param keyType
* the public key algorithm type name.
* @param issuers
@@ -89,14 +84,13 @@ public interface X509KeyManager extends KeyManager {
* will do.
* @return the client aliases for the specified public key type, or
* {@code null} if there are no matching aliases.
- * @since Android 1.0
*/
public String[] getClientAliases(String keyType, Principal[] issuers);
/**
* Returns the server aliases for the specified public key type and list of
* certificate issuers.
- *
+ *
* @param keyType
* the public key algorithm type name.
* @param issuers
@@ -104,18 +98,16 @@ public interface X509KeyManager extends KeyManager {
* will do.
* @return the client aliases for the specified public key type, or
* {@code null} if there are no matching aliases.
- * @since Android 1.0
*/
public String[] getServerAliases(String keyType, Principal[] issuers);
/**
* Returns the private key for the specified alias.
- *
+ *
* @param alias
* the alias to get the private key for.
* @return the private key for the specified alias, or {@code null} if the
* alias cannot be found.
- * @since Android 1.0
*/
public PrivateKey getPrivateKey(String alias);
-} \ No newline at end of file
+}
diff --git a/x-net/src/main/java/javax/net/ssl/X509TrustManager.java b/x-net/src/main/java/javax/net/ssl/X509TrustManager.java
index 135c0e7..7d7827e 100644
--- a/x-net/src/main/java/javax/net/ssl/X509TrustManager.java
+++ b/x-net/src/main/java/javax/net/ssl/X509TrustManager.java
@@ -22,9 +22,7 @@ import java.security.cert.X509Certificate;
/**
* The trust manager for X509 certificates to be used to perform authentication
- * for secure sockets.
- *
- * @since Android 1.0
+ * for secure sockets.
*/
public interface X509TrustManager extends TrustManager {
@@ -32,7 +30,7 @@ public interface X509TrustManager extends TrustManager {
* Checks whether the specified certificate chain (partial or complete) can
* be validated and is trusted for client authentication for the specified
* authentication type.
- *
+ *
* @param chain
* the certificate chain to validate.
* @param authType
@@ -43,7 +41,6 @@ public interface X509TrustManager extends TrustManager {
* if the specified certificate chain is empty or {@code null},
* or if the specified authentication type is {@code null} or an
* empty string.
- * @since Android 1.0
*/
public void checkClientTrusted(X509Certificate[] chain, String authType)
throws CertificateException;
@@ -53,7 +50,7 @@ public interface X509TrustManager extends TrustManager {
* Checks whether the specified certificate chain (partial or complete) can
* be validated and is trusted for server authentication for the specified
* key exchange algorithm.
- *
+ *
* @param chain
* the certificate chain to validate.
* @param authType
@@ -64,7 +61,6 @@ public interface X509TrustManager extends TrustManager {
* if the specified certificate chain is empty or {@code null},
* or if the specified authentication type is {@code null} or an
* empty string.
- * @since Android 1.0
*/
public void checkServerTrusted(X509Certificate[] chain, String authType)
throws CertificateException;
@@ -72,10 +68,9 @@ public interface X509TrustManager extends TrustManager {
/**
* Returns the list of certificate issuer authorities which are trusted for
* authentication of peers.
- *
+ *
* @return the list of certificate issuer authorities which are trusted for
* authentication of peers.
- * @since Android 1.0
*/
public X509Certificate[] getAcceptedIssuers();
-} \ No newline at end of file
+}
diff --git a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/AlertException.java b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/AlertException.java
index edf7638..f607364 100644
--- a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/AlertException.java
+++ b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/AlertException.java
@@ -15,21 +15,17 @@
* limitations under the License.
*/
-/**
- * @author Alexander Y. Kleymenov
- * @version $Revision$
- */
-
package org.apache.harmony.xnet.provider.jsse;
import javax.net.ssl.SSLException;
/**
- * This exception is used to signalize the fatal alert
- * occured during the work of protocol.
+ * This exception is used to signal that a fatal alert has occurred while working through the
+ * protocol.
*/
public class AlertException extends RuntimeException {
+ private static final long serialVersionUID = -4448327177165687581L;
// SSLException to be thrown to application side
private final SSLException reason;
// alert description code
@@ -37,11 +33,11 @@ public class AlertException extends RuntimeException {
/**
* Constructs the instance.
- * @param description: The alert description code.
- * @see org.apache.harmony.xnet.provider.jsse.AlertProtocol
- * @param reason: The SSLException to be thrown to application
- * side after alert processing (sending the record with alert,
- * shoutdown work, etc).
+ *
+ * @param description The alert description code from {@link AlertProtocol}
+ * @param reason The SSLException to be thrown to application side after alert processing
+ * (sending the record with alert, shutdown work, etc).
+ * @see AlertProtocol
*/
protected AlertException(byte description, SSLException reason) {
super(reason);
@@ -50,8 +46,8 @@ public class AlertException extends RuntimeException {
}
/**
- * Returns the reason of alert. This reason should be rethrown
- * after alert protcessin.
+ * Returns the reason of alert. This reason should be rethrown after alert processing.
+ *
* @return the reason of alert.
*/
protected SSLException getReason() {
@@ -60,9 +56,9 @@ public class AlertException extends RuntimeException {
/**
* Returns alert's description code.
- * @return byte value describing the occured alert.
- * @see org.apache.harmony.xnet.provider.jsse.AlertProtocol for more information about possible
- * reason codes.
+ *
+ * @return alert description code from {@link AlertProtocol}
+ * @see AlertProtocol for more information about possible reason codes.
*/
protected byte getDescriptionCode() {
return description;
diff --git a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/AlertProtocol.java b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/AlertProtocol.java
index 8f10875..a12d00a 100644
--- a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/AlertProtocol.java
+++ b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/AlertProtocol.java
@@ -15,11 +15,6 @@
* limitations under the License.
*/
-/**
- * @author Alexander Y. Kleymenov
- * @version $Revision$
- */
-
package org.apache.harmony.xnet.provider.jsse;
import org.apache.harmony.xnet.provider.jsse.SSLRecordProtocol;
@@ -136,8 +131,6 @@ public class AlertProtocol {
* Defines the description code of the no_renegotiation alert
*/
protected static final byte NO_RENEGOTIATION = 100;
-
-
// holds level and description codes
private final byte[] alert = new byte[2];
// record protocol to be used to wrap the alerts
@@ -271,7 +264,7 @@ public class AlertProtocol {
/**
* Returns the record with reported alert message.
* The returned array of bytes is ready to be sent to another peer.
- * Note, that this method does not automatically set the state of allert
+ * Note, that this method does not automatically set the state of alert
* protocol in "no alert" state, so after wrapping the method setProcessed
* should be called.
*/
@@ -281,7 +274,7 @@ public class AlertProtocol {
}
/**
- * Shutdownes the protocol. It will be impossiblke to use the instance
+ * Shutdown the protocol. It will be impossible to use the instance
* after the calling of this method.
*/
protected void shutdown() {
diff --git a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/Appendable.java b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/Appendable.java
index 1485bae..070f42a 100644
--- a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/Appendable.java
+++ b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/Appendable.java
@@ -15,24 +15,19 @@
* limitations under the License.
*/
-/**
- * @author Alexander Y. Kleymenov
- * @version $Revision$
- */
-
package org.apache.harmony.xnet.provider.jsse;
/**
- * This interface represents the ability of the input stream related
- * classes to provide additianal data to be read.
+ * This interface represents the ability of the input stream related classes to provide additional
+ * data to be read.
*/
public interface Appendable {
/**
* Provides the additional data to be read.
- * @param src: the source data to be appended.
+ *
+ * @param src the source data to be appended.
*/
public void append(byte[] src);
}
-
diff --git a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/CertificateMessage.java b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/CertificateMessage.java
index 6aac128..8065860 100644
--- a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/CertificateMessage.java
+++ b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/CertificateMessage.java
@@ -15,11 +15,6 @@
* limitations under the License.
*/
-/**
- * @author Boris Kuznetsov
- * @version $Revision$
- */
-
package org.apache.harmony.xnet.provider.jsse;
import org.apache.harmony.xnet.provider.jsse.Message;
@@ -28,6 +23,7 @@ import org.apache.harmony.xnet.provider.jsse.HandshakeIODataStream;
import org.apache.harmony.xnet.provider.jsse.AlertProtocol;
import java.io.IOException;
+import java.security.cert.Certificate;
import java.security.cert.CertificateEncodingException;
import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
@@ -35,7 +31,6 @@ import java.security.cert.X509Certificate;
import java.util.Vector;
/**
- *
* Represents server/client certificate message
* @see <a href="http://www.ietf.org/rfc/rfc2246.txt">TLS
* 1.0 spec., 7.4.2. Server certificate; 7.4.6. Client certificate</a>
@@ -80,7 +75,7 @@ public class CertificateMessage extends Message {
fatalAlert(AlertProtocol.INTERNAL_ERROR, "INTERNAL ERROR", e);
return;
}
- Vector certs_vector = new Vector();
+ Vector<Certificate> certs_vector = new Vector<Certificate>();
int size = 0;
int enc_size = 0;
while (l > 0) {
@@ -141,6 +136,7 @@ public class CertificateMessage extends Message {
*
* @param out
*/
+ @Override
public void send(HandshakeIODataStream out) {
int total_length = 0;
@@ -172,6 +168,7 @@ public class CertificateMessage extends Message {
*
* @return
*/
+ @Override
public int getType() {
return Handshake.CERTIFICATE;
}
diff --git a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/CertificateRequest.java b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/CertificateRequest.java
index 8bedccd..7b27787 100644
--- a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/CertificateRequest.java
+++ b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/CertificateRequest.java
@@ -15,11 +15,6 @@
* limitations under the License.
*/
-/**
- * @author Boris Kuznetsov
- * @version $Revision$
- */
-
package org.apache.harmony.xnet.provider.jsse;
import org.apache.harmony.xnet.provider.jsse.Message;
@@ -110,7 +105,7 @@ public class CertificateRequest extends Message {
certificate_authorities = new X500Principal[size];
int totalPrincipalsLength = 0;
int principalLength = 0;
- Vector principals = new Vector();
+ Vector<X500Principal> principals = new Vector<X500Principal>();
while (totalPrincipalsLength < size) {
principalLength = in.readUint16(); // encoded X500Principal size
principals.add(new X500Principal(in));
@@ -119,7 +114,7 @@ public class CertificateRequest extends Message {
}
certificate_authorities = new X500Principal[principals.size()];
for (int i = 0; i < certificate_authorities.length; i++) {
- certificate_authorities[i] = (X500Principal) principals.elementAt(i);
+ certificate_authorities[i] = principals.elementAt(i);
}
this.length = 3 + certificate_types.length + totalPrincipalsLength;
if (this.length != length) {
@@ -134,6 +129,7 @@ public class CertificateRequest extends Message {
*
* @param out
*/
+ @Override
public void send(HandshakeIODataStream out) {
out.writeUint8(certificate_types.length);
@@ -156,6 +152,7 @@ public class CertificateRequest extends Message {
*
* @return
*/
+ @Override
public int getType() {
return Handshake.CERTIFICATE_REQUEST;
}
diff --git a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/CertificateVerify.java b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/CertificateVerify.java
index 183b8aa..9b18ecb 100644
--- a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/CertificateVerify.java
+++ b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/CertificateVerify.java
@@ -15,11 +15,6 @@
* limitations under the License.
*/
-/**
- * @author Boris Kuznetsov
- * @version $Revision$
- */
-
package org.apache.harmony.xnet.provider.jsse;
import org.apache.harmony.xnet.provider.jsse.Message;
@@ -30,7 +25,6 @@ import org.apache.harmony.xnet.provider.jsse.AlertProtocol;
import java.io.IOException;
/**
- *
* Represents certificate verify message
* @see <a href="http://www.ietf.org/rfc/rfc2246.txt">TLS 1.0 spec., 7.4.8.
* Certificate verify</a>
@@ -83,6 +77,7 @@ public class CertificateVerify extends Message {
*
* @param out
*/
+ @Override
public void send(HandshakeIODataStream out) {
if (signedHash.length != 0) {
out.writeUint16(signedHash.length);
@@ -95,6 +90,7 @@ public class CertificateVerify extends Message {
*
* @return
*/
+ @Override
public int getType() {
return Handshake.CERTIFICATE_VERIFY;
}
diff --git a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/CipherSuite.java b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/CipherSuite.java
index 8352386..f084195 100644
--- a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/CipherSuite.java
+++ b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/CipherSuite.java
@@ -15,11 +15,6 @@
* limitations under the License.
*/
-/**
- * @author Boris Kuznetsov
- * @version $Revision$
- */
-
package org.apache.harmony.xnet.provider.jsse;
import java.security.GeneralSecurityException;
@@ -277,29 +272,29 @@ public class CipherSuite {
};
// hash for quick access to cipher suite by name
- private static Hashtable cuitesByName;
+ private static Hashtable<String, CipherSuite> cuitesByName;
/**
- * array of supported sipher suites.
+ * array of supported cipher suites.
* Set of supported suites is defined at the moment provider's start
*/
-// TODO Dinamical supported suites: new providers may be dynamically
-// added/removed and the set of supportes suites may be changed
+// TODO Dynamically supported suites: new providers may be dynamically
+// added/removed and the set of supported suites may be changed
static CipherSuite[] supportedCipherSuites;
/**
- * array of supported sipher suites names
+ * array of supported cipher suites names
*/
static String[] supportedCipherSuiteNames;
/**
- * default sipher suites
+ * default cipher suites
*/
static CipherSuite[] defaultCipherSuites;
static {
int count = 0;
- cuitesByName = new Hashtable();
+ cuitesByName = new Hashtable<String, CipherSuite>();
for (int i = 0; i < cuitesByCode.length; i++) {
cuitesByName.put(cuitesByCode[i].getName(), cuitesByCode[i]);
if (cuitesByCode[i].supported) {
@@ -353,7 +348,7 @@ public class CipherSuite {
* @return
*/
public static CipherSuite getByName(String name) {
- return (CipherSuite) cuitesByName.get(name);
+ return cuitesByName.get(name);
}
/**
@@ -364,8 +359,8 @@ public class CipherSuite {
* @return
*/
public static CipherSuite getByCode(byte b1, byte b2) {
- if (b1 != 0 || b2 > cuitesByCode.length) {
- // Unknoun
+ if (b1 != 0 || (b2 & 0xFF) > cuitesByCode.length) {
+ // Unknown
return new CipherSuite("UNKNOUN_" + b1 + "_" + b2, false, 0, "",
"", new byte[] { b1, b2 });
}
@@ -383,7 +378,7 @@ public class CipherSuite {
*/
public static CipherSuite getByCode(byte b1, byte b2, byte b3) {
if (b1 == 0 && b2 == 0) {
- if (b3 <= cuitesByCode.length) {
+ if ((b3 & 0xFF) <= cuitesByCode.length) {
return cuitesByCode[b3];
}
}
@@ -523,7 +518,7 @@ public class CipherSuite {
* @return
*/
public static String[] getSupportedCipherSuiteNames() {
- return (String[]) supportedCipherSuiteNames.clone();
+ return supportedCipherSuiteNames.clone();
}
/**
@@ -545,6 +540,7 @@ public class CipherSuite {
/**
* Returns cipher suite description
*/
+ @Override
public String toString() {
return name + ": " + cipherSuiteCode[0] + " " + cipherSuiteCode[1];
}
@@ -552,6 +548,7 @@ public class CipherSuite {
/**
* Compares this cipher suite to the specified object.
*/
+ @Override
public boolean equals(Object obj) {
if (obj instanceof CipherSuite
&& this.cipherSuiteCode[0] == ((CipherSuite) obj).cipherSuiteCode[0]
@@ -610,3 +607,4 @@ public class CipherSuite {
}
}
+
diff --git a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ClientHandshakeImpl.java b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ClientHandshakeImpl.java
index 55a06f5..b488a0e 100644
--- a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ClientHandshakeImpl.java
+++ b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ClientHandshakeImpl.java
@@ -15,11 +15,6 @@
* limitations under the License.
*/
-/**
- * @author Boris Kuznetsov
- * @version $Revision$
- */
-
package org.apache.harmony.xnet.provider.jsse;
import java.io.IOException;
@@ -52,7 +47,7 @@ import javax.net.ssl.X509ExtendedKeyManager;
* Handshake protocol operates on top of the Record Protocol.
* It is responsible for session negotiating.
*
- * The implementation proceses inbound server handshake messages,
+ * The implementation processes inbound server handshake messages,
* creates and sends respond messages. Outbound messages are supplied
* to Record Protocol. Detected errors are reported to the Alert protocol.
*
@@ -75,6 +70,7 @@ public class ClientHandshakeImpl extends HandshakeProtocol {
* Starts handshake
*
*/
+ @Override
public void start() {
if (session == null) { // initial handshake
session = findSessionToResume();
@@ -139,9 +135,10 @@ public class ClientHandshakeImpl extends HandshakeProtocol {
}
/**
- * Proceses inbound handshake messages
+ * Processes inbound handshake messages
* @param bytes
*/
+ @Override
public void unwrap(byte[] bytes) {
if (this.delegatedTaskErr != null) {
Exception e = this.delegatedTaskErr;
@@ -248,7 +245,7 @@ public class ClientHandshakeImpl extends HandshakeProtocol {
session.protocol = servProt;
recordProtocol.setVersion(session.protocol.version);
session.cipherSuite = serverHello.cipher_suite;
- session.id = (byte[]) serverHello.session_id.clone();
+ session.id = serverHello.session_id.clone();
session.serverRandom = serverHello.random;
break;
case 11: // CERTIFICATE
@@ -285,15 +282,12 @@ public class ClientHandshakeImpl extends HandshakeProtocol {
}
serverHelloDone = new ServerHelloDone(io_stream, length);
if (this.nonBlocking) {
- delegatedTasks.add(new DelegatedTask(
- new PrivilegedExceptionAction(){
- public Object run() throws Exception {
+ delegatedTasks.add(new DelegatedTask(new PrivilegedExceptionAction<Void>() {
+ public Void run() throws Exception {
processServerHelloDone();
return null;
- }
- },
- this,
- AccessController.getContext()));
+ }
+ }, this, AccessController.getContext()));
return;
}
processServerHelloDone();
@@ -338,6 +332,7 @@ public class ClientHandshakeImpl extends HandshakeProtocol {
* @ see TLS 1.0 spec., E.1. Version 2 client hello
* @param bytes
*/
+ @Override
public void unwrapSSLv2(byte[] bytes) {
unexpectedMessage();
}
@@ -345,6 +340,7 @@ public class ClientHandshakeImpl extends HandshakeProtocol {
/**
* Creates and sends Finished message
*/
+ @Override
protected void makeFinished() {
byte[] verify_data;
if (serverHello.server_version[1] == 1) {
@@ -591,8 +587,9 @@ public class ClientHandshakeImpl extends HandshakeProtocol {
}
/**
- * Proceses ChangeCipherSpec message
+ * Processes ChangeCipherSpec message
*/
+ @Override
public void receiveChangeCipherSpec() {
if (isResuming) {
if (serverHello == null) {
@@ -628,3 +625,4 @@ public class ClientHandshakeImpl extends HandshakeProtocol {
}
}
+
diff --git a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ClientHello.java b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ClientHello.java
index aa811fb..5764105 100644
--- a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ClientHello.java
+++ b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ClientHello.java
@@ -15,11 +15,6 @@
* limitations under the License.
*/
-/**
-* @author Boris Kuznetsov
-* @version $Revision$
-*/
-
package org.apache.harmony.xnet.provider.jsse;
import java.io.IOException;
@@ -27,7 +22,6 @@ import java.security.SecureRandom;
import java.util.Arrays;
/**
- *
* Represents Client Hello message
* @see <a href="http://www.ietf.org/rfc/rfc2246.txt">TLS 1.0 spec., 7.4.1.2.
* Client hello</a>
@@ -176,6 +170,7 @@ public class ClientHello extends Message {
* Sends message
* @param out
*/
+ @Override
public void send(HandshakeIODataStream out) {
out.write(client_version);
out.write(random);
@@ -204,6 +199,7 @@ public class ClientHello extends Message {
* Returns message type
* @return
*/
+ @Override
public int getType() {
return Handshake.CLIENT_HELLO;
}
diff --git a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ClientKeyExchange.java b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ClientKeyExchange.java
index a208456..af751c2 100644
--- a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ClientKeyExchange.java
+++ b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ClientKeyExchange.java
@@ -15,11 +15,6 @@
* limitations under the License.
*/
-/**
-* @author Boris Kuznetsov
-* @version $Revision$
-*/
-
package org.apache.harmony.xnet.provider.jsse;
import org.apache.harmony.xnet.provider.jsse.Message;
@@ -30,7 +25,6 @@ import java.io.IOException;
import java.math.BigInteger;
/**
- *
* Represents client key exchange message
* @see <a href="http://www.ietf.org/rfc/rfc2246.txt">TLS 1.0 spec., 7.4.7.
* Client key exchange message</a>
@@ -129,6 +123,7 @@ public class ClientKeyExchange extends Message {
* Sends message
* @param out
*/
+ @Override
public void send(HandshakeIODataStream out) {
if (exchange_keys.length != 0) {
if (!isRSA || isTLS) {// DH or TLSv1 RSA
@@ -142,6 +137,7 @@ public class ClientKeyExchange extends Message {
* Returns message type
* @return
*/
+ @Override
public int getType() {
return Handshake.CLIENT_KEY_EXCHANGE;
}
diff --git a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ConnectionState.java b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ConnectionState.java
index 63bad5d..49a7af9 100644
--- a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ConnectionState.java
+++ b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ConnectionState.java
@@ -15,11 +15,6 @@
* limitations under the License.
*/
-/**
- * @author Alexander Y. Kleymenov
- * @version $Revision$
- */
-
package org.apache.harmony.xnet.provider.jsse;
import org.apache.harmony.xnet.provider.jsse.Logger;
diff --git a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ConnectionStateSSLv3.java b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ConnectionStateSSLv3.java
index 078bf58..07bd340 100644
--- a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ConnectionStateSSLv3.java
+++ b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ConnectionStateSSLv3.java
@@ -15,11 +15,6 @@
* limitations under the License.
*/
-/**
- * @author Alexander Y. Kleymenov
- * @version $Revision$
- */
-
package org.apache.harmony.xnet.provider.jsse;
import java.security.GeneralSecurityException;
@@ -31,7 +26,7 @@ import javax.crypto.spec.SecretKeySpec;
import javax.net.ssl.SSLProtocolException;
/**
- * This class incapsulates the operating environment of the SSL v3
+ * This class encapsulates the operating environment of the SSL v3
* (http://wp.netscape.com/eng/ssl3) Record Protocol and provides
* relating encryption/decryption functionality.
* The work functionality is based on the security
@@ -218,8 +213,9 @@ public class ConnectionStateSSLv3 extends ConnectionState {
/**
* Creates the GenericStreamCipher or GenericBlockCipher
* data structure for specified data of specified type.
- * @throws org.apache.harmony.xnet.provider.jsse.AlertException if alert was occured.
+ * @throws AlertException if alert was occurred.
*/
+ @Override
protected byte[] encrypt(byte type, byte[] fragment, int offset, int len) {
try {
int content_mac_length = len + hash_size;
@@ -282,6 +278,7 @@ public class ConnectionStateSSLv3 extends ConnectionState {
* the specified type from the provided data.
* @throws AlertException if alert was occured.
*/
+ @Override
protected byte[] decrypt(byte type, byte[] fragment,
int offset, int len) {
// plain data of the Generic[Stream|Block]Cipher structure
@@ -344,9 +341,10 @@ public class ConnectionStateSSLv3 extends ConnectionState {
}
/**
- * Shutdownes the protocol. It will be impossiblke to use the instance
+ * Shutdown the protocol. It will be impossible to use the instance
* after the calling of this method.
*/
+ @Override
protected void shutdown() {
Arrays.fill(mac_write_secret, (byte) 0);
Arrays.fill(mac_read_secret, (byte) 0);
diff --git a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ConnectionStateTLS.java b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ConnectionStateTLS.java
index 1b21b17..949e655 100644
--- a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ConnectionStateTLS.java
+++ b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ConnectionStateTLS.java
@@ -15,11 +15,6 @@
* limitations under the License.
*/
-/**
- * @author Alexander Y. Kleymenov
- * @version $Revision$
- */
-
package org.apache.harmony.xnet.provider.jsse;
import org.apache.harmony.xnet.provider.jsse.AlertException;
@@ -36,7 +31,7 @@ import javax.crypto.spec.SecretKeySpec;
import javax.net.ssl.SSLProtocolException;
/**
- * This class incapsulates the operating environment of the TLS v1
+ * This class encapsulates the operating environment of the TLS v1
* (http://www.ietf.org/rfc/rfc2246.txt) Record Protocol and provides
* relating encryption/decryption functionality.
* The work functionality is based on the security
@@ -44,7 +39,7 @@ import javax.net.ssl.SSLProtocolException;
*/
public class ConnectionStateTLS extends ConnectionState {
- // Precomputed prf label values:
+ // Pre-calculated prf label values:
// "key expansion".getBytes()
private static byte[] KEY_EXPANSION_LABEL = {
(byte) 0x6B, (byte) 0x65, (byte) 0x79, (byte) 0x20, (byte) 0x65,
@@ -235,8 +230,9 @@ public class ConnectionStateTLS extends ConnectionState {
/**
* Creates the GenericStreamCipher or GenericBlockCipher
* data structure for specified data of specified type.
- * @throws org.apache.harmony.xnet.provider.jsse.AlertException if alert was occured.
+ * @throws AlertException if alert was occurred.
*/
+ @Override
protected byte[] encrypt(byte type, byte[] fragment, int offset, int len) {
try {
int content_mac_length = len + hash_size;
@@ -298,8 +294,9 @@ public class ConnectionStateTLS extends ConnectionState {
* Retrieves the fragment of the Plaintext structure of
* the specified type from the provided data representing
* the Generic[Stream|Block]Cipher structure.
- * @throws org.apache.harmony.xnet.provider.jsse.AlertException if alert was occured.
+ * @throws AlertException if alert was occurred.
*/
+ @Override
protected byte[] decrypt(byte type, byte[] fragment,
int offset, int len) {
// plain data of the Generic[Stream|Block]Cipher structure
diff --git a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ContentType.java b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ContentType.java
index dedfe64..69704f5 100644
--- a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ContentType.java
+++ b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ContentType.java
@@ -15,11 +15,6 @@
* limitations under the License.
*/
-/**
- * @author Alexander Y. Kleymenov
- * @version $Revision$
- */
-
package org.apache.harmony.xnet.provider.jsse;
/**
diff --git a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/DHParameters.java b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/DHParameters.java
index 1a441a5..441fc5f 100644
--- a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/DHParameters.java
+++ b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/DHParameters.java
@@ -14,11 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-/**
- * @author Boris Kuznetsov
- * @version $Revision$
- */
package org.apache.harmony.xnet.provider.jsse;
/**
diff --git a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/DataStream.java b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/DataStream.java
index b52b838..ffc8612 100644
--- a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/DataStream.java
+++ b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/DataStream.java
@@ -15,11 +15,6 @@
* limitations under the License.
*/
-/**
- * @author Alexander Y. Kleymenov
- * @version $Revision$
- */
-
package org.apache.harmony.xnet.provider.jsse;
/**
diff --git a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/DelegatedTask.java b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/DelegatedTask.java
index ea6ba78..3b2e103 100644
--- a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/DelegatedTask.java
+++ b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/DelegatedTask.java
@@ -15,11 +15,6 @@
* limitations under the License.
*/
-/**
- * @author Boris Kuznetsov
- * @version $Revision$
- */
-
package org.apache.harmony.xnet.provider.jsse;
import org.apache.harmony.xnet.provider.jsse.HandshakeProtocol;
@@ -35,7 +30,7 @@ import java.security.PrivilegedExceptionAction;
public class DelegatedTask implements Runnable {
private final HandshakeProtocol handshaker;
- private final PrivilegedExceptionAction action;
+ private final PrivilegedExceptionAction<Void> action;
private final AccessControlContext context;
/**
@@ -44,7 +39,7 @@ public class DelegatedTask implements Runnable {
* @param handshaker
* @param context
*/
- public DelegatedTask(PrivilegedExceptionAction action, HandshakeProtocol handshaker, AccessControlContext context) {
+ public DelegatedTask(PrivilegedExceptionAction<Void> action, HandshakeProtocol handshaker, AccessControlContext context) {
this.action = action;
this.handshaker = handshaker;
this.context = context;
diff --git a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/DigitalSignature.java b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/DigitalSignature.java
index a8794df..a0f18b4 100644
--- a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/DigitalSignature.java
+++ b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/DigitalSignature.java
@@ -14,26 +14,26 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-/**
- * @author Boris Kuznetsov
- * @version $Revision$
- */
package org.apache.harmony.xnet.provider.jsse;
-import org.apache.harmony.xnet.provider.jsse.AlertException;
-
+import java.security.DigestException;
+import java.security.InvalidKeyException;
import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.security.Signature;
+import java.security.SignatureException;
import java.security.cert.Certificate;
import java.util.Arrays;
+import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
+import javax.crypto.IllegalBlockSizeException;
+import javax.crypto.NoSuchPaddingException;
import javax.net.ssl.SSLException;
/**
- * This class represents Signature type, as descrybed in TLS v 1.0 Protocol
+ * This class represents Signature type, as described in TLS v 1.0 Protocol
* specification, 7.4.3. It allow to init, update and sign hash. Hash algorithm
* depends on SignatureAlgorithm.
*
@@ -56,10 +56,10 @@ import javax.net.ssl.SSLException;
*/
public class DigitalSignature {
- private MessageDigest md5 = null;
- private MessageDigest sha = null;
- private Signature signature = null;
- private Cipher cipher = null;
+ private final MessageDigest md5;
+ private final MessageDigest sha;
+ private final Signature signature;
+ private final Cipher cipher;
private byte[] md5_hash;
private byte[] sha_hash;
@@ -69,33 +69,35 @@ public class DigitalSignature {
* @param keyExchange
*/
public DigitalSignature(int keyExchange) {
- try {
+ try {
+ sha = MessageDigest.getInstance("SHA-1");
+
if (keyExchange == CipherSuite.KeyExchange_RSA_EXPORT ||
keyExchange == CipherSuite.KeyExchange_RSA ||
keyExchange == CipherSuite.KeyExchange_DHE_RSA ||
keyExchange == CipherSuite.KeyExchange_DHE_RSA_EXPORT) {
// SignatureAlgorithm is rsa
md5 = MessageDigest.getInstance("MD5");
- sha = MessageDigest.getInstance("SHA-1");
cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");
+ signature = null;
} else if (keyExchange == CipherSuite.KeyExchange_DHE_DSS ||
keyExchange == CipherSuite.KeyExchange_DHE_DSS_EXPORT ) {
// SignatureAlgorithm is dsa
- sha = MessageDigest.getInstance("SHA-1");
signature = Signature.getInstance("NONEwithDSA");
-// The Signature should be empty in case of anonimous signature algorithm:
-// } else if (keyExchange == CipherSuite.KeyExchange_DH_anon ||
-// keyExchange == CipherSuite.KeyExchange_DH_anon_EXPORT) {
-//
+ cipher = null;
+ md5 = null;
+ } else {
+ cipher = null;
+ signature = null;
+ md5 = null;
}
- } catch (Exception e) {
- throw new AlertException(
- AlertProtocol.INTERNAL_ERROR,
- new SSLException(
- "INTERNAL ERROR: Unexpected exception on digital signature",
- e));
- }
-
+ } catch (NoSuchAlgorithmException e) {
+ // this should never happen
+ throw new AssertionError(e);
+ } catch (NoSuchPaddingException e) {
+ // this should never happen
+ throw new AssertionError(e);
+ }
}
/**
@@ -109,8 +111,9 @@ public class DigitalSignature {
} else if (cipher != null) {
cipher.init(Cipher.ENCRYPT_MODE, key);
}
- } catch (Exception e){
- e.printStackTrace();
+ } catch (InvalidKeyException e){
+ throw new AlertException(AlertProtocol.BAD_CERTIFICATE,
+ new SSLException("init - invalid private key", e));
}
}
@@ -125,8 +128,9 @@ public class DigitalSignature {
} else if (cipher != null) {
cipher.init(Cipher.DECRYPT_MODE, cert);
}
- } catch (Exception e){
- e.printStackTrace();
+ } catch (InvalidKeyException e){
+ throw new AlertException(AlertProtocol.BAD_CERTIFICATE,
+ new SSLException("init - invalid certificate", e));
}
}
@@ -135,16 +139,12 @@ public class DigitalSignature {
* @param data
*/
public void update(byte[] data) {
- try {
- if (sha != null) {
- sha.update(data);
- }
- if (md5 != null) {
- md5.update(data);
- }
- } catch (Exception e){
- e.printStackTrace();
- }
+ if (sha != null) {
+ sha.update(data);
+ }
+ if (md5 != null) {
+ md5.update(data);
+ }
}
/**
@@ -197,10 +197,15 @@ public class DigitalSignature {
return cipher.doFinal();
}
return new byte[0];
- } catch (Exception e){
- e.printStackTrace();
+ } catch (DigestException e){
+ return new byte[0];
+ } catch (SignatureException e){
+ return new byte[0];
+ } catch (BadPaddingException e){
return new byte[0];
- }
+ } catch (IllegalBlockSizeException e){
+ return new byte[0];
+ }
}
/**
@@ -209,34 +214,40 @@ public class DigitalSignature {
* @return true if verified
*/
public boolean verifySignature(byte[] data) {
- try {
- if (signature != null) {
+ if (signature != null) {
+ try {
return signature.verify(data);
- } else if (cipher != null) {
- byte[] decrypt = cipher.doFinal(data);
- byte[] md5_sha;
- if (md5_hash != null && sha_hash != null) {
- md5_sha = new byte[md5_hash.length + sha_hash.length];
- System.arraycopy(md5_hash, 0, md5_sha, 0, md5_hash.length);
- System.arraycopy(sha_hash, 0, md5_sha, md5_hash.length, sha_hash.length);
- } else if (md5_hash != null) {
- md5_sha = md5_hash;
- } else {
- md5_sha = sha_hash;
- }
- if (Arrays.equals(decrypt, md5_sha)) {
- return true;
- } else {
- return false;
- }
- } else if (data == null || data.length == 0) {
- return true;
- } else {
+ } catch (SignatureException e) {
return false;
}
- } catch (Exception e){
- e.printStackTrace();
+ }
+
+ if (cipher != null) {
+ final byte[] decrypt;
+ try {
+ decrypt = cipher.doFinal(data);
+ } catch (IllegalBlockSizeException e) {
+ return false;
+ } catch (BadPaddingException e) {
return false;
+ }
+
+ final byte[] md5_sha;
+ if (md5_hash != null && sha_hash != null) {
+ md5_sha = new byte[md5_hash.length + sha_hash.length];
+ System.arraycopy(md5_hash, 0, md5_sha, 0, md5_hash.length);
+ System.arraycopy(sha_hash, 0, md5_sha, md5_hash.length, sha_hash.length);
+ } else if (md5_hash != null) {
+ md5_sha = md5_hash;
+ } else {
+ md5_sha = sha_hash;
+ }
+
+ return Arrays.equals(decrypt, md5_sha);
+ } else if (data == null || data.length == 0) {
+ return true;
+ } else {
+ return false;
}
}
diff --git a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/EndOfBufferException.java b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/EndOfBufferException.java
index b2bcafe..1dcdd20 100644
--- a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/EndOfBufferException.java
+++ b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/EndOfBufferException.java
@@ -15,25 +15,18 @@
* limitations under the License.
*/
-/**
- * @author Alexander Y. Kleymenov
- * @version $Revision$
- */
-
package org.apache.harmony.xnet.provider.jsse;
import java.io.IOException;
/**
- * This class represents the exception signalizing that
- * data could not be read from the stream because
- * underlying input stream reached its end.
+ * This exception indicates that data could not be read from the stream because the underlying input
+ * stream reached its end.
*/
public class EndOfBufferException extends IOException {
- /**
- * Constructor
- */
+ private static final long serialVersionUID = 1838636631255369519L;
+
public EndOfBufferException() {
super();
}
diff --git a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/EndOfSourceException.java b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/EndOfSourceException.java
index fbc1eaf..631679a 100644
--- a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/EndOfSourceException.java
+++ b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/EndOfSourceException.java
@@ -15,28 +15,20 @@
* limitations under the License.
*/
-/**
- * @author Alexander Y. Kleymenov
- * @version $Revision$
- */
-
package org.apache.harmony.xnet.provider.jsse;
import java.io.IOException;
/**
- * This class represents the exception signalizing that
- * data could not be read from the buffered stream because
- * underlying data buffer was exhausted.
+ * This exception indicates that data could not be read from the buffered stream because underlying
+ * data buffer was exhausted.
*/
public class EndOfSourceException extends IOException {
- /**
- * Constructor
- */
+ private static final long serialVersionUID = -4673611435974054413L;
+
public EndOfSourceException() {
super();
}
}
-
diff --git a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/Finished.java b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/Finished.java
index d0f1fe1..6b555c6 100644
--- a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/Finished.java
+++ b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/Finished.java
@@ -15,11 +15,6 @@
* limitations under the License.
*/
-/**
-* @author Boris Kuznetsov
-* @version $Revision$
-*/
-
package org.apache.harmony.xnet.provider.jsse;
import org.apache.harmony.xnet.provider.jsse.Message;
@@ -63,6 +58,7 @@ public class Finished extends Message {
}
}
+ @Override
public void send(HandshakeIODataStream out) {
out.write(data);
}
@@ -71,6 +67,7 @@ public class Finished extends Message {
* Returns message type
* @return
*/
+ @Override
public int getType() {
return Handshake.FINISHED;
}
diff --git a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/Handshake.java b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/Handshake.java
index 4668b8c..64e73dd 100644
--- a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/Handshake.java
+++ b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/Handshake.java
@@ -15,11 +15,6 @@
* limitations under the License.
*/
-/**
- * @author Boris Kuznetsov
- * @version $Revision$
- */
-
package org.apache.harmony.xnet.provider.jsse;
/**
diff --git a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/HandshakeIODataStream.java b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/HandshakeIODataStream.java
index b5c4553..74cc27d 100644
--- a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/HandshakeIODataStream.java
+++ b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/HandshakeIODataStream.java
@@ -15,11 +15,6 @@
* limitations under the License.
*/
-/**
- * @author Alexander Y. Kleymenov
- * @version $Revision$
- */
-
package org.apache.harmony.xnet.provider.jsse;
import org.apache.harmony.xnet.provider.jsse.AlertException;
@@ -101,14 +96,17 @@ public class HandshakeIODataStream
// position of the last byte to read + 1
private int read_pos_end;
+ @Override
public int available() {
return read_pos_end - read_pos;
}
+ @Override
public boolean markSupported() {
return true;
}
+ @Override
public void mark(int limit) {
marked_pos = read_pos;
}
@@ -117,6 +115,7 @@ public class HandshakeIODataStream
marked_pos = read_pos;
}
+ @Override
public void reset() {
read_pos = marked_pos;
}
@@ -138,6 +137,7 @@ public class HandshakeIODataStream
* @param byte: byte
* @return
*/
+ @Override
public int read() throws IOException {
if (read_pos == read_pos_end) {
//return -1;
@@ -151,6 +151,7 @@ public class HandshakeIODataStream
* @param new: long
* @return
*/
+ @Override
public byte[] read(int length) throws IOException {
if (length > available()) {
throw new EndOfBufferException();
@@ -161,6 +162,7 @@ public class HandshakeIODataStream
return res;
}
+ @Override
public int read(byte[] dest, int offset, int length) throws IOException {
if (length > available()) {
throw new EndOfBufferException();
@@ -174,7 +176,7 @@ public class HandshakeIODataStream
/**
* Appends the income data to be read by handshake protocol.
- * The attempts to overflow the buffer by meens of this methos
+ * The attempts to overflow the buffer by means of this methods
* seem to be futile because of:
* 1. The SSL protocol specifies the maximum size of the record
* and record protocol does not pass huge messages.
diff --git a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/HandshakeProtocol.java b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/HandshakeProtocol.java
index 606e5c7..6579398 100644
--- a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/HandshakeProtocol.java
+++ b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/HandshakeProtocol.java
@@ -15,11 +15,6 @@
* limitations under the License.
*/
-/**
- * @author Boris Kuznetsov
- * @version $Revision$
- */
-
package org.apache.harmony.xnet.provider.jsse;
import java.math.BigInteger;
@@ -89,7 +84,7 @@ public abstract class HandshakeProtocol {
/**
* Delegated tasks for this handshake implementation
*/
- protected Vector delegatedTasks = new Vector();
+ protected Vector<DelegatedTask> delegatedTasks = new Vector<DelegatedTask>();
/**
* Indicates non-blocking handshake
@@ -169,13 +164,13 @@ public abstract class HandshakeProtocol {
if (owner instanceof SSLEngineImpl) {
engineOwner = (SSLEngineImpl) owner;
nonBlocking = true;
- this.parameters = (SSLParameters) engineOwner.sslParameters;
+ this.parameters = engineOwner.sslParameters;
}
// BEGIN android-removed
// else if (owner instanceof SSLSocketImpl) {
// socketOwner = (SSLSocketImpl) owner;
// nonBlocking = false;
- // this.parameters = (SSLParameters) socketOwner.sslParameters;
+ // this.parameters = socketOwner.sslParameters;
// }
// END android-removed
}
@@ -482,11 +477,8 @@ public abstract class HandshakeProtocol {
public Runnable getTask() {
if (delegatedTasks.isEmpty()) {
return null;
- } else {
- Runnable task = (Runnable)delegatedTasks.firstElement();
- delegatedTasks.remove(0);
- return task;
}
+ return delegatedTasks.remove(0);
}
/**
@@ -523,7 +515,7 @@ public abstract class HandshakeProtocol {
mod = ((RSAKey) pk).getModulus();
} else {
KeyFactory kf = KeyFactory.getInstance("RSA");
- mod = ((RSAPublicKeySpec) kf.getKeySpec(pk, RSAPublicKeySpec.class))
+ mod = kf.getKeySpec(pk, RSAPublicKeySpec.class)
.getModulus();
}
return mod.bitLength();
diff --git a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/HelloRequest.java b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/HelloRequest.java
index 2ce4061..40d4a71 100644
--- a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/HelloRequest.java
+++ b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/HelloRequest.java
@@ -15,10 +15,6 @@
* limitations under the License.
*/
-/**
-* @author Boris Kuznetsov
-* @version $Revision$
-*/
package org.apache.harmony.xnet.provider.jsse;
import org.apache.harmony.xnet.provider.jsse.Message;
@@ -60,9 +56,11 @@ public class HelloRequest extends Message {
* Sends message
* @param out
*/
+ @Override
public void send(HandshakeIODataStream out) {
}
+ @Override
public int length() {
return 0;
}
@@ -71,6 +69,7 @@ public class HelloRequest extends Message {
* Returns message type
* @return
*/
+ @Override
public int getType() {
return Handshake.HELLO_REQUEST;
}
diff --git a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/JSSEProvider.java b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/JSSEProvider.java
index e65f832..33b0a45 100644
--- a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/JSSEProvider.java
+++ b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/JSSEProvider.java
@@ -15,14 +15,10 @@
* limitations under the License.
*/
-/**
- * @author Alexander Y. Kleymenov
- * @version $Revision$
- */
-
package org.apache.harmony.xnet.provider.jsse;
import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.security.Provider;
/**
@@ -67,7 +63,7 @@ import java.security.Provider;
* TLS_DH_anon_WITH_DES_CBC_SHA
* TLS_DH_anon_WITH_3DES_EDE_CBC_SHA
*
- * The real set of availible cipher suites depends on set of availible
+ * The real set of available cipher suites depends on set of available
* crypto algorithms. These algorithms must be provided by some crypto
* provider.
*
@@ -108,17 +104,16 @@ import java.security.Provider;
*/
public final class JSSEProvider extends Provider {
+ private static final long serialVersionUID = 3075686092260669675L;
+
public JSSEProvider() {
super("HarmonyJSSE", 1.0, "Harmony JSSE Provider");
- AccessController.doPrivileged(new java.security.PrivilegedAction<Void>() {
+ AccessController.doPrivileged(new PrivilegedAction<Void>() {
public Void run() {
- put("SSLContext.TLS",
- "org.apache.harmony.xnet.provider.jsse.SSLContextImpl");
+ put("SSLContext.TLS", SSLContextImpl.class.getName());
put("Alg.Alias.SSLContext.TLSv1", "TLS");
- put("KeyManagerFactory.X509",
- "org.apache.harmony.xnet.provider.jsse.KeyManagerFactoryImpl");
- put("TrustManagerFactory.X509",
- "org.apache.harmony.xnet.provider.jsse.TrustManagerFactoryImpl");
+ put("KeyManagerFactory.X509", KeyManagerFactoryImpl.class.getName());
+ put("TrustManagerFactory.X509", TrustManagerFactoryImpl.class.getName());
// BEGIN android-added
put("MessageDigest.SHA-1", "org.apache.harmony.xnet.provider.jsse.OpenSSLMessageDigestJDK$SHA1");
put("Alg.Alias.MessageDigest.SHA1", "SHA-1");
@@ -138,4 +133,3 @@ public final class JSSEProvider extends Provider {
});
}
}
-
diff --git a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/KeyManagerFactoryImpl.java b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/KeyManagerFactoryImpl.java
index 1daf80c..3b55299 100644
--- a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/KeyManagerFactoryImpl.java
+++ b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/KeyManagerFactoryImpl.java
@@ -14,11 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-/**
- * @author Boris Kuznetsov
- * @version $Revision$
- */
package org.apache.harmony.xnet.provider.jsse;
import java.io.File;
@@ -53,13 +48,14 @@ public class KeyManagerFactoryImpl extends KeyManagerFactorySpi {
* @see javax.net.ssl.KeyManagerFactorySpi#engineInit(KeyStore ks, char[]
* password)
*/
+ @Override
public void engineInit(KeyStore ks, char[] password)
throws KeyStoreException, NoSuchAlgorithmException,
UnrecoverableKeyException {
if (ks != null) {
keyStore = ks;
if (password != null) {
- pwd = (char[]) password.clone();
+ pwd = password.clone();
} else {
pwd = new char[0];
}
@@ -115,6 +111,7 @@ public class KeyManagerFactoryImpl extends KeyManagerFactorySpi {
* @see javax.net.ssl.KeyManagerFactorySpi#engineInit(ManagerFactoryParameters
* spec)
*/
+ @Override
public void engineInit(ManagerFactoryParameters spec)
throws InvalidAlgorithmParameterException {
throw new InvalidAlgorithmParameterException(
@@ -125,6 +122,7 @@ public class KeyManagerFactoryImpl extends KeyManagerFactorySpi {
/**
* @see javax.net.ssl.KeyManagerFactorySpi#engineGetKeyManagers()
*/
+ @Override
public KeyManager[] engineGetKeyManagers() {
if (keyStore == null) {
throw new IllegalStateException("KeyManagerFactory is not initialized");
diff --git a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/KeyManagerImpl.java b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/KeyManagerImpl.java
index b7451d5..f63170f 100644
--- a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/KeyManagerImpl.java
+++ b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/KeyManagerImpl.java
@@ -14,11 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-/**
- * @author Boris Kuznetsov
- * @version $Revision$
- */
package org.apache.harmony.xnet.provider.jsse;
import java.net.Socket;
@@ -28,6 +23,7 @@ import java.security.NoSuchAlgorithmException;
import java.security.Principal;
import java.security.PrivateKey;
import java.security.UnrecoverableEntryException;
+import java.security.KeyStore.PrivateKeyEntry;
import java.security.cert.Certificate;
import java.security.cert.X509Certificate;
import java.util.Enumeration;
@@ -40,11 +36,11 @@ import javax.security.auth.x500.X500Principal;
/**
* KeyManager implementation.
- * This implementation uses hashed key store information.
- * It works faster than retrieving all of the data from the key store.
- * Any key store changes, that happen after key manager was created, have no effect.
- * The implementation does not use peer information (host, port)
- * that may be obtained from socket or engine.
+ *
+ * This implementation uses hashed key store information. It works faster than retrieving all of the
+ * data from the key store. Any key store changes, that happen after key manager was created, have
+ * no effect. The implementation does not use peer information (host, port) that may be obtained
+ * from socket or engine.
*
* @see javax.net.ssl.KeyManager
*
@@ -52,7 +48,7 @@ import javax.security.auth.x500.X500Principal;
public class KeyManagerImpl extends X509ExtendedKeyManager {
// hashed key store information
- private final Hashtable hash = new Hashtable();
+ private final Hashtable<String, PrivateKeyEntry> hash;
/**
* Creates Key manager
@@ -61,21 +57,20 @@ public class KeyManagerImpl extends X509ExtendedKeyManager {
* @param pwd
*/
public KeyManagerImpl(KeyStore keyStore, char[] pwd) {
- String alias;
- KeyStore.PrivateKeyEntry entry;
- Enumeration aliases;
+ super();
+ this.hash = new Hashtable<String, PrivateKeyEntry>();
+ final Enumeration<String> aliases;
try {
aliases = keyStore.aliases();
} catch (KeyStoreException e) {
return;
}
for (; aliases.hasMoreElements();) {
- alias = (String) aliases.nextElement();
+ final String alias = aliases.nextElement();
try {
- if (keyStore.entryInstanceOf(alias,
- KeyStore.PrivateKeyEntry.class)) {
- entry = (KeyStore.PrivateKeyEntry) keyStore.getEntry(alias,
- new KeyStore.PasswordProtection(pwd));
+ if (keyStore.entryInstanceOf(alias, KeyStore.PrivateKeyEntry.class)) {
+ final KeyStore.PrivateKeyEntry entry = (KeyStore.PrivateKeyEntry) keyStore
+ .getEntry(alias, new KeyStore.PasswordProtection(pwd));
hash.put(alias, entry);
}
} catch (KeyStoreException e) {
@@ -86,41 +81,18 @@ public class KeyManagerImpl extends X509ExtendedKeyManager {
continue;
}
}
-
}
- /**
- * @see javax.net.ssl.X509ExtendedKeyManager#chooseClientAlias(String[]
- * keyType, Principal[] issuers, Socket socket)
- */
- public String chooseClientAlias(String[] keyType, Principal[] issuers,
- Socket socket) {
- String[] al = chooseAlias(keyType, issuers);
- if (al != null) {
- return al[0];
- } else {
- return null;
- }
+ public String chooseClientAlias(String[] keyType, Principal[] issuers, Socket socket) {
+ final String[] al = chooseAlias(keyType, issuers);
+ return (al == null ? null : al[0]);
}
- /**
- * @see javax.net.ssl.X509ExtendedKeyManager#chooseServerAlias(String
- * keyType, Principal[] issuers, Socket socket)
- */
- public String chooseServerAlias(String keyType, Principal[] issuers,
- Socket socket) {
- String[] al = chooseAlias(new String[] { keyType }, issuers);
- if (al != null) {
- return al[0];
- } else {
- return null;
- }
+ public String chooseServerAlias(String keyType, Principal[] issuers, Socket socket) {
+ final String[] al = chooseAlias(new String[] { keyType }, issuers);
+ return (al == null ? null : al[0]);
}
- /**
- * @see javax.net.ssl.X509ExtendedKeyManager#getCertificateChain(String
- * alias)
- */
public X509Certificate[] getCertificateChain(String alias) {
// BEGIN android-changed
if (alias == null) {
@@ -128,8 +100,7 @@ public class KeyManagerImpl extends X509ExtendedKeyManager {
}
// END android-changed
if (hash.containsKey(alias)) {
- Certificate[] certs = ((KeyStore.PrivateKeyEntry) hash.get(alias))
- .getCertificateChain();
+ Certificate[] certs = hash.get(alias).getCertificateChain();
if (certs[0] instanceof X509Certificate) {
X509Certificate[] xcerts = new X509Certificate[certs.length];
for (int i = 0; i < certs.length; i++) {
@@ -142,25 +113,14 @@ public class KeyManagerImpl extends X509ExtendedKeyManager {
}
- /**
- * @see javax.net.ssl.X509ExtendedKeyManager#getClientAliases(String
- * keyType, Principal[] issuers)
- */
public String[] getClientAliases(String keyType, Principal[] issuers) {
return chooseAlias(new String[] { keyType }, issuers);
}
- /**
- * @see javax.net.ssl.X509ExtendedKeyManager#getServerAliases(String
- * keyType, Principal[] issuers)
- */
public String[] getServerAliases(String keyType, Principal[] issuers) {
return chooseAlias(new String[] { keyType }, issuers);
}
- /**
- * @see javax.net.ssl.X509ExtendedKeyManager#getPrivateKey(String alias)
- */
public PrivateKey getPrivateKey(String alias) {
// BEGIN android-changed
if (alias == null) {
@@ -168,53 +128,33 @@ public class KeyManagerImpl extends X509ExtendedKeyManager {
}
// END android-changed
if (hash.containsKey(alias)) {
- return ((KeyStore.PrivateKeyEntry) hash.get(alias)).getPrivateKey();
+ return hash.get(alias).getPrivateKey();
}
return null;
}
- /**
- * @see javax.net.ssl.X509ExtendedKeyManager#chooseEngineClientAlias(String[]
- * keyType, Principal[] issuers, SSLEngine engine)
- */
- public String chooseEngineClientAlias(String[] keyType,
- Principal[] issuers, SSLEngine engine) {
- String[] al = chooseAlias(keyType, issuers);
- if (al != null) {
- return al[0];
- } else {
- return null;
- }
+ @Override
+ public String chooseEngineClientAlias(String[] keyType, Principal[] issuers, SSLEngine engine) {
+ final String[] al = chooseAlias(keyType, issuers);
+ return (al == null ? null : al[0]);
}
- /**
- * @see javax.net.ssl.X509ExtendedKeyManager#chooseEngineServerAlias(String
- * keyType, Principal[] issuers, SSLEngine engine)
- */
- public String chooseEngineServerAlias(String keyType, Principal[] issuers,
- SSLEngine engine) {
- String[] al = chooseAlias(new String[] { keyType }, issuers);
- if (al != null) {
- return al[0];
- } else {
- return null;
- }
+ @Override
+ public String chooseEngineServerAlias(String keyType, Principal[] issuers, SSLEngine engine) {
+ final String[] al = chooseAlias(new String[] { keyType }, issuers);
+ return (al == null ? null : al[0]);
}
private String[] chooseAlias(String[] keyType, Principal[] issuers) {
- String alias;
- KeyStore.PrivateKeyEntry entry;
-
if (keyType == null || keyType.length == 0) {
return null;
}
- Vector found = new Vector();
- int count = 0;
- for (Enumeration aliases = hash.keys(); aliases.hasMoreElements();) {
- alias = (String) aliases.nextElement();
- entry = (KeyStore.PrivateKeyEntry) hash.get(alias);
- Certificate[] certs = entry.getCertificateChain();
- String alg = certs[0].getPublicKey().getAlgorithm();
+ Vector<String> found = new Vector<String>();
+ for (Enumeration<String> aliases = hash.keys(); aliases.hasMoreElements();) {
+ final String alias = aliases.nextElement();
+ final KeyStore.PrivateKeyEntry entry = hash.get(alias);
+ final Certificate[] certs = entry.getCertificateChain();
+ final String alg = certs[0].getPublicKey().getAlgorithm();
for (int i = 0; i < keyType.length; i++) {
if (alg.equals(keyType[i])) {
if (issuers != null && issuers.length != 0) {
@@ -226,7 +166,6 @@ public class KeyManagerImpl extends X509ExtendedKeyManager {
for (int iii = 0; iii < issuers.length; iii++) {
if (issuer.equals(issuers[iii])) {
found.add(alias);
- count++;
break loop;
}
}
@@ -235,18 +174,13 @@ public class KeyManagerImpl extends X509ExtendedKeyManager {
}
} else {
found.add(alias);
- count++;
}
}
}
}
- if (count > 0) {
- String[] result = new String[count];
- found.toArray(result);
- return result;
- } else {
- return null;
+ if (!found.isEmpty()) {
+ return found.toArray(new String[found.size()]);
}
+ return null;
}
-
}
diff --git a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/Logger.java b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/Logger.java
index 5b7ba2c..c06aa7e 100644
--- a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/Logger.java
+++ b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/Logger.java
@@ -15,11 +15,6 @@
* limitations under the License.
*/
-/**
- * @author Alexander Y. Kleymenov
- * @version $Revision$
- */
-
package org.apache.harmony.xnet.provider.jsse;
import java.io.PrintStream;
@@ -41,6 +36,7 @@ public class Logger {
prefix = name + "["+Thread.currentThread().getName()+"] ";
}
+ @Override
public void print(String msg) {
for (int i=0; i<indent; i++) {
super.print(" ");
@@ -56,6 +52,7 @@ public class Logger {
indent --;
}
+ @Override
public void println(String msg) {
print(prefix);
super.println(msg);
diff --git a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/Message.java b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/Message.java
index cf99d6e..f1b2515 100644
--- a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/Message.java
+++ b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/Message.java
@@ -15,10 +15,6 @@
* limitations under the License.
*/
-/**
-* @author Boris Kuznetsov
-* @version $Revision$
-*/
package org.apache.harmony.xnet.provider.jsse;
import org.apache.harmony.xnet.provider.jsse.AlertException;
diff --git a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLSocketImplWrapper.java b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLSocketImplWrapper.java
index e3451aa..959f2a0 100644
--- a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLSocketImplWrapper.java
+++ b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLSocketImplWrapper.java
@@ -1,17 +1,18 @@
/*
- * Copyright (C) 2008 The Android Open Source Project
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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
*
- * 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
*
- * 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.
+ * 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 org.apache.harmony.xnet.provider.jsse;
@@ -38,132 +39,164 @@ public class OpenSSLSocketImplWrapper extends OpenSSLSocketImpl {
this.socket = socket;
}
+ @Override
public void connect(SocketAddress sockaddr, int timeout)
throws IOException {
throw new IOException("Underlying socket is already connected.");
}
+ @Override
public void connect(SocketAddress sockaddr) throws IOException {
throw new IOException("Underlying socket is already connected.");
}
+ @Override
public void bind(SocketAddress sockaddr) throws IOException {
throw new IOException("Underlying socket is already connected.");
}
+ @Override
public SocketAddress getRemoteSocketAddress() {
return socket.getRemoteSocketAddress();
}
+ @Override
public SocketAddress getLocalSocketAddress() {
return socket.getLocalSocketAddress();
}
+ @Override
public InetAddress getLocalAddress() {
return socket.getLocalAddress();
}
+ @Override
public InetAddress getInetAddress() {
return socket.getInetAddress();
}
+ @Override
public String toString() {
return "SSL socket over " + socket.toString();
}
+ @Override
public void setSoLinger(boolean on, int linger) throws SocketException {
socket.setSoLinger(on, linger);
}
+ @Override
public void setTcpNoDelay(boolean on) throws SocketException {
socket.setTcpNoDelay(on);
}
+ @Override
public void setReuseAddress(boolean on) throws SocketException {
socket.setReuseAddress(on);
}
+ @Override
public void setKeepAlive(boolean on) throws SocketException {
socket.setKeepAlive(on);
}
+ @Override
public void setTrafficClass(int tos) throws SocketException {
socket.setTrafficClass(tos);
}
+ @Override
public void setSoTimeout(int to) throws SocketException {
socket.setSoTimeout(to);
super.setSoTimeout(to);
}
+ @Override
public void setSendBufferSize(int size) throws SocketException {
socket.setSendBufferSize(size);
}
+ @Override
public void setReceiveBufferSize(int size) throws SocketException {
socket.setReceiveBufferSize(size);
}
+ @Override
public boolean getTcpNoDelay() throws SocketException {
return socket.getTcpNoDelay();
}
+ @Override
public boolean getReuseAddress() throws SocketException {
return socket.getReuseAddress();
}
+ @Override
public boolean getOOBInline() throws SocketException {
return socket.getOOBInline();
}
+ @Override
public boolean getKeepAlive() throws SocketException {
return socket.getKeepAlive();
}
+ @Override
public int getTrafficClass() throws SocketException {
return socket.getTrafficClass();
}
+ @Override
public int getSoTimeout() throws SocketException {
return socket.getSoTimeout();
}
+ @Override
public int getSoLinger() throws SocketException {
return socket.getSoLinger();
}
+ @Override
public int getSendBufferSize() throws SocketException {
return socket.getSendBufferSize();
}
+ @Override
public int getReceiveBufferSize() throws SocketException {
return socket.getReceiveBufferSize();
}
+ @Override
public boolean isConnected() {
return socket.isConnected();
}
+ @Override
public boolean isClosed() {
return socket.isClosed();
}
+ @Override
public boolean isBound() {
return socket.isBound();
}
+ @Override
public boolean isOutputShutdown() {
return socket.isOutputShutdown();
}
+ @Override
public boolean isInputShutdown() {
return socket.isInputShutdown();
}
+ @Override
public int getPort() {
return socket.getPort();
}
+ @Override
public int getLocalPort() {
return socket.getLocalPort();
}
diff --git a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/PRF.java b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/PRF.java
index 3ed9b2a..c2f91a3 100644
--- a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/PRF.java
+++ b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/PRF.java
@@ -15,11 +15,6 @@
* limitations under the License.
*/
-/**
- * @author Alexander Y. Kleymenov
- * @version $Revision$
- */
-
package org.apache.harmony.xnet.provider.jsse;
import org.apache.harmony.xnet.provider.jsse.AlertException;
diff --git a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ProtocolVersion.java b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ProtocolVersion.java
index 1343c3b..def27f9 100644
--- a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ProtocolVersion.java
+++ b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ProtocolVersion.java
@@ -14,11 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-/**
- * @author Boris Kuznetsov
- * @version $Revision$
- */
package org.apache.harmony.xnet.provider.jsse;
import java.util.Hashtable;
@@ -28,41 +23,13 @@ import java.util.Hashtable;
* Represents Protocol Version
*/
public class ProtocolVersion {
-
/**
- * Protocol name
- */
- public final String name;
-
- /**
- * Protocol version as byte array
- */
- public final byte[] version;
-
- /**
- * Protocols supported by this provider implementaton
+ * Protocols supported by this provider implementation
*/
public static final String[] supportedProtocols = new String[] { "TLSv1",
"SSLv3" };
- private static Hashtable protocolsByName = new Hashtable(4);
-
- private ProtocolVersion(String name, byte[] version) {
- this.name = name;
- this.version = version;
- }
-
- /**
- * Compares this ProtocolVersion to the specified object.
- */
- public boolean equals(Object o) {
- if (o instanceof ProtocolVersion
- && this.version[0] == ((ProtocolVersion) o).version[0]
- && this.version[1] == ((ProtocolVersion) o).version[1]) {
- return true;
- }
- return false;
- }
+ private static Hashtable<String, ProtocolVersion> protocolsByName = new Hashtable<String, ProtocolVersion>(4);
/**
*
@@ -112,7 +79,7 @@ public class ProtocolVersion {
* @return
*/
public static ProtocolVersion getByName(String name) {
- return (ProtocolVersion) protocolsByName.get(name);
+ return protocolsByName.get(name);
}
/**
@@ -161,4 +128,31 @@ public class ProtocolVersion {
protocolsByName.put("TLS", TLSv1);
}
+ /**
+ * Protocol name
+ */
+ public final String name;
+
+ /**
+ * Protocol version as byte array
+ */
+ public final byte[] version;
+
+ private ProtocolVersion(String name, byte[] version) {
+ this.name = name;
+ this.version = version;
+ }
+
+ /**
+ * Compares this ProtocolVersion to the specified object.
+ */
+ @Override
+ public boolean equals(Object o) {
+ if (o instanceof ProtocolVersion
+ && this.version[0] == ((ProtocolVersion) o).version[0]
+ && this.version[1] == ((ProtocolVersion) o).version[1]) {
+ return true;
+ }
+ return false;
+ }
} \ No newline at end of file
diff --git a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLBufferedInput.java b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLBufferedInput.java
index 44009b9..a150470 100644
--- a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLBufferedInput.java
+++ b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLBufferedInput.java
@@ -15,11 +15,6 @@
* limitations under the License.
*/
-/**
- * @author Alexander Y. Kleymenov
- * @version $Revision$
- */
-
package org.apache.harmony.xnet.provider.jsse;
import org.apache.harmony.xnet.provider.jsse.SSLInputStream;
@@ -57,6 +52,7 @@ public class SSLBufferedInput extends SSLInputStream {
/**
* Returns the number of bytes available for reading.
*/
+ @Override
public int available() throws IOException {
// in assumption that the buffer has been set
return in.remaining();
@@ -73,6 +69,7 @@ public class SSLBufferedInput extends SSLInputStream {
* Reads the following byte value. If there are no bytes in the source
* buffer, method throws java.nio.BufferUnderflowException.
*/
+ @Override
public int read() throws IOException {
// TODO: implement optimized read(int)
// and read(byte[], int, int) methods
diff --git a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLContextImpl.java b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLContextImpl.java
index 2e4de04..c39e3ff 100644
--- a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLContextImpl.java
+++ b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLContextImpl.java
@@ -15,11 +15,6 @@
* limitations under the License.
*/
-/**
- * @author Alexander Y. Kleymenov
- * @version $Revision$
- */
-
package org.apache.harmony.xnet.provider.jsse;
import org.apache.harmony.xnet.provider.jsse.SSLEngineImpl;
@@ -61,6 +56,7 @@ public class SSLContextImpl extends SSLContextSpi {
super();
}
+ @Override
public void engineInit(KeyManager[] kms, TrustManager[] tms,
SecureRandom sr) throws KeyManagementException {
engineInit(kms, tms, sr, null, null);
@@ -96,6 +92,7 @@ public class SSLContextImpl extends SSLContextSpi {
return new OpenSSLSocketFactoryImpl(sslParameters);
}
+ @Override
public SSLServerSocketFactory engineGetServerSocketFactory() {
if (sslParameters == null) {
throw new IllegalStateException("SSLContext is not initiallized.");
@@ -103,6 +100,7 @@ public class SSLContextImpl extends SSLContextSpi {
return new OpenSSLServerSocketFactoryImpl(sslParameters);
}
+ @Override
public SSLEngine engineCreateSSLEngine(String host, int port) {
if (sslParameters == null) {
throw new IllegalStateException("SSLContext is not initiallized.");
@@ -111,6 +109,7 @@ public class SSLContextImpl extends SSLContextSpi {
(SSLParameters) sslParameters.clone());
}
+ @Override
public SSLEngine engineCreateSSLEngine() {
if (sslParameters == null) {
throw new IllegalStateException("SSLContext is not initiallized.");
@@ -118,10 +117,12 @@ public class SSLContextImpl extends SSLContextSpi {
return new SSLEngineImpl((SSLParameters) sslParameters.clone());
}
+ @Override
public ServerSessionContext engineGetServerSessionContext() {
return serverSessionContext;
}
+ @Override
public ClientSessionContext engineGetClientSessionContext() {
return clientSessionContext;
}
diff --git a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLEngineAppData.java b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLEngineAppData.java
index 698723b..9a2cb5e 100644
--- a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLEngineAppData.java
+++ b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLEngineAppData.java
@@ -15,11 +15,6 @@
* limitations under the License.
*/
-/**
- * @author Alexander Y. Kleymenov
- * @version $Revision$
- */
-
package org.apache.harmony.xnet.provider.jsse;
import org.apache.harmony.xnet.provider.jsse.AlertException;
@@ -77,11 +72,10 @@ public class SSLEngineAppData implements org.apache.harmony.xnet.provider.jsse.A
pos = len;
// data was written, exit
break;
- } else {
- // write chunk of data
- dsts[i].put(buffer, pos, rem);
- pos += rem;
}
+ // write chunk of data
+ dsts[i].put(buffer, pos, rem);
+ pos += rem;
}
if (pos != len) {
// The data did not feet into the buffers,
diff --git a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLEngineDataStream.java b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLEngineDataStream.java
index bc13577..e209dd1 100644
--- a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLEngineDataStream.java
+++ b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLEngineDataStream.java
@@ -15,11 +15,6 @@
* limitations under the License.
*/
-/**
- * @author Alexander Y. Kleymenov
- * @version $Revision$
- */
-
package org.apache.harmony.xnet.provider.jsse;
import java.nio.ByteBuffer;
diff --git a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLEngineImpl.java b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLEngineImpl.java
index 383e146..c28a311 100644
--- a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLEngineImpl.java
+++ b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLEngineImpl.java
@@ -15,11 +15,6 @@
* limitations under the License.
*/
-/**
- * @author Alexander Y. Kleymenov
- * @version $Revision$
- */
-
package org.apache.harmony.xnet.provider.jsse;
import org.apache.harmony.xnet.provider.jsse.AlertException;
@@ -114,6 +109,7 @@ public class SSLEngineImpl extends SSLEngine {
* @see javax.net.ssl.SSLEngine#beginHandshake() method documentation
* for more information
*/
+ @Override
public void beginHandshake() throws SSLException {
if (engine_was_closed) {
throw new SSLException("Engine has already been closed.");
@@ -143,6 +139,7 @@ public class SSLEngineImpl extends SSLEngine {
* @see javax.net.ssl.SSLEngine#closeInbound() method documentation
* for more information
*/
+ @Override
public void closeInbound() throws SSLException {
if (logger != null) {
logger.println("closeInbound() "+isInboundDone);
@@ -173,6 +170,7 @@ public class SSLEngineImpl extends SSLEngine {
* @see javax.net.ssl.SSLEngine#closeOutbound() method documentation
* for more information
*/
+ @Override
public void closeOutbound() {
if (logger != null) {
logger.println("closeOutbound() "+isOutboundDone);
@@ -199,6 +197,7 @@ public class SSLEngineImpl extends SSLEngine {
* @see javax.net.ssl.SSLEngine#getDelegatedTask() method documentation
* for more information
*/
+ @Override
public Runnable getDelegatedTask() {
return handshakeProtocol.getTask();
}
@@ -209,6 +208,7 @@ public class SSLEngineImpl extends SSLEngine {
* @see javax.net.ssl.SSLEngine#getSupportedCipherSuites() method
* documentation for more information
*/
+ @Override
public String[] getSupportedCipherSuites() {
return CipherSuite.getSupportedCipherSuiteNames();
}
@@ -220,6 +220,7 @@ public class SSLEngineImpl extends SSLEngine {
* @see javax.net.ssl.SSLEngine#getEnabledCipherSuites() method
* documentation for more information
*/
+ @Override
public String[] getEnabledCipherSuites() {
return sslParameters.getEnabledCipherSuites();
}
@@ -229,6 +230,7 @@ public class SSLEngineImpl extends SSLEngine {
* @see javax.net.ssl.SSLEngine#setEnabledCipherSuites(String[]) method
* documentation for more information
*/
+ @Override
public void setEnabledCipherSuites(String[] suites) {
sslParameters.setEnabledCipherSuites(suites);
}
@@ -238,8 +240,9 @@ public class SSLEngineImpl extends SSLEngine {
* @see javax.net.ssl.SSLEngine#getSupportedProtocols() method
* documentation for more information
*/
+ @Override
public String[] getSupportedProtocols() {
- return (String[]) ProtocolVersion.supportedProtocols.clone();
+ return ProtocolVersion.supportedProtocols.clone();
}
/**
@@ -247,6 +250,7 @@ public class SSLEngineImpl extends SSLEngine {
* @see javax.net.ssl.SSLEngine#getEnabledProtocols() method
* documentation for more information
*/
+ @Override
public String[] getEnabledProtocols() {
return sslParameters.getEnabledProtocols();
}
@@ -256,6 +260,7 @@ public class SSLEngineImpl extends SSLEngine {
* @see javax.net.ssl.SSLEngine#setEnabledProtocols(String[]) method
* documentation for more information
*/
+ @Override
public void setEnabledProtocols(String[] protocols) {
sslParameters.setEnabledProtocols(protocols);
}
@@ -265,6 +270,7 @@ public class SSLEngineImpl extends SSLEngine {
* @see javax.net.ssl.SSLEngine#setUseClientMode(boolean) method
* documentation for more information
*/
+ @Override
public void setUseClientMode(boolean mode) {
if (handshake_started) {
throw new IllegalArgumentException(
@@ -279,6 +285,7 @@ public class SSLEngineImpl extends SSLEngine {
* @see javax.net.ssl.SSLEngine#getUseClientMode() method
* documentation for more information
*/
+ @Override
public boolean getUseClientMode() {
return sslParameters.getUseClientMode();
}
@@ -288,6 +295,7 @@ public class SSLEngineImpl extends SSLEngine {
* @see javax.net.ssl.SSLEngine#setNeedClientAuth(boolean) method
* documentation for more information
*/
+ @Override
public void setNeedClientAuth(boolean need) {
sslParameters.setNeedClientAuth(need);
}
@@ -297,6 +305,7 @@ public class SSLEngineImpl extends SSLEngine {
* @see javax.net.ssl.SSLEngine#getNeedClientAuth() method
* documentation for more information
*/
+ @Override
public boolean getNeedClientAuth() {
return sslParameters.getNeedClientAuth();
}
@@ -306,6 +315,7 @@ public class SSLEngineImpl extends SSLEngine {
* @see javax.net.ssl.SSLEngine#setWantClientAuth(boolean) method
* documentation for more information
*/
+ @Override
public void setWantClientAuth(boolean want) {
sslParameters.setWantClientAuth(want);
}
@@ -315,6 +325,7 @@ public class SSLEngineImpl extends SSLEngine {
* @see javax.net.ssl.SSLEngine#getWantClientAuth() method
* documentation for more information
*/
+ @Override
public boolean getWantClientAuth() {
return sslParameters.getWantClientAuth();
}
@@ -324,6 +335,7 @@ public class SSLEngineImpl extends SSLEngine {
* @see javax.net.ssl.SSLEngine#setEnableSessionCreation(boolean) method
* documentation for more information
*/
+ @Override
public void setEnableSessionCreation(boolean flag) {
sslParameters.setEnableSessionCreation(flag);
}
@@ -333,6 +345,7 @@ public class SSLEngineImpl extends SSLEngine {
* @see javax.net.ssl.SSLEngine#getEnableSessionCreation() method
* documentation for more information
*/
+ @Override
public boolean getEnableSessionCreation() {
return sslParameters.getEnableSessionCreation();
}
@@ -344,6 +357,7 @@ public class SSLEngineImpl extends SSLEngine {
* @see javax.net.ssl.SSLEngine#getHandshakeStatus() method
* documentation for more information
*/
+ @Override
public SSLEngineResult.HandshakeStatus getHandshakeStatus() {
if (!handshake_started || engine_was_shutteddown) {
// initial handshake has not been started yet
@@ -365,12 +379,12 @@ public class SSLEngineImpl extends SSLEngine {
* @see javax.net.ssl.SSLEngine#getSession() method
* documentation for more information
*/
+ @Override
public SSLSession getSession() {
if (session != null) {
return session;
- } else {
- return SSLSessionImpl.NULL_SESSION;
}
+ return SSLSessionImpl.NULL_SESSION;
}
/**
@@ -378,6 +392,7 @@ public class SSLEngineImpl extends SSLEngine {
* @see javax.net.ssl.SSLEngine#isInboundDone() method
* documentation for more information
*/
+ @Override
public boolean isInboundDone() {
return isInboundDone || engine_was_closed;
}
@@ -387,6 +402,7 @@ public class SSLEngineImpl extends SSLEngine {
* @see javax.net.ssl.SSLEngine#isOutboundDone() method
* documentation for more information
*/
+ @Override
public boolean isOutboundDone() {
return isOutboundDone;
}
@@ -402,6 +418,7 @@ public class SSLEngineImpl extends SSLEngine {
* @see javax.net.ssl.SSLEngine#unwrap(ByteBuffer,ByteBuffer[],int,int)
* method documentation for more information
*/
+ @Override
public SSLEngineResult unwrap(ByteBuffer src, ByteBuffer[] dsts,
int offset, int length) throws SSLException {
if (engine_was_shutteddown) {
@@ -566,6 +583,7 @@ public class SSLEngineImpl extends SSLEngine {
* @see javax.net.ssl.SSLEngine#wrap(ByteBuffer[],int,int,ByteBuffer) method
* documentation for more information
*/
+ @Override
public SSLEngineResult wrap(ByteBuffer[] srcs, int offset,
int len, ByteBuffer dst) throws SSLException {
if (engine_was_shutteddown) {
diff --git a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLInputStream.java b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLInputStream.java
index bd9b6cf..6c23a91 100644
--- a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLInputStream.java
+++ b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLInputStream.java
@@ -15,11 +15,6 @@
* limitations under the License.
*/
-/**
- * @author Alexander Y. Kleymenov
- * @version $Revision$
- */
-
package org.apache.harmony.xnet.provider.jsse;
import java.io.IOException;
@@ -37,6 +32,7 @@ public abstract class SSLInputStream extends InputStream {
/**
* @see java.io.InputStream#available()
*/
+ @Override
public abstract int available() throws IOException;
/**
@@ -49,11 +45,13 @@ public abstract class SSLInputStream extends InputStream {
* @see org.apache.harmony.xnet.provider.jsse.SSLBufferedInput#read()
* @see org.apache.harmony.xnet.provider.jsse.HandshakeIODataStream#read()
*/
+ @Override
public abstract int read() throws IOException;
/**
* @see java.io.InputStream#skip(long)
*/
+ @Override
public long skip(long n) throws IOException {
long skept = n;
while (n > 0) {
@@ -119,6 +117,7 @@ public abstract class SSLInputStream extends InputStream {
/**
* @see java.io.InputStream#read(byte[],int,int)
*/
+ @Override
public int read(byte[] b, int off, int len) throws IOException {
int read_b;
int i = 0;
diff --git a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLParameters.java b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLParameters.java
index fb05722..89916de 100644
--- a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLParameters.java
+++ b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLParameters.java
@@ -15,11 +15,6 @@
* limitations under the License.
*/
-/**
- * @author Alexander Y. Kleymenov
- * @version $Revision$
- */
-
package org.apache.harmony.xnet.provider.jsse;
import java.security.KeyManagementException;
@@ -28,6 +23,9 @@ import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.security.UnrecoverableKeyException;
+import java.security.InvalidAlgorithmParameterException;
+import java.security.cert.CertificateEncodingException;
+
import javax.net.ssl.KeyManager;
import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.TrustManager;
@@ -193,6 +191,11 @@ public class SSLParameters implements Cloneable {
if (initialize_default) {
// found trustManager is default trust manager
defaultTrustManager = trustManager;
+// BEGIN android-added
+ if (trustManager instanceof TrustManagerImpl) {
+ ((TrustManagerImpl) trustManager).indexTrustAnchors();
+ }
+// END android-added
}
}
} catch (NoSuchAlgorithmException e) {
@@ -201,6 +204,12 @@ public class SSLParameters implements Cloneable {
throw new KeyManagementException(e);
} catch (UnrecoverableKeyException e) {
throw new KeyManagementException(e);
+// BEGIN android-added
+ } catch (CertificateEncodingException e) {
+ throw new KeyManagementException(e);
+ } catch (InvalidAlgorithmParameterException e) {
+ throw new KeyManagementException(e);
+// END android-added
}
// initialize secure random
// BEGIN android-removed
@@ -303,7 +312,7 @@ public class SSLParameters implements Cloneable {
enabledCipherSuiteNames[i] = enabledCipherSuites[i].getName();
}
}
- return (String[]) enabledCipherSuiteNames.clone();
+ return enabledCipherSuiteNames.clone();
}
/**
@@ -331,7 +340,7 @@ public class SSLParameters implements Cloneable {
* @return the set of enabled protocols
*/
protected String[] getEnabledProtocols() {
- return (String[]) enabledProtocols.clone();
+ return enabledProtocols.clone();
}
/**
@@ -422,6 +431,7 @@ public class SSLParameters implements Cloneable {
* Returns the clone of this object.
* @return the clone.
*/
+ @Override
protected Object clone() {
// BEGIN android-changed
try {
diff --git a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLRecordProtocol.java b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLRecordProtocol.java
index 4428820..423a817 100644
--- a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLRecordProtocol.java
+++ b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLRecordProtocol.java
@@ -15,11 +15,6 @@
* limitations under the License.
*/
-/**
- * @author Alexander Y. Kleymenov
- * @version $Revision$
- */
-
package org.apache.harmony.xnet.provider.jsse;
import org.apache.harmony.xnet.provider.jsse.AlertException;
@@ -33,7 +28,7 @@ import javax.net.ssl.SSLProtocolException;
* This class performs functionality dedicated to SSL record layer.
* It unpacks and routes income data to the appropriate
* client protocol (handshake, alert, application data protocols)
- * and paketizes outcome data into SSL/TLS records.
+ * and packages outcome data into SSL/TLS records.
* Initially created object has null connection state and does not
* perform any cryptography computations over the income/outcome data.
* After handshake protocol agreed upon security parameters they are placed
@@ -179,14 +174,13 @@ public class SSLRecordProtocol {
}
if (activeReadState == null) {
return record_size;
- } else {
- return activeReadState.getContentSize(record_size);
}
+ return activeReadState.getContentSize(record_size);
}
/**
* Depending on the Connection State (Session) encrypts and compress
- * the provided data, and packs it into TLSCiphertext structute.
+ * the provided data, and packs it into TLSCiphertext structure.
* @param content_type: int
* @param fragment: byte[]
* @return ssl packet created over the current connection state
@@ -198,7 +192,7 @@ public class SSLRecordProtocol {
/**
* Depending on the Connection State (Session) encrypts and compress
- * the provided data, and packs it into TLSCiphertext structute.
+ * the provided data, and packs it into TLSCiphertext structure.
* @param content_type: int
* @param fragment: byte[]
* @return ssl packet created over the current connection state
@@ -374,7 +368,7 @@ public class SSLRecordProtocol {
type));
}
} else {
- in.skip((long) 2); // just skip the version number
+ in.skip(2); // just skip the version number
}
int length = in.readUint16();
if (logger != null) {
diff --git a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLSessionImpl.java b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLSessionImpl.java
index 4510c96..5d46568 100644
--- a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLSessionImpl.java
+++ b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLSessionImpl.java
@@ -15,11 +15,6 @@
* limitations under the License.
*/
-/**
- * @author Boris Kuznetsov
- * @version $Revision$
- */
-
package org.apache.harmony.xnet.provider.jsse;
import java.security.AccessControlContext;
@@ -29,7 +24,8 @@ import java.security.SecureRandom;
import java.security.cert.Certificate;
import java.security.cert.CertificateEncodingException;
import java.security.cert.X509Certificate;
-import java.util.Iterator;
+import java.util.HashMap;
+import java.util.Map;
import java.util.Vector;
import javax.net.ssl.SSLPeerUnverifiedException;
@@ -39,25 +35,67 @@ import javax.net.ssl.SSLSessionBindingEvent;
import javax.net.ssl.SSLSessionBindingListener;
import javax.net.ssl.SSLSessionContext;
-import org.apache.harmony.luni.util.TwoKeyHashMap;
-
/**
*
* SSLSession implementation
- *
+ *
* @see javax.net.ssl.SSLSession
*/
-public class SSLSessionImpl implements SSLSession {
+public class SSLSessionImpl implements SSLSession, Cloneable {
/**
- * Session object reporting an invalid cipher suite of
- * "SSL_NULL_WITH_NULL_NULL"
+ * Session object reporting an invalid cipher suite of "SSL_NULL_WITH_NULL_NULL"
*/
public static final SSLSessionImpl NULL_SESSION = new SSLSessionImpl(null);
+ /**
+ * Container class for the 'value' map's keys.
+ */
+ private static final class ValueKey {
+ final String name;
+ final AccessControlContext acc;
+
+ ValueKey(String name) {
+ super();
+ this.name = name;
+ this.acc = AccessController.getContext();
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((acc == null) ? 0 : acc.hashCode());
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (!(obj instanceof ValueKey))
+ return false;
+ ValueKey other = (ValueKey) obj;
+ if (acc == null) {
+ if (other.acc != null)
+ return false;
+ } else if (!acc.equals(other.acc))
+ return false;
+ if (name == null) {
+ if (other.name != null)
+ return false;
+ } else if (!name.equals(other.name))
+ return false;
+ return true;
+ }
+ }
+
private long creationTime;
private boolean isValid = true;
- private TwoKeyHashMap values = new TwoKeyHashMap();
+ private Map<ValueKey, Object> values = new HashMap<ValueKey, Object>();
/**
* ID of the session
@@ -65,7 +103,7 @@ public class SSLSessionImpl implements SSLSession {
byte[] id;
/**
- * Last time the session was accessed
+ * Last time the session was accessed
*/
long lastAccessedTime;
@@ -87,7 +125,7 @@ public class SSLSessionImpl implements SSLSession {
// END android-changed
/**
- * certificates were sent to the peer
+ * certificates were sent to the peer
*/
X509Certificate[] localCertificates;
@@ -97,21 +135,20 @@ public class SSLSessionImpl implements SSLSession {
X509Certificate[] peerCertificates;
/**
- * Peer host name
+ * Peer host name
*/
- String peerHost;
+ private String peerHost;
/**
* Peer port number
*/
- int peerPort = -1;
+ private int peerPort = -1;
/**
* Master secret
*/
byte[] master_secret;
-
/**
* clientRandom
*/
@@ -125,10 +162,11 @@ public class SSLSessionImpl implements SSLSession {
/**
* True if this entity is considered the server
*/
- boolean isServer = false;
+ final boolean isServer;
/**
* Creates SSLSession implementation
+ *
* @param cipher_suite
* @param sr
*/
@@ -143,11 +181,11 @@ public class SSLSessionImpl implements SSLSession {
this.cipherSuite = cipher_suite;
id = new byte[32];
sr.nextBytes(id);
- long time = new java.util.Date().getTime() / 1000;
+ long time = creationTime / 1000;
id[28] = (byte) ((time & 0xFF000000) >>> 24);
- id[29] = (byte) ((time & 0xFF0000) >>> 16);
- id[30] = (byte) ((time & 0xFF00) >>> 8);
- id[31] = (byte) (time & 0xFF);
+ id[29] = (byte) ((time & 0x00FF0000) >>> 16);
+ id[30] = (byte) ((time & 0x0000FF00) >>> 8);
+ id[31] = (byte) ((time & 0x000000FF));
isServer = true;
}
@@ -155,78 +193,48 @@ public class SSLSessionImpl implements SSLSession {
/**
* Creates SSLSession implementation
+ *
* @param sr
*/
public SSLSessionImpl(SecureRandom sr) {
this(null, sr);
}
- private SSLSessionImpl() {
- }
-
- /**
- * @see javax.net.ssl.SSLSession#getApplicationBufferSize()
- */
public int getApplicationBufferSize() {
return SSLRecordProtocol.MAX_DATA_LENGTH;
}
- /**
- * @see javax.net.ssl.SSLSession#getCipherSuite()
- */
public String getCipherSuite() {
return cipherSuite.getName();
}
- /**
- * @see javax.net.ssl.SSLSession#getCreationTime()
- */
public long getCreationTime() {
return creationTime;
}
- /**
- * @see javax.net.ssl.SSLSession#getId()
- */
public byte[] getId() {
return id;
}
- /**
- * @see javax.net.ssl.SSLSession#getLastAccessedTime()
- */
public long getLastAccessedTime() {
return lastAccessedTime;
}
- /**
- * @see javax.net.ssl.SSLSession#getLocalCertificates()
- */
public Certificate[] getLocalCertificates() {
return localCertificates;
}
- /**
- * @see javax.net.ssl.SSLSession#getLocalPrincipal()
- */
public Principal getLocalPrincipal() {
if (localCertificates != null && localCertificates.length > 0) {
return localCertificates[0].getSubjectX500Principal();
- } else {
- return null;
}
+ return null;
}
- /**
- * @see javax.net.ssl.SSLSession#getPacketBufferSize()
- */
public int getPacketBufferSize() {
return SSLRecordProtocol.MAX_SSL_PACKET_SIZE;
}
- /**
- * @see javax.net.ssl.SSLSession#getPeerCertificateChain()
- */
public javax.security.cert.X509Certificate[] getPeerCertificateChain()
throws SSLPeerUnverifiedException {
if (peerCertificates == null) {
@@ -235,8 +243,8 @@ public class SSLSessionImpl implements SSLSession {
javax.security.cert.X509Certificate[] certs = new javax.security.cert.X509Certificate[peerCertificates.length];
for (int i = 0; i < certs.length; i++) {
try {
- certs[i] = javax.security.cert.X509Certificate
- .getInstance(peerCertificates[i].getEncoded());
+ certs[i] = javax.security.cert.X509Certificate.getInstance(peerCertificates[i]
+ .getEncoded());
} catch (javax.security.cert.CertificateException e) {
} catch (CertificateEncodingException e) {
}
@@ -244,34 +252,21 @@ public class SSLSessionImpl implements SSLSession {
return certs;
}
- /**
- * @see javax.net.ssl.SSLSession#getPeerCertificates()
- */
- public Certificate[] getPeerCertificates()
- throws SSLPeerUnverifiedException {
+ public Certificate[] getPeerCertificates() throws SSLPeerUnverifiedException {
if (peerCertificates == null) {
throw new SSLPeerUnverifiedException("No peer certificate");
}
return peerCertificates;
}
- /**
- * @see javax.net.ssl.SSLSession#getPeerHost()
- */
public String getPeerHost() {
return peerHost;
}
- /**
- * @see javax.net.ssl.SSLSession#getPeerPort()
- */
public int getPeerPort() {
return peerPort;
}
- /**
- * @see javax.net.ssl.SSLSession#getPeerPrincipal()
- */
public Principal getPeerPrincipal() throws SSLPeerUnverifiedException {
if (peerCertificates == null) {
throw new SSLPeerUnverifiedException("No peer certificate");
@@ -279,16 +274,10 @@ public class SSLSessionImpl implements SSLSession {
return peerCertificates[0].getSubjectX500Principal();
}
- /**
- * @see javax.net.ssl.SSLSession#getProtocol()
- */
public String getProtocol() {
return protocol.name;
}
- /**
- * @see javax.net.ssl.SSLSession#getSessionContext()
- */
public SSLSessionContext getSessionContext() {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
@@ -297,109 +286,71 @@ public class SSLSessionImpl implements SSLSession {
return context;
}
- /**
- * @see javax.net.ssl.SSLSession#getValue(String name)
- */
public Object getValue(String name) {
if (name == null) {
throw new IllegalArgumentException("Parameter is null");
}
- return values.get(name, AccessController.getContext());
+ return values.get(new ValueKey(name));
}
- /**
- * @see javax.net.ssl.SSLSession#getValueNames()
- */
public String[] getValueNames() {
- Vector v = new Vector();
- AccessControlContext current = AccessController.getContext();
- AccessControlContext cont;
- for (Iterator it = values.entrySet().iterator(); it.hasNext();) {
- TwoKeyHashMap.Entry entry = (TwoKeyHashMap.Entry) it.next();
- cont = (AccessControlContext) entry.getKey2();
- if ((current == null && cont == null)
- || (current != null && current.equals(cont))) {
- v.add(entry.getKey1());
+ final Vector<String> v = new Vector<String>();
+ final AccessControlContext currAcc = AccessController.getContext();
+ for (ValueKey key : values.keySet()) {
+ if ((currAcc == null && key.acc == null)
+ || (currAcc != null && currAcc.equals(key.acc))) {
+ v.add(key.name);
}
}
- return (String[]) v.toArray(new String[0]);
+ return v.toArray(new String[v.size()]);
}
- /**
- * @see javax.net.ssl.SSLSession#invalidate()
- */
public void invalidate() {
isValid = false;
}
- /**
- * @see javax.net.ssl.SSLSession#isValid()
- */
public boolean isValid() {
- if (isValid
- && context != null
- && context.getSessionTimeout() != 0
- && lastAccessedTime + context.getSessionTimeout() > System
- .currentTimeMillis()) {
+ if (isValid && context != null && context.getSessionTimeout() != 0
+ && lastAccessedTime + context.getSessionTimeout() > System.currentTimeMillis()) {
isValid = false;
}
return isValid;
}
- /**
- * @see javax.net.ssl.SSLSession#putValue(String name, Object value)
- */
public void putValue(String name, Object value) {
if (name == null || value == null) {
throw new IllegalArgumentException("Parameter is null");
}
- Object old = values.put(name, AccessController.getContext(), value);
+ Object old = values.put(new ValueKey(name), value);
if (value instanceof SSLSessionBindingListener) {
- ((SSLSessionBindingListener) value)
- .valueBound(new SSLSessionBindingEvent(this, name));
+ ((SSLSessionBindingListener) value).valueBound(new SSLSessionBindingEvent(this, name));
}
if (old != null && old instanceof SSLSessionBindingListener) {
- ((SSLSessionBindingListener) old)
- .valueUnbound(new SSLSessionBindingEvent(this, name));
+ ((SSLSessionBindingListener) old).valueUnbound(new SSLSessionBindingEvent(this, name));
}
}
- /**
- * @see javax.net.ssl.SSLSession#removeValue(String name)
- */
public void removeValue(String name) {
if (name == null) {
throw new IllegalArgumentException("Parameter is null");
}
- values.remove(name, AccessController.getContext());
+ values.remove(new ValueKey(name));
}
+ @Override
public Object clone() {
- SSLSessionImpl ses = new SSLSessionImpl();
- ses.id = this.id;
- ses.creationTime = this.creationTime;
- ses.lastAccessedTime = this.lastAccessedTime;
- ses.isValid = this.isValid;
- ses.cipherSuite = this.cipherSuite;
- ses.localCertificates = this.localCertificates;
- ses.peerCertificates = this.peerCertificates;
- ses.master_secret = this.master_secret;
- ses.clientRandom = this.clientRandom;
- ses.serverRandom = this.serverRandom;
- ses.peerHost = this.peerHost;
- ses.peerPort = this.peerPort;
- ses.isServer = this.isServer;
- ses.context = this.context;
- ses.protocol = this.protocol;
- ses.values = this.values;
- return ses;
+ try {
+ return super.clone();
+ } catch (CloneNotSupportedException e) {
+ throw new AssertionError(e);
+ }
}
-
/**
* Sets the address of the peer
+ *
* @param peerHost
* @param peerPort
*/
diff --git a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLStreamedInput.java b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLStreamedInput.java
index efabef8..c040653 100644
--- a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLStreamedInput.java
+++ b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLStreamedInput.java
@@ -15,11 +15,6 @@
* limitations under the License.
*/
-/**
- * @author Alexander Y. Kleymenov
- * @version $Revision$
- */
-
package org.apache.harmony.xnet.provider.jsse;
import java.io.IOException;
@@ -37,6 +32,7 @@ public class SSLStreamedInput extends SSLInputStream {
this.in = in;
}
+ @Override
public int available() throws IOException {
return in.available();
}
@@ -49,6 +45,7 @@ public class SSLStreamedInput extends SSLInputStream {
* @throws org.apache.harmony.xnet.provider.jsse.EndOfSourceException if the end of the underlying
* stream has been reached.
*/
+ @Override
public int read() throws IOException {
int res = in.read();
if (res < 0) {
diff --git a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLv3Constants.java b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLv3Constants.java
index 1a03f7f..07aaca8 100644
--- a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLv3Constants.java
+++ b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLv3Constants.java
@@ -15,11 +15,6 @@
* limitations under the License.
*/
-/**
- * @author Boris Kuznetsov
- * @version $Revision$
- */
-
package org.apache.harmony.xnet.provider.jsse;
/**
diff --git a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ServerHandshakeImpl.java b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ServerHandshakeImpl.java
index f6eef23..3bb096b 100644
--- a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ServerHandshakeImpl.java
+++ b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ServerHandshakeImpl.java
@@ -15,11 +15,6 @@
* limitations under the License.
*/
-/**
-* @author Boris Kuznetsov
-* @version $Revision$
-*/
-
package org.apache.harmony.xnet.provider.jsse;
import org.apache.harmony.xnet.provider.jsse.SSLv3Constants;
@@ -56,7 +51,7 @@ import javax.net.ssl.X509TrustManager;
* Handshake protocol operates on top of the Record Protocol.
* It responsible for negotiating a session.
*
- * The implementation proceses inbound client handshake messages,
+ * The implementation processes inbound client handshake messages,
* creates and sends respond messages. Outbound messages are supplied
* to Record Protocol. Detected errors are reported to the Alert protocol.
*
@@ -82,6 +77,7 @@ public class ServerHandshakeImpl extends HandshakeProtocol {
/**
* Start session negotiation
*/
+ @Override
public void start() {
if (session == null) { // initial handshake
status = NEED_UNWRAP;
@@ -101,6 +97,7 @@ public class ServerHandshakeImpl extends HandshakeProtocol {
* Proceses inbound handshake messages
* @param bytes
*/
+ @Override
public void unwrap(byte[] bytes) {
io_stream.append(bytes);
@@ -128,15 +125,12 @@ public class ServerHandshakeImpl extends HandshakeProtocol {
needSendHelloRequest = false;
clientHello = new ClientHello(io_stream, length);
if (nonBlocking) {
- delegatedTasks.add(new DelegatedTask(
- new PrivilegedExceptionAction(){
- public Object run() throws Exception {
+ delegatedTasks.add(new DelegatedTask(new PrivilegedExceptionAction<Void>() {
+ public Void run() throws Exception {
processClientHello();
return null;
- }
- },
- this,
- AccessController.getContext()));
+ }
+ }, this, AccessController.getContext()));
return;
}
processClientHello();
@@ -152,7 +146,7 @@ public class ServerHandshakeImpl extends HandshakeProtocol {
if (clientCert.certs.length == 0) {
if (parameters.getNeedClientAuth()) {
fatalAlert(AlertProtocol.HANDSHAKE_FAILURE,
- "HANDSHAKE FAILURE: no client certificate recived");
+ "HANDSHAKE FAILURE: no client certificate received");
}
} else {
String authType = clientCert.certs[0].getPublicKey()
@@ -324,32 +318,27 @@ public class ServerHandshakeImpl extends HandshakeProtocol {
* @ see TLS 1.0 spec., E.1. Version 2 client hello
* @param bytes
*/
+ @Override
public void unwrapSSLv2(byte[] bytes) {
+ io_stream.append(bytes);
+ io_stream.mark();
try {
- io_stream.append(bytes);
- io_stream.mark();
- try {
- clientHello = new ClientHello(io_stream);
- } catch (IOException e) {
- io_stream.reset();
- return;
- }
- if (nonBlocking) {
- delegatedTasks.add(new DelegatedTask(
- new PrivilegedExceptionAction(){
- public Object run() throws Exception {
- processClientHello();
- return null;
+ clientHello = new ClientHello(io_stream);
+ } catch (IOException e) {
+ io_stream.reset();
+ return;
+ }
+ if (nonBlocking) {
+ delegatedTasks.add(new DelegatedTask(
+ new PrivilegedExceptionAction<Void>() {
+ public Void run() throws Exception {
+ processClientHello();
+ return null;
}
- },
- this,
- AccessController.getContext()));
- return;
- }
- processClientHello();
- } catch (Exception e) {
- fatalAlert(AlertProtocol.INTERNAL_ERROR, "INTERNAL ERROR", e);
+ }, this, AccessController.getContext()));
+ return;
}
+ processClientHello();
}
/**
@@ -407,10 +396,9 @@ public class ServerHandshakeImpl extends HandshakeProtocol {
status = NOT_HANDSHAKING;
clearMessages();
return;
- } else {
- fatalAlert(AlertProtocol.HANDSHAKE_FAILURE,
- "SSL Session may not be created");
}
+ // throw AlertException
+ fatalAlert(AlertProtocol.HANDSHAKE_FAILURE, "SSL Session may not be created");
}
session = null;
} else {
@@ -569,7 +557,7 @@ public class ServerHandshakeImpl extends HandshakeProtocol {
} catch (NoSuchAlgorithmException e) {
kf = KeyFactory.getInstance("DiffieHellman");
}
- dhkeySpec = (DHPublicKeySpec) kf.getKeySpec(dhkey,
+ dhkeySpec = kf.getKeySpec(dhkey,
DHPublicKeySpec.class);
}
if (!cipher_suite.isAnonymous()) { // calculate signed_params
@@ -654,6 +642,7 @@ public class ServerHandshakeImpl extends HandshakeProtocol {
/**
* Creates and sends finished message
*/
+ @Override
protected void makeFinished() {
byte[] verify_data;
boolean isTLS = (serverHello.server_version[1] == 1); // TLS 1.0 protocol
@@ -702,8 +691,9 @@ public class ServerHandshakeImpl extends HandshakeProtocol {
}
/**
- * Proceses inbound ChangeCipherSpec message
+ * Processes inbound ChangeCipherSpec message
*/
+ @Override
public void receiveChangeCipherSpec() {
if (isResuming) {
if (serverFinished == null) {
diff --git a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ServerHello.java b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ServerHello.java
index 0365288..1cd9624 100644
--- a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ServerHello.java
+++ b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ServerHello.java
@@ -15,11 +15,6 @@
* limitations under the License.
*/
-/**
-* @author Boris Kuznetsov
-* @version $Revision$
-*/
-
package org.apache.harmony.xnet.provider.jsse;
import org.apache.harmony.xnet.provider.jsse.Message;
@@ -112,6 +107,7 @@ public class ServerHello extends Message {
* Sends message
* @param out
*/
+ @Override
public void send(HandshakeIODataStream out) {
out.write(server_version);
out.write(random);
@@ -134,6 +130,7 @@ public class ServerHello extends Message {
* Returns message type
* @return
*/
+ @Override
public int getType() {
return Handshake.SERVER_HELLO;
}
diff --git a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ServerHelloDone.java b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ServerHelloDone.java
index e794ed9..73b6a81 100644
--- a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ServerHelloDone.java
+++ b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ServerHelloDone.java
@@ -15,11 +15,6 @@
* limitations under the License.
*/
-/**
-* @author Boris Kuznetsov
-* @version $Revision$
-*/
-
package org.apache.harmony.xnet.provider.jsse;
import org.apache.harmony.xnet.provider.jsse.Message;
@@ -59,6 +54,7 @@ public class ServerHelloDone extends Message {
* Sends message
* @param out
*/
+ @Override
public void send(HandshakeIODataStream out) {
}
@@ -66,6 +62,7 @@ public class ServerHelloDone extends Message {
* Returns message length
* @return
*/
+ @Override
public int length() {
return 0;
}
@@ -74,6 +71,7 @@ public class ServerHelloDone extends Message {
* Returns message type
* @return
*/
+ @Override
public int getType() {
return Handshake.SERVER_HELLO_DONE;
}
diff --git a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ServerKeyExchange.java b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ServerKeyExchange.java
index 1d93ece..446b7b4 100644
--- a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ServerKeyExchange.java
+++ b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ServerKeyExchange.java
@@ -15,11 +15,6 @@
* limitations under the License.
*/
-/**
-* @author Boris Kuznetsov
-* @version $Revision$
-*/
-
package org.apache.harmony.xnet.provider.jsse;
import org.apache.harmony.xnet.provider.jsse.Message;
@@ -150,6 +145,7 @@ public class ServerKeyExchange extends Message {
* Sends message
* @param out
*/
+ @Override
public void send(HandshakeIODataStream out) {
out.writeUint16(bytes1.length);
out.write(bytes1);
@@ -189,6 +185,7 @@ public class ServerKeyExchange extends Message {
* Returns message type
* @return
*/
+ @Override
public int getType() {
return Handshake.SERVER_KEY_EXCHANGE;
}
diff --git a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/TrustManagerFactoryImpl.java b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/TrustManagerFactoryImpl.java
index b96d1ab..c473864 100644
--- a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/TrustManagerFactoryImpl.java
+++ b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/TrustManagerFactoryImpl.java
@@ -15,11 +15,6 @@
* limitations under the License.
*/
-/**
- * @author Boris Kuznetsov
- * @version $Revision$
- */
-
package org.apache.harmony.xnet.provider.jsse;
import java.io.File;
@@ -50,6 +45,7 @@ public class TrustManagerFactoryImpl extends TrustManagerFactorySpi {
/**
* @see javax.net.ssl.TrustManagerFactorySpi#engineInit(KeyStore)
*/
+ @Override
public void engineInit(KeyStore ks) throws KeyStoreException {
if (ks != null) {
keyStore = ks;
@@ -117,6 +113,7 @@ public class TrustManagerFactoryImpl extends TrustManagerFactorySpi {
/**
* @see javax.net.ssl#engineInit(ManagerFactoryParameters)
*/
+ @Override
public void engineInit(ManagerFactoryParameters spec)
throws InvalidAlgorithmParameterException {
throw new InvalidAlgorithmParameterException(
@@ -126,6 +123,7 @@ public class TrustManagerFactoryImpl extends TrustManagerFactorySpi {
/**
* @see javax.net.ssl#engineGetTrustManagers()
*/
+ @Override
public TrustManager[] engineGetTrustManagers() {
if (keyStore == null) {
throw new IllegalStateException(
diff --git a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/TrustManagerImpl.java b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/TrustManagerImpl.java
index 31f7314..5c40b4e 100644
--- a/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/TrustManagerImpl.java
+++ b/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/TrustManagerImpl.java
@@ -15,15 +15,13 @@
* limitations under the License.
*/
-/**
- * @author Boris Kuznetsov
- * @version $Revision$
- */
-
package org.apache.harmony.xnet.provider.jsse;
+import org.bouncycastle.jce.provider.IndexedPKIXParameters;
+
import java.security.InvalidAlgorithmParameterException;
import java.security.KeyStore;
+import java.security.KeyStoreException;
import java.security.cert.CertPathValidator;
import java.security.cert.CertPathValidatorException;
import java.security.cert.CertificateException;
@@ -72,13 +70,11 @@ public class TrustManagerImpl implements X509TrustManager {
try {
validator = CertPathValidator.getInstance("PKIX");
factory = CertificateFactory.getInstance("X509");
- String alias;
- X509Certificate cert;
byte[] nameConstrains = null;
- Set trusted = new HashSet();
- for (Enumeration en = ks.aliases(); en.hasMoreElements();) {
- alias = (String) en.nextElement();
- cert = (X509Certificate) ks.getCertificate(alias);
+ Set<TrustAnchor> trusted = new HashSet<TrustAnchor>();
+ for (Enumeration<String> en = ks.aliases(); en.hasMoreElements();) {
+ final String alias = en.nextElement();
+ final X509Certificate cert = (X509Certificate) ks.getCertificate(alias);
if (cert != null) {
trusted.add(new TrustAnchor(cert, nameConstrains));
}
@@ -90,6 +86,17 @@ public class TrustManagerImpl implements X509TrustManager {
}
}
+// BEGIN android-added
+ /**
+ * Indexes trust anchors so they can be found in O(1) instead of O(N) time.
+ */
+ public void indexTrustAnchors() throws CertificateEncodingException,
+ InvalidAlgorithmParameterException, KeyStoreException {
+ params = new IndexedPKIXParameters(params.getTrustAnchors());
+ params.setRevocationEnabled(false);
+ }
+// END android-added
+
/**
* @see javax.net.ssl.X509TrustManager#checkClientTrusted(X509Certificate[],
* String)
@@ -208,11 +215,11 @@ public class TrustManagerImpl implements X509TrustManager {
if (params == null) {
return new X509Certificate[0];
}
- Set anchors = params.getTrustAnchors();
+ Set<TrustAnchor> anchors = params.getTrustAnchors();
X509Certificate[] certs = new X509Certificate[anchors.size()];
int i = 0;
- for (Iterator it = anchors.iterator(); it.hasNext();) {
- certs[i++] = ((TrustAnchor) it.next()).getTrustedCert();
+ for (Iterator<TrustAnchor> it = anchors.iterator(); it.hasNext();) {
+ certs[i++] = it.next().getTrustedCert();
}
return certs;
}
diff --git a/x-net/src/main/native/org_apache_harmony_xnet_provider_jsse_OpenSSLSocketImpl.cpp b/x-net/src/main/native/org_apache_harmony_xnet_provider_jsse_OpenSSLSocketImpl.cpp
index 8f36632..87f2af3 100644
--- a/x-net/src/main/native/org_apache_harmony_xnet_provider_jsse_OpenSSLSocketImpl.cpp
+++ b/x-net/src/main/native/org_apache_harmony_xnet_provider_jsse_OpenSSLSocketImpl.cpp
@@ -421,7 +421,7 @@ typedef struct app_data {
static int sslCreateAppData(SSL* ssl) {
APP_DATA* data = (APP_DATA*) malloc(sizeof(APP_DATA));
- memset(data, sizeof(APP_DATA), 0);
+ memset(data, 0, sizeof(APP_DATA));
data->aliveAndKicking = 1;
data->waitingThreads = 0;