Menu

#10 Bug in PositionTrackingPushbackReader when underlying Reader returns 'some input'.

None
closed
None
5
2016-08-24
2016-08-23
Anonymous
No

First, thanks for making Argo. I'm using it multiple personal and professional projects.

I found that when calling JdomParser.parse(Reader), with input {"nullField":null} and said Reader doesn't fill the buffer in one call, this happens:

argo.saj.InvalidSyntaxException: At line 1, column 14:  Expected 'n' to be followed by [[u, l, l]], but got [[u]].
    at argo.staj.InvalidSyntaxRuntimeException$1.asInvalidSyntaxException(InvalidSyntaxRuntimeException.java:41)
    at argo.saj.SajParser.parse(SajParser.java:104)
    at argo.saj.SajParser.parse(SajParser.java:52)
    at argo.jdom.JdomParser$1.parse(JdomParser.java:47)
    at argo.jdom.JdomParser.parse(JdomParser.java:54)
    at argo.jdom.JdomParser.parse(JdomParser.java:45)

It boils down to PositionTrackingPushbackReader not checking the return value of Reader.read(char[]). Said method may return a value not equal to the length of the buffer, meaning that the caller can expect more data in a subsequent call.

This behaviour is exposed by JdomParserTest.whenReaderReturnsSome_thenReadMore in the supplied patch.

I don't have a Source Forge account, but can be contacted on henrik@rebelalliance.se.
Attached patch is based on trunk as of 2016-08-23.
Credit is also due to Mårten Dolk for helping with triage and patch review.

Thanks for making a great library. Hope this report and patch is of help.

Henrik Sjöstrand

1 Attachments

Discussion

  • Mark Slater

    Mark Slater - 2016-08-24
    • status: open --> pending
    • Group: -->
     
  • Mark Slater

    Mark Slater - 2016-08-24
    • status: pending --> closed
     
  • Mark Slater

    Mark Slater - 2016-08-24

    Thanks for the bug report and patch. I've just released version 3.20 with your fix (slightly tweaked).

     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB