Index: modules/x-net/src/test/impl/java.injected/javax/net/ssl/HttpsURLConnection_ImplTest.java =================================================================== --- modules/x-net/src/test/impl/java.injected/javax/net/ssl/HttpsURLConnection_ImplTest.java (revision 0) +++ modules/x-net/src/test/impl/java.injected/javax/net/ssl/HttpsURLConnection_ImplTest.java (revision 0) @@ -0,0 +1,101 @@ +/* + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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 javax.net.ssl; + +import java.io.IOException; +import java.net.URL; +import java.security.cert.Certificate; + +import junit.framework.TestCase; + +/** + * Tests for HttpsURLConnection class constructors and methods. + * + */ +public class HttpsURLConnection_ImplTest extends TestCase { + + public final void testGetDefaultHostnameVerifier() { + + HostnameVerifier ver = HttpsURLConnection.getDefaultHostnameVerifier(); + if (!(ver instanceof DefaultHostnameVerifier)) { + fail("Incorrect instance"); + } + if (ver.verify("localhost", null)) { + fail("connection should not be permitted"); + } + } + + public final void testGetHostnameVerifier() { + + HttpsURLConnection con = new MyHttpsURLConnection(null); + HostnameVerifier ver = con.getHostnameVerifier(); + if (!(ver instanceof DefaultHostnameVerifier)) { + fail("Incorrect instance"); + } + if (ver.verify("localhost", null)) { + fail("connection should not be permitted"); + } + } +} + +class MyHttpsURLConnection extends HttpsURLConnection { + + public MyHttpsURLConnection(URL url) { + super(url); + } + + /* + * @see javax.net.ssl.HttpsURLConnection#getCipherSuite() + */ + public String getCipherSuite() { + return null; + } + + /* + * @see javax.net.ssl.HttpsURLConnection#getLocalCertificates() + */ + public Certificate[] getLocalCertificates() { + return null; + } + + /* + * @see javax.net.ssl.HttpsURLConnection#getServerCertificates() + */ + public Certificate[] getServerCertificates() + throws SSLPeerUnverifiedException { + return null; + } + + /* + * @see java.net.HttpURLConnection#disconnect() + */ + public void disconnect() { + } + + /* + * @see java.net.HttpURLConnection#usingProxy() + */ + public boolean usingProxy() { + return false; + } + + /* + * @see java.net.URLConnection#connect() + */ + public void connect() throws IOException { + } +} \ No newline at end of file Index: modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/KeyStoreBuilderParametersTest.java =================================================================== --- modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/KeyStoreBuilderParametersTest.java (revision 0) +++ modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/KeyStoreBuilderParametersTest.java (working copy) @@ -14,18 +14,15 @@ * limitations under the License. */ -/** -* @author Boris V. Kuznetsov -* @version $Revision$ -*/ +package org.apache.harmony.xnet.tests.javax.net.ssl; -package javax.net.ssl; - -import java.util.ArrayList; -import java.util.List; import java.security.KeyStore; import java.security.KeyStoreException; +import java.util.ArrayList; +import java.util.List; +import javax.net.ssl.KeyStoreBuilderParameters; + import junit.framework.TestCase; @@ -40,11 +37,8 @@ * Class under test for void KeyStoreBuilderParameters(KeyStore.Builder) */ public final void testKeyStoreBuilderParametersBuilder() { - try { - new KeyStoreBuilderParameters((KeyStore.Builder) null); - fail("No expected NullPointerException"); - } catch (NullPointerException e) { - } + // should not throw NullPointerException + new KeyStoreBuilderParameters((KeyStore.Builder) null); } /* Index: modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/SSLServerSocketTest.java =================================================================== --- modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/SSLServerSocketTest.java (revision 0) +++ modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/SSLServerSocketTest.java (working copy) @@ -14,15 +14,13 @@ * limitations under the License. */ -/** - * @author Boris V. Kuznetsov - * @version $Revision$ - */ -package javax.net.ssl; +package org.apache.harmony.xnet.tests.javax.net.ssl; import java.io.IOException; import java.net.InetAddress; +import javax.net.ssl.SSLServerSocket; + import junit.framework.TestCase; Index: modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/SSLSessionBindingEventTest.java =================================================================== --- modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/SSLSessionBindingEventTest.java (revision 0) +++ modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/SSLSessionBindingEventTest.java (working copy) @@ -14,16 +14,15 @@ * limitations under the License. */ -/** -* @author Boris V. Kuznetsov -* @version $Revision$ -*/ +package org.apache.harmony.xnet.tests.javax.net.ssl; -package javax.net.ssl; - import java.security.Principal; import java.security.cert.Certificate; +import javax.net.ssl.SSLPeerUnverifiedException; +import javax.net.ssl.SSLSession; +import javax.net.ssl.SSLSessionContext; +import javax.net.ssl.SSLSessionBindingEvent; import javax.security.cert.X509Certificate; import junit.framework.TestCase; Index: modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/SSLProtocolExceptionTest.java =================================================================== --- modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/SSLProtocolExceptionTest.java (revision 0) +++ modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/SSLProtocolExceptionTest.java (working copy) @@ -14,13 +14,8 @@ * limitations under the License. */ -/** -* @author Vera Y. Petrashkova -* @version $Revision$ -*/ +package org.apache.harmony.xnet.tests.javax.net.ssl; -package javax.net.ssl; - import javax.net.ssl.SSLProtocolException; import junit.framework.TestCase; Index: modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/HttpsURLConnectionTest.java =================================================================== --- modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/HttpsURLConnectionTest.java (revision 0) +++ modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/HttpsURLConnectionTest.java (working copy) @@ -14,17 +14,18 @@ * limitations under the License. */ -/** -* @author Boris V. Kuznetsov -* @version $Revision$ -*/ -package javax.net.ssl; +package org.apache.harmony.xnet.tests.javax.net.ssl; import java.io.IOException; -import java.security.cert.Certificate; import java.net.URL; +import java.security.cert.Certificate; +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLPeerUnverifiedException; +import javax.net.ssl.SSLSocketFactory; + import junit.framework.TestCase; @@ -34,8 +35,9 @@ */ public class HttpsURLConnectionTest extends TestCase { - public final void testGetPeerPrincipal() { - HttpsURLConnection con = new MyHttpsURLConnection(null); + public final void testGetPeerPrincipal() throws Exception { + HttpsURLConnection con = new MyHttpsURLConnection(new URL( + "http://foo.com")); try { con.getPeerPrincipal(); fail("No expected SSLPeerUnverifiedException"); @@ -50,27 +52,6 @@ } } - public final void testGetDefaultHostnameVerifier() { - HostnameVerifier ver = HttpsURLConnection.getDefaultHostnameVerifier(); - if (!(ver instanceof DefaultHostnameVerifier)) { - fail("Incorrect instance"); - } - if (ver.verify("localhost", null)) { - fail("connection should not be permitted"); - } - } - - public final void testGetHostnameVerifier() { - HttpsURLConnection con = new MyHttpsURLConnection(null); - HostnameVerifier ver = con.getHostnameVerifier(); - if (!(ver instanceof DefaultHostnameVerifier)) { - fail("Incorrect instance"); - } - if (ver.verify("localhost", null)) { - fail("connection should not be permitted"); - } - } - public final void testSetDefaultHostnameVerifier() { try { HttpsURLConnection.setDefaultHostnameVerifier(null); Index: modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/SSLSocketTest.java =================================================================== --- modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/SSLSocketTest.java (revision 0) +++ modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/SSLSocketTest.java (working copy) @@ -14,17 +14,17 @@ * limitations under the License. */ -/** - * @author Boris V. Kuznetsov - * @version $Revision$ - */ -package javax.net.ssl; +package org.apache.harmony.xnet.tests.javax.net.ssl; import java.io.IOException; import java.net.InetAddress; import java.net.ServerSocket; import java.net.UnknownHostException; +import javax.net.ssl.SSLSession; +import javax.net.ssl.SSLSocket; +import javax.net.ssl.HandshakeCompletedListener; + import junit.framework.TestCase; Index: modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/SSLPermissionTest.java =================================================================== --- modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/SSLPermissionTest.java (revision 0) +++ modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/SSLPermissionTest.java (working copy) @@ -14,12 +14,10 @@ * limitations under the License. */ -/** - * @author Boris V. Kuznetsov - * @version $Revision$ - */ -package javax.net.ssl; +package org.apache.harmony.xnet.tests.javax.net.ssl; +import javax.net.ssl.SSLPermission; + import junit.framework.TestCase; /** Index: modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/SSLPeerUnverifiedExceptionTest.java =================================================================== --- modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/SSLPeerUnverifiedExceptionTest.java (revision 0) +++ modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/SSLPeerUnverifiedExceptionTest.java (working copy) @@ -14,13 +14,8 @@ * limitations under the License. */ -/** -* @author Vera Y. Petrashkova -* @version $Revision$ -*/ +package org.apache.harmony.xnet.tests.javax.net.ssl; -package javax.net.ssl; - import javax.net.ssl.SSLPeerUnverifiedException; import junit.framework.TestCase; Index: modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/SSLExceptionTest.java =================================================================== --- modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/SSLExceptionTest.java (revision 0) +++ modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/SSLExceptionTest.java (working copy) @@ -14,13 +14,8 @@ * limitations under the License. */ -/** -* @author Vera Y. Petrashkova -* @version $Revision$ -*/ +package org.apache.harmony.xnet.tests.javax.net.ssl; -package javax.net.ssl; - import javax.net.ssl.SSLException; import junit.framework.TestCase; Index: modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/HandshakeCompletedEventTest.java =================================================================== --- modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/HandshakeCompletedEventTest.java (revision 0) +++ modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/HandshakeCompletedEventTest.java (working copy) @@ -14,17 +14,18 @@ * limitations under the License. */ -/** -* @author Boris V. Kuznetsov -* @version $Revision$ -*/ +package org.apache.harmony.xnet.tests.javax.net.ssl; -package javax.net.ssl; - import java.io.IOException; import java.net.ServerSocket; import java.security.cert.Certificate; +import javax.net.ssl.HandshakeCompletedEvent; +import javax.net.ssl.SSLPeerUnverifiedException; +import javax.net.ssl.SSLSession; +import javax.net.ssl.SSLSocket; +import javax.net.ssl.SSLSocketFactory; + import junit.framework.TestCase; Index: modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/SSLEngineResultTest.java =================================================================== --- modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/SSLEngineResultTest.java (revision 0) +++ modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/SSLEngineResultTest.java (working copy) @@ -14,34 +14,19 @@ * limitations under the License. */ -/** -* @author Vera Y. Petrashkova -* @version $Revision$ -*/ +package org.apache.harmony.xnet.tests.javax.net.ssl; -package javax.net.ssl; +import javax.net.ssl.SSLEngineResult; import junit.framework.TestCase; /** - * Template tests for SSLEngineResult class - * FIXME: uncommente these tests + * Tests for SSLEngineResult class * */ public class SSLEngineResultTest extends TestCase { - public static void main(String[] args) { - junit.textui.TestRunner.run(SSLEngineResultTest.class); - } - /** - * Constructor for SSLEngineResult. - * @param arg0 - */ - public SSLEngineResultTest(String arg0) { - super(arg0); - } - /** * Test for SSLEngineResult(SSLEngineResult.Status status, * SSLEngineResult.HandshakeStatus handshakeStatus, * int bytesConsumed, @@ -57,10 +42,9 @@ * or bytesProduced is negative or when status or handshakeStatus * is null * - * FIXME: this test should be added for 1.5 release */ public void testSSLEngineResultConstructor() { -/* + int[] neg = { -1, -10, -1000, Integer.MIN_VALUE, (Integer.MIN_VALUE + 1) }; int[] pos = { 0, 1, 1000, Integer.MAX_VALUE, (Integer.MAX_VALUE - 1) }; @@ -118,13 +102,12 @@ } } } -*/ + } /** * Test for SSLEngineResult.Status.values() method - * FIXME: this test should be added for 1.5 release */ -/* + public void testStatus01() { SSLEngineResult.Status [] enS = SSLEngineResult.Status.values(); assertTrue("Incorrect array of Status objects", enS.length > 0); @@ -137,15 +120,14 @@ assertTrue("BUFFER_UNDERFLOW object does not define", findEl(enS, SSLEngineResult.Status.BUFFER_UNDERFLOW)); } -*/ + /** * Test for SSLEngineResult.Status.valueOf(String name) method * Assertion: * throws IllegalArgumentException when there is no constan with specified * name - * FIXME: this test should be added for 1.5 release */ -/* + public void testStatus02() { String [] invalid = {"", "OK1", "BUFFER_overflow", "BUFFER_UND", "CLOSED_CLOSED", "Bad string for verification valueOf method" @@ -166,12 +148,11 @@ } } } -*/ + /** * Test for SSLEngineResult.HandshakeStatus.values() method - * FIXME: this test should be added for 1.5 release */ -/* + public void testHandshakeStatus01() { SSLEngineResult.HandshakeStatus [] enHS = SSLEngineResult.HandshakeStatus .values(); @@ -188,15 +169,14 @@ assertTrue("NOT_HANDSHAKING object does not define", findEl(enHS, SSLEngineResult.HandshakeStatus.NOT_HANDSHAKING)); } -*/ + /** * Test for SSLEngineResult.HandshakeStatus.valueOf(String name) method * Assertion: * throws IllegalArgumentException when there is no constan with specified * name - * FIXME: this test should be added for 1.5 release */ -/* + public void testHandshakeStatus02() { String [] invalid = {"", "FINISHED1", "NEED_task", "NEED_UN", "NEED_WRAP_WRAP", "not_HANDSHAKING", "Bad string for verification valueOf method" @@ -230,5 +210,5 @@ } return ok; } -*/ + } Index: modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/SSLHandshakeExceptionTest.java =================================================================== --- modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/SSLHandshakeExceptionTest.java (revision 0) +++ modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/SSLHandshakeExceptionTest.java (working copy) @@ -14,13 +14,8 @@ * limitations under the License. */ -/** -* @author Vera Y. Petrashkova -* @version $Revision$ -*/ +package org.apache.harmony.xnet.tests.javax.net.ssl; -package javax.net.ssl; - import javax.net.ssl.SSLHandshakeException; import junit.framework.TestCase; Index: modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/SSLEngineTest.java =================================================================== --- modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/SSLEngineTest.java (revision 0) +++ modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/SSLEngineTest.java (working copy) @@ -14,16 +14,17 @@ * limitations under the License. */ -/** -* @author Vera Y. Petrashkova -* @version $Revision$ -*/ +package org.apache.harmony.xnet.tests.javax.net.ssl; -package javax.net.ssl; - import java.nio.ByteBuffer; import java.nio.ReadOnlyBufferException; +import javax.net.ssl.SSLEngine; +import javax.net.ssl.SSLException; +import javax.net.ssl.SSLEngineResult.HandshakeStatus; +import javax.net.ssl.SSLSession; +import javax.net.ssl.SSLEngineResult; + import junit.framework.TestCase; /** @@ -86,7 +87,7 @@ * throws IllegalArgumentException when src or dst is null * throws ReadOnlyBufferException when dst is ReadOnly byte buffer * - * TODO: + * Check that implementation behavior follows RI: * jdk 1.5 does not throw IllegalArgumentException when parameters are null * and does not throw ReadOnlyBufferException if dst is read only byte buffer */ @@ -96,37 +97,27 @@ ByteBuffer bbN = null; ByteBuffer bb = ByteBuffer.allocate(10); SSLEngine e = new mySSLEngine(host, port); - try { - e.wrap(bbN, bb); - fail("IllegalArgumentException must be thrown for null src byte buffer"); - } catch (IllegalArgumentException ex) { - } - try { - e.wrap(bb, bbN); - fail("IllegalArgumentException must be thrown for null dst byte buffer"); - } catch (IllegalArgumentException ex) { - } + + e.wrap(bbN, bb); + e.wrap(bb, bbN); + ByteBuffer roBb = bb.asReadOnlyBuffer(); assertTrue("Not read only byte buffer", roBb.isReadOnly()); - try { - e.wrap(bb, roBb); - fail("ReadOnlyBufferException must be thrown for read only dst"); - } catch (ReadOnlyBufferException ex) { - } + e.wrap(bb, roBb); + } /** * Test for wrap(ByteBuffer[] srcs, ByteBuffer dst) method * - * Assertions: - * throws IllegalArgumentException when srcs or dst is null or - * srcs contains null byte buffer; - * throws ReadOnlyBufferException when dst is read only byte buffer + * Assertions: throws IllegalArgumentException when srcs or dst is null or + * srcs contains null byte buffer; throws ReadOnlyBufferException when dst + * is read only byte buffer * - * TODO: + * Check that implementation behavior follows RI: * jdk 1.5 does not throw IllegalArgumentException when dst is null or - * if srcs contains null elements - * It does not throw ReadOnlyBufferException for read only dst + * if srcs contains null elements It does not throw ReadOnlyBufferException + * for read only dst */ public void testWrap02() throws SSLException { String host = "new host"; @@ -142,27 +133,17 @@ fail("IllegalArgumentException must be thrown for null srcs byte buffer array"); } catch (IllegalArgumentException ex) { } - try { - e.wrap(bbA, bb); - fail("IllegalArgumentException must be thrown for srcs byte buffer array" - + " which contains null elements"); - } catch (IllegalArgumentException ex) { - } - try { - e.wrap(bbA, bbN); - fail("IllegalArgumentException must be thrown for null dst byte buffer"); - } catch (IllegalArgumentException ex) { - } + e.wrap(bbA, bb); + e.wrap(bbA, bbN); + ByteBuffer roBb = bb.asReadOnlyBuffer(); bbA[0] = ByteBuffer.allocate(100); bbA[2] = ByteBuffer.allocate(20); assertTrue("Not read only byte buffer", roBb.isReadOnly()); - try { - e.wrap(bbA, roBb); - fail("ReadOnlyBufferException must be thrown for read only dst"); - } catch (ReadOnlyBufferException ex) { - } + + e.wrap(bbA, roBb); + } /** @@ -239,7 +220,7 @@ * throws IllegalArgumentException when src or dst is null * throws ReadOnlyBufferException when dst is read only byte buffer * - * TODO: + * Check that implementation behavior follows RI: * jdk 1.5 does not throw IllegalArgumentException when parameters are null * and does not throw ReadOnlyBufferException if dst is read only byte buffer */ @@ -249,37 +230,27 @@ ByteBuffer bbN = null; ByteBuffer bb = ByteBuffer.allocate(10); SSLEngine e = new mySSLEngine(host, port); - try { - e.unwrap(bbN, bb); - fail("IllegalArgumentException must be thrown for null src byte buffer"); - } catch (IllegalArgumentException ex) { - } - try { - e.unwrap(bb, bbN); - fail("IllegalArgumentException must be thrown for null dst byte buffer"); - } catch (IllegalArgumentException ex) { - } + + e.unwrap(bbN, bb); + e.unwrap(bb, bbN); + ByteBuffer roBb = bb.asReadOnlyBuffer(); assertTrue("Not read only byte buffer", roBb.isReadOnly()); - try { - e.unwrap(bb, roBb); - fail("ReadOnlyBufferException must be thrown for read only dst"); - } catch (ReadOnlyBufferException ex) { - } + + e.unwrap(bb, roBb); } /** * Test for unwrap(ByteBuffer src, ByteBuffer[] dsts) method * - * Assertions: - * throws IllegalArgumentException if parameters are null or when dsts - * contains null elements - * throws ReadOnlyBufferException when dsts contains read only elements + * Assertions: throws IllegalArgumentException if parameters are null or + * when dsts contains null elements throws ReadOnlyBufferException when dsts + * contains read only elements * - * TODO: - * jdk 1.5 does not throw IllegalArgumentException when src is null or if - * dsts contains null elements - * It does not throw ReadOnlyBufferException when dsts contains read only elements + * Check that implementation behavior follows RI: + * jdk 1.5 does not throw IllegalArgumentException when src is null or + * if dsts contains null elements It does not throw ReadOnlyBufferException + * when dsts contains read only elements */ public void testUnwrap02() throws SSLException { String host = "new host"; @@ -295,29 +266,18 @@ fail("IllegalArgumentException must be thrown for null dsts byte buffer array"); } catch (IllegalArgumentException ex) { } - try { - e.unwrap(bb, bbA); - fail("IllegalArgumentException must be thrown for dsts byte buffer array" - + " which contains null elements"); - } catch (IllegalArgumentException ex) { - } - try { - e.unwrap(bbN, bbA); - fail("IllegalArgumentException must be thrown for null src byte buffer"); - } catch (IllegalArgumentException ex) { - } + e.unwrap(bb, bbA); + e.unwrap(bbN, bbA); ByteBuffer bb1 = ByteBuffer.allocate(100); ByteBuffer roBb = bb1.asReadOnlyBuffer(); bbA[0] = bb1; bbA[2] = roBb; assertTrue("Not read only byte buffer", bbA[2].isReadOnly()); - try { - e.unwrap(bb, bbA); - fail("ReadOnlyBufferException must be thrown because dsts contains read only buffer"); - } catch (ReadOnlyBufferException ex) { - } + + e.unwrap(bb, bbA); + } /** Index: modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/SSLKeyExceptionTest.java =================================================================== --- modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/SSLKeyExceptionTest.java (revision 0) +++ modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/SSLKeyExceptionTest.java (working copy) @@ -14,13 +14,8 @@ * limitations under the License. */ -/** -* @author Vera Y. Petrashkova -* @version $Revision$ -*/ +package org.apache.harmony.xnet.tests.javax.net.ssl; -package javax.net.ssl; - import javax.net.ssl.SSLKeyException; import junit.framework.TestCase; Index: modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/X509ExtendedKeyManagerTest.java =================================================================== --- modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/X509ExtendedKeyManagerTest.java (revision 0) +++ modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/X509ExtendedKeyManagerTest.java (working copy) @@ -14,13 +14,8 @@ * limitations under the License. */ -/** -* @author Boris V. Kuznetsov -* @version $Revision$ -*/ +package org.apache.harmony.xnet.tests.javax.net.ssl; -package javax.net.ssl; - import java.net.Socket; import java.security.Principal; import java.security.PrivateKey; Index: modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/CertPathTrustManagerParametersTest.java =================================================================== --- modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/CertPathTrustManagerParametersTest.java (revision 0) +++ modules/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/CertPathTrustManagerParametersTest.java (working copy) @@ -14,17 +14,13 @@ * limitations under the License. */ -/** - * @author Boris V. Kuznetsov - * @version $Revision$ - */ -package javax.net.ssl; +package org.apache.harmony.xnet.tests.javax.net.ssl; import java.security.cert.CertPathParameters; +import javax.net.ssl.CertPathTrustManagerParameters; import junit.framework.TestCase; - /** * Tests for CertPathTrustManagerParameters class constructors * and methods. Index: modules/x-net/src/main/java/javax/net/ssl/KeyStoreBuilderParameters.java =================================================================== --- modules/x-net/src/main/java/javax/net/ssl/KeyStoreBuilderParameters.java (revision 424263) +++ modules/x-net/src/main/java/javax/net/ssl/KeyStoreBuilderParameters.java (working copy) @@ -15,9 +15,9 @@ */ /** -* @author Boris V. Kuznetsov -* @version $Revision$ -*/ + * @author Boris V. Kuznetsov + * @version $Revision$ + */ package javax.net.ssl; @@ -28,31 +28,30 @@ /** * @com.intel.drl.spec_ref - * + * */ public class KeyStoreBuilderParameters implements ManagerFactoryParameters { - + private List ksbuilders; + public KeyStoreBuilderParameters(KeyStore.Builder builder) { - if (builder == null) { - throw new NullPointerException("builder parameter is null"); - } - // FIXME for 1.5 classes - // new ArrayList() -> Collections.emptyList(); ksbuilders = new ArrayList(); - ksbuilders.add(builder); + if (builder != null) { + ksbuilders.add(builder); + } } + public KeyStoreBuilderParameters(List parameters) { - if (parameters == null) { - throw new NullPointerException("Builders list is null"); - } - if (parameters.isEmpty()) { - throw new IllegalArgumentException("Builders list is empty"); - } + if (parameters == null) { + throw new NullPointerException("Builders list is null"); + } + if (parameters.isEmpty()) { + throw new IllegalArgumentException("Builders list is empty"); + } ksbuilders = new ArrayList(parameters); } - + public List getParameters() { return Collections.unmodifiableList(ksbuilders); } -} +} \ No newline at end of file Index: modules/x-net/src/main/java/javax/net/ssl/SSLEngine.java =================================================================== --- modules/x-net/src/main/java/javax/net/ssl/SSLEngine.java (revision 424263) +++ modules/x-net/src/main/java/javax/net/ssl/SSLEngine.java (working copy) @@ -218,49 +218,55 @@ int length, ByteBuffer dst) throws SSLException; /** - * @com.intel.drl.spec_ref + * implementation behavior follows RI: + * jdk 1.5 does not throw IllegalArgumentException when parameters are null + * and does not throw ReadOnlyBufferException if dst is read only byte buffer * */ 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(); - } +// 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(); +// } return unwrap(src, new ByteBuffer[] { dst }, 0, 1); } /** - * @com.intel.drl.spec_ref - * + * implementation behavior follows RI: + * jdk 1.5 does not throw IllegalArgumentException when src is null or if + * dsts contains null elements + * It does not throw ReadOnlyBufferException when dsts contains read only elements */ public SSLEngineResult unwrap(ByteBuffer src, ByteBuffer[] dsts) throws SSLException { - if (src == null) { - throw new IllegalArgumentException("Byte buffer src is null"); - } +// if (src == null) { +// throw new IllegalArgumentException("Byte buffer src is null"); +// } 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(); - } - } +// 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); } /** - * @com.intel.drl.spec_ref + * implementation behavior follows RI: jdk 1.5 does not throw + * IllegalArgumentException when dst is null or if srcs contains null + * elements It does not throw ReadOnlyBufferException for read only dst * */ public SSLEngineResult wrap(ByteBuffer[] srcs, ByteBuffer dst) @@ -268,36 +274,38 @@ 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(); - } +// 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); } /** - * @com.intel.drl.spec_ref + * implementation behavior follows RI: + * jdk 1.5 does not throw IllegalArgumentException when parameters are null + * and does not throw ReadOnlyBufferException if dst is read only byte buffer * */ 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(); - } +// 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(); +// } return wrap(new ByteBuffer[] { src }, 0, 1, dst); } } \ No newline at end of file