Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-5943

Throw error in exceptionmapper

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.0
    • 2.7.13, 3.0.2, 3.1
    • JAX-RS
    • None
    • Unknown

    Description

      In ExceptionUtils.convertFaultToResponse(), it only catches Exception. So CXF fails to process the request if we throw Error in our own XXXExceptionMapper. The definition of ExceptionMapper is:
      Interface ExceptionMapper<E extends Throwable> So I think we should catch Throwable instead.

      if (response == null) {
      ExceptionMapper<T> mapper =
      ServerProviderFactory.getInstance(inMessage).createExceptionMapper(ex.getClass(), inMessage);
      if (mapper != null) {
      try

      { response = mapper.toResponse(ex); }

      catch (Exception mapperEx)

      { inMessage.getExchange().put(JAXRSUtils.EXCEPTION_FROM_MAPPER, "true"); mapperEx.printStackTrace(); return Response.serverError().build(); }


      }
      }
      }

      Attachments

        1. cxf-5943.patch
          13 kB
          Iris Ding

        Activity

          People

            sergey_beryozkin Sergey Beryozkin
            irisding Iris Ding
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: