From df50805038b90ede98496241921f3f991ea00b71 Mon Sep 17 00:00:00 2001 From: Isaac Parenteau Date: Sun, 18 Sep 2022 22:23:00 -0500 Subject: [PATCH 1/3] Updated libraries to fix vulnerabilities --- .gitignore | 1 + pom.xml | 12 ++++++------ .../net/locusworks/logger/ApplicationLogger.java | 16 ++++++++-------- .../logger/ApplicationLoggerFactory.java | 4 ++-- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/.gitignore b/.gitignore index aba6df2..3bd096c 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ .settings/ target/ bin/ +.idea diff --git a/pom.xml b/pom.xml index 0882a30..061439b 100644 --- a/pom.xml +++ b/pom.xml @@ -20,8 +20,8 @@ ${project.basedir} 1.8 1.8 - 2.14.1 - 1.7.32 + 2.19.0 + 2.0.1 https://nexus.locusworks.net @@ -30,7 +30,7 @@ org.apache.maven.plugins maven-surefire-plugin - 3.0.0-M5 + 3.0.0-M7 always @@ -51,7 +51,7 @@ org.owasp dependency-check-maven - 6.3.1 + 7.2.0 @@ -63,7 +63,7 @@ org.apache.maven.plugins maven-enforcer-plugin - 3.0.0 + 3.1.0 enforce @@ -153,4 +153,4 @@ - \ No newline at end of file + diff --git a/src/main/java/net/locusworks/logger/ApplicationLogger.java b/src/main/java/net/locusworks/logger/ApplicationLogger.java index 5761eb7..ed89d39 100644 --- a/src/main/java/net/locusworks/logger/ApplicationLogger.java +++ b/src/main/java/net/locusworks/logger/ApplicationLogger.java @@ -17,7 +17,7 @@ public class ApplicationLogger implements org.slf4j.Logger { private static final Logger logger = LoggerFactory.getLogger(ApplicationLogger.class); - private String name; + private final String name; private LogLevel level; @@ -471,7 +471,7 @@ public class ApplicationLogger implements org.slf4j.Logger { public void error(Map values, String valueFormat, StringBuilder sb, Throwable e) { msgHelper(LogLevel.ERROR, values, valueFormat, sb); if (e != null) { - msgHelper(LogLevel.ERROR, "", e); + msgHelper("", e); } } @@ -588,7 +588,7 @@ public class ApplicationLogger implements org.slf4j.Logger { values.entrySet() .stream() .map(entry -> String.format(format, entry.getKey(), entry.getValue())) - .forEach(s -> builder.append(s)); + .forEach(builder::append); log(level, builder.toString()); } @@ -605,13 +605,13 @@ public class ApplicationLogger implements org.slf4j.Logger { /** * helper method to format a message for logging - * @param level log level to use + * * @param message message to log - * @param e any throwable to log + * @param e any throwable to log */ - private void msgHelper(LogLevel level, String message, Throwable e) { + private void msgHelper(String message, Throwable e) { String msg = e == null ? String.format("%n%s", message) : String.format("%n%s%n%s%n%s", message, e.getMessage(), getStackTrace(e)); - log(level, msg); + log(LogLevel.ERROR, msg); } /** @@ -622,4 +622,4 @@ public class ApplicationLogger implements org.slf4j.Logger { private String format(String message, LogLevel level) { return String.format("th%06d [%-5s] [%s] %s", Thread.currentThread().getId(), level, this.name, message); } -} \ No newline at end of file +} diff --git a/src/main/java/net/locusworks/logger/ApplicationLoggerFactory.java b/src/main/java/net/locusworks/logger/ApplicationLoggerFactory.java index 46b8929..d43d811 100644 --- a/src/main/java/net/locusworks/logger/ApplicationLoggerFactory.java +++ b/src/main/java/net/locusworks/logger/ApplicationLoggerFactory.java @@ -20,7 +20,7 @@ public class ApplicationLoggerFactory { * Need to get the log level from the properties file. * Would normally use the configuration service but would create a circular dependency as * the configuration service use the ApplicationLoggerFactory to create a logger - * @param initializer The initializer + * @param init The initializer */ public static void init(ApplicationLoggerInitializer init) { initializer = init; @@ -214,4 +214,4 @@ public class ApplicationLoggerFactory { this.level = level; } } -} \ No newline at end of file +} From 0c4e4efea8d76a6931ad07a635b54a9575e8d61c Mon Sep 17 00:00:00 2001 From: Isaac Parenteau Date: Sun, 18 Sep 2022 22:23:00 -0500 Subject: [PATCH 2/3] Updated libraries to fix vulnerabilities --- .gitignore | 1 + pom.xml | 12 ++++++------ .../net/locusworks/logger/ApplicationLogger.java | 12 ++++++------ .../locusworks/logger/ApplicationLoggerFactory.java | 4 ++-- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index aba6df2..3bd096c 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ .settings/ target/ bin/ +.idea diff --git a/pom.xml b/pom.xml index 0882a30..061439b 100644 --- a/pom.xml +++ b/pom.xml @@ -20,8 +20,8 @@ ${project.basedir} 1.8 1.8 - 2.14.1 - 1.7.32 + 2.19.0 + 2.0.1 https://nexus.locusworks.net @@ -30,7 +30,7 @@ org.apache.maven.plugins maven-surefire-plugin - 3.0.0-M5 + 3.0.0-M7 always @@ -51,7 +51,7 @@ org.owasp dependency-check-maven - 6.3.1 + 7.2.0 @@ -63,7 +63,7 @@ org.apache.maven.plugins maven-enforcer-plugin - 3.0.0 + 3.1.0 enforce @@ -153,4 +153,4 @@ - \ No newline at end of file + diff --git a/src/main/java/net/locusworks/logger/ApplicationLogger.java b/src/main/java/net/locusworks/logger/ApplicationLogger.java index 5761eb7..5fcb119 100644 --- a/src/main/java/net/locusworks/logger/ApplicationLogger.java +++ b/src/main/java/net/locusworks/logger/ApplicationLogger.java @@ -17,7 +17,7 @@ public class ApplicationLogger implements org.slf4j.Logger { private static final Logger logger = LoggerFactory.getLogger(ApplicationLogger.class); - private String name; + private final String name; private LogLevel level; @@ -471,7 +471,7 @@ public class ApplicationLogger implements org.slf4j.Logger { public void error(Map values, String valueFormat, StringBuilder sb, Throwable e) { msgHelper(LogLevel.ERROR, values, valueFormat, sb); if (e != null) { - msgHelper(LogLevel.ERROR, "", e); + msgHelper("", e); } } @@ -588,7 +588,7 @@ public class ApplicationLogger implements org.slf4j.Logger { values.entrySet() .stream() .map(entry -> String.format(format, entry.getKey(), entry.getValue())) - .forEach(s -> builder.append(s)); + .forEach(builder::append); log(level, builder.toString()); } @@ -605,9 +605,9 @@ public class ApplicationLogger implements org.slf4j.Logger { /** * helper method to format a message for logging - * @param level log level to use + * @param level level to use * @param message message to log - * @param e any throwable to log + * @param e any throwable to log */ private void msgHelper(LogLevel level, String message, Throwable e) { String msg = e == null ? String.format("%n%s", message) : String.format("%n%s%n%s%n%s", message, e.getMessage(), getStackTrace(e)); @@ -622,4 +622,4 @@ public class ApplicationLogger implements org.slf4j.Logger { private String format(String message, LogLevel level) { return String.format("th%06d [%-5s] [%s] %s", Thread.currentThread().getId(), level, this.name, message); } -} \ No newline at end of file +} diff --git a/src/main/java/net/locusworks/logger/ApplicationLoggerFactory.java b/src/main/java/net/locusworks/logger/ApplicationLoggerFactory.java index 46b8929..d43d811 100644 --- a/src/main/java/net/locusworks/logger/ApplicationLoggerFactory.java +++ b/src/main/java/net/locusworks/logger/ApplicationLoggerFactory.java @@ -20,7 +20,7 @@ public class ApplicationLoggerFactory { * Need to get the log level from the properties file. * Would normally use the configuration service but would create a circular dependency as * the configuration service use the ApplicationLoggerFactory to create a logger - * @param initializer The initializer + * @param init The initializer */ public static void init(ApplicationLoggerInitializer init) { initializer = init; @@ -214,4 +214,4 @@ public class ApplicationLoggerFactory { this.level = level; } } -} \ No newline at end of file +} From 8b4e67892ab1054fd4455fbc5c74838551cf8878 Mon Sep 17 00:00:00 2001 From: Isaac Parenteau Date: Sun, 18 Sep 2022 22:31:42 -0500 Subject: [PATCH 3/3] Fixed issue with Jenkis file --- Jenkinsfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3b19af3..ea2d75d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -48,7 +48,7 @@ def init() { if (branch_name.indexOf('master')==0) build_type='master' // common pipeline elements - node('master') { + node() { Initialize() SetVersion(build_type) print_vars() // after SetVersion - all variables now defined @@ -57,16 +57,16 @@ def init() { } if (branch_name.indexOf('develop')==0) { - node('master') { + node() { Deploy(); } } else if (branch_name.indexOf('release/')==0) { - node('master') { + node() { Deploy(); } } - node('master') { + node() { set_result('SUCCESS') } @@ -183,4 +183,4 @@ def SetVersion( v ) { } } -return this \ No newline at end of file +return this