Hi,

I use Castor source generator for nearly all my xml exchanges.
Starting on a new project recently, I think I fall on a bug that I subtmit here
since there is no Product Castor at this URL :
http://bugzilla.exolab.org/enter_bug.cgi.

Here is the bug :
When I use a ComplexType containing an element that is an union whose one
element is also an union, I fall on a NullPointerException while executing
castor source generator. This happens with the lastest version that is 0.9.7
and with older ones also.

I provide as an attached file the xsd schema I use and the stack trace is at the
end of this mail.

Regards,

Nicolas

-- using UNIX style line separation.
-- Suppressing non fatal warnings.
Creating classes for: CreditCard
java.lang.NullPointerException
        at
org.exolab.castor.builder.TypeConversion.compare(TypeConversion.java:567)
        at
org.exolab.castor.builder.TypeConversion.findCommonType(TypeConversion.java:551)
        at
org.exolab.castor.builder.TypeConversion.convertType(TypeConversion.java:132)
        at
org.exolab.castor.builder.binding.XMLBindingComponent.getJavaType(XMLBindingComponent.java:1185)
        at
org.exolab.castor.builder.MemberFactory.createFieldInfo(MemberFactory.java:291)
        at
org.exolab.castor.builder.SourceFactory.processContentModel(SourceFactory.java:1508)
        at
org.exolab.castor.builder.SourceFactory.processContentModel(SourceFactory.java:1552)
        at
org.exolab.castor.builder.SourceFactory.processComplexType(SourceFactory.java:1464)
        at
org.exolab.castor.builder.SourceFactory.createSourceCode(SourceFactory.java:402)
        at
org.exolab.castor.builder.SourceGenerator.createClasses(SourceGenerator.java:1045)
        at
org.exolab.castor.builder.SourceGenerator.createClasses(SourceGenerator.java:931)
        at
org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.java:370)
        at
org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.java:452)
        at
org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.java:485)
        at
org.exolab.castor.builder.SourceGenerator.main(SourceGenerator.java:865)


<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"; elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0">

	<xs:simpleType name="DayOfWeekCodeType">
		<xs:union memberTypes="DayListType DayCodeType"/>
	</xs:simpleType>
		
	<xs:simpleType name="DayListType">
		<xs:restriction base="xs:string">
			<xs:pattern value="[1-7]{1,7}"/>
		</xs:restriction>
	</xs:simpleType>
	
	<xs:simpleType name="DayCodeType">
		<xs:restriction base="xs:NMTOKEN">
			<xs:enumeration value="Mon"/>
			<xs:enumeration value="Tue"/>
			<xs:enumeration value="Wed"/>
			<xs:enumeration value="Thu"/>
			<xs:enumeration value="Fri"/>
			<xs:enumeration value="Sat"/>
			<xs:enumeration value="Sun"/>
			<xs:enumeration value="Daily"/>
		</xs:restriction>
	</xs:simpleType>
	
	<xs:simpleType name="DateTimeType">
		<xs:union memberTypes="xs:date DayOfWeekCodeType"/>
	</xs:simpleType>
	
	<xs:element name="CreditCard">
		<xs:complexType>
			<xs:sequence>
				<xs:element name="Expiration" type="DateTimeType" />
			</xs:sequence>
		</xs:complexType>
	</xs:element>
</xs:schema>
-------------------------------------------------
If you wish to unsubscribe from this list, please 
send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------

Reply via email to