Skip to content

Commit d7fb44c

Browse files
committed
Minor fix for custom escape handling wrt "long" (>6 chars) escape handling
1 parent 69c844c commit d7fb44c

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

src/main/java/com/fasterxml/jackson/core/json/UTF8JsonGenerator.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1720,11 +1720,11 @@ private final int _writeCustomEscape(byte[] outputBuffer, int outputPtr, Seriali
17201720
return (outputPtr + len);
17211721
}
17221722

1723-
private final int _handleLongCustomEscape(byte[] outputBuffer, int outputPtr, int outputEnd, byte[] raw,
1724-
int remainingChars)
1723+
private final int _handleLongCustomEscape(byte[] outputBuffer, int outputPtr, int outputEnd,
1724+
byte[] raw, int remainingChars)
17251725
throws IOException, JsonGenerationException
17261726
{
1727-
int len = raw.length;
1727+
final int len = raw.length;
17281728
if ((outputPtr + len) > outputEnd) {
17291729
_outputTail = outputPtr;
17301730
_flushBuffer();
@@ -1733,11 +1733,12 @@ private final int _handleLongCustomEscape(byte[] outputBuffer, int outputPtr, in
17331733
_outputStream.write(raw, 0, len);
17341734
return outputPtr;
17351735
}
1736-
System.arraycopy(raw, 0, outputBuffer, outputPtr, len);
1737-
outputPtr += len;
17381736
}
1737+
System.arraycopy(raw, 0, outputBuffer, outputPtr, len);
1738+
outputPtr += len;
17391739
// but is the invariant still obeyed? If not, flush once more
17401740
if ((outputPtr + 6 * remainingChars) > outputEnd) {
1741+
_outputTail = outputPtr;
17411742
_flushBuffer();
17421743
return _outputTail;
17431744
}

0 commit comments

Comments
 (0)