Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-12363

ServerErrorRetryStrategy throws ClassCastException for BasicHttpRequest (not assignable to HttpRequestWrapper)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • Apache Sling Testing Clients 3.0.20, Apache Sling Testing Clients 3.0.22, Apache Sling Testing Clients 3.0.24
    • Testing Clients 3.1.0
    • None

    Description

      Relates to SLING-11748

      https://github.com/apache/sling-org-apache-sling-testing-clients/pull/42

      During a network outage, some executions of integration tests using SlingClient started failing with the following stack trace:

       

      [ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 327.4 s <<< FAILURE! -- in com.adobe.cq.cloud.testing.it.smoke.PublishEndToEndIT
      [ERROR] com.adobe.cq.cloud.testing.it.smoke.PublishEndToEndIT.testActivateAndDeactivate -- Time elapsed: 327.2 s <<< ERROR!
      java.lang.ClassCastException: Cannot cast org.apache.http.message.BasicHttpRequest to org.apache.http.client.methods.HttpRequestWrapper
      	at java.base/java.lang.Class.cast(Class.java:3889)
      	at org.apache.http.protocol.HttpCoreContext.getAttribute(HttpCoreContext.java:119)
      	at org.apache.sling.testing.clients.util.ServerErrorRetryStrategy.getRequestDetails(ServerErrorRetryStrategy.java:96)
      	at org.apache.sling.testing.clients.util.ServerErrorRetryStrategy.retryRequest(ServerErrorRetryStrategy.java:58)
      	at org.apache.http.impl.execchain.ServiceUnavailableRetryExec.execute(ServiceUnavailableRetryExec.java:88)
      	at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
      	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72)
      	at org.apache.sling.testing.clients.interceptors.FormBasedAuthInterceptor.doLogin(FormBasedAuthInterceptor.java:141)
      	at org.apache.sling.testing.clients.interceptors.FormBasedAuthInterceptor.process(FormBasedAuthInterceptor.java:80)
      	at org.apache.http.protocol.ImmutableHttpProcessor.process(ImmutableHttpProcessor.java:133)
      	at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
      	at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
      	at org.apache.http.impl.execchain.ServiceUnavailableRetryExec.execute(ServiceUnavailableRetryExec.java:85)
      	at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
      	at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
      	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
      	at org.apache.sling.testing.clients.AbstractSlingClient.execute(AbstractSlingClient.java:698)
      	at org.apache.sling.testing.clients.AbstractSlingClient.doStreamRequest(AbstractSlingClient.java:326)
      	at org.apache.sling.testing.clients.AbstractSlingClient.doStreamGet(AbstractSlingClient.java:440)
      	at org.apache.sling.testing.clients.AbstractSlingClient.doGet(AbstractSlingClient.java:503)
      	at org.apache.sling.testing.clients.AbstractSlingClient.doGet(AbstractSlingClient.java:539)
      	at org.apache.sling.testing.clients.SlingClient.exists(SlingClient.java:202)
      	at com.adobe.cq.testing.junit.rules.Page.prepare(Page.java:151)
      	at com.adobe.cq.testing.junit.rules.Page.before(Page.java:82) 

      The type expected by getRequestDetails() should probably be changed from HttpRequestWrapper to org.apache.http.HttpRequest, which is a common interface for both BasicHttpRequest and HttpRequestWrapper, and which happens to define the getRequestLine() method .

       

       

      Attachments

        Issue Links

          Activity

            People

              pfaffm@adobe.com Marc Pfaff
              madamcin Mark Adamcin
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: