You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Johan Compagner (Jira)" <ji...@apache.org> on 2022/08/24 07:21:00 UTC

[jira] [Comment Edited] (HTTPCORE-724) org.apache.hc.core5.util.ReflectionUtils us using illegal reflective access

    [ https://issues.apache.org/jira/browse/HTTPCORE-724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17584059#comment-17584059 ] 

Johan Compagner edited comment on HTTPCORE-724 at 8/24/22 7:20 AM:
-------------------------------------------------------------------

Ah i guess this line:

 

[httpcomponents-client/AsyncClientTlsAlpn.java at 5.1.x · apache/httpcomponents-client (github.com)|https://github.com/apache/httpcomponents-client/blob/5.1.x/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientTlsAlpn.java#L60]

 

means really "java 9 and newer" not "older" right?

 

1 problem is that if you compile still against java 8 but people run your stuff on java 17 (they can choose) then this is a bit of a problem

 

i would expect that this would be documented better (but searching for it or looking for it didn't result in anything, and when just running on java 17, you also don't get any reflected access warning anymore, so you don't have any idea)

 


was (Author: jcompanger@gmail.com):
Ah i guess this line:

 

[httpcomponents-client/AsyncClientTlsAlpn.java at 5.1.x · apache/httpcomponents-client (github.com)|https://github.com/apache/httpcomponents-client/blob/5.1.x/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientTlsAlpn.java#L60]

 

means really "java 9 and newer" not "older" right?

 

1 problem is that if you compile still against java 8 but people run your stuff on java 17 (they can choose) then this is a bit of a problem

 

> org.apache.hc.core5.util.ReflectionUtils us using illegal reflective access
> ---------------------------------------------------------------------------
>
>                 Key: HTTPCORE-724
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-724
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>    Affects Versions: 5.1.4
>            Reporter: Johan Compagner
>            Priority: Major
>
> a basic example:
>  
>  
>  
> {code:java}
> public class Main {
>     public static void main(String[] args) throws IOException, InterruptedException, ExecutionException, NoSuchAlgorithmException {
>         System.err.println(String.join(" ", SSLContext.getDefault().getSupportedSSLParameters().getProtocols()));
>         try (CloseableHttpAsyncClient client = HttpAsyncClients.createDefault()) {
>             client.start();
>             SimpleHttpRequest request1 = SimpleRequestBuilder.get("https://www.google.com/").build();
>             Future<SimpleHttpResponse> future = client.execute(request1, null);
>             // and wait until response is received
>             SimpleHttpResponse response1 = future.get();
>             System.out.println(request1.getRequestUri() + "->" + response1.getCode());
>         };
>     }
> {code}
>  
>  
> does not work under java 16 or higher
>  
> in java 16 you can get around it by using:
> --illegal-access=permit
> but in java 17 that is not allowed anymore, that is ignored.
> if you run it with java 15 you will get:
>  
> WARNING: Illegal reflective access by org.apache.hc.core5.util.ReflectionUtils$1 ([file:/C:/workspace_master/HttpTest/lib/httpcore5-5.1.4.jar|file:///C:/workspace_master/HttpTest/lib/httpcore5-5.1.4.jar]) to method sun.security.ssl.SSLEngineImpl.getApplicationProtocol()
>  
> and after that line if i enabled wire logging everything goes different, (i think java 16/17 then just try todo http1.1)
>  
>  
>  



--
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