Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-4325

Wrong exception uri when an HTTP error code is returned

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.6.0, 2.7.0, 2.8.0
    • 2.8.2, 2.9.0
    • camel-restlet
    • None
    • Novice

    Description

      When a REST service returns an HTTP error code (e.g. 404), the URI property of the exception is incorrect.
      The URI is the URI of the origin endpoint of the route.
      It should be instead the URI of the endpoint that threw the exception.

      For instance, in the following route :

      <route id="restproxy">           
          <from uri="restlet:http://localhost:9080/oe/ws/offre/{id}"/>           
          <doTry>
              <to uri="restlet:http://bla.dot.com:8080/oe/ws/offre/{id}"/>
              <doCatch>
                  <exception>org.apache.camel.CamelException</exception>
                  <log message="URI=${exception.uri}"/>
              </doCatch>
          </doTry>
      </route>
      

      The logged URI is "restlet:http://localhost:9080/oe/ws/offre/

      {id}

      " but should be instead the real URI used, e.g. "restlet:http://bla.dot.com:8080/oe/ws/offre/1".

      This bug might be fixed by the following code change in class org.apache.camel.component.restlet.RestletProducer, method populateRestletProducerException() :

      • String uri = exchange.getFromEndpoint().getEndpointUri();
        + String uri = response.getRequest().getResourceRef()

      Attachments

        Activity

          People

            njiang Willem Jiang
            cedric.delaunois Cedric de Launois
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: