You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by cu...@apache.org on 2012/05/23 22:28:44 UTC
svn commit: r1342030 - in /avro/trunk: CHANGES.txt
lang/java/avro/src/main/java/org/apache/avro/io/BinaryDecoder.java
lang/java/avro/src/test/java/org/apache/avro/io/TestBinaryDecoder.java
Author: cutting
Date: Wed May 23 20:28:44 2012
New Revision: 1342030
URL: http://svn.apache.org/viewvc?rev=1342030&view=rev
Log:
AVRO-1097. Fix BinaryDecoder so that EOFException is thrown instead of a generic IOException when reading ints and longs past the end of file.
Modified:
avro/trunk/CHANGES.txt
avro/trunk/lang/java/avro/src/main/java/org/apache/avro/io/BinaryDecoder.java
avro/trunk/lang/java/avro/src/test/java/org/apache/avro/io/TestBinaryDecoder.java
Modified: avro/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/avro/trunk/CHANGES.txt?rev=1342030&r1=1342029&r2=1342030&view=diff
==============================================================================
--- avro/trunk/CHANGES.txt (original)
+++ avro/trunk/CHANGES.txt Wed May 23 20:28:44 2012
@@ -49,9 +49,16 @@ Avro 1.7.0 (unreleased)
AVRO-1028. Python: Fix HTTP server to handle connection resets and
redirects. (Bo Shi via cutting)
- AVRO-1095. C++ compiler warns about control reaching end of doAdavance (in JsonIO.cc) which returns something other than void. (thiru)
+ AVRO-1095. C++ compiler warns about control reaching end of
+ doAdavance (in JsonIO.cc) which returns something other than
+ void. (thiru)
AVRO-1026. Add namespace support to C++. (Keh-Li Sheng via thiru)
+
+ AVRO-1097. Fix BinaryDecoder so that EOFException is thrown
+ instead of a generic IOException when reading ints and longs past
+ the end of file. (thiru & cutting)
+
BUG FIXES
AVRO-1045. Java: Fix a bug in GenericData#deepCopy() of ByteBuffer values.
Modified: avro/trunk/lang/java/avro/src/main/java/org/apache/avro/io/BinaryDecoder.java
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/avro/src/main/java/org/apache/avro/io/BinaryDecoder.java?rev=1342030&r1=1342029&r2=1342030&view=diff
==============================================================================
--- avro/trunk/lang/java/avro/src/main/java/org/apache/avro/io/BinaryDecoder.java (original)
+++ avro/trunk/lang/java/avro/src/main/java/org/apache/avro/io/BinaryDecoder.java Wed May 23 20:28:44 2012
@@ -458,6 +458,8 @@ public class BinaryDecoder extends Decod
if (remaining < num) {
// move remaining to front
source.compactAndFill(buf, pos, minPos, remaining);
+ if (pos >= limit)
+ throw new EOFException();
}
}
Modified: avro/trunk/lang/java/avro/src/test/java/org/apache/avro/io/TestBinaryDecoder.java
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/avro/src/test/java/org/apache/avro/io/TestBinaryDecoder.java?rev=1342030&r1=1342029&r2=1342030&view=diff
==============================================================================
--- avro/trunk/lang/java/avro/src/test/java/org/apache/avro/io/TestBinaryDecoder.java (original)
+++ avro/trunk/lang/java/avro/src/test/java/org/apache/avro/io/TestBinaryDecoder.java Wed May 23 20:28:44 2012
@@ -433,4 +433,17 @@ public class TestBinaryDecoder {
}
Assert.assertTrue(null != eof);
}
+
+ @Test(expected = EOFException.class)
+ public void testEOF() throws IOException {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ Encoder e = EncoderFactory.get().binaryEncoder(baos, null);
+ e.writeLong(0x10000000000000l);
+ e.flush();
+
+ Decoder d = newDecoder(new ByteArrayInputStream(baos.toByteArray()));
+ Assert.assertEquals(0x10000000000000l, d.readLong());
+ d.readInt();
+ }
+
}