Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Push writer output through lexer and proxy handler for validation #356

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@
<jdk>(,11)</jdk>
</activation>
<properties>
<version.jakarta.json.api>2.0.1</version.jakarta.json.api>
<version.jakarta.json.api>2.0.2</version.jakarta.json.api>
<version.parsson>1.0.2</version.parsson>
<version.jakarta.xml.bind.api>3.0.1</version.jakarta.xml.bind.api>
<version.jaxb-runtime>3.0.2</version.jaxb-runtime>
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/io/xlate/edi/internal/stream/LocationView.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,18 @@ protected LocationView() {
}

public String toString() {
return toString(false);
}

protected String toString(boolean afterSegment) {
StringBuilder display = new StringBuilder();

if (getSegmentPosition() < 0) {
display.append("at offset ");
display.append(getCharacterOffset());
} else {
display.append("in segment ");
display.append(afterSegment ? "after " : "in ");
display.append("segment ");
display.append(String.valueOf(getSegmentTag()));
display.append(" at position ");
display.append(String.valueOf(getSegmentPosition()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public StaEDIOutputFactory() {
supportedProperties.add(PRETTY_PRINT);
supportedProperties.add(TRUNCATE_EMPTY_ELEMENTS);
supportedProperties.add(FORMAT_ELEMENTS);
supportedProperties.add(EDI_VALIDATE_CONTROL_STRUCTURE);

properties.put(PRETTY_PRINT, Boolean.FALSE);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

public class StaEDIStreamLocation extends LocationView implements Location {

private boolean afterSegment = false;
private boolean composite = false;
private boolean repeating = false;
private int repeatCount = -1;
Expand All @@ -31,9 +32,15 @@ public StaEDIStreamLocation(Location source) {
super(source);
}

@Override
public String toString() {
return super.toString(afterSegment);
}

@Override
public StaEDIStreamLocation copy() {
StaEDIStreamLocation copy = new StaEDIStreamLocation(this);
copy.afterSegment = this.afterSegment;
copy.composite = this.composite;
copy.repeating = this.repeating;
copy.repeatCount = this.repeatCount;
Expand Down Expand Up @@ -82,10 +89,11 @@ static int initOrIncrement(int position) {
public void incrementSegmentPosition(String segmentTag) {
this.segmentPosition = initOrIncrement(segmentPosition);
this.segmentTag = segmentTag;
clearSegmentLocations();
clearSegmentLocations(false);
}

public void clearSegmentLocations() {
public void clearSegmentLocations(boolean afterSegment) {
this.afterSegment = afterSegment;
this.elementPosition = -1;
this.elementOccurrence = -1;
this.repeating = false;
Expand Down
Loading
Loading