Author: jleroux
Date: Sun Dec 17 21:33:27 2017
New Revision: 1818514
URL:
http://svn.apache.org/viewvc?rev=1818514&view=revLog:
Improved: Fixing defects reported by FindBugs, package
org.apache.ofbiz.base.start.
(OFBIZ-9573)
For r1815119 I wrote:
No functional change, while reviewing r1811413
I noticed we can use a try-with-ress here
Fixes a possible not closed
As reported by Michael on dev ML:
if I see it right, you have not implemented a try-with-resources block but
simply moved the stream declaration inside the try block and removed the
finally block. Please check.
Michael was right, here is the fix
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=1818514&r1=1818513&r2=1818514&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 Sun Dec 17 21:33:27 2017
@@ -150,9 +150,8 @@ final class StartupControlPanel {
private static void loadGlobalOfbizSystemProperties(String globalOfbizPropertiesFileName) throws StartupException {
String systemProperties = System.getProperty(globalOfbizPropertiesFileName);
if (systemProperties != null) {
- try { FileInputStream stream = new FileInputStream(systemProperties);
+ 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);
}