diff options
author | Charles Cole <cc847m@att.com> | 2017-12-04 14:47:04 -0600 |
---|---|---|
committer | Charles Cole <cc847m@att.com> | 2017-12-04 21:09:13 +0000 |
commit | da75a5e8cd3e64fb8e7efa8db18e1a488870d0dc (patch) | |
tree | 158dda481852435ea14c12404815d510b21be444 /common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/PropertyUtil.java | |
parent | e73c82943d4a1e6dffd7712837d50e58c01bef7b (diff) |
Fix sonar issues in ONAP-logging
Fixed the Sonar issues in ONAP-logging that required minimal refactoring
of the code. Many of the System.out and System.err issues I did not
fix, as I don't know what loggers to use.
Issue-ID: POLICY-458
Change-Id: I8eccb932b350a170b9cd680b90009e6612a0abcd
Signed-off-by: Charles Cole <cc847m@att.com>
Diffstat (limited to 'common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/PropertyUtil.java')
-rw-r--r-- | common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/PropertyUtil.java | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/PropertyUtil.java b/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/PropertyUtil.java index d2a98239..1bc57f01 100644 --- a/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/PropertyUtil.java +++ b/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/PropertyUtil.java @@ -37,6 +37,14 @@ import java.util.TimerTask; */ public class PropertyUtil { + + // timer thread used for polling for property file changes + private static Timer timer = null; + + // this table maps canonical file into a 'ListenerRegistration' instance + private static HashMap<File, ListenerRegistration> registrations = + new HashMap<>(); + /** * Read in a properties file * @param file the properties file @@ -45,7 +53,7 @@ public class PropertyUtil * does not exist or can't be opened, and 'IOException' if there is * a problem loading the properties file. */ - static public Properties getProperties(File file) throws IOException + public static Properties getProperties(File file) throws IOException { // create an InputStream (may throw a FileNotFoundException) FileInputStream fis = new FileInputStream(file); @@ -73,16 +81,13 @@ public class PropertyUtil * does not exist or can't be opened, and 'IOException' if there is * a problem loading the properties file. */ - static public Properties getProperties(String fileName) throws IOException + public static Properties getProperties(String fileName) throws IOException { return getProperties(new File(fileName)); } /* ============================================================ */ - // timer thread used for polling for property file changes - private static Timer timer = null; - /** * This is the callback interface, used for sending notifications of * changes in the properties file. @@ -99,10 +104,6 @@ public class PropertyUtil void propertiesChanged(Properties properties, Set<String> changedKeys); } - // this table maps canonical file into a 'ListenerRegistration' instance - static private HashMap<File, ListenerRegistration> registrations = - new HashMap<>(); - /** * This is an internal class - one instance of this exists for each * property file that is being monitored. Note that multiple listeners @@ -306,7 +307,7 @@ public class PropertyUtil * does not exist or can't be opened, and 'IOException' if there is * a problem loading the properties file. */ - static public Properties getProperties(File file, Listener listener) + public static Properties getProperties(File file, Listener listener) throws IOException { if (listener == null) @@ -350,7 +351,7 @@ public class PropertyUtil * does not exist or can't be opened, and 'IOException' if there is * a problem loading the properties file. */ - static public Properties getProperties(String fileName, Listener listener) + public static Properties getProperties(String fileName, Listener listener) throws IOException { return getProperties(new File(fileName), listener); @@ -362,7 +363,7 @@ public class PropertyUtil * @param notify if not null, this is a callback interface that was used for * notifications of changes */ - static public void stopListening(File file, Listener listener) + public static void stopListening(File file, Listener listener) { if (listener != null) { @@ -380,7 +381,7 @@ public class PropertyUtil * @param notify if not null, this is a callback interface that was used for * notifications of changes */ - static public void stopListening(String fileName, Listener listener) + public static void stopListening(String fileName, Listener listener) { stopListening(new File(fileName), listener); } @@ -388,7 +389,7 @@ public class PropertyUtil /* ============================================================ */ // TEMPORARY - used to test callback interface - static public class Test implements Listener + public static class Test implements Listener { String name; |