IDEA try-with-resources error: AutoCloseable
try (HttpPost post = new HttpPost(url)){
...
}catch(... | ... ){
}
Editor tip: incompatible types: try with resources is not applicable to variable types
Reason: the httppost used does not implement closeable and is not supported. The compiler automatically helps us complete close(), which is not available in httppost. If you want to test the writing method, you can use: closeablehttpclient, bufferedinputstream and so on. Finally, decompile it.
try (CloseableHttpClient client =HttpClients.createDefault();){
...
}...