harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r419970 - in /incubator/harmony/enhanced/classlib/trunk/modules/nio/src: main/java/java/nio/ByteBuffer.java test/java/common/org/apache/harmony/tests/java/nio/ByteBufferTest.java
Date Fri, 07 Jul 2006 20:14:20 GMT
Author: tellison
Date: Fri Jul  7 13:14:20 2006
New Revision: 419970

URL: http://svn.apache.org/viewvc?rev=419970&view=rev
Log:
Fix for HARMONY-798 ([classlib][nio] java.nio.ByteBuffer.order((ByteOrder) null) throws unspecified
NPE)

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ByteBuffer.java
    incubator/harmony/enhanced/classlib/trunk/modules/nio/src/test/java/common/org/apache/harmony/tests/java/nio/ByteBufferTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ByteBuffer.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ByteBuffer.java?rev=419970&r1=419969&r2=419970&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ByteBuffer.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ByteBuffer.java
Fri Jul  7 13:14:20 2006
@@ -685,19 +685,19 @@
 	}
 
 	/**
-	 * Sets the byte order of this buffer.
-	 * 
-	 * @param byteOrder     The byte order to set
-	 * @return This buffer
-	 */
+     * Sets the byte order of this buffer.
+     * 
+     * @param byteOrder
+     *            The byte order to set. If <code>null</code> then the order
+     *            will be {@link ByteOrder.LITTLE_ENDIAN LITTLE_ENDIAN}.
+     * @return This buffer
+     * @see ByteOrder
+     */
 	public final ByteBuffer order(ByteOrder byteOrder) {
 		return orderImpl(byteOrder);
 	}
 
 	ByteBuffer orderImpl(ByteOrder byteOrder) {
-		if (byteOrder == null) {
-			throw new NullPointerException();
-		}
 		order = byteOrder == ByteOrder.BIG_ENDIAN ? Endianness.BIG_ENDIAN
 				: Endianness.LITTLE_ENDIAN;
 		return this;

Modified: incubator/harmony/enhanced/classlib/trunk/modules/nio/src/test/java/common/org/apache/harmony/tests/java/nio/ByteBufferTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/nio/src/test/java/common/org/apache/harmony/tests/java/nio/ByteBufferTest.java?rev=419970&r1=419969&r2=419970&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/nio/src/test/java/common/org/apache/harmony/tests/java/nio/ByteBufferTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/nio/src/test/java/common/org/apache/harmony/tests/java/nio/ByteBufferTest.java
Fri Jul  7 13:14:20 2006
@@ -457,6 +457,18 @@
     public void testOrder() {
         // BIG_ENDIAN is the default byte order
         assertEquals(ByteOrder.BIG_ENDIAN, buf.order());
+
+        buf.order(ByteOrder.LITTLE_ENDIAN);
+        assertEquals(ByteOrder.LITTLE_ENDIAN, buf.order());
+        
+        buf.order(ByteOrder.BIG_ENDIAN);
+        assertEquals(ByteOrder.BIG_ENDIAN, buf.order());
+
+        // Regression test for HARMONY-798
+        buf.order((ByteOrder)null);
+        assertEquals(ByteOrder.LITTLE_ENDIAN, buf.order());
+        
+        buf.order(ByteOrder.BIG_ENDIAN);
     }
 
     /*



Mime
View raw message