[ 
https://issues.apache.org/jira/browse/DAFFODIL-2879?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dave Thompson closed DAFFODIL-2879.
-----------------------------------

Verified the specified commit (commit 3f897fe62b7946870290d7414ee27d5b733426b1) 
is included in the latest pull from the daffodil repository.

Verified, via review, changes identified in the ticket and commit comments were 
implemented including the modified tests. 

Verified the affected daffodil subproject sbt test suites executed successfully.

> Group evaluation throwing ClassCastException for optional element
> -----------------------------------------------------------------
>
>                 Key: DAFFODIL-2879
>                 URL: https://issues.apache.org/jira/browse/DAFFODIL-2879
>             Project: Daffodil
>          Issue Type: Bug
>          Components: Back End
>    Affects Versions: 3.6.0
>            Reporter: Peter Katlic
>            Priority: Major
>             Fix For: 3.7.0
>
>
> A group is defined with an element using fn:count and referenced inside a 
> sequence of array and optional elements. See the test count_21b in 
> daffodil-test/src/test/resources/org/apache/daffodil/section23/dfdl_functions/Functions.tdml
>  for an example.
> Group schema:
> {code:java}
> <xs:group name="countGroup">
>   <xs:sequence>
>     <xs:element name="count" type="xs:int" dfdl:representation="binary" 
> dfdl:inputValueCalc="{ fn:count(../ex:foo) }"/>
>   </xs:sequence>
> </xs:group>{code}
> Sequence schema:
> {code:java}
> <xs:element name="arrayOptional">
>   <xs:complexType>
>     <xs:sequence>
>       <xs:element name="array">
>         <xs:complexType>
>           <xs:sequence>
>             <xs:element name="foo" type="xs:int" minOccurs="2" maxOccurs="2" 
> dfdl:representation="binary"/>
>             <xs:group ref="countGroup"/>
>           </xs:sequence>
>         </xs:complexType>
>       </xs:element>
>       <xs:element name="optional">
>         <xs:complexType>
>           <xs:sequence>
>             <xs:element name="foo" type="xs:int" minOccurs="0" maxOccurs="1" 
> dfdl:representation="binary"/>
>             <!-- throws ClassCastException, possible bug in Daffodil group 
> evaluation -->
>             <!-- <xs:group ref="countGroup"/> -->
>             <xs:element name="count" type="xs:int" 
> dfdl:representation="binary" dfdl:inputValueCalc="{ fn:count(../ex:foo) }"/>
>           </xs:sequence>
>         </xs:complexType>
>       </xs:element>
>     </xs:sequence>
>   </xs:complexType>
> </xs:element>{code}
> Uncommenting 
> {code:java}
> <xs:group ref="countGroup"/>{code}
>  and commenting out 
> {code:java}
> <xs:element name="count" type="xs:int" dfdl:representation="binary" 
> dfdl:inputValueCalc="{ fn:count(../ex:foo) }"/>{code}
>  will produce the following error:
> {code:java}
> java.lang.ClassCastException: class 
> org.apache.daffodil.runtime1.infoset.DISimple cannot be cast to class 
> org.apache.daffodil.runtime1.infoset.DIArray{code}
> It seems as if the optional is evaluated as a DownArray instead of a 
> DownElement.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to