Uploaded image for project: 'Daffodil'
  1. Daffodil
  2. DFDL-779

lengthKind "implicit" on xs:string causing StringFixedLengthInBytesFixedWidthCharacters exception

XMLWordPrintableJSON

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • s11
    • s11
    • None
    • None

      While creating tests for DFDL-241 I ran into this error. I soon realized that I wanted dfdl:lengthKind="delimited" for this element and changing this attribute fixed my problem. I believe I should have been getting an SDE asking for min/maxLength, or maybe something different since the string had a binary representation - something more descriptive and helpful than the error below.

      [info] Test edu.illinois.ncsa.daffodil.section23.dfdl_expressions.TestDFDLExpressions.test_byteOrderExpr7b started
      [error] Test edu.illinois.ncsa.daffodil.section23.dfdl_expressions.TestDFDLExpressions.test_byteOrderExpr7b failed: edu.illinois.ncsa.daffodil.processors.ParseError: Parse Error: StringFixedLengthInBytesFixedWidthCharacters - Exception:
      [error] edu.illinois.ncsa.daffodil.processors.DFDLByteReader.getByteArray(DFDLReader.scala:105)
      [error] edu.illinois.ncsa.daffodil.processors.InStreamFromByteChannel.getByteAlignedBytes(InStream.scala:246)
      [error] edu.illinois.ncsa.daffodil.processors.InStreamFromByteChannel.getBytes(InStream.scala:208)
      [error] edu.illinois.ncsa.daffodil.processors.StringLengthInBytes.parseInput(PrimitivesLengthKind.scala:161)
      [error] edu.illinois.ncsa.daffodil.processors.StringLength$$anon$1$$anonfun$parse$1.apply(PrimitivesLengthKind.scala:48)
      [error] edu.illinois.ncsa.daffodil.processors.StringLength$$anon$1$$anonfun$parse$1.apply(PrimitivesLengthKind.scala:38)
      [error] edu.illinois.ncsa.daffodil.processors.WithParseErrorThrowing$class.withParseErrorThrowing(Parser.scala:223)
      [error] edu.illinois.ncsa.daffodil.processors.PrimParser.withParseErrorThrowing(ProcessorBases.scala:9)
      [error] edu.illinois.ncsa.daffodil.processors.StringLength$$anon$1.parse(PrimitivesLengthKind.scala:38)
      [error] edu.illinois.ncsa.daffodil.processors.Parser.parse1(Parser.scala:135)
      [error] edu.illinois.ncsa.daffodil.processors.SeqCompParser$$anonfun$parse$3.apply(Parser.scala:336)
      [error] edu.illinois.ncsa.daffodil.processors.SeqCompParser$$anonfun$parse$3.apply(Parser.scala:334)
      [error] scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
      [error] scala.collection.immutable.List.foreach(List.scala:76)
      [error] edu.illinois.ncsa.daffodil.processors.SeqCompParser.parse(Parser.scala:334)
      [error] edu.illinois.ncsa.daffodil.processors.Parser.parse1(Parser.scala:135)
      [error] edu.illinois.ncsa.daffodil.processors.DataProcessor$$anonfun$parse$3$$anon$1.liftedTree1$1(Runtime.scala:130)
      [error] edu.illinois.ncsa.daffodil.processors.DataProcessor$$anonfun$parse$3$$anon$1.<init>(Runtime.scala:129)
      [error] edu.illinois.ncsa.daffodil.processors.DataProcessor$$anonfun$parse$3.apply(Runtime.scala:126)
      [error] edu.illinois.ncsa.daffodil.processors.DataProcessor$$anonfun$parse$3.apply(Runtime.scala:125)
      [error] scala.util.DynamicVariable.withValue(DynamicVariable.scala:57)
      [error] edu.illinois.ncsa.daffodil.ExecutionMode$$anonfun$usingRuntimeMode$1.apply(ExecutionMode.scala:80)
      [error] edu.illinois.ncsa.daffodil.ExecutionMode$$anonfun$usingRuntimeMode$1.apply(ExecutionMode.scala:80)
      [error] edu.illinois.ncsa.daffodil.processors.DataProcessor.parse(Runtime.scala:125)
      [error] edu.illinois.ncsa.daffodil.processors.DataProcessor.parse(Runtime.scala:117)
      [error] edu.illinois.ncsa.daffodil.tdml.ParserTestCase.runParseExpectSuccess(TDMLRunner.scala:556)
      [error] edu.illinois.ncsa.daffodil.tdml.ParserTestCase.runProcessor(TDMLRunner.scala:445)
      [error] edu.illinois.ncsa.daffodil.tdml.TestCase.run(TDMLRunner.scala:394)
      [error] edu.illinois.ncsa.daffodil.tdml.DFDLTestSuite.runOneTestWithDataVolumes(TDMLRunner.scala:257)
      [error] edu.illinois.ncsa.daffodil.tdml.DFDLTestSuite.runOneTest(TDMLRunner.scala:248)
      [error] edu.illinois.ncsa.daffodil.section23.dfdl_expressions.TestDFDLExpressions.test_byteOrderExpr7b(TestDFDLExpressions.scala:64)
      [error] sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      [error] sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      [error] sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      [error] java.lang.reflect.Method.invoke(Method.java:601)
      [error] org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
      [error] org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      [error] org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
      [error] org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
      [error] org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
      [error] org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
      [error] org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
      [error] org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
      [error] org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
      [error] org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
      [error] org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
      [error] org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
      [error] org.junit.runners.ParentRunner.run(ParentRunner.java:309)
      [error] org.junit.runners.Suite.runChild(Suite.java:127)
      [error] org.junit.runners.Suite.runChild(Suite.java:26)
      [error] org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
      [error] org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
      [error] org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
      [error] org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
      [error] org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
      [error] org.junit.runners.ParentRunner.run(ParentRunner.java:309)
      [error] org.junit.runner.JUnitCore.run(JUnitCore.java:160)
      [error] org.junit.runner.JUnitCore.run(JUnitCore.java:138)
      [error] com.novocode.junit.JUnitRunner.run(JUnitRunner.java:90)
      [error] sbt.TestRunner.delegateRun(TestFramework.scala:58)
      [error] sbt.TestRunner.run(TestFramework.scala:51)
      [error] sbt.TestRunner.runTest$1(TestFramework.scala:71)
      [error] sbt.TestRunner.run(TestFramework.scala:80)
      [error] sbt.TestFramework$$anonfun$9$$anonfun$apply$9$$anonfun$10$$anonfun$apply$10.apply(TestFramework.scala:188)
      [error] sbt.TestFramework$$anonfun$9$$anonfun$apply$9$$anonfun$10$$anonfun$apply$10.apply(TestFramework.scala:188)
      [error] sbt.TestFramework$.sbt$TestFramework$$withContextLoader(TestFramework.scala:200)
      [error] sbt.TestFramework$$anonfun$9$$anonfun$apply$9$$anonfun$10.apply(TestFramework.scala:188)
      [error] sbt.TestFramework$$anonfun$9$$anonfun$apply$9$$anonfun$10.apply(TestFramework.scala:188)
      [error] sbt.Tests$$anonfun$makeSerial$1$$anonfun$apply$8.apply(Tests.scala:121)
      [error] sbt.Tests$$anonfun$makeSerial$1$$anonfun$apply$8.apply(Tests.scala:121)
      [error] scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:233)
      [error] scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:233)
      [error] scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
      [error] scala.collection.immutable.List.foreach(List.scala:76)
      [error] scala.collection.TraversableLike$class.map(TraversableLike.scala:233)
      [error] scala.collection.immutable.List.map(List.scala:76)
      [error] sbt.Tests$$anonfun$makeSerial$1.apply(Tests.scala:121)
      [error] sbt.Tests$$anonfun$makeSerial$1.apply(Tests.scala:121)
      [error] sbt.std.Transform$$anon$3$$anonfun$apply$2.apply(System.scala:47)
      [error] sbt.std.Transform$$anon$3$$anonfun$apply$2.apply(System.scala:47)
      [error] sbt.std.Transform$$anon$5.work(System.scala:71)
      [error] sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:232)
      [error] sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:232)
      [error] sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
      [error] sbt.Execute.work(Execute.scala:238)
      [error] sbt.Execute$$anonfun$submit$1.apply(Execute.scala:232)
      [error] sbt.Execute$$anonfun$submit$1.apply(Execute.scala:232)
      [error] sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:160)
      [error] sbt.CompletionService$$anon$2.call(CompletionService.scala:30)
      [error] java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
      [error] java.util.concurrent.FutureTask.run(FutureTask.java:166)
      [error] java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
      [error] java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
      [error] java.util.concurrent.FutureTask.run(FutureTask.java:166)
      [error] java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
      [error] java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
      [error] java.lang.Thread.run(Thread.java:722)
      [error]
      [error] Schema context: element.b0m Location line 80 column 71 in file:/tmp/daffodil_tmp_7355745031498832314.dfdl.xsd
      [error] Data location was preceding byte 0
      [error] UTF-8 text starting at byte 0 is: (littleEndian.)
      [error] Data (hex) starting at byte 0 is: (0x6C6974746C65456E6469616E2E00010001)
      [error] at edu.illinois.ncsa.daffodil.processors.Parser.PE(Parser.scala:125)
      [error] at edu.illinois.ncsa.daffodil.processors.StringLength$$anon$1$$anonfun$parse$1.apply(PrimitivesLengthKind.scala:54)
      [error] at edu.illinois.ncsa.daffodil.processors.StringLength$$anon$1$$anonfun$parse$1.apply(PrimitivesLengthKind.scala:38)
      [error] at edu.illinois.ncsa.daffodil.processors.WithParseErrorThrowing$class.withParseErrorThrowing(Parser.scala:223)
      [error] at edu.illinois.ncsa.daffodil.processors.PrimParser.withParseErrorThrowing(ProcessorBases.scala:9)
      [error] at edu.illinois.ncsa.daffodil.processors.StringLength$$anon$1.parse(PrimitivesLengthKind.scala:38)
      [error] at edu.illinois.ncsa.daffodil.processors.Parser.parse1(Parser.scala:135)
      [error] at edu.illinois.ncsa.daffodil.processors.SeqCompParser$$anonfun$parse$3.apply(Parser.scala:336)
      [error] at edu.illinois.ncsa.daffodil.processors.SeqCompParser$$anonfun$parse$3.apply(Parser.scala:334)
      [error] at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
      [error] at scala.collection.immutable.List.foreach(List.scala:76)
      [error] at edu.illinois.ncsa.daffodil.processors.SeqCompParser.parse(Parser.scala:334)
      [error] at edu.illinois.ncsa.daffodil.processors.Parser.parse1(Parser.scala:135)
      [error] at edu.illinois.ncsa.daffodil.processors.DataProcessor$$anonfun$parse$3$$anon$1.liftedTree1$1(Runtime.scala:130)
      [error] at edu.illinois.ncsa.daffodil.processors.DataProcessor$$anonfun$parse$3$$anon$1.<init>(Runtime.scala:129)
      [error] at edu.illinois.ncsa.daffodil.processors.DataProcessor$$anonfun$parse$3.apply(Runtime.scala:126)
      [error] at edu.illinois.ncsa.daffodil.processors.DataProcessor$$anonfun$parse$3.apply(Runtime.scala:125)
      [error] at scala.util.DynamicVariable.withValue(DynamicVariable.scala:57)
      [error] at edu.illinois.ncsa.daffodil.ExecutionMode$$anonfun$usingRuntimeMode$1.apply(ExecutionMode.scala:80)
      [error] at edu.illinois.ncsa.daffodil.ExecutionMode$$anonfun$usingRuntimeMode$1.apply(ExecutionMode.scala:80)
      [error] at edu.illinois.ncsa.daffodil.processors.DataProcessor.parse(Runtime.scala:125)
      [error] at edu.illinois.ncsa.daffodil.processors.DataProcessor.parse(Runtime.scala:117)
      [error] at edu.illinois.ncsa.daffodil.tdml.ParserTestCase.runParseExpectSuccess(TDMLRunner.scala:556)
      [error] at edu.illinois.ncsa.daffodil.tdml.ParserTestCase.runProcessor(TDMLRunner.scala:445)
      [error] at edu.illinois.ncsa.daffodil.tdml.TestCase.run(TDMLRunner.scala:394)
      [error] at edu.illinois.ncsa.daffodil.tdml.DFDLTestSuite.runOneTestWithDataVolumes(TDMLRunner.scala:257)
      [error] at edu.illinois.ncsa.daffodil.tdml.DFDLTestSuite.runOneTest(TDMLRunner.scala:248)
      [error] at edu.illinois.ncsa.daffodil.section23.dfdl_expressions.TestDFDLExpressions.test_byteOrderExpr7b(TestDFDLExpressions.scala:64)
      [error] ...

      The test (byteOrderExpr7b) is nearly identical to byteOrderExpr7. The only difference is the lengthKind for the string. byteOrderExpr 7 passes.

      Please see the following files:
      daffodil-test/src/test/scala-debug/edu/illinois/ncsa/daffodil/section23/dfdl_expressions/TestDFDLExpressionsDebug.scala
      daffodil-test/src/test/resources/edu/illinois/ncsa/daffodil/section23/runtime_properties/runtime-properties.tdml

              jchab Jessie Chab
              jchab Jessie Chab
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: