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();){
...
}...
Read More:
- [Solved] SpringBoot Pack Project: Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources
- try-with-resource automatically closes the resources of the AutoClosable interface
- [Solved] Error:maven-resources-production:ruoyi-ywjs: java.lang.NegativeArraySizeException
- Resources is configured in the build of Maven project to prevent the failure of resource export
- [Solved] Read the resources resource and convert it to file error: java.io.filenotfoundexception
- Eclipse Error: There are no resources that can be added or removed from the server.
- [Solved] Error:Maven Resources Compiler: Maven project configuration required for module ‘XX‘ isn‘t available
- IDEA was Filed to Start: error launching idea (Failed to create JVM )
- [Solved] Spring Boot Package Error: Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0
- Idea create Maven project Error: [error] no longer supports source option 1.5. Please use version 1.6 or higher, and the idea reports an error: error: Java does not support the error of release version 5
- IDEA Maven Fail to Download Dependencies Error: ERROR – #org.jetbrains.idea.maven – Cannot reconnect.
- [How to Solve] Idea prompt does not support Lombok
- Idea error: (44,22) Java: constant string too long
- [Solved] IDEA startup Error: Java lang.StackOverflowError
- How to Solve IDEA @Autowired Error
- IDEA Import Servlet Package Error [How to Solve]
- [Solved] IDEA: Internal error (java.lang.UnsupportedClassVersionError)
- [Solved] IDEA error: sun.security.pkcs not found
- [Solved] IDEA mvn Error: GC overhead limit exceeded
- IDEA Error: Command line is too long [How to Solve]