Interesting. I just debugged into JAXB a bit for this. By default, JAXB treats such exception as "recoverable" and pretty much just ignores them. You can configure a JAXB ValidationEventHandler on the JAXBDataBinding in CXF that would do something a bit smarter than that.
The REALLY interesting thing with JAXB is that by default, the default ValidationEventHandler is the Unmarshaller itself, which would ignore it. However, if you call unmarshaller.setEventHandler(null), the default event handler gets set to a new javax.xml.bind.helpers.DefaultValidationEventHandler that DOESN'T ignore them. I'm going to try calling unmarshaller.setEventHandler(null) as the default for future versions of CXF. It just makes more sense to me to make sure exceptions get propagated properly. However, for now, you should be able to configure the event handler into the databinding to use. Dan On Wed August 19 2009 6:02:21 am Sergey Pulyaev INTEGO wrote: > I have the following situation: > Web service function receives a value object with some properties and > one of the properties have a check in the setter - is value correct. > > But when the exception thrown about incorrect value it is catched by > Accessor.handleInvocationTargetException, > converted into AccessorException and that's all... > > So - i receive almost correct value object without problem field set. > > How can i stop processing unmarshalling on error in setter? > > The only throwable that will stop unmarshalling is a java.lang.Error.... > > Best regards > Sergey > > -------- > This data is for general information only and shall not be used to produce > documents of any kind without same being submitted to, reviewed by, and > approved by Intego in writing. All data is subject to change. User assumes > all liability relating to the use of this data and agrees to release, > indemnify, and hold harmless Intego from any and all claims relating said > use. User is responsible to check for any viruses before use. -- Daniel Kulp [email protected] http://www.dankulp.com/blog
