users@jaxb.java.net

Re: (feature request/bug) -- ValidatorImpl constructor doesn't initialize DatatypeConverter

From: Ryan Shoemaker - JavaSoft East <Ryan.Shoemaker_at_Sun.COM>
Date: Tue, 07 Sep 2004 10:31:19 -0400

jon gold wrote:

> if there's a need for a use case, here it is (and the reason i ended up
> finding all of this out): i have a swing app which my users use to fill
> in various values. unbeknownst to them, the values are actually turned
> into a jaxb object. when they hit save, they're marshalling, but i want
> to validate first, or course. thus, i'm creating jaxb objects from scratch,
> and calling validate before ever trying to marshal or unmarshal.

This sounds like a bug to me, but I haven't been able to reproduce it.

I modified $JAXB_HOME/samples/create-marshal to call validate before
marshal, but it seemed to work fine.

*** 101,109 ****

               // set the required Items list
               po.setItems( items );
!
! jc.createValidator().validate( po );
!
               // create a Marshaller and marshal to System.out
               Marshaller m = jc.createMarshaller();
               m.setProperty( Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE );
--- 101,107 ----

               // set the required Items list
               po.setItems( items );
!
               // create a Marshaller and marshal to System.out
               Marshaller m = jc.createMarshaller();
               m.setProperty( Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE );

It would be very helpful if you could put together a small test case
that reproduces the problem. Also, let me know which version of the
RI you are running ("% xjc -version").

It might be a bug that the javadoc doesn't state that the datatype
converter must be initialized before validation. I'll check with
the spec guys.

Thanks,

--Ryan


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net