From d52d6366effdbbcb243c06c031fe9f324f16c4a9 Mon Sep 17 00:00:00 2001 From: kurczews Date: Tue, 12 Dec 2017 15:47:55 +0100 Subject: Reduce complexity of HealthCheckUtils * Split bulk conditionals * Split health checks to separate methods * Fix minor issues Issue-ID: SO-353 Change-Id: Ib6298bc488a94aa4fbb253e3894532708547533d Signed-off-by: kurczews --- .../mso/properties/MsoJavaProperties.java | 25 ++++++++++++---------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'common') diff --git a/common/src/main/java/org/openecomp/mso/properties/MsoJavaProperties.java b/common/src/main/java/org/openecomp/mso/properties/MsoJavaProperties.java index 3675dd6178..f0ca191978 100644 --- a/common/src/main/java/org/openecomp/mso/properties/MsoJavaProperties.java +++ b/common/src/main/java/org/openecomp/mso/properties/MsoJavaProperties.java @@ -115,7 +115,6 @@ public class MsoJavaProperties extends AbstractMsoProperties { } finally { this.automaticRefreshInMinutes = this.getIntProperty(RELOAD_TIME_PROPERTY, DEFAULT_RELOAD_TIME_MIN); - // Always close the file try { if (reader != null) { reader.close(); @@ -155,27 +154,31 @@ public class MsoJavaProperties extends AbstractMsoProperties { return false; } MsoJavaProperties other = (MsoJavaProperties) obj; - if (!msoProperties.equals(other.msoProperties)) { - return false; - } - return true; + + return msoProperties.equals(other.msoProperties); } @Override public String toString() { - StringBuffer response = new StringBuffer(); - response.append("Config file " + propertiesFileName + "(Timer:" + automaticRefreshInMinutes + "mins):" - + System.getProperty("line.separator")); + StringBuilder response = new StringBuilder(); + response.append("Config file ") + .append(propertiesFileName) + .append("(Timer:") + .append(automaticRefreshInMinutes) + .append("mins):") + .append(System.lineSeparator()); + for (Object key : this.msoProperties.keySet()) { String propertyName = (String) key; response.append(propertyName); response.append("="); response.append(this.msoProperties.getProperty(propertyName)); - response.append(System.getProperty("line.separator")); + response.append(System.lineSeparator()); } - response.append(System.getProperty("line.separator")); - response.append(System.getProperty("line.separator")); + response.append(System.lineSeparator()); + response.append(System.lineSeparator()); + return response.toString(); } } -- cgit 1.2.3-korg