users@jersey.java.net

MarshalException not caught in AbstractRootElementProvider

From: Bao,Sam <Sam.Bao_at_Cerner.com>
Date: Thu, 6 Aug 2009 16:41:01 -0500

In the writeTo method in AbstractRootElementProvider, it doesn't catch for MarshalException similar to how the readFrom method catches the UnmarshalException in line 99. So the resource is still return a 200 status with no response entity.

 

So I had previously asked about how to handle the WebApplicationException with status 400, and so I was thinking that likewise it would apply to MarshalException except for the fact that it's never caught and rethrow WebApplicationException for my exception mapper to handle. What is the reason MarshalException is not caught? Is it intentional or an oversight? I'm leaning towards the former and thus would like to understand the reason. Mainly because I'm still getting a 200 status which is definitely not correct. In the meantime, how should I handle being able to return my own status code and response entity? I thought about validating and marshalling the xml myself. The other was to extend AbstractRootElementProvider and override the writeTo method. I'm leaning towards the first idea, but I'd like to hear other suggestions and comments.

 

Thanks.

 

----------------------------------------------------------------------
CONFIDENTIALITY NOTICE This message and any included attachments are from Cerner Corporation and are intended only for the addressee. The information contained in this message is confidential and may constitute inside or non-public information under international, federal, or state securities laws. Unauthorized forwarding, printing, copying, distribution, or use of such information is strictly prohibited and may be unlawful. If you are not the addressee, please promptly delete this message and notify the sender of the delivery error by e-mail or you may call Cerner's corporate offices in Kansas City, Missouri, U.S.A at (+1) (816)221-1024.