harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From py...@apache.org
Subject svn commit: r448767 - in /incubator/harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/net/DatagramPacket.java test/java/tests/api/java/net/DatagramPacketTest.java
Date Fri, 22 Sep 2006 01:59:06 GMT
Author: pyang
Date: Thu Sep 21 18:59:05 2006
New Revision: 448767

URL: http://svn.apache.org/viewvc?view=rev&rev=448767
Log:
Apply patch for HARMONY-890([classlib][net] compatibility: incorrect default port number for
new DatagramPacket(new byte[], int))

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/DatagramPacket.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/DatagramPacketTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/DatagramPacket.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/DatagramPacket.java?view=diff&rev=448767&r1=448766&r2=448767
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/DatagramPacket.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/DatagramPacket.java
Thu Sep 21 18:59:05 2006
@@ -1,4 +1,4 @@
-/* Copyright 1998, 2004 The Apache Software Foundation or its licensors, as applicable
+/* Copyright 1998, 2006 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.
@@ -34,7 +34,7 @@
 
 	InetAddress address;
 
-	int port;
+	int port = -1; // The default port number is -1
 
 	int offset = 0;
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/DatagramPacketTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/DatagramPacketTest.java?view=diff&rev=448767&r1=448766&r2=448767
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/DatagramPacketTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/DatagramPacketTest.java
Thu Sep 21 18:59:05 2006
@@ -1,4 +1,4 @@
-/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+/* Copyright 1998, 2006 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.
@@ -45,6 +45,15 @@
 		} catch (Exception e) {
 			fail("Exception during Constructor test: " + e.toString());
 		}
+        //regression for Harmony-890
+        dp = new DatagramPacket(new byte[942],4);
+        assertEquals(-1, dp.getPort());
+        try{
+            dp.getSocketAddress();
+            fail("Should throw IllegalArgumentException");            
+        }catch(IllegalArgumentException e){
+            //expected
+        }
 	}
 
 	/**



Mime
View raw message