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

When bridging http endpoints and end users do not enable the bridgeEndpoint option they may get a NPE exception

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.18.0
    • Fix Version/s: 2.18.2, 2.19.0
    • Component/s: camel-http, camel-jetty
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      I noticed that you get a NullPointerException when you forget the bridgeEndpoint=true option when bridging two HTTP endpoints (first endpoint is a REST Jetty endpoint, second one also uses Jetty). Maybe Camel can warn in this case that the bridgeEndpoint parameter is missing.

      Simplified basic code (Java):

       restConfiguration().component("jetty").host("0.0.0.0").port(8080)
                      .dataFormatProperty("prettyPrint", "true")
                      .bindingMode(RestBindingMode.auto);
      
      rest("/API/").get("/{ID}/").to("jetty:http://www.google.com");
      

      HTTP Request to http://localhost:8080/API/1/ results in NullPointerException.

      Stacktrace:
      java.lang.NullPointerException
      at org.eclipse.jetty.client.HttpClient.send(HttpClient.java:521)
      at org.eclipse.jetty.client.HttpRequest.send(HttpRequest.java:694)
      at org.eclipse.jetty.client.HttpRequest.send(HttpRequest.java:678)
      at org.apache.camel.component.jetty9.JettyContentExchange9.send(JettyContentExchange9.java:228)
      at org.apache.camel.component.jetty.JettyHttpProducer.processInternal(JettyHttpProducer.java:247)
      at org.apache.camel.component.jetty.JettyHttpProducer.process(JettyHttpProducer.java:86)
      at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:145)
      at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
      at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:163)
      at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:542)
      at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
      at org.apache.camel.processor.Pipeline.process(Pipeline.java:120)
      at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)
      at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
      at org.apache.camel.component.jetty.CamelContinuationServlet.doService(CamelContinuationServlet.java:191)
      at org.apache.camel.http.common.CamelServlet.service(CamelServlet.java:74)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
      at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)
      at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587)
      at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
      at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
      at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
      at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
      at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
      at org.eclipse.jetty.server.Server.handle(Server.java:499)
      at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)
      at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
      at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)
      at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
      at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
      at java.lang.Thread.run(Thread.java:745)

      This issue is probably a bit related to the already resolved CAMEL-4242.

        Attachments

          Activity

            People

            • Assignee:
              davsclaus Claus Ibsen
              Reporter:
              fwein Frank Wein
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: