Author: mbrohl
Date: Sat Oct 28 14:19:22 2017
New Revision: 1813634

URL: http://svn.apache.org/viewvc?rev=1813634&view=rev
Log:
Improved: Fixing defects reported by FindBugs, package 
org.apache.ofbiz.service.rmi.socket.ssl.
(OFBIZ-9714)

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.

Modified:
    
ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/rmi/socket/ssl/SSLServerSocketFactory.java

Modified: 
ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/rmi/socket/ssl/SSLServerSocketFactory.java
URL: 
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/rmi/socket/ssl/SSLServerSocketFactory.java?rev=1813634&r1=1813633&r2=1813634&view=diff
==============================================================================
--- 
ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/rmi/socket/ssl/SSLServerSocketFactory.java
 (original)
+++ 
ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/rmi/socket/ssl/SSLServerSocketFactory.java
 Sat Oct 28 14:19:22 2017
@@ -71,9 +71,9 @@ public class SSLServerSocketFactory impl
 
         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());


Reply via email to