cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jason Pell (JIRA)" <>
Subject [jira] [Commented] (CXF-6312) Unusable error message for Unmarshall Error
Date Wed, 25 Mar 2015 06:58:52 GMT


Jason Pell commented on CXF-6312:

I added a sample of integrating the custom schema validation here.

The test case creates two servers, one with the custom event handlers registered and one with

I create two clients, one pointing at each server and submit a request that will fail validation.

My event handler adds "***" to content of the message, just as a test, and then I assert on

So it definately works just fine in 3.0.4 and 2.7.15.   There is no actual implementation
of the validation in cxf, you have to implement your own and ensure you implement the new
interfaces so that its correctly registered on the jaxb context and afterwards the appropriate
after [un]marshalling method is called to produce the exception.

If you don't want to create a new one per chain (as I have done in my own project), you can
implement your own.  Feel free to submit a PR via github if you want to contribute anything

If you think this feature can be better integrated, I will be more than happy to look at it.

> Unusable error message for Unmarshall Error
> -------------------------------------------
>                 Key: CXF-6312
>                 URL:
>             Project: CXF
>          Issue Type: Bug
>          Components: JAXB Databinding
>    Affects Versions: 3.0.3, 3.0.4
>            Reporter: EasternWahoo
>            Assignee: Jason Pell
>            Priority: Critical
> CXF soap faults for unmarshalling errors do not contain information useful in locating
the error.  For example, invalid content in an element  results in this faultString: Unmarshalling
Error: xxxx .   (Where xxxx is the invalid data)
> The full stack trace contains messages with location of the bad string, i.e. : 
>  [com.sun.istack.SAXParseException2; lineNumber: 5; columnNumber: 38; xxxx].   This fragment
in JAXBEncodeDecoder, extracts the message from the linked exception, i.e., the last exception
in the stack: 
>        } catch (PrivilegedActionException e) { 
>             Exception ex = e.getException(); 
>             if (ex instanceof Fault) { 
>                 throw (Fault)ex; 
>             } 
>             if (ex instanceof javax.xml.bind.UnmarshalException) { 
>                 javax.xml.bind.UnmarshalException unmarshalEx = (javax.xml.bind.UnmarshalException)ex;

>                 if (unmarshalEx.getLinkedException() != null) { 
>                     throw new Fault(new Message("UNMARSHAL_ERROR", LOG, 
>                                             unmarshalEx.getLinkedException().getMessage()),
> For more info, see this mailing list thread:

This message was sent by Atlassian JIRA

View raw message