Author: desruisseaux
Date: Mon Jun 17 14:24:02 2013
New Revision: 1493775
URL: http://svn.apache.org/r1493775
Log:
Fixed a random bug in the test case (was not a bug in the library itself).
Modified:
sis/branches/JDK7/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/ChannelDataInputTest.java
Modified: sis/branches/JDK7/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/ChannelDataInputTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/ChannelDataInputTest.java?rev=1493775&r1=1493774&r2=1493775&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/ChannelDataInputTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/ChannelDataInputTest.java
[UTF-8] Mon Jun 17 14:24:02 2013
@@ -170,13 +170,13 @@ public final strictfp class ChannelDataI
final Random random = TestUtilities.createRandomNumberGenerator("testSeekOnForwardOnlyChannel");
int length = random.nextInt(2048) + 1024;
final byte[] array = createRandomArray(length, random);
- length -= (Long.SIZE / Byte.SIZE) - 1; // Safety against buffer underflow.
+ length -= (Long.SIZE / Byte.SIZE); // Safety against buffer underflow.
final ByteBuffer buffer = ByteBuffer.wrap(array);
final ChannelDataInput input = new ChannelDataInput("testSeekOnForwardOnlyChannel",
Channels.newChannel(new ByteArrayInputStream(array)),
ByteBuffer.allocate(random.nextInt(64) + 16), false);
int position = 0;
- while (position <= length) {
+ while (position < length) {
input.seek(position);
assertEquals("getStreamPosition()", position, input.getStreamPosition());
assertEquals(buffer.getLong(position), input.readLong());
|