Skip to content

Commit 9285e13

Browse files
committed
Fix 3 bugs in Avro reader/decoder, related to state handling
1 parent bd2c681 commit 9285e13

3 files changed

Lines changed: 5 additions & 2 deletions

File tree

avro/src/main/java/tools/jackson/dataformat/avro/deser/JacksonAvroParserImpl.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,9 +485,10 @@ public void skipLong() throws IOException {
485485
int maxLeft = 9;
486486
int b;
487487
do {
488-
b = _nextByteGuaranteed();
488+
b = buf[ptr++];
489489
} while ((--maxLeft > 0) && (b < 0));
490490
if (b < 0) {
491+
_inputPtr = ptr;
491492
_reportInvalidNegative(b);
492493
}
493494
}

avro/src/main/java/tools/jackson/dataformat/avro/deser/MapReader.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ public JsonToken nextToken() throws IOException
157157
_count = _parser.decodeMapNext();
158158
// more stuff?
159159
if (_count > 0L) {
160+
_state = STATE_VALUE;
160161
_index = 0;
161162
_currentName = _parser.decodeMapKey();
162163
return (_currToken = JsonToken.PROPERTY_NAME);
@@ -235,6 +236,7 @@ public JsonToken nextToken() throws IOException
235236
_count = _parser.decodeMapNext();
236237
// more stuff?
237238
if (_count > 0L) {
239+
_state = STATE_VALUE;
238240
_index = 0;
239241
_currentName = _parser.decodeMapKey();
240242
return (_currToken = JsonToken.PROPERTY_NAME);

avro/src/main/java/tools/jackson/dataformat/avro/deser/ScalarDecoder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ public JsonToken readValue(AvroReadContext parent, AvroParserImpl parser) throws
645645

646646
@Override
647647
public void skipValue(AvroParserImpl parser) throws IOException {
648-
parser.skipFloat();
648+
parser.skipBytesDecimal();
649649
}
650650
}
651651
}

0 commit comments

Comments
 (0)