Skip to content

ArrayOutOfBoundException at WriterBasedJsonGenerator.writeString(Reader, int) #702

@jeffreye

Description

@jeffreye

I am invoking writeString(myReader, -1) on a JsonGenerator and get this error sometimes.

java.lang.ArrayIndexOutOfBoundsException: Index 4000 out of bounds for length 4000
	at com.fasterxml.jackson.core.json.WriterBasedJsonGenerator.writeString(WriterBasedJsonGenerator.java:466) ~[jackson-core-2.12.0.jar:2.12.0]

//Add trailing quote
if ((_outputTail + len) >= _outputEnd) {
_flushBuffer();
}
_outputBuffer[_outputTail++] = _quoteChar;
if (toRead > 0 && len >= 0) {
_reportError("Didn't read enough from reader");
}

Basically, we need to add this case to the line

(_outputTail + len) >= _outputEnd

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions