You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by balellu <ba...@hotmail.com> on 2013/05/01 22:58:23 UTC

Customize JAXB unmarshalling error messages

I am looking at options to customize error message during JAXB unmarshalling
of service input. My goal is to add the property name which caused this
error.

JAXB unmarshalling provides basic error message 

/"xyz" is not of type int/

I want to customize it such that i could change it as 

*Input "customerAge=xyz" is not of type int.*

Using jaxws:property "jaxb-validation-event-handler" i was able to handle to
ValidationEventHandler and ValidationEvent and Locator inside
ValidationEvent. This provided me handle to

1. Error Message
2. Linked Exception (root exception)
3. Line and column number

I could also get handle to Node and Object but both are null. When i looked
around i figured out these will be not null only if the parser used by JAXB
is DOM or if i can over ErrorHandler on JAXB.

I tried setting jaxws:property "source-preferred-format" to "dom" but still
i get null for Node and Object on ValidationEvent.

I would like to know what is the best way to customize the error message
that were caused during JAXB unmarhsalling.

Thanks



--
View this message in context: http://cxf.547215.n5.nabble.com/Customize-JAXB-unmarshalling-error-messages-tp5727021.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Customize JAXB unmarshalling error messages

Posted by balellu <ba...@hotmail.com>.
Giving this a bump.



--
View this message in context: http://cxf.547215.n5.nabble.com/Customize-JAXB-unmarshalling-error-messages-tp5727021p5727446.html
Sent from the cxf-user mailing list archive at Nabble.com.