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

Diagnostic message from choice where no branch is successful is too hard to understand

XMLWordPrintableJSON

      See discussion below.

      ----Original Message----
      From: Mike Beckerle mbeckerle@tresys.com
      Sent: Tuesday, May 14, 2013 10:57 AM
      To: Garriss Jr., James P.; Stephen Lawrence
      Subject: RE: [daffodil] error error error error message

      Well, here is what is happening. Because your schema has alternatives in it (choice), and none of them are passing, it is rolling up the reasons why all the alternatives failed, and listing them all.

      This is a hack, but in general, if your choice has nothing that matches, it may not be for the reason that the last branch failed on that is of interest. It could be because the first, or any of the others failed that the overall thing fails.

      A much more verbose presentation of this would help that lays out each failure, and the point in the schema where that choice alternative was, etc.

      We will make a JIRA issue to improve this.
      ________________________________
      From: Garriss Jr., James P. [jgarriss@mitre.org]
      Sent: Tuesday, May 14, 2013 10:25 AM
      To: Stephen Lawrence
      Cc: Mike Beckerle
      Subject: [daffodil] error error error error message

      I added a check constraints to the display name, forcing Daffodil to validate the set of allowed characters on parse. And it does! It gives me the assertion error message, which is good.

      But...it appears to throw the same set of error messages 4 times. Is that a bug?

      Here's the key schema:

      <xsd:simpleType name="DisplayName">
      <xsd:annotation>
      <xsd:appinfo source="http://www.ogf.org/dfdl/dfdl-1.0/">
      <dfdl:assert test="

      { dfdl:checkConstraints(.) }

      " message="A display name has a restricted set of allowed characters"/>
      </xsd:appinfo>
      </xsd:annotation>
      <xsd:restriction base="xsd:string">
      <xsd:pattern value="[A-Za-z0-9!#$%&'*+-/=?^_`\{\|\}]+"/>
      </xsd:restriction>
      </xsd:simpleType>

      Here's the input (the @ is not allowed):

      From: "John@Doe" <johndoe@examplename.com>

      Here's the output:

      C:\Users\jgarriss\Documents\DFDL_Schemas_Email\02_Message_Headers>C:\Users\jgarriss\daffodil\bin\daffodil parse -s From.xsd -r From from06_invalid_dis
      play.txt
      [error] Parse Error: All alternatives failed. Reason(s): List(Parse Error: Alternative failed. Reason(s): List(Parse Error: Init('<') - element.Displa
      yEmail: Delimiter not found!
      Schema context: element.DisplayEmail Location in file:/C:/Users/jgarriss/Documents/DFDL_Schemas_Email/02_Message_Headers/Email.xsd
      Data location was preceding byte 6
      UTF-8 text starting at byte 0 is: (From: "John@Doe" <johndoe@examplename.co)
      Data (hex) starting at byte 0 is: (0x46726F6D3A20224A6F686E40446F6522203C6A6F686E646F65406578616D706C656E616D652E636F))
      Schema context: element.DisplayEmailWithoutDisplayName Location in file:/C:/Users/jgarriss/Documents/DFDL_Schemas_Email/02_Message_Headers/Email.xsd
      Data location was preceding byte 6
      UTF-8 text starting at byte 0 is: (From: "John@Doe" <johndoe@examplename.co)
      Data (hex) starting at byte 0 is: (0x46726F6D3A20224A6F686E40446F6522203C6A6F686E646F65406578616D706C656E616D652E636F), Parse Error: Alternative faile
      d. Reason(s): List(Parse Error: Assertion failed. A display name has a restricted set of allowed characters
      Schema context: simpleType.DisplayName Location in file:/C:/Users/jgarriss/Documents/DFDL_Schemas_Email/02_Message_Headers/Email.xsd
      Data location was preceding byte 17
      UTF-8 text starting at byte 16 is: ( <johndoe@examplename.com>
      )
      Data (hex) starting at byte 16 is: (0x203C6A6F686E646F65406578616D706C656E616D652E636F6D3E0D0A))
      Schema context: element.DisplayEmailWithoutDisplayName Location in file:/C:/Users/jgarriss/Documents/DFDL_Schemas_Email/02_Message_Headers/Email.xsd
      Data location was preceding byte 6
      UTF-8 text starting at byte 0 is: (From: "John@Doe" <johndoe@examplename.co)
      Data (hex) starting at byte 0 is: (0x46726F6D3A20224A6F686E40446F6522203C6A6F686E646F65406578616D706C656E616D652E636F), Parse Error: Alternative faile
      d. Reason(s): List(Parse Error: Assertion failed. A display name has a restricted set of allowed characters
      Schema context: simpleType.DisplayName Location in file:/C:/Users/jgarriss/Documents/DFDL_Schemas_Email/02_Message_Headers/Email.xsd
      Data location was preceding byte 17
      UTF-8 text starting at byte 16 is: ( <johndoe@examplename.com>
      )
      Data (hex) starting at byte 16 is: (0x203C6A6F686E646F65406578616D706C656E616D652E636F6D3E0D0A))
      Schema context: element.DisplayEmailWithoutDisplayName Location in file:/C:/Users/jgarriss/Documents/DFDL_Schemas_Email/02_Message_Headers/Email.xsd
      Data location was preceding byte 6
      UTF-8 text starting at byte 0 is: (From: "John@Doe" <johndoe@examplename.co)
      Data (hex) starting at byte 0 is: (0x46726F6D3A20224A6F686E40446F6522203C6A6F686E646F65406578616D706C656E616D652E636F), Parse Error: Alternative faile
      d. Reason(s): List(Parse Error: Assertion failed. A local part has a restricted set of allowed characters
      Schema context: element.LocalPart Location in file:/C:/Users/jgarriss/Documents/DFDL_Schemas_Email/02_Message_Headers/Email.xsd
      Data location was preceding byte 11
      UTF-8 text starting at byte 8 is: (ohn@Doe" <johndoe@examplename.com>
      )
      Data (hex) starting at byte 8 is: (0x6F686E40446F6522203C6A6F686E646F65406578616D706C656E616D652E636F6D3E0D0A))
      Schema context: element.DisplayEmailWithoutDisplayName Location in file:/C:/Users/jgarriss/Documents/DFDL_Schemas_Email/02_Message_Headers/Email.xsd
      Data location was preceding byte 6
      UTF-8 text starting at byte 0 is: (From: "John@Doe" <johndoe@examplename.co)
      Data (hex) starting at byte 0 is: (0x46726F6D3A20224A6F686E40446F6522203C6A6F686E646F65406578616D706C656E616D652E636F))
      Schema context: element.DisplayEmailWithoutDisplayName Location in file:/C:/Users/jgarriss/Documents/DFDL_Schemas_Email/02_Message_Headers/Email.xsd
      Data location was preceding byte 6
      UTF-8 text starting at byte 0 is: (From: "John@Doe" <johndoe@examplename.co)
      Data (hex) starting at byte 0 is: (0x46726F6D3A20224A6F686E40446F6522203C6A6F686E646F65406578616D706C656E616D652E636F)

              Unassigned Unassigned
              mbeckerle.dfdl Mike Beckerle
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: