The attachment d2377.bin in the previous message was rejected by the listserv. 
The file contains just 5 bytes for the 3 integers in the schema. It is not 
needed to illustrate the bug. You can run the unparse step with the attached 
XML file to see the bug.

Regards,

   Shashi Ramaka
   sram...@owlcyberdefense.com<mailto:sram...@owlcyberdefense.com>
   Tel: 703-965-3656

From: Ramaka, Shashi <sram...@owlcyberdefense.com>
Sent: Friday, October 16, 2020 1:17 PM
To: dev@daffodil.apache.org
Subject: DAFFODIL-2377

I am working on DAFFODIL-2377: Abort instead of diagnostic message. 
(https://issues.apache.org/jira/browse/DAFFODIL-2377)

The attached files can be used to illustrate the bug.


daffodil parse -s s2377.xsd -o d2377.xml d2377.bin

daffodil unparse -s s2377.xsd d2377.xml

Unparsing results in the below error:

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!   An unexpected exception occurred. This is a bug!   !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

The schema has three elements. The first element has a length of 1 byte and 
alignment of 1 byte while the next two elements have length = 1 and alignment = 
2. The unparser is unparsing the first element correctly but throwing the above 
exception while determining the second element. Specifically it is failing 
figuring out the fill byte to be used.

The unparser is failing on the highlighted line in ProcessorStateBase.scala in 
daffodil-runtime1:

final def fillByte: Byte = {
  if (maybeCachedFillByte.isEmpty)
    maybeCachedFillByte = 
MaybeInt(termRuntimeData.maybeFillByteEv.get.evaluate(this).toInt)
  maybeCachedFillByte.get.toByte
}

Seems like the processor state in termRuntimeData does not have the fill byte 
value from the schema. If I update the above fillByte to return a hard coded 
byte value, unparse is working fine.

I'd appreciate any pointers on how to proceed from here.


Regards,

   Shashi Ramaka
   sram...@owlcyberdefense.com<mailto:sram...@owlcyberdefense.com>
   Tel: 703-965-3656

Reply via email to