You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by te...@apache.org on 2006/07/21 22:48:19 UTC
svn commit: r424455 - in
/incubator/harmony/enhanced/classlib/trunk/modules/luni/src:
main/java/java/net/DatagramSocket.java
test/java/tests/api/java/net/DatagramSocketTest.java
Author: tellison
Date: Fri Jul 21 13:48:18 2006
New Revision: 424455
URL: http://svn.apache.org/viewvc?rev=424455&view=rev
Log:
Apply patch HARMONY-891 ([classlib][[net] compatibility: java.net.DatagramSocket((DatagramSocketImpl) null) does not throw NPE)
Modified:
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/DatagramSocket.java
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/DatagramSocketTest.java
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/DatagramSocket.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/DatagramSocket.java?rev=424455&r1=424454&r2=424455&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/DatagramSocket.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/DatagramSocket.java Fri Jul 21 13:48:18 2006
@@ -504,6 +504,9 @@
* the DatagramSocketImpl to use
*/
protected DatagramSocket(DatagramSocketImpl socketImpl) {
+ if (socketImpl == null) {
+ throw new NullPointerException();
+ }
impl = socketImpl;
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/DatagramSocketTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/DatagramSocketTest.java?rev=424455&r1=424454&r2=424455&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/DatagramSocketTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/DatagramSocketTest.java Fri Jul 21 13:48:18 2006
@@ -20,6 +20,7 @@
import java.net.BindException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
+import java.net.DatagramSocketImpl;
import java.net.Inet4Address;
import java.net.Inet6Address;
import java.net.InetAddress;
@@ -967,6 +968,23 @@
ensureExceptionThrownIfOptionIsUnsupportedOnOS(SO_TIMEOUT);
} catch (Exception e) {
handleException(e, SO_TIMEOUT);
+ }
+ }
+ /**
+ * @tests java.net.DatagramSocket#DatagramSocket(java.net.DatagramSocketImpl)
+ */
+ public void test_ConstructorLjava_net_DatagramSocketImpl() {
+ class testDatagramSocket extends DatagramSocket {
+ public testDatagramSocket(DatagramSocketImpl impl){
+ super(impl);
+ }
+ }
+
+ try {
+ new testDatagramSocket((DatagramSocketImpl) null);
+ fail("exception expected");
+ } catch (NullPointerException ex) {
+ //expected
}
}