harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From py...@apache.org
Subject svn commit: r450730 - in /incubator/harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/net/DatagramSocket.java test/java/tests/api/java/net/DatagramSocketTest.java
Date Thu, 28 Sep 2006 07:22:43 GMT
Author: pyang
Date: Thu Sep 28 00:22:43 2006
New Revision: 450730

URL: http://svn.apache.org/viewvc?view=rev&rev=450730
Log:
Apply patch for HARMONY-894( [classlib][net] java.net.DatagramSocket(null).getBroadcast()
returns different values for harmony vs RI)

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?view=diff&rev=450730&r1=450729&r2=450730
==============================================================================
--- 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
Thu Sep 28 00:22:43 2006
@@ -522,7 +522,7 @@
 	 * @throws SocketException
 	 *             if a problem occurs creating or binding the socket
 	 */
-	public DatagramSocket(SocketAddress localAddr) throws SocketException {
+	public DatagramSocket(SocketAddress localAddr) throws SocketException {        
 		if (localAddr != null) {
 			if (!(localAddr instanceof InetSocketAddress))
 				throw new IllegalArgumentException(Msg.getString(
@@ -539,7 +539,9 @@
 				close();
 				throw e;
 			}
-		}
+		} 
+        // SocketOptions.SO_BROADCAST is set by default for DatagramSocket
+        setBroadcast(true);
 	}
 
 	void checkClosedAndBind(boolean bind) throws SocketException {

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?view=diff&rev=450730&r1=450729&r2=450730
==============================================================================
--- 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
Thu Sep 28 00:22:43 2006
@@ -1040,6 +1040,7 @@
 				int portNumber = Support_PortManager.getNextPort();
 				ds = new java.net.DatagramSocket(new InetSocketAddress(
 						InetAddress.getLocalHost(), portNumber));
+                assertTrue(ds.getBroadcast());
 				assertTrue("Created socket with incorrect port", ds
 						.getLocalPort() == portNumber);
 				assertTrue("Created socket with incorrect address", ds
@@ -1056,6 +1057,9 @@
 			} catch (IllegalArgumentException e) {
 
 			}
+            //regression for Harmony-894
+            ds = new DatagramSocket((SocketAddress)null);
+            assertTrue(ds.getBroadcast());
 		} catch (Exception ex) {
 			fail(
 					"unexpected exception when datagramSocket SocketAddress constructor test");



Mime
View raw message