@@ -416,28 +416,21 @@ protected String resetGroup(final Entry entry)
416416 " {\n " +
417417 " for (final %2$s %6$s : %5$s.iterator())\n " +
418418 " {\n " +
419+ " %6$s.reset();\n " +
419420 " if (%6$s.next() == null)\n " +
420421 " {\n " +
421- " %6$s.reset();\n " +
422422 " break;\n " +
423423 " }\n " +
424- " else\n " +
425- " {\n " +
426- " %6$s.reset();\n " +
427- " }\n " +
428424 " }\n " +
429425 " %3$s = MISSING_INT;\n " +
430426 " has%4$s = false;\n " +
431- " %7$s = null;\n " +
432427 " }\n \n " ,
433428 resetMethod ,
434429 decoderClassName (name ),
435430 formatPropertyName (numberField .name ()),
436431 numberField .name (),
437432 iteratorFieldName (group ),
438- formatPropertyName (decoderClassName (name )),
439- formatPropertyName (name )
440- );
433+ formatPropertyName (decoderClassName (name )));
441434 }
442435 }
443436
@@ -491,9 +484,6 @@ private String additionalReset(final boolean isGroup)
491484 {
492485 return
493486 " buffer = null;\n " +
494- (isGroup ?
495- " next = null;\n " : ""
496- ) +
497487 " if (" + CODEC_VALIDATION_ENABLED + ")\n " +
498488 " {\n " +
499489 " invalidTagId = Decoder.NO_ERROR;\n " +
@@ -1743,6 +1733,7 @@ private String generateDecodePrefix(
17431733 " this.buffer = buffer;\n " +
17441734 " final int end = offset + length;\n " +
17451735 " int position = offset;\n " +
1736+ " int positionIter = position;\n " +
17461737 (hasCommonCompounds ? " position += header.decode(buffer, position, length);\n " : "" ) +
17471738 (isGroup ? " seenFields.clear();\n " : "" ) +
17481739 " int tag;\n \n " +
@@ -1921,7 +1912,17 @@ private String decodeGroup(final Entry entry)
19211912 " {\n " +
19221913 " if (%1$sCurrent != null)\n " +
19231914 " {\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 " +
19251926 " %1$sCurrent = %1$sCurrent.next();\n " +
19261927 " }\n " +
19271928 " }\n " +
0 commit comments