svn commit: r1815119 - /ofbiz/ofbiz-framework/trunk/framework/start/src/main/java/org/apache/ofbiz/base/start/StartupControlPanel.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1815119 - /ofbiz/ofbiz-framework/trunk/framework/start/src/main/java/org/apache/ofbiz/base/start/StartupControlPanel.java

jleroux@apache.org
Author: jleroux
Date: Mon Nov 13 17:06:24 2017
New Revision: 1815119

URL: http://svn.apache.org/viewvc?rev=1815119&view=rev
Log:
Improved: Fixing defects reported by FindBugs, package
org.apache.ofbiz.base.start.
(OFBIZ-9573)

No functional change, while reviewing r1811413
I noticed we can use a try-with-ress here

Modified:
    ofbiz/ofbiz-framework/trunk/framework/start/src/main/java/org/apache/ofbiz/base/start/StartupControlPanel.java

Modified: ofbiz/ofbiz-framework/trunk/framework/start/src/main/java/org/apache/ofbiz/base/start/StartupControlPanel.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/start/src/main/java/org/apache/ofbiz/base/start/StartupControlPanel.java?rev=1815119&r1=1815118&r2=1815119&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/start/src/main/java/org/apache/ofbiz/base/start/StartupControlPanel.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/start/src/main/java/org/apache/ofbiz/base/start/StartupControlPanel.java Mon Nov 13 17:06:24 2017
@@ -150,21 +150,11 @@ final class StartupControlPanel {
     private static void loadGlobalOfbizSystemProperties(String globalOfbizPropertiesFileName) throws StartupException {
         String systemProperties = System.getProperty(globalOfbizPropertiesFileName);
         if (systemProperties != null) {
-            FileInputStream stream = null;
-            try {
-                stream = new FileInputStream(systemProperties);
-                System.getProperties().load(stream);
-                stream.close();
+            try { FileInputStream  stream = new FileInputStream(systemProperties);
+            System.getProperties().load(stream);
+            stream.close();
             } catch (IOException e) {
                 throw new StartupException("Couldn't load global system props", e);
-            } finally {
-                try {
-                    if (stream != null) {
-                    stream.close();
-                    }
-                } catch (IOException e) {
-                    System.out.println("There was a problem while closing the Stream " + e);
-                }
             }
         }
     }