[prev in list] [next in list] [prev in thread] [next in thread]
List: htmlunit-develop
Subject: [HtmlUnit] SF.net SVN: htmlunit:[5740] trunk/htmlunit/src
From: asashour () users ! sourceforge ! net
Date: 2010-05-26 12:03:18
Message-ID: E1OHFKQ-0000qw-2f () sfp-svn-4 ! v30 ! ch3 ! sourceforge ! com
[Download RAW message or body]
Revision: 5740
http://htmlunit.svn.sourceforge.net/htmlunit/?rev=5740&view=rev
Author: asashour
Date: 2010-05-26 12:03:17 +0000 (Wed, 26 May 2010)
Log Message:
-----------
Fix MemoryInputStream.read() for negative values.
Issue 3007121
Modified Paths:
--------------
trunk/htmlunit/src/changes/changes.xml
trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/MemoryInputStream.java
trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/MemoryInputStreamTest.java
Modified: trunk/htmlunit/src/changes/changes.xml
===================================================================
--- trunk/htmlunit/src/changes/changes.xml 2010-05-26 11:33:04 UTC (rev 5739)
+++ trunk/htmlunit/src/changes/changes.xml 2010-05-26 12:03:17 UTC (rev 5740)
@@ -6,6 +6,9 @@
<body>
<release version="2.8" date="?" description="Bugfixes, large file download, \
single thread for JavaScript background tasks, HttpClient 4, initial FF 3.6"> + \
<action type="fix" dev="asashour" issue="3007121"> + Fix \
MemoryInputStream.read() for negative values. + </action>
<action type="update" dev="asashour" issue="2950332" due-to="Nicolas \
Belisle"> Upgrade HttpClient to 4.0.1.
</action>
Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/MemoryInputStream.java
===================================================================
--- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/MemoryInputStream.java 2010-05-26 \
11:33:04 UTC (rev 5739)
+++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/MemoryInputStream.java 2010-05-26 \
12:03:17 UTC (rev 5740) @@ -76,7 +76,7 @@
return -1;
}
if (index_ < data_.length) {
- return data_[index_++];
+ return data_[index_++] & 0xFF;
}
return super.read();
}
Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/MemoryInputStreamTest.java
===================================================================
--- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/MemoryInputStreamTest.java 2010-05-26 \
11:33:04 UTC (rev 5739)
+++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/MemoryInputStreamTest.java 2010-05-26 \
12:03:17 UTC (rev 5740) @@ -18,6 +18,7 @@
import static org.junit.Assert.assertTrue;
import java.io.ByteArrayInputStream;
+import java.io.InputStream;
import java.util.Arrays;
import java.util.Random;
@@ -59,4 +60,15 @@
assertTrue(Arrays.equals(buff, IOUtils.toByteArray(in)));
assertEquals(bufferSize < maximumSize, in.isInMemory());
}
+
+ /**
+ * @throws Exception if the test fails
+ */
+ @Test
+ public void negativeNumbers() throws Exception {
+ final InputStream in = new ByteArrayInputStream(new byte[] {(byte) 0xF0});
+ final MemoryInputStream memoryIn = new MemoryInputStream(in, 5);
+ assertEquals(0xF0, memoryIn.read());
+ assertEquals(-1, memoryIn.read());
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's \
largest Open Source development site.
------------------------------------------------------------------------------
_______________________________________________
HtmlUnit-develop mailing list
HtmlUnit-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/htmlunit-develop
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic