Skip to content

Commit

Permalink
Merge pull request #121 from xlate/120_reset_improperly_positioned_se…
Browse files Browse the repository at this point in the history
…gment_elements

Reset improperly positioned segment's elements in validation
  • Loading branch information
MikeEdgar committed Sep 25, 2020
2 parents 73f2721 + 18c16d6 commit 73472ca
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 73472ca

Please sign in to comment.