Skip to main content

Customized JAXBValidation Fault

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
1 reply [Last post]
Anonymous

Hello All,

I would like to create a detailed collection of
JAXBValidationException(s) to send it to the client

I've annotated the
@SchemaValidation(handler=MyValidationErrorHandler.class) and my
extended class of ValidationErrorHandler works.
But the SAXParseException in my ValidationErrorHandler is like this

value 'b' with length = '1' is not facet-valid with respect to
minLength '2' for type 'validStringType'
The value 'b' of element 'ns2:name' is not valid.

and this is only the first occurance of a validationError.

This is not enough to create a usefull fault object for the client like
this:

...

Project
projectName
alue 'b' with length = '1' is not facet-valid with
respect to minLength '2' for type 'validStringType'
The value 'b' of element 'ns2:projectName' is not
valid.

Project
projectDecription
alue 'b' with length = '1' is not facet-valid with
respect to minLength '2' for type 'validStringType'
The value 'b' of element 'ns2:projectDecription' is
not valid.

...

Is there a possibiltiy to register a customized ValidationEventHandler
(which collects all errors) in the handler chain? Whow?

Thanks in advance

Tom

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Thomas Grabietz

possibly the Sax parser enters the ValidationErrorHandler with every
occurence of an error. So it's also possible to lookup the param name in
the wscontext to create the collection of errors.

Any better approaches?

Tom

On 17.01.2013 11:14, tom@toms-toy.de wrote:
> Hello All,
>
> I would like to create a detailed collection of
> JAXBValidationException(s) to send it to the client
>
> I've annotated the
> @SchemaValidation(handler=MyValidationErrorHandler.class) and my
> extended class of ValidationErrorHandler works.
> But the SAXParseException in my ValidationErrorHandler is like this
>
> value 'b' with length = '1' is not facet-valid with respect to
> minLength '2' for type 'validStringType'
> The value 'b' of element 'ns2:name' is not valid.
>
> and this is only the first occurance of a validationError.
>
> This is not enough to create a usefull fault object for the client like
> this:
>
> ...
>
>
> Project
> projectName
> alue 'b' with length = '1' is not facet-valid with
> respect to minLength '2' for type 'validStringType'
> The value 'b' of element 'ns2:projectName' is not
> valid.
>
>
> Project
> projectDecription
> alue 'b' with length = '1' is not facet-valid with
> respect to minLength '2' for type 'validStringType'
> The value 'b' of element 'ns2:projectDecription' is
> not valid.
>
> ...
>
>
> Is there a possibiltiy to register a customized ValidationEventHandler
> (which collects all errors) in the handler chain? Whow?
>
> Thanks in advance
>
> Tom
>