@@ -416,28 +416,21 @@ protected String resetGroup(final Entry entry)
416
416
" {\n " +
417
417
" for (final %2$s %6$s : %5$s.iterator())\n " +
418
418
" {\n " +
419
+ " %6$s.reset();\n " +
419
420
" if (%6$s.next() == null)\n " +
420
421
" {\n " +
421
- " %6$s.reset();\n " +
422
422
" break;\n " +
423
423
" }\n " +
424
- " else\n " +
425
- " {\n " +
426
- " %6$s.reset();\n " +
427
- " }\n " +
428
424
" }\n " +
429
425
" %3$s = MISSING_INT;\n " +
430
426
" has%4$s = false;\n " +
431
- " %7$s = null;\n " +
432
427
" }\n \n " ,
433
428
resetMethod ,
434
429
decoderClassName (name ),
435
430
formatPropertyName (numberField .name ()),
436
431
numberField .name (),
437
432
iteratorFieldName (group ),
438
- formatPropertyName (decoderClassName (name )),
439
- formatPropertyName (name )
440
- );
433
+ formatPropertyName (decoderClassName (name )));
441
434
}
442
435
}
443
436
@@ -491,9 +484,6 @@ private String additionalReset(final boolean isGroup)
491
484
{
492
485
return
493
486
" buffer = null;\n " +
494
- (isGroup ?
495
- " next = null;\n " : ""
496
- ) +
497
487
" if (" + CODEC_VALIDATION_ENABLED + ")\n " +
498
488
" {\n " +
499
489
" invalidTagId = Decoder.NO_ERROR;\n " +
@@ -1743,6 +1733,7 @@ private String generateDecodePrefix(
1743
1733
" this.buffer = buffer;\n " +
1744
1734
" final int end = offset + length;\n " +
1745
1735
" int position = offset;\n " +
1736
+ " int positionIter = position;\n " +
1746
1737
(hasCommonCompounds ? " position += header.decode(buffer, position, length);\n " : "" ) +
1747
1738
(isGroup ? " seenFields.clear();\n " : "" ) +
1748
1739
" int tag;\n \n " +
@@ -1921,7 +1912,17 @@ private String decodeGroup(final Entry entry)
1921
1912
" {\n " +
1922
1913
" if (%1$sCurrent != null)\n " +
1923
1914
" {\n " +
1924
- " position += %1$sCurrent.decode(buffer, position, end - position);\n " +
1915
+ " positionIter = %1$sCurrent.decode(buffer, position, end - position);\n " +
1916
+ " if (positionIter == 0 && " + CODEC_VALIDATION_ENABLED + ")\n " +
1917
+ " {\n " +
1918
+ " invalidTagId = tag;\n " +
1919
+ " rejectReason = " + INCORRECT_NUMINGROUP_COUNT_FOR_REPEATING_GROUP + ";\n " +
1920
+ " break;\n " +
1921
+ " }\n " +
1922
+ " else\n " +
1923
+ " {\n " +
1924
+ " position += positionIter;\n " +
1925
+ " }\n " +
1925
1926
" %1$sCurrent = %1$sCurrent.next();\n " +
1926
1927
" }\n " +
1927
1928
" }\n " +
0 commit comments