Uploaded image for project: 'HttpComponents HttpCore'
  1. HttpComponents HttpCore
  2. HTTPCORE-728

SSLIOSession uses SSLEngine.getApplicationProtocol() which doesn't exist in all Java 8 versions

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Not A Problem
    • 5.2
    • None
    • HttpCore
    • None

    Description

      We have a Renovate bot that upgraded the HttpClient version from 5.1.3 to 5.2. Tests that were working before now started failing with the following message:

      Exception in thread "I/O server dispatch-1" java.lang.NoSuchMethodError: javax.net.ssl.SSLEngine.getApplicationProtocol()Ljava/lang/String;
      	at org.apache.hc.core5.reactor.ssl.SSLIOSession.doHandshake(SSLIOSession.java:429)

      I've done a comparison between version 5.1.3 and 5.2, and this change is causing the issue:

      5.1.3:

      final String applicationProtocol = ReflectionUtils.callGetter(this.sslEngine, "ApplicationProtocol", String.class);

      5.2:

      final String applicationProtocol = this.sslEngine.getApplicationProtocol();

      The cause of the issue is that this method is officially added in Java 9. From https://docs.oracle.com/en/java/javase/19/docs/api/java.base/javax/net/ssl/SSLEngine.html#getApplicationProtocol():

      Since:
      9

      It seems that this method is backported to Java 8, but not to all versions. From https://docs.oracle.com/javase/8/docs/api/javax/net/ssl/SSLEngine.html#getApplicationProtocol--:

      API Note:
      This method is defined in Java SE 8 Maintenance Release 3.

      One solution could be to make users upgrade Java 8 to the latest version (our build server currently uses version 1.8.0_221). However, that may not work for everybody.

      Attachments

        Activity

          People

            Unassigned Unassigned
            Spoor Rob Spoor
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: