Skip to content

Commit

Permalink
Reset improperly positioned segment's elements in validation
Browse files Browse the repository at this point in the history
- Verified in existing test case by allowing ELEMENT_OCCURRENCE_ERROR
through filter.
  • Loading branch information
MikeEdgar committed Sep 25, 2020
1 parent 73f2721 commit 18c16d6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,7 @@ boolean checkPeerSegments(CharSequence tag, UsageNode current, int startDepth, V
handler.segmentError(next.getId(), next.getLink(), SEGMENT_NOT_IN_PROPER_SEQUENCE);

next.incrementUsage();
next.resetChildren();

if (next.exceedsMaximumUsage(SEGMENT_VERSION)) {
handler.segmentError(next.getId(), next.getLink(), SEGMENT_EXCEEDS_MAXIMUM_USE);
Expand Down Expand Up @@ -928,6 +929,7 @@ public boolean validCompositeOccurrences(Dialect dialect, Location position) {
this.composite = this.element;
this.element = null;
this.composite.incrementUsage();
// resetChildren?

if (this.composite.exceedsMaximumUsage(version)) {
elementErrors.add(new UsageError(this.composite, TOO_MANY_REPETITIONS));
Expand All @@ -943,6 +945,7 @@ public boolean validCompositeOccurrences(Dialect dialect, Location position) {

if (implSegmentSelected) {
this.implComposite.incrementUsage();
// resetChildren?
}

return elementErrors.isEmpty();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public boolean accept(EDIStreamReader reader) {
switch (reader.getEventType()) {
case START_TRANSACTION:
case SEGMENT_ERROR:
case ELEMENT_OCCURRENCE_ERROR:
return true;
default:
return false;
Expand Down

0 comments on commit 18c16d6

Please sign in to comment.