You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by douglassparker <do...@me.com> on 2011/11/02 21:17:30 UTC

Re: ExceptionMapper choosing the wrong mapper

I have a similar, but different issue.  I have an Exception mapper for
javax.xml.stream.XMLStreamException.  I also have other mappers and a
fallback mapper for Throwable.  If an exception is thrown that is a SUBCLASS
of XmlStreamException, it is handled by the Throwable Mapper, and not by the
XmlStreamException mapper.  I don't want to create mappers for every
concrete exception type.  Exception mappers are supposed to respect
inheritance.  Any suggestions?  

--
View this message in context: http://cxf.547215.n5.nabble.com/ExceptionMapper-choosing-the-wrong-mapper-tp4775881p4959214.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: ExceptionMapper choosing the wrong mapper

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
On 02/11/11 20:36, douglassparker wrote:
> On further reflection, this may or may not be a problem with the exception
> mappers.  I was trying to send back a Response.Status.BAD_REQUEST when the
> client sends malformed XML.  But I suppose the issue could be that the CXF
> interceptors are throwing the exception and the exception mappers never have
> a chance to handle it.  The specific exception is
> com.ctc.wstx.exc.WstxUnexpectedCharException.  This is a subclass of
> XMLStreamException, so I was hoping there was a way to map it the way I
> wanted.
>
Where is this exception originating from, from JAXBElementProvider ?
If so then it will be wrapped in the instance of 
WebApplicationException, so what you can do in that case is to register 
a custom WebApplicationException mapper

Sergey

> --
> View this message in context: http://cxf.547215.n5.nabble.com/ExceptionMapper-choosing-the-wrong-mapper-tp4775881p4959271.html
> Sent from the cxf-user mailing list archive at Nabble.com.


Re: ExceptionMapper choosing the wrong mapper

Posted by douglassparker <do...@me.com>.
On further reflection, this may or may not be a problem with the exception
mappers.  I was trying to send back a Response.Status.BAD_REQUEST when the
client sends malformed XML.  But I suppose the issue could be that the CXF
interceptors are throwing the exception and the exception mappers never have
a chance to handle it.  The specific exception is
com.ctc.wstx.exc.WstxUnexpectedCharException.  This is a subclass of
XMLStreamException, so I was hoping there was a way to map it the way I
wanted.   

--
View this message in context: http://cxf.547215.n5.nabble.com/ExceptionMapper-choosing-the-wrong-mapper-tp4775881p4959271.html
Sent from the cxf-user mailing list archive at Nabble.com.