File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
modules/transport-netty3/src/main/java/org/elasticsearch/transport/netty3 Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change 2424import org .elasticsearch .common .io .stream .StreamInput ;
2525import org .jboss .netty .buffer .ChannelBuffer ;
2626
27+ import java .io .EOFException ;
2728import java .io .IOException ;
2829
2930/**
@@ -67,6 +68,14 @@ public int available() throws IOException {
6768 return endIndex - buffer .readerIndex ();
6869 }
6970
71+ @ Override
72+ protected void ensureCanReadBytes (int length ) throws EOFException {
73+ int bytesAvailable = endIndex - buffer .readerIndex ();
74+ if (bytesAvailable < length ) {
75+ throw new EOFException ("tried to read: " + length + " bytes but only " + bytesAvailable + " remaining" );
76+ }
77+ }
78+
7079 @ Override
7180 public void mark (int readlimit ) {
7281 buffer .markReaderIndex ();
You can’t perform that action at this time.
0 commit comments