Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ClassCastException #20

Closed
radboudp opened this issue Feb 6, 2020 · 2 comments
Closed

ClassCastException #20

radboudp opened this issue Feb 6, 2020 · 2 comments

Comments

@radboudp
Copy link

radboudp commented Feb 6, 2020

Hi,

We have the following XSD:

<xsd:complexType name="fooType"> <xsd:sequence> <xsd:element name="id" type="FooIDType"/> </xsd:sequence> </xsd:complexType>
<xsd:simpleType name="FooIDType"> <xsd:restriction base="xsd:string"> <xsd:pattern value="(XX|YY|ZZ):[a-zA-Z0-9]{4,10}"/> </xsd:restriction> </xsd:simpleType>

When I call getXsdComplexType() on the XsdElement for "id" in the fooType, then we encounter an ClassCastException because the underlaying type is a XsdSimpleType. I had expected the getXsdComplexType() method to return null.

java.lang.ClassCastException: org.xmlet.xsdparser.xsdelements.XsdSimpleType cannot be cast to org.xmlet.xsdparser.xsdelements.XsdComplexType at org.xmlet.xsdparser.xsdelements.XsdElement.getXsdType(XsdElement.java:297) at org.xmlet.xsdparser.xsdelements.XsdElement.getXsdComplexType(XsdElement.java:288) at nl.svb.sem.correspondentiemanager.xsd.model.XsdStructure.findComplexForElement(XsdStructure.java:76)

@lcduarte
Copy link
Member

lcduarte commented Feb 8, 2020

Hello,

Thanks for reporting the issue, it was indeed an oversight on my part.

I performed a new release to fix it, 1.0.25. If you notice anything else feel free to open another issue :)

@lcduarte lcduarte closed this as completed Feb 8, 2020
@radboudp
Copy link
Author

radboudp commented Feb 9, 2020

My pleasure. Thank you for picking it up so quickly. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants