[ 
https://issues.apache.org/jira/browse/DAFFODIL-2596?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17475017#comment-17475017
 ] 

Olabusayo Kilo commented on DAFFODIL-2596:
------------------------------------------

I encountered this same error for a different customer.

The workaround Mike B and I settled on was:

 
{code:xml}
<!-- for the repType type; must specify the length -->
<xs:simpleType name="enum1b" dfdl:lengthKind="explicit" dfdl:length="1/>

<!-- for the enum restiction base, must specify delimited -->
<xs:simpleType name="enum_string" dfdl:lengthKind="delimited">
    <xs:restriction base="xs:string"/>
</xs:simpleType>

<xs:simpleType name="message_type_enum_table" dfdlx:repType="noc:enum1b">
    <xs:restriction base="noc:enum_string">
        <xs:enumeration value="Unspecified" dfdlx:repValues="0"/>
        <xs:enumeration value="VMF" dfdlx:repValues="1"/>
        <xs:enumeration value="XML" dfdlx:repValues="2"/>
    </xs:restriction>
</xs:simpleType>{code}
 

Without specifying the repType type as we did above (enum1b with lengthKind and 
length set), we found that we would get the following fatal error:

 
{noformat}
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!                      
                                                                                
                                                   
!!   An unexpected exception occurred. This is a bug!   !!                      
                                                                                
                                                   
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!                      
                                                                                
                                                   
                                                                                
                                                                                
                                                   
 Please report this bug and help us fix it:                                     
                                                                                
                                                   
                                                                                
                                                                                
                                                   
  https://daffodil.apache.org/community/#issue-tracker                          
                                                                                
                                                   
                                                                                
                                                                                
                                                   
 Please include the following exception, the command you                        
                                                                                
                                                   
 ran, and any input, schema, or tdml files used that led                        
                                                                                
                                                   
 to this bug.                                                                   
                                                                                
                                                   
                                                                                
                                                                                
                                                   
                                                                                
                                                                                
                                                   
java.util.NoSuchElementException: None.get                                      
                                                                                
                                                   
        at scala.None$.get(Option.scala:529)                                    
                                                                                
                                                   
        at scala.None$.get(Option.scala:527)                                    
                                                                                
                                                   
        at 
org.apache.daffodil.grammar.primitives.TypeValueCalc.repTypeUnparser$lzycompute(PrimitivesExpressions.scala:310)
                                                                                
        
        at 
org.apache.daffodil.grammar.primitives.TypeValueCalc.repTypeUnparser(PrimitivesExpressions.scala:310)
                                                                                
                   
        at 
org.apache.daffodil.grammar.primitives.TypeValueCalc.unparser$lzycompute(PrimitivesExpressions.scala:322)
                                                                                
               
        at 
org.apache.daffodil.grammar.primitives.TypeValueCalc.unparser(PrimitivesExpressions.scala:318)
                                                                                
                          
        at 
org.apache.daffodil.runtime1.GramRuntime1Mixin.maybeUnparser(GramRuntime1Mixin.scala:57)
                                                                                
                                
        at 
org.apache.daffodil.runtime1.GramRuntime1Mixin.maybeUnparser$(GramRuntime1Mixin.scala:54)
                                                                                
                               
        at 
org.apache.daffodil.grammar.Gram.maybeUnparser$lzycompute(GrammarTerm.scala:51) 
                                                                                
                                        
        at org.apache.daffodil.grammar.Gram.maybeUnparser(GrammarTerm.scala:51) 
                                                                                
                                                   
        at 
org.apache.daffodil.grammar.primitives.ElementCombinator.eReptypeUnparser$lzycompute(ElementCombinator.scala:107)
                                                                                
       
        at 
org.apache.daffodil.grammar.primitives.ElementCombinator.eReptypeUnparser(ElementCombinator.scala:107)
                                                                                
                  
        at 
