Skip to content

Commit 60ee726

Browse files
committed
second batch
Signed-off-by: David Kral <[email protected]>
1 parent 9185f2f commit 60ee726

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

json/processor/src/main/java/io/helidon/json/processor/AbstractJsonParser.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -332,16 +332,15 @@ public String readString() {
332332
}
333333
int firstRun = stringBufferLength > bufferLength - currentIndex ? bufferLength : stringBufferLength;
334334
int stringBuffIndex = 0;
335-
int bufferIndex = currentIndex;
336335
byte b;
337336
for ( ; stringBuffIndex < firstRun; stringBuffIndex++) {
338-
b = this.buffer[++bufferIndex];
337+
b = this.buffer[++currentIndex];
339338
if (b == '\\') {
340339
//Specialized character handling is likely required
340+
currentIndex--;
341341
break;
342342
}
343343
if (b == '"') {
344-
currentIndex = bufferIndex;
345344
return new String(stringBuffer, 0, stringBuffIndex);
346345
}
347346
stringBuffer[stringBuffIndex] = (char) b;
@@ -351,7 +350,7 @@ public String readString() {
351350
increaseStringBuffer();
352351
}
353352

354-
for ( ; currentIndex < this.bufferLength; stringBuffIndex++) {
353+
for ( ; currentIndex < this.bufferLength; ) {
355354
b = readNextByte();
356355
switch (b) {
357356
case '"':
@@ -374,7 +373,7 @@ public String readString() {
374373
}
375374

376375
private char processEscapedSequence() {
377-
if (hasNext()) {
376+
if (!hasNext()) {
378377
throw new JsonException("Incomplete JSON.");
379378
}
380379
byte c = buffer[++currentIndex];

0 commit comments

Comments
 (0)