You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ni...@apache.org on 2010/09/08 19:15:52 UTC
svn commit: r995160 - in /commons/proper/io/trunk/src:
java/org/apache/commons/io/input/SwappedDataInputStream.java
test/org/apache/commons/io/input/SwappedDataInputStreamTest.java
Author: niallp
Date: Wed Sep 8 17:15:52 2010
New Revision: 995160
URL: http://svn.apache.org/viewvc?rev=995160&view=rev
Log:
IO-243 SwappedDataInputStream readBoolean is inverted - thanks to Ray Myers for the patch
Modified:
commons/proper/io/trunk/src/java/org/apache/commons/io/input/SwappedDataInputStream.java
commons/proper/io/trunk/src/test/org/apache/commons/io/input/SwappedDataInputStreamTest.java
Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/input/SwappedDataInputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/input/SwappedDataInputStream.java?rev=995160&r1=995159&r2=995160&view=diff
==============================================================================
--- commons/proper/io/trunk/src/java/org/apache/commons/io/input/SwappedDataInputStream.java (original)
+++ commons/proper/io/trunk/src/java/org/apache/commons/io/input/SwappedDataInputStream.java Wed Sep 8 17:15:52 2010
@@ -48,15 +48,15 @@ public class SwappedDataInputStream exte
}
/**
- * Return <code>{@link #readByte()} == 0</code>
- * @return the true if the byte read is zero, otherwise false
+ * Return <code>{@link #readByte()} != 0</code>
+ * @return false if the byte read is zero, otherwise true
* @throws IOException if an I/O error occurs
* @throws EOFException if an end of file is reached unexpectedly
*/
public boolean readBoolean()
throws IOException, EOFException
{
- return ( 0 == readByte() );
+ return ( 0 != readByte() );
}
/**
Modified: commons/proper/io/trunk/src/test/org/apache/commons/io/input/SwappedDataInputStreamTest.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/org/apache/commons/io/input/SwappedDataInputStreamTest.java?rev=995160&r1=995159&r2=995160&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/org/apache/commons/io/input/SwappedDataInputStreamTest.java (original)
+++ commons/proper/io/trunk/src/test/org/apache/commons/io/input/SwappedDataInputStreamTest.java Wed Sep 8 17:15:52 2010
@@ -61,7 +61,16 @@ public class SwappedDataInputStreamTest
}
public void testReadBoolean() throws IOException {
- assertEquals( false, this.sdis.readBoolean() );
+ bytes = new byte[] {
+ 0x00,
+ 0x01,
+ 0x02,
+ };
+ ByteArrayInputStream bais = new ByteArrayInputStream( bytes );
+ SwappedDataInputStream sdis = new SwappedDataInputStream( bais );
+ assertEquals( false, sdis.readBoolean() );
+ assertEquals( true, sdis.readBoolean() );
+ assertEquals( true, sdis.readBoolean() );
}
public void testReadByte() throws IOException {