Merge pull request #1016 from yasirmhd/master

Incorporating the review comments in #1015
This commit is contained in:
Jake Wharton 2017-02-17 10:09:15 -05:00 committed by GitHub
commit e0f0854ac2

View File

@ -1006,13 +1006,12 @@ public class JsonReader implements Closeable {
} else if (c == '\\') {
pos = p;
int len = p - start - 1;
char escapeChar = readEscapeCharacter();
if (builder == null) {
int estimatedLength = (len + pos - p) * 2;
int estimatedLength = (len + 1) * 2;
builder = new StringBuilder(Math.max(estimatedLength, 16));
}
builder.append(buffer, start, len);
builder.append(escapeChar);
builder.append(readEscapeCharacter());
p = pos;
l = limit;
start = p;