aboutsummaryrefslogtreecommitdiffstats
path: root/appc-config/appc-config-generator/provider/src/main/java/org/onap/sdnc/config/generator/tool/LogParserTool.java
diff options
context:
space:
mode:
authorJakub Dudycz <jakub.dudycz@nokia.com>2018-02-26 11:43:19 +0100
committerPatrick Brady <pb071s@att.com>2018-02-26 19:11:04 +0000
commit534f94b92547efab097040209e61fa06e07f6e43 (patch)
tree29fa789a3538c4e4c51361e03aeb721d25dbd947 /appc-config/appc-config-generator/provider/src/main/java/org/onap/sdnc/config/generator/tool/LogParserTool.java
parent23e0901d5ba71ebadfb99e91d10bda0275708518 (diff)
appc-config-generator-provider sonar fixes part 1
Initial code reformat and import rearrangement Change-Id: I0a808bc3043d8558d96f15e0b695fddf5333bab1 Issue-ID: APPC-671 Signed-off-by: Jakub Dudycz <jakub.dudycz@nokia.com>
Diffstat (limited to 'appc-config/appc-config-generator/provider/src/main/java/org/onap/sdnc/config/generator/tool/LogParserTool.java')
-rw-r--r--appc-config/appc-config-generator/provider/src/main/java/org/onap/sdnc/config/generator/tool/LogParserTool.java19
1 files changed, 11 insertions, 8 deletions
diff --git a/appc-config/appc-config-generator/provider/src/main/java/org/onap/sdnc/config/generator/tool/LogParserTool.java b/appc-config/appc-config-generator/provider/src/main/java/org/onap/sdnc/config/generator/tool/LogParserTool.java
index 0c228b8eb..ebd58b01c 100644
--- a/appc-config/appc-config-generator/provider/src/main/java/org/onap/sdnc/config/generator/tool/LogParserTool.java
+++ b/appc-config/appc-config-generator/provider/src/main/java/org/onap/sdnc/config/generator/tool/LogParserTool.java
@@ -24,19 +24,21 @@
package org.onap.sdnc.config.generator.tool;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
public class LogParserTool {
+
private static final EELFLogger log = EELFManager.getInstance().getLogger(JSONTool.class);
private String[] singleLines;
- private List<String> recentErrors = new ArrayList<String>();;
+ private List<String> recentErrors = new ArrayList<String>();
+ ;
private Date todaysDate = new Date();
private SimpleDateFormat dFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
private final int minMilli = 60000;
@@ -62,7 +64,7 @@ public class LogParserTool {
String error = recentErrors.get(0);
recentErrors.clear();
return "Error: "
- + error.substring(error.indexOf("Error parsing orchestration file:") + 34);
+ + error.substring(error.indexOf("Error parsing orchestration file:") + 34);
}
}
@@ -70,11 +72,11 @@ public class LogParserTool {
int result;
for (int i = singleLines.length - 1; i >= 0; i--) {
if (singleLines[i].contains("Starting orchestration of file backed up to")
- || singleLines[i].contains("Error parsing orchestration file:")) {
+ || singleLines[i].contains("Error parsing orchestration file:")) {
result = checkDateTime(singleLines[i]);
- if (result == IN_TIME)
+ if (result == IN_TIME) {
recentErrors.add(singleLines[i]);
- else if (result == NOT_IN_TIME) {
+ } else if (result == NOT_IN_TIME) {
return;
}
}
@@ -87,8 +89,9 @@ public class LogParserTool {
newDate = dFormat.parse(line.substring(0, 19));
if ((todaysDate.getTime() - newDate.getTime()) <= 5 * minMilli) {
return IN_TIME;
- } else
+ } else {
return NOT_IN_TIME;
+ }
} catch (ParseException e) {
e.printStackTrace();
return NO_DATE;