pingidentity / scim2

The UnboundID SCIM 2.0 SDK for Java

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CreateRequestBuilder class throws ProcessingException

gaglanihetal opened this issue · comments

/**

  • Invoke the SCIM create request.
  • @param The type of object to return.
  • @param cls The Java class object used to determine the type to return.
  • @return The successfully modified SCIM resource.
  • @throws ScimException If an error occurred.
    */
    public C invoke(final Class cls) throws ScimException
    {
    Response response = buildRequest().post(
    Entity.entity(resource, getContentType()));
    try
    {
    if(response.getStatusInfo().getFamily() ==
    Response.Status.Family.SUCCESSFUL)
    {
    return response.readEntity(cls);
    }
    else
    {
    throw toScimException(response);
    }
    }
    finally
    {
    response.close();
    }
    }

I expect this method to throw ScimException as defined in its documentation but since the actual post is outside of the try catch, the ProcessingException from JAXRS makes it back to the calling method. Is this working as designed?

I think that this is working as designed, but the Javadoc could be more informative.

ScimExceptions model the various HTTP responses listed in RFC 7644, section 3.12. You should expect a subclass of ScimException to be thrown if the SCIM service returns a 40x or 50x status code to the client.

ProcessingExceptions are categorically different. The Javadoc for ProcessingException lists the following example causes:

  • failures in filter or interceptor chain execution,
  • errors caused by missing message body readers or writers for the particular Java type and media type combinations,
  • propagated IO exceptions thrown by entity readers and writers during entity serialization and de-serialization.
  • as well as any other JAX-RS runtime processing errors

To that, I'd add that you'd expect a ProcessingException when a network connection cannot be made.

I will update the Javadocs and add a @throws ProcessingException clause where appropriate.