From a4b1e4c32927208e92ca9895fa780e18051d3932 Mon Sep 17 00:00:00 2001
From: Roberto Sánchez <roberto.sanchez@curisit.net>
Date: Thu, 18 Sep 2014 14:20:17 +0000
Subject: [PATCH] #0 feature - Fixed some SonarQube issues
---
src/main/java/net/curisit/securis/License.java | 27 +++++++++++++--------------
1 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/src/main/java/net/curisit/securis/License.java b/src/main/java/net/curisit/securis/License.java
index 8f08b6f..1d49af8 100644
--- a/src/main/java/net/curisit/securis/License.java
+++ b/src/main/java/net/curisit/securis/License.java
@@ -42,7 +42,7 @@
*/
public class License {
- private static final Logger log = LogManager.getLogger(License.class);
+ private static final Logger LOG = LogManager.getLogger(License.class);
/**
* Aplication entry point when it used as CLI
@@ -51,9 +51,8 @@
* @throws URISyntaxException
*/
public static void main(String[] args) throws URISyntaxException {
- // Configuration conf = XMLConfigurationFactory.getInstance().getConfiguration("config", License.class.getResource("/log4j.xml").toURI());
- log.debug("SeCuris client tool init ");
+ LOG.debug("SeCuris client tool init ");
checkConfigFile();
CommandLine cmd = getCommandLine(args);
@@ -65,7 +64,7 @@
filename = "./license.req";
File file = new File(filename);
LicenseManager.getInstance().createRequestFile(file);
- log.info("Request file {} generated OK", file.getAbsolutePath());
+ LOG.info("Request file {} generated OK", file.getAbsolutePath());
System.exit(0);
}
@@ -76,10 +75,10 @@
File file = new File(filename);
try {
LicenseManager.getInstance().validateLicense(file);
- log.info("License file {} is valid", file.getAbsolutePath());
+ LOG.info("License file {} is valid", file.getAbsolutePath());
} catch (SeCurisException e) {
- log.info("License file {} is NOT valid", file.getAbsolutePath());
- log.info("Reason: {}", e.toString());
+ LOG.info("License file {} is NOT valid", file.getAbsolutePath());
+ LOG.info("Reason: {}", e.toString());
}
System.exit(0);
@@ -89,30 +88,30 @@
String reqFilename = cmd.getOptionValue("rfile");
checkMandatoryParameter(reqFilename, "rfile");
- log.warn("This command is not yet implemented");
+ LOG.warn("This command is not yet implemented");
System.exit(0);
}
if (cmd.hasOption('t')) {
- log.warn("This command is not yet implemented");
+ LOG.warn("This command is not yet implemented");
System.exit(0);
}
if (cmd.hasOption('r')) {
String licFilename = cmd.getOptionValue("renew");
checkMandatoryParameter(licFilename, "renew");
- log.warn("This command is not yet implemented");
+ LOG.warn("This command is not yet implemented");
System.exit(0);
}
} catch (SeCurisException e) {
- log.error("The command generated an error: {}", e.toString());
+ LOG.error("The command generated an error: {}", e.toString());
}
}
private static void checkMandatoryParameter(String value, String param) {
if (value == null) {
- log.error("Parameter {} is mandatory. Use --help to get information about parameters", param);
+ LOG.error("Parameter {} is mandatory. Use --help to get information about parameters", param);
System.exit(-5);
}
}
@@ -123,12 +122,12 @@
private static void checkConfigFile() {
String appCode = Params.get(Params.KEYS.APPLICATION_CODE);
if (appCode == null) {
- log.error("Manadatory parameter {} is not set in config file", Params.KEYS.APPLICATION_CODE);
+ LOG.error("Manadatory parameter {} is not set in config file", Params.KEYS.APPLICATION_CODE);
System.exit(-3);
}
String customerCode = Params.get(Params.KEYS.CUSTOMER_CODE);
if (customerCode == null) {
- log.error("Manadatory parameter {} is not set in config file", Params.KEYS.CUSTOMER_CODE);
+ LOG.error("Manadatory parameter {} is not set in config file", Params.KEYS.CUSTOMER_CODE);
System.exit(-4);
}
}
--
Gitblit v1.3.2