findbug_fixes
Change-Id: I90889d3cfbab6bcfee241932b5dbbe2b148d7806
diff --git a/src/main/java/net/floodlightcontroller/core/internal/Controller.java b/src/main/java/net/floodlightcontroller/core/internal/Controller.java
index b464dbc..7374803 100644
--- a/src/main/java/net/floodlightcontroller/core/internal/Controller.java
+++ b/src/main/java/net/floodlightcontroller/core/internal/Controller.java
@@ -1648,12 +1648,14 @@
protected Role getInitialRole(Map<String, String> configParams) {
Role role = null;
String roleString = configParams.get("role");
+ FileInputStream fs = null;
if (roleString == null) {
String rolePath = configParams.get("rolepath");
if (rolePath != null) {
Properties properties = new Properties();
try {
- properties.load(new FileInputStream(rolePath));
+ fs = new FileInputStream(rolePath);
+ properties.load(fs);
roleString = properties.getProperty("floodlight.role");
} catch (IOException exc) {
// Don't treat it as an error if the file specified by the
@@ -1661,6 +1663,14 @@
// HA mechanism by just creating/setting the floodlight.role
// property in that file without having to modify the
// floodlight properties.
+ } finally {
+ if (fs != null) {
+ try {
+ fs.close();
+ } catch (IOException e) {
+ log.error("Exception while closing resource ", e);
+ }
+ }
}
}
}
diff --git a/src/main/java/net/floodlightcontroller/core/internal/RoleChanger.java b/src/main/java/net/floodlightcontroller/core/internal/RoleChanger.java
index 6f1a350..6252a72 100644
--- a/src/main/java/net/floodlightcontroller/core/internal/RoleChanger.java
+++ b/src/main/java/net/floodlightcontroller/core/internal/RoleChanger.java
@@ -118,7 +118,7 @@
protected long lastSubmitTime;
protected Thread workerThread;
protected long timeout;
- protected static long DEFAULT_TIMEOUT = 15L * 1000 * 1000 * 1000L; // 15s
+ protected final static long DEFAULT_TIMEOUT = 15L * 1000 * 1000 * 1000L; // 15s
protected final static Logger log = LoggerFactory.getLogger(RoleChanger.class);
/**