Can you do me a favour ? What happens if you re-generate using 1.3rc1 ?
Does the problem go away ?
Werner
jpshields wrote:
> Hi,
>
> Thanks for the quick answer.
>
> Here's the xsd I used to generate the old pojos with 1.0.3(I've kept the
> interesting part):
>
> <xs:element name="GatePositionList">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="GatePosition" minOccurs="0" maxOccurs="unbounded">
> <xs:complexType>
> <xs:sequence>
> <xs:element ref="Name"/>
> <xs:element name="PositionValue" type="PercentStepValue"
> maxOccurs="unbounded"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
>
> <xs:simpleType name="Value">
> <xs:restriction base="xs:double"/>
> </xs:simpleType>
> <xs:complexType name="StepValue">
> <xs:attribute name="Step" use="required">
> <xs:simpleType>
> <xs:restriction base="xs:integer"/>
> </xs:simpleType>
> </xs:attribute>
> <xs:attribute name="Value" type="Value" use="required"/>
> </xs:complexType>
> <xs:complexType name="PositiveStepValue">
> <xs:complexContent>
> <xs:restriction base="StepValue">
> <xs:attribute name="Value" use="required">
> <xs:simpleType>
> <xs:restriction base="Value">
> <xs:minInclusive value="0.0"/>
> </xs:restriction>
> </xs:simpleType>
> </xs:attribute>
> </xs:restriction>
> </xs:complexContent>
> </xs:complexType>
> <xs:complexType name="PercentStepValue">
> <xs:complexContent>
> <xs:restriction base="StepValue">
> <xs:attribute name="Value" use="required">
> <xs:simpleType>
> <xs:restriction base="Value">
> <xs:minInclusive value="0.0"/>
> <xs:maxInclusive value="1.0"/>
> </xs:restriction>
> </xs:simpleType>
> </xs:attribute>
> </xs:restriction>
> </xs:complexContent>
> </xs:complexType>
>
> The descriptors generated seems pretty fine and respect the hierarchy of
> complexTypes:
>
> PercentStepValueDescriptor extends StepValueDescriptor {
> PercentStepValueDescriptor(){
> ...
> typeValidator.setMinInclusive(0.0);
> typeValidator.setMaxInclusive(1.0);
> ...
> }
> }
>
> The case I'm testing is for the "Value" of "PositionValue" for a
> "GatePosition" like this:
> <PositionValue Step="1" Value="1.1"/>, I'me using a value which is higher
> than the max allowed of 1.0.
>
> When I debug the 1.0.3 (which works), the stack trace shows something like
> that (for the PercentStepValueDescriptor):
>
> DoubleValidator.validate(double, ValidationContext) line: 145
> DoubleValidator.validate(Object, ValidationContext) line: 221
> FieldValidator.validate(Object, ValidationContext) line: 279
> StepValueDescriptor(XMLClassDescriptorImpl).validate(Object,
> ValidationContext) line: 929
> PercentStepValueDescriptor(XMLClassDescriptorImpl).validate(Object,
> ValidationContext) line: 784
> PositionValueDescriptor(XMLClassDescriptorImpl).validate(Object,
> ValidationContext) line: 784
> FieldValidator(Validator).validate(Object, ValidationContext) line: 127
> FieldValidator.validate(Object, ValidationContext) line: 237
> GatePositionDescriptor(XMLClassDescriptorImpl).validate(Object,
> ValidationContext) line: 923
> FieldValidator(Validator).validate(Object, ValidationContext) line: 127
> FieldValidator.validate(Object, ValidationContext) line: 237
> GatePositionListDescriptor(XMLClassDescriptorImpl).validate(Object,
> ValidationContext) line: 923
> Validator.validate(Object, ValidationContext) line: 127
> Marshaller.validate(Object) line: 2471
> Marshaller.marshal(Object) line: 836
>
> And the DoubleValidator has the right min and max values (0.0 and 1.0 for
> respectively _isThereMinInclusive/_minInclusive and
> _isThereMaxInclusive/_maxInclusive.
>
> For the 1.3rc1, the stack trace looks the same, but when in the
> DoubleValidator, the values of
> _useMinInclusive /_minInclusive are false/0.0 and _useMaxInclusive /
> _maxInclusive are false / 0.0. So no validations are applied to my double
> value of 1.1.
>
> DoubleValidator.validate(double, ValidationContext) line: 267
> DoubleValidator.validate(Object, ValidationContext) line: 331
> FieldValidator.validateInstance(ValidationContext, Object) line: 333
> FieldValidator.validate(Object, ValidationContext) line: 277
> StepValueDescriptor(XMLClassDescriptorImpl).validateField(Object,
> ValidationContext, XMLFieldDescriptor) line: 1098
> StepValueDescriptor(XMLClassDescriptorImpl).validate(Object,
> ValidationContext) line: 1073
> PercentStepValueDescriptor(XMLClassDescriptorImpl).validate(Object,
> ValidationContext) line: 909
> PositionValueDescriptor(XMLClassDescriptorImpl).validate(Object,
> ValidationContext) line: 909
> FieldValidator(Validator).validate(Object, ValidationContext) line: 135
> FieldValidator.validate(Object, ValidationContext) line: 248
> GatePositionDescriptor(XMLClassDescriptorImpl).validateField(Object,
> ValidationContext, XMLFieldDescriptor) line: 1098
> GatePositionDescriptor(XMLClassDescriptorImpl).validate(Object,
> ValidationContext) line: 1068
> FieldValidator(Validator).validate(Object, ValidationContext) line: 135
> FieldValidator.validate(Object, ValidationContext) line: 248
> GatePositionListDescriptor(XMLClassDescriptorImpl).validateField(Object,
> ValidationContext, XMLFieldDescriptor) line: 1098
> GatePositionListDescriptor(XMLClassDescriptorImpl).validate(Object,
> ValidationContext) line: 1068
> Validator.validate(Object, ValidationContext) line: 135
> Marshaller.validate(Object) line: 2812
> Marshaller.marshal(Object) line: 905
>
> I've linked my property file:
> http://www.nabble.com/file/p21563938/castor.properties castor.properties
>
> If you need anything else, just ask.
>
> Thanks.
>
>
> Werner Guttmann wrote:
>> Hi,
>>
>> it all depends.
>>
>> Can you please give me a sample of what's going wrong after switching to
>> Castor 1.3rc1 without regenerating the Java POJOs ?
>>
>> Regards
>> Werner
>>
>> jpshields wrote:
>>> Hi,
>>>
>>> I'm pretty sure this question has already been answered before and I just
>>> missed it in the older posts because my problem seems just to big.
>>>
>>> I'm updating my castor framework from 1.0.3 to 1.3rc1 and the validations
>>> made by the marshalling framework does not work anymore and invalid
>>> values
>>> are slipping into my output xml files.
>>>
>>> My pojos were generated by castor 1.0.3 and I wanted to use the lenient
>>> properties (with 1.3rc1) to keep them and avoid unnecessary code
>>> rewriting
>>> based on those pojos. In my new castor.properties file, I kept the
>>> marshalling validation option to true like this:
>>>
>>> # True if all documents should be validated by the marshaling framework
>>> # Defaults to true.
>>> #
>>> org.exolab.castor.marshalling.validation=true
>>>
>>> I've doubled checked the validation parameter after the Marshaller
>>> instantiation and it outputs to "true" (like it should).
>>>
>>> Marshaller marshaller = new Marshaller(aWriter);
>>> String validate =
>>> marshaller.getProperty("org.exolab.castor.marshalling.validation");
>>>
>>> With the same code (generated by castor 1.0.3), if I change my
>>> castor.properties file and add the new jar, marshalling validation
>>> doesn't
>>> work anymore.
>>>
>>> I'm also using the new features with java 5.0 to use the internal JDK
>>> Xerces:
>>> org.exolab.castor.xml.serializer.factory=org.exolab.castor.xml.XercesJDK5XMLSerializerFactory
>>>
>>> I've also tried to generate new pojos with the 1.3rc1 source generator,
>>> but
>>> the same problem arise. I'm out of ideas. Is there another property I
>>> missed
>>> in the config file or some features that needs enabling?
>>>
>>> thanks in advance.
>>>
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>> http://xircles.codehaus.org/manage_email
>>
>>
>>
>>
>
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email