Improved: Fixing defects reported by FindBugs, package
org.apache.ofbiz.service.rmi.socket.ssl.
I modified the patch to keep the previous logic to get the SSL server
socket. The cast should be safe because of the SSLServerSocketFactory
being used to get the socket.
Thanks Dennis Balkir for reporting and providing the patch.
@@ -71,9 +71,9 @@ public class SSLServerSocketFactory implements RMIServerSocketFactory, Serializa
KeyStore ks = null;
if (keystore != null) {
- try {
+ try (FileInputStream fis = new FileInputStream(keystore)) {
ks = KeyStore.getInstance(ksType);
- ks.load(new FileInputStream(keystore), passphrase);
+ ks.load(fis, passphrase);
} catch (NoSuchAlgorithmException e) {
Debug.logError(e, module);
throw new IOException(e.getMessage());
