Here is my code :
KeyStore truststore = KeyStore.getInstance("JKS");
truststore.load(new FileInputStream(TRUSTSTORE_FILE),
TRUSTSTORE_PASSWORD.toCharArray()); //sonarqube issue
Which is the most suitable InputStream for getting this done?
Here is the full error :
This method creates and uses a java.io.FileInputStream or java.io.FileOutputStream object. Unfortunately both of these classes implement a finalize method, which means that objects created will likely hang around until a full garbage collection occurs, which will leave excessive garbage on the heap for longer, and potentially much longer than expected.
Do I really need to switch to :
InputStream is = java.nio.file.Files.newInputStream(myfile.toPath());
I am not comfortable with this one.