org.apache.daffodil.grammar.primitives.ElementCombinator.unparser$lzycompute(ElementCombinator.scala:131)
                                                                                
               
        at 
org.apache.daffodil.grammar.primitives.ElementCombinator.unparser(ElementCombinator.scala:109)
                                                                                
                          
        at 
org.apache.daffodil.grammar.Prod.unparser$lzycompute(Production.scala:97)       
                                                                                
                                        
        at org.apache.daffodil.grammar.Prod.unparser(Production.scala:89)       
                                                                                
                                                   
        at 
org.apache.daffodil.grammar.Prod.unparser$lzycompute(Production.scala:97)       
                                                                                
                                        
        at org.apache.daffodil.grammar.Prod.unparser(Production.scala:89)       
                                                                                
                                                   
        at 
org.apache.daffodil.grammar.primitives.SequenceChild.childUnparser$lzycompute(SequenceChild.scala:72)
                                                                                
                   
        at 
org.apache.daffodil.grammar.primitives.SequenceChild.childUnparser(SequenceChild.scala:72)
                                                                                
                              
        at 
org.apache.daffodil.grammar.primitives.SequenceChild.optSequenceChildUnparser$lzycompute(SequenceChild.scala:84)
                                                                                
        
        at 
org.apache.daffodil.grammar.primitives.SequenceChild.optSequenceChildUnparser(SequenceChild.scala:83)
                                                                                
                   
        at 
org.apache.daffodil.grammar.primitives.OrderedSequence.$anonfun$unparser$2(SequenceCombinator.scala:100)
                                                                                
                
        at 
scala.collection.TraversableLike.$anonfun$flatMap$1(TraversableLike.scala:293)  
                
{noformat}

> lengthKind property is not inherited for types with dfdlx:repType
> -----------------------------------------------------------------
>
>                 Key: DAFFODIL-2596
>                 URL: https://issues.apache.org/jira/browse/DAFFODIL-2596
>             Project: Daffodil
>          Issue Type: Bug
>          Components: Front End
>    Affects Versions: 3.2.0
>            Reporter: Josh Adams
>            Assignee: Josh Adams
>            Priority: Major
>             Fix For: 3.3.0
>
>
> Ran into this while working on a customer schema
> Essentially if the default dfdl:lengthKind="implicit" and you attempt to use 
> a dfdl:repType that involves uses string values for its enumeration, you will 
> either get an error complaining that you cannot have an xs:string with 
> lengthKind="implicit" without specifying a maxLength, OR for some unknown 
> reason you can get a completely different usage error:
> org.apache.daffodil.exceptions.Abort: Usage error: v.>=(0)
> org.apache.daffodil.exceptions.Assert$.abort(Assert.scala:137)
> org.apache.daffodil.util.MaybeULong$.apply(MaybeULong.scala:54)
> org.apache.daffodil.util.MaybeJULong$.apply(MaybeULong.scala:84)
> org.apache.daffodil.processors.LengthInBitsEvBase.compute(EvElement.scala:144)
>         at org.apache.daffodil.exceptions.Assert$.abort(Assert.scala:137)
>         at org.apache.daffodil.util.MaybeULong$.apply(MaybeULong.scala:54)
>         at org.apache.daffodil.util.MaybeJULong$.apply(MaybeULong.scala:84)
>         at 
> org.apache.daffodil.processors.LengthInBitsEvBase.compute(EvElement.scala:144)
>         at 
> org.apache.daffodil.processors.LengthInBitsEvBase.compute(EvElement.scala:118)
>         at 
> org.apache.daffodil.processors.Evaluatable.evaluate(Evaluatable.scala:281)
>         at 
> org.apache.daffodil.processors.Evaluatable.compileTimeEvaluate(Evaluatable.scala:212)
>         at 
> org.apache.daffodil.processors.Evaluatable.compile(Evaluatable.scala:317)
>         at 
> org.apache.daffodil.processors.Evaluatable.compile(Evaluatable.scala:326)



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to