harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r986150 - in /harmony/enhanced/java/trunk/classlib/modules/imageio/src: main/java/javax/imageio/stream/ test/java/javax/imageio/stream/
Date Mon, 16 Aug 2010 22:42:43 GMT
Author: hindessm
Date: Mon Aug 16 22:42:43 2010
New Revision: 986150

URL: http://svn.apache.org/viewvc?rev=986150&view=rev
Log:
Applying patch from "[#HARMONY-6611]
ImageOutputStreamImplTest.testWriteUTF() unit test fails with
ByteOrder.LITTLE_ENDIAN".

Modified:
    harmony/enhanced/java/trunk/classlib/modules/imageio/src/main/java/javax/imageio/stream/ImageInputStreamImpl.java
    harmony/enhanced/java/trunk/classlib/modules/imageio/src/main/java/javax/imageio/stream/ImageOutputStreamImpl.java
    harmony/enhanced/java/trunk/classlib/modules/imageio/src/test/java/javax/imageio/stream/ImageOutputStreamImplTest.java

Modified: harmony/enhanced/java/trunk/classlib/modules/imageio/src/main/java/javax/imageio/stream/ImageInputStreamImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/imageio/src/main/java/javax/imageio/stream/ImageInputStreamImpl.java?rev=986150&r1=986149&r2=986150&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/imageio/src/main/java/javax/imageio/stream/ImageInputStreamImpl.java
(original)
+++ harmony/enhanced/java/trunk/classlib/modules/imageio/src/main/java/javax/imageio/stream/ImageInputStreamImpl.java
Mon Aug 16 22:42:43 2010
@@ -187,11 +187,14 @@ public abstract class ImageInputStreamIm
 	}
 
 	public String readUTF() throws IOException {
+		ByteOrder byteOrder = getByteOrder();
+		setByteOrder(ByteOrder.BIG_ENDIAN);
 		final int size = readUnsignedShort();
 		final byte[] buf = new byte[size];
 		final char[] out = new char[size];
 
 		readFully(buf, 0, size);
+		setByteOrder(byteOrder);
 		//return new DataInputStream(new ByteArrayInputStream(buff)).readUTF();
 		return Util.convertUTF8WithBuf(buf, out, 0, size);
 	}

Modified: harmony/enhanced/java/trunk/classlib/modules/imageio/src/main/java/javax/imageio/stream/ImageOutputStreamImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/imageio/src/main/java/javax/imageio/stream/ImageOutputStreamImpl.java?rev=986150&r1=986149&r2=986150&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/imageio/src/main/java/javax/imageio/stream/ImageOutputStreamImpl.java
(original)
+++ harmony/enhanced/java/trunk/classlib/modules/imageio/src/main/java/javax/imageio/stream/ImageOutputStreamImpl.java
Mon Aug 16 22:42:43 2010
@@ -124,10 +124,13 @@ public abstract class ImageOutputStreamI
 	}
 
 	public void writeUTF(String s) throws IOException {
+		ByteOrder byteOrder = getByteOrder();
+		setByteOrder(ByteOrder.BIG_ENDIAN);
 		ByteArrayOutputStream baos = new ByteArrayOutputStream();
 
 		new DataOutputStream(baos).writeUTF(s);
 		write(baos.toByteArray(), 0, baos.size());
+		setByteOrder(byteOrder);
 	}
 
 	public void writeShorts(short[] s, int off, int len) throws IOException {

Modified: harmony/enhanced/java/trunk/classlib/modules/imageio/src/test/java/javax/imageio/stream/ImageOutputStreamImplTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/imageio/src/test/java/javax/imageio/stream/ImageOutputStreamImplTest.java?rev=986150&r1=986149&r2=986150&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/imageio/src/test/java/javax/imageio/stream/ImageOutputStreamImplTest.java
(original)
+++ harmony/enhanced/java/trunk/classlib/modules/imageio/src/test/java/javax/imageio/stream/ImageOutputStreamImplTest.java
Mon Aug 16 22:42:43 2010
@@ -17,9 +17,7 @@
 
 package javax.imageio.stream;
 
-import java.io.ByteArrayOutputStream;
 import java.io.IOException;
-import java.io.OutputStream;
 import java.nio.ByteOrder;
 import java.util.Arrays;
 
@@ -221,13 +219,12 @@ public class ImageOutputStreamImplTest e
 		out.writeUTF("test");
 		assertEquals("test", in.readUTF());
 
-		// FIXME: fails with ByteOrder.LITTLE_ENDIAN
-		// out.reset();
-		// in.reset();
-		// out.setByteOrder(ByteOrder.LITTLE_ENDIAN);
-		// in.setByteOrder(ByteOrder.LITTLE_ENDIAN);
-		// out.writeUTF("test");
-		// assertEquals("test", in.readUTF());
+		out.reset();
+		in.reset();
+		out.setByteOrder(ByteOrder.LITTLE_ENDIAN);
+		in.setByteOrder(ByteOrder.LITTLE_ENDIAN);
+		out.writeUTF("test");
+		assertEquals("test", in.readUTF());
 	}
 
 	static class BasicImageOutputStreamImpl extends ImageOutputStreamImpl {



Mime
View raw message