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

URLConnectionEngine can not create error stream on client

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 3.0.15.Final
    • 3.0.13.Final
    • jaxrs
    • 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:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: