Schema validation in JAXB does not return validation errors to the client
-------------------------------------------------------------------------

                 Key: XFIRE-771
                 URL: http://jira.codehaus.org/browse/XFIRE-771
             Project: XFire
          Issue Type: Improvement
          Components: JAXB 2.0
    Affects Versions: 1.2.2
            Reporter: Alexander Ananiev
         Assigned To: Dan Diephouse


When schema validation is enabled for JAXB unmarshaling and it fails, the 
following code is used in org.codehaus.xfire.jaxb2.JaxbType.readObject:

        catch (JAXBException e)
        {
            throw new XFireFault("Could not unmarshall type.", e, 
XFireFault.RECEIVER);
        }

JAXBException in this case is the "Unmarshalling" exception, the actual 
validation exception is its cause. Hence, this code looses the cause exception 
since XFireFault does not handle exception chains. 

I use the following patch instead:

        catch (JAXBException jaxbEx)
        {
            Throwable ex = jaxbEx;
            if (jaxbEx.getLinkedException()!=null)
                ex=jaxbEx.getLinkedException();
            
            //throw new XFireFault("Could not unmarshall type.", ex, 
XFireFault.RECEIVER);
            throw new XFireFault( ex );
        }

But a better solution would be to change XfireFault so it collects messages 
from all exceptions in a chain, not just from the top one. 



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to