Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-2496

URLConnectionEngine can not create error stream on client

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 7.0.0.ER6
    • 7.0.0.ER3
    • REST
    • None

      Description of problem:
      URLConnectionEngine can not create error stream on client with EAP, if proxy is used.

      Attached reproducer is based on ApacheHttpClient4Test from upstream TS.

      In this usecase, client is based on URLConnectionEngine:

      ClientHttpEngine executor = new URLConnectionEngine();
      ResteasyClient client = new ResteasyClientBuilder().httpEngine(executor).build();
      

      and error method from proxy is used (this method should return 404 and NotFoundException)

          @GET
          @Path("error")
          @Produces("text/plain")
          String error();
      

      Proxy don't have created error stream, but proxy try to close error stream, so NullPointerException is thrown.

      How reproducible:
      Always

      Steps to Reproduce: (use attached reproducer)

      1. mvn test -Djboss.home=${EAP_HOME}

      Actual results:

      Exception in thread "Thread-11" Exception in thread "Thread-13" Exception in thread "Thread-12" javax.ws.rs.ProcessingException: java.lang.NullPointerException
      	at org.jboss.resteasy.client.jaxrs.internal.ClientResponse.close(ClientResponse.java:108)
      	at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.extractResult(ClientInvocation.java:179)
      	at org.jboss.resteasy.client.jaxrs.internal.proxy.extractors.BodyEntityExtractor.extractEntity(BodyEntityExtractor.java:59)
      	at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientInvoker.invoke(ClientInvoker.java:104)
      	at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientProxy.invoke(ClientProxy.java:64)
      	at com.sun.proxy.$Proxy45.error(Unknown Source)
      	at org.jboss.resteasy.test.client.other.ApacheHttpClient4Test.callProxy(ApacheHttpClient4Test.java:295)
      	at org.jboss.resteasy.test.client.other.ApacheHttpClient4Test.access$200(ApacheHttpClient4Test.java:52)
      	at org.jboss.resteasy.test.client.other.ApacheHttpClient4Test$4.run(ApacheHttpClient4Test.java:211)
      Caused by: java.lang.NullPointerException
      	at org.jboss.resteasy.client.jaxrs.engines.URLConnectionEngine$1.releaseConnection(URLConnectionEngine.java:87)
      	at org.jboss.resteasy.client.jaxrs.internal.ClientResponse.close(ClientResponse.java:105)
      	... 8 more
      

      Expected results:
      NotFoundException

            rsigal@redhat.com Ronald Sigal
            mkopecky@redhat.com Marek Kopecky
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: