Ok, thanks, that helped get the import right:
<dependency>
<groupId>org.smooks.cartridges.edi</groupId>
<artifactId>smooks-edifact-cartridge</artifactId>
<version>2.0.0-M3</version>
</dependency>
<dependency>
<groupId>org.smooks.cartridges.edi</groupId>
<artifactId>d96a-edifact-binding</artifactId>
<version>2.0.0-M3</version>
</dependency>
<dependency>
<groupId>org.smooks.cartridges.edi</groupId>
<artifactId>edifact-schemas</artifactId>
<version>2.0.0-M3</version>
<classifier>d96a</classifier>
</dependency>
It seems in our version, we use d96a version of Edifact.
Do have an issue with a nullpointer in org.apache.daffodil though...
I wrote following method:
public String parseDelJit(String message) {
final Smooks smooks = new Smooks();
smooks.setReaderConfig(new EdifactReaderConfigurator("/d96a/EDIFACT-Messages.dfdl.xsd").setMessageTypes(Arrays.asList("DELJIT")));
final StringWriter writer = new StringWriter();
smooks.filterSource(new StringSource(message), new StreamResult(writer));
return writer.toString();
}
And call it from a simple test with following DELJIT file:
@Test
public void DelJitTest() throws IOException, SAXException {
String message = "UNH DELJIT D96AUNA10010BGM 3020212241720458870DTM137202106031720 203NAD SEE521J 92NAD BY737 92LOC 11086 LOC159086 SEQ 34570156DTM194202105280814 203GIR 4665023107 FYYV4162UM2M2617547 VI1 LILIN30753320 MNQTY131+000000000001DTM 2202106021720 203UNT 12 \n";
String parsed = edifactTasks.parseDelJit(message);
}
However, this gives a nullpointer exception in org.apache.daffodil:
org.smooks.api.SmooksException: Failed to filter source
...
Caused by: org.apache.daffodil.exceptions.Abort: Invariant broken. Runtime.scala - Leaked exception: java.lang.NullPointerException
java.lang.NullPointerException
at org.apache.daffodil.io.BucketingInputSource.fillBucketsToIndex(InputSource.scala:261)
at org.apache.daffodil.io.BucketingInputSource.areBytesAvailable(InputSource.scala:329)
...
at org.smooks.cartridges.dfdl.parser.DfdlParser.parse(DfdlParser.java:183)
at org.smooks.engine.delivery.sax.ng.SaxNgParser.parse(SaxNgParser.java:86)
Any idea what could be going wrong here?
Op woensdag 23 juni 2021 om 07:33:59 UTC+2 schreef Claude: