jersey
  1. jersey
  2. JERSEY-1468

Jersey prints error stack trace instead of throwing the error from Response#readEntity()

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.0-m08
    • Fix Version/s: 2.0-m10, 2.0
    • Component/s: core
    • Labels:
      None

      Description

      class Interceptor implements ReaderInterceptor{
      	@Override
      	public Object aroundReadFrom(ReaderInterceptorContext ctx)
      			throws IOException, WebApplicationException {
      		throw new IOException("error");
      	}
      }
      
      response = invocation.invoke();
      String entity = response.readEntity(String.class);
      

      I throw the exception in the ReaderInterceptor, but
      readEntity (InboundMessageContext) prints the stack trace of the IOException and returns the original entity.

      Java has no way to get know the Exception occurred, i.e. there is no programatic way to get know the Exception occurred in the interceptor. Also, the throwing of IOException in the interceptor has no meaning this way. Better way to do this is the way it is done in bufferEntity, where IOException is encapsulated in MessageProcessingException.

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Michal Gajdos
            Reporter:
            jan.supol
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 3 hours
              3h
              Remaining:
              0m
              Logged:
              Time Not Required
              1m