mbeckerle commented on a change in pull request #676:
URL: https://github.com/apache/daffodil/pull/676#discussion_r746959968
##########
File path:
daffodil-runtime2/src/main/scala/org/apache/daffodil/runtime2/Runtime2DataProcessor.scala
##########
@@ -89,13 +92,25 @@ class Runtime2DataProcessor(executableFile: os.Path)
extends DFDL.DataProcessorB
os.write(infile, input)
val result = os.proc(executableFile, "-o", outfile, "parse",
infile).call(cwd = tempDir, stderr = os.Pipe)
if (result.out.text.isEmpty && result.err.text.isEmpty) {
- val parseResult = new ParseResult(outfile, Success, infile)
+ val parseResult = new ParseResult(infile, outfile, Success)
parseResult
} else {
- val msg = s"Unexpected daffodil output on stdout: ${result.out.text}
on stderr: ${result.err.text}"
- val parseError = new ParseError(Nope, Nope, Nope, Maybe(msg))
- val parseResult = new ParseResult(outfile, Failure(parseError), infile)
- parseResult.addDiagnostic(parseError)
+ val validationWarnings = if (result.out.text.isEmpty) {
+ Seq.empty
+ } else {
+ val warning = new ValidationWarning { override def getMessage:
String = result.out.text }
+ Seq(warning)
+ }
+ val validationFailures = if (result.err.text.isEmpty) {
+ Seq.empty
Review comment:
I find it surprising that this isn't covered by tests. Isn't this the
"ordinary" path taken when there are no valiation failures?
##########
File path:
daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/ex_nums.tdml
##########
@@ -37,62 +37,69 @@
</tdml:defineConfig>
<tdml:parserTestCase
- name="ex_nums_parse_runtime1"
model="ex_nums.dfdl.xsd"
+ name="ex_nums_runtime1"
config="config-runtime1">
<tdml:document>
- <tdml:documentPart type="file">ex_nums_parse.dat</tdml:documentPart>
+ <tdml:documentPart type="file">ex_nums.dat</tdml:documentPart>
</tdml:document>
<tdml:infoset>
- <tdml:dfdlInfoset
type="file">ex_nums_unparse_runtime1.xml</tdml:dfdlInfoset>
+ <tdml:dfdlInfoset type="file">ex_nums.dat.xml.runtime1</tdml:dfdlInfoset>
</tdml:infoset>
</tdml:parserTestCase>
- <tdml:unparserTestCase
- name="ex_nums_unparse_runtime1"
- model="ex_nums.dfdl.xsd"
- config="config-runtime1">
- <tdml:infoset>
- <tdml:dfdlInfoset
type="file">ex_nums_unparse_runtime1.xml</tdml:dfdlInfoset>
- </tdml:infoset>
- <tdml:document>
- <tdml:documentPart type="file">ex_nums_parse.dat</tdml:documentPart>
- </tdml:document>
- </tdml:unparserTestCase>
-
<tdml:parserTestCase
- name="ex_nums_parse_runtime2"
model="ex_nums.dfdl.xsd"
+ name="ex_nums_runtime2"
config="config-runtime2">
<tdml:document>
- <tdml:documentPart type="file">ex_nums_parse.dat</tdml:documentPart>
+ <tdml:documentPart type="file">ex_nums.dat</tdml:documentPart>
</tdml:document>
<tdml:infoset>
- <tdml:dfdlInfoset
type="file">ex_nums_unparse_runtime2.xml</tdml:dfdlInfoset>
+ <tdml:dfdlInfoset type="file">ex_nums.dat.xml.runtime2</tdml:dfdlInfoset>
</tdml:infoset>
</tdml:parserTestCase>
<tdml:unparserTestCase
- name="ex_nums_unparse_runtime2"
- model="ex_nums.dfdl.xsd"
- config="config-runtime2">
- <tdml:infoset>
- <tdml:dfdlInfoset
type="file">ex_nums_unparse_runtime2.xml</tdml:dfdlInfoset>
- </tdml:infoset>
- <tdml:document>
- <tdml:documentPart type="file">ex_nums_parse.dat</tdml:documentPart>
- </tdml:document>
- </tdml:unparserTestCase>
-
- <tdml:unparserTestCase
- name="ex_nums_unparse_errors"
model="ex_nums.dfdl.xsd"
+ name="ex_nums_runtime2_error"
config="config-runtime2">
<tdml:infoset>
- <tdml:dfdlInfoset
type="file">ex_nums_unparse_errors.xml</tdml:dfdlInfoset>
+ <tdml:dfdlInfoset
type="file">ex_nums.dat.xml.runtime2.error</tdml:dfdlInfoset>
</tdml:infoset>
<tdml:errors>
<tdml:error>value</tdml:error>
+ <tdml:error>boolean_false</tdml:error>
Review comment:
The unparser doesn't provide any validation, other than the validation
inherent in unparsing. There's never a call to Xerces to validate, for example.
##########
File path:
daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/ex_nums.dfdl.xsd
##########
@@ -23,26 +23,24 @@
xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
- <xs:include
schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>
+ <!-- Representation property bindings -->
+ <xs:include
schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>
<xs:annotation>
<xs:appinfo source="http://www.ogf.org/dfdl/">
<dfdl:format
- alignment="1"
- alignmentUnits="bits"
Review comment:
Surprising to me that you have lengthUnits 'bits' but not alignmentUnits
'bits'. The two tend to go together.
##########
File path:
daffodil-tdml-processor/src/main/scala/org/apache/daffodil/tdml/processor/Runtime2TDMLDFDLProcessor.scala
##########
@@ -140,13 +139,11 @@ final class Runtime2TDMLDFDLProcessorFactory private(
* TDML XML Infosets, feeding to the unparser, creating XML from the result
created by
* the Runtime2DataProcessor. All the "real work" is done by
Runtime2DataProcessor.
*/
-class Runtime2TDMLDFDLProcessor(tempDir: os.Path, executable: os.Path,
- var diagnostics: Seq[Diagnostic]) extends
TDMLDFDLProcessor {
+class Runtime2TDMLDFDLProcessor(tempDir: os.Path, executable: os.Path) extends
TDMLDFDLProcessor {
Review comment:
extends clause should be on the next line.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]