Yaldiz, Sunay wrote:
Hello,
I got such an exception when I try to marshall an array which is
created, but whose elements are null. I of course have the validation
property of the my marshaller set to true. I tried similar thing by marshalling with an object whose reference was
null. This object was not of type collection. I thought I would get
validation exception also here, but I did not. So, my question is, why do I get exception in the first case, but not in
the second? Actually what I want is that even if I want the marshalling
validated, I don't really want to get an exception because the array
elements are null. Is it possible?

It seems the problem is in FieldValidator.validate(Object object, ValidationContext context):
...
if (type.isArray()) {
byteArray = (type.getComponentType() == Byte.TYPE);
if (!byteArray) {
size = Array.getLength(value);
if (_validator != null) {
for (int i = 0; i < size; i++)
_validator.validate(Array.get(value, i), context);
}
else {
for (int i = 0; i < size; i++)
super.validate(Array.get(value, i), context);
}
}
}



Perhaps it's possible to override the validator, but someone else has to comment on that.


You can patch the code and/or submit a bug-report on http://bugzilla.exolab.org.

Stein

----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev


Reply via email to