Uploaded image for project: 'HttpComponents HttpClient'
  1. HttpComponents HttpClient
  2. HTTPCLIENT-1851

Regression ClassCastException when connecting SSL

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • 4.5.3
    • 4.5.4
    • HttpClient (classic)
    • None

    Description

      I have a small program that makes a Rest call to get some data. With
      'org.apache.httpcomponents:httpclient:4.5.2', it works fine.
      Upgrading to org.apache.httpcomponents:httpclient:4.5.3, I'm getting a ClassCastException. Nothing else changed. 4.5.2 doesn't even seem to go through this code path at all.

      09:24:02.987 [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection released: [id: 0][route:

      {s}

      ->https://testserver:9091][total kept alive: 0; route allocated: 0 of 2; total allocated: 0 of 20]
      Exception in thread "main" java.lang.ClassCastException: [B cannot be cast to java.lang.String
      at org.apache.http.conn.ssl.DefaultHostnameVerifier.getSubjectAltNames(DefaultHostnameVerifier.java:309)
      at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:136)
      at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:123)
      at org.apache.http.conn.ssl.SSLConnectionSocketFactory.verifyHostname(SSLConnectionSocketFactory.java:463)
      at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:397)
      at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:355)
      at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:142)
      at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:359)
      at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:381)
      at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:237)
      at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185)
      at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
      at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:111)
      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.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56)
      at org.springframework.http.client.HttpComponentsClientHttpRequest.executeInternal(HttpComponentsClientHttpRequest.java:89)
      at org.springframework.http.client.AbstractBufferingClientHttpRequest.executeInternal(AbstractBufferingClientHttpRequest.java:48)
      at org.springframework.http.client.AbstractClientHttpRequest.execute(AbstractClientHttpRequest.java:53)
      at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:652)
      at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:628)
      at org.springframework.web.client.RestTemplate.getForObject(RestTemplate.java:303)

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              scarlson Scott Carlson
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: