Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-633

RESTEasy ClientInvoker throws generic RuntimeExceptions

    Details

    • Type: Enhancement
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 2.0.GA, 2.0.1.GA, 2.1.0.GA, 2.2.1, 2.2.2.GA, 2.2.3.GA
    • Fix Version/s: 3.0-beta-1, 2.3.5.Final
    • Component/s: jaxrs
    • Labels:
      None

      Description

      The invoke() method of the ClientInvoker class catches all Exceptions thrown by the underlying connection library (e.g., org.apache.http.conn.HttpHostConnectException, which is thrown when the remote host is not accepting connections) and wraps them in generic RuntimeExceptions. This is highly undesirable, as it forces the caller to "catch (RuntimeException)" (catching NPE's and other non-connection-related exceptions in the process) just to be able to react to connection problems. A more specific unchecked exception should be thrown instead so that the caller can distinguish between RuntimeExceptions caused by bugs in the code from mere connection issues.

      Additionally, the invoke() method also throws a generic RuntimeException if the object was constructed with a null value for baseUri. It would be far better to detect the null baseUri in ProxyFactory.create() and throw a NullPointerException before the ClientInvoker is even created, so that the root cause of the problem can be easily identified (rather than result in a generic error at a potentially much later time in the execution of the program).

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                ron_sigal Ronald Sigal
                Reporter:
                reggert Richard Eggert
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: