This is an automated email from the ASF dual-hosted git repository. adityasharma pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/roller.git
The following commit(s) were added to refs/heads/master by this push: new 8b6e2b2 Fixed: sonarqube issue - removed unused private fields 8b6e2b2 is described below commit 8b6e2b22138110a51fe5f4e31a4c4a91ae49c611 Author: Aditya Sharma <adityasha...@apache.org> AuthorDate: Tue Jan 5 11:26:38 2021 +0530 Fixed: sonarqube issue - removed unused private fields --- .../roller/planet/config/PlanetRuntimeConfig.java | 79 ++++++++++------------ 1 file changed, 37 insertions(+), 42 deletions(-) diff --git a/app/src/main/java/org/apache/roller/planet/config/PlanetRuntimeConfig.java b/app/src/main/java/org/apache/roller/planet/config/PlanetRuntimeConfig.java index 50f298b..1c91d69 100644 --- a/app/src/main/java/org/apache/roller/planet/config/PlanetRuntimeConfig.java +++ b/app/src/main/java/org/apache/roller/planet/config/PlanetRuntimeConfig.java @@ -34,102 +34,97 @@ import org.apache.roller.weblogger.planet.ui.PlanetConfig; * Planet specific runtime properties. */ public class PlanetRuntimeConfig { - + private static Log log = LogFactory.getLog(PlanetRuntimeConfig.class); - + private static String runtime_config = "/org/apache/roller/planet/config/planetRuntimeConfigDefs.xml"; private static RuntimeConfigDefs configDefs = null; - - // special case for our context urls - private static String relativeContextURL = null; - private static String absoluteContextURL = null; - - + // prevent instantiations private PlanetRuntimeConfig() {} - - + + /** * Retrieve a single property from the PropertiesManager ... returns null * if there is an error **/ public static String getProperty(String name) { - + String value = null; - + try { PropertiesManager pmgr = WebloggerFactory.getWeblogger().getPropertiesManager(); value = pmgr.getProperty(name).getValue(); } catch(Exception e) { log.warn("Trouble accessing property: "+name, e); } - + log.debug("fetched property ["+name+"="+value+"]"); return value; } - - + + /** * Retrieve a property as a boolean ... defaults to false if there is an error **/ public static boolean getBooleanProperty(String name) { - + // get the value first, then convert String value = PlanetRuntimeConfig.getProperty(name); - + if(value == null) return false; - + return (new Boolean(value)).booleanValue(); } - - + + /** * Retrieve a property as an int ... defaults to -1 if there is an error **/ public static int getIntProperty(String name) { - + // get the value first, then convert String value = PlanetRuntimeConfig.getProperty(name); - + if(value == null) return -1; - + int intval = -1; try { intval = Integer.parseInt(value); } catch(Exception e) { log.warn("Trouble converting to int: "+name, e); } - + return intval; } - - + + public static RuntimeConfigDefs getRuntimeConfigDefs() { - + if(configDefs == null) { - + // unmarshall the config defs file try { - InputStream is = + InputStream is = PlanetRuntimeConfig.class.getResourceAsStream(runtime_config); - + RuntimeConfigDefsParser parser = new RuntimeConfigDefsParser(); configDefs = parser.unmarshall(is); - + } catch(Exception e) { // error while parsing :( log.error("Error parsing runtime config defs", e); } - + } - + return configDefs; } - - + + /** * Get the runtime configuration definitions XML file as a string. * @@ -139,27 +134,27 @@ public class PlanetRuntimeConfig { * the display for editing those properties. */ public static String getRuntimeConfigDefsAsString() { - + log.debug("Trying to load runtime config defs file"); - + try { InputStreamReader reader = new InputStreamReader(PlanetConfig.class.getResourceAsStream(runtime_config)); StringWriter configString = new StringWriter(); - + char[] buf = new char[8196]; int length = 0; while((length = reader.read(buf)) > 0) configString.write(buf, 0, length); - + reader.close(); - + return configString.toString(); } catch(Exception e) { log.error("Error loading runtime config defs file", e); } - + return ""; } - + }