Merge back fix for #360
This commit is contained in:
parent
98a8bd25bb
commit
1bc52cbd8c
@ -184,9 +184,12 @@ public class ChannelBufferInputStream extends InputStream implements DataInput {
|
||||
lineBuf.append((char) b);
|
||||
}
|
||||
|
||||
while (lineBuf.charAt(lineBuf.length() - 1) == '\r') {
|
||||
lineBuf.setLength(lineBuf.length() - 1);
|
||||
if (lineBuf.length() > 0) {
|
||||
while (lineBuf.charAt(lineBuf.length() - 1) == '\r') {
|
||||
lineBuf.setLength(lineBuf.length() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return lineBuf.toString();
|
||||
}
|
||||
|
@ -168,4 +168,15 @@ public class ChannelBufferStreamTest {
|
||||
|
||||
assertEquals(buf.readerIndex(), in.readBytes());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEmptyReadLine() throws Exception {
|
||||
ChannelBuffer buf = ChannelBuffers.buffer(0);
|
||||
ChannelBufferInputStream in = new ChannelBufferInputStream(buf);
|
||||
|
||||
String s = in.readLine();
|
||||
assertEquals(0, s.length());
|
||||
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user