Fixed sonar issues in PropertiesListners.java 69/74269/2
authorezhil <ezhrajam@in.ibm.com>
Wed, 5 Dec 2018 14:13:36 +0000 (19:43 +0530)
committerEzhilarasi R <ezhrajam@in.ibm.com>
Wed, 5 Dec 2018 15:27:09 +0000 (15:27 +0000)
Fixed sonar issue
Issue-ID: MUSIC-225
Change-Id: I7e7192b94b434430cb2811dd89e631046c97844c
Signed-off-by: ezhil <ezhrajam@in.ibm.com>
src/main/java/org/onap/music/main/PropertiesListener.java

index 0ed18be..026790e 100755 (executable)
@@ -3,6 +3,7 @@
  * org.onap.music
  * ===================================================================
  *  Copyright (c) 2017 AT&T Intellectual Property
+ *  Modifications Copyright (C) 2018 IBM.
  * ===================================================================
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -37,7 +38,7 @@ import org.onap.music.eelf.logging.format.ErrorTypes;
 
 public class PropertiesListener implements ServletContextListener {
     private Properties prop;
-
+    private static final String MUSIC_PROPERTIES="music.properties";
     private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(PropertiesListener.class);
 
     @Override
@@ -51,8 +52,8 @@ public class PropertiesListener implements ServletContextListener {
         try {
             InputStream musicProps = null;
             projectProp.load(new FileInputStream(musicPropertiesFilePath));
-            if (projectProp.containsKey("music.properties")) {
-                musicProps = new FileInputStream(projectProp.getProperty("music.properties"));
+            if (projectProp.containsKey(MUSIC_PROPERTIES)) {
+                musicProps = new FileInputStream(projectProp.getProperty(MUSIC_PROPERTIES));
             } else {
                 musicProps = new FileInputStream(MusicUtil.getMusicPropertiesFilePath());
             }
@@ -84,7 +85,7 @@ public class PropertiesListener implements ServletContextListener {
                         case "music.rest.ip":
                             MusicUtil.setMusicRestIp(prop.getProperty(key));
                             break;
-                        case "music.properties":
+                        case MUSIC_PROPERTIES:
                             MusicUtil.setMusicPropertiesFilePath(prop.getProperty(key));
                             break;
                         case "lock.lease.period":