Problems in ReaderInputStream
-----------------------------
Key: JBREM-1252
URL:
https://jira.jboss.org/browse/JBREM-1252
Project: JBoss Remoting
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: stream
Affects Versions: 3.1.0.Beta2
Reporter: Ron Sigal
Fix For: 3.1.0.Beta3
There are a couple of little problems in org.jboss.remoting3.stream.ReaderInputStream:
1. When you enter read(), you want byteBuffer to be in "read" mode, so
byteBuffer.flip() should be added to the constructor.
2. When you enter flip(), you want charBuffer to be in "read" mode, so
charBuffer.flip() should be added to the constructor.
3. In fill()
try {
final int cnt = reader.read(charBuffer);
if (cnt == -1) {
return false;
}
doesn't tmake sense. It could be that you've transferred some bytes to byteBuffer
and now reader is empty. When changed to
try {
final int cnt = reader.read(charBuffer);
if (cnt == -1) {
// return false;
return byteBuffer.position() > 0;
}
the code works.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira