You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Rob Spoor (Jira)" <ji...@apache.org> on 2022/11/11 09:18:00 UTC

[jira] [Created] (HTTPCORE-728) SSLIOSession uses SSLEngine.getApplicationProtocol() which doesn't exist in all Java 8 versions

Rob Spoor created HTTPCORE-728:
----------------------------------

             Summary: SSLIOSession uses SSLEngine.getApplicationProtocol() which doesn't exist in all Java 8 versions
                 Key: HTTPCORE-728
                 URL: https://issues.apache.org/jira/browse/HTTPCORE-728
             Project: HttpComponents HttpCore
          Issue Type: Bug
          Components: HttpCore
    Affects Versions: 5.2
            Reporter: Rob Spoor


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:
{code}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){code}
I've done a comparison between version 5.1.3 and 5.2, and this change is causing the issue:

5.1.3:
{code}final String applicationProtocol = ReflectionUtils.callGetter(this.sslEngine, "ApplicationProtocol", String.class);{code}
5.2:
{code}final String applicationProtocol = this.sslEngine.getApplicationProtocol();{code}
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():
{quote}Since:
9{quote}
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--:
{quote}API Note:
This method is defined in Java SE 8 Maintenance Release 3.{quote}
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.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org