diff --git a/pom.xml b/pom.xml index 56e5df5..04c56ec 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.jenkins-ci.plugins plugin - 4.74 + 4.76 @@ -17,8 +17,6 @@ Parses the console log generated by a build - - false 2.387.3 2.5.1 @@ -38,7 +36,7 @@ org.apache.maven.plugins maven-pmd-plugin - 3.21.0 + 3.21.2 11 diff --git a/src/findbugs/excludesFilter.xml b/src/findbugs/excludesFilter.xml deleted file mode 100644 index 6ddd604..0000000 --- a/src/findbugs/excludesFilter.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - diff --git a/src/main/java/hudson/plugins/logparser/LogParserLogPart.java b/src/main/java/hudson/plugins/logparser/LogParserLogPart.java index ad9c7eb..fe79309 100755 --- a/src/main/java/hudson/plugins/logparser/LogParserLogPart.java +++ b/src/main/java/hudson/plugins/logparser/LogParserLogPart.java @@ -26,7 +26,7 @@ public void setLogPartNum(final int logPartNum) { } public boolean isEmpty() { - return (lines[0] == null); + return lines[0] == null; } } diff --git a/src/main/java/hudson/plugins/logparser/LogParserParser.java b/src/main/java/hudson/plugins/logparser/LogParserParser.java index 8cac814..17dc153 100755 --- a/src/main/java/hudson/plugins/logparser/LogParserParser.java +++ b/src/main/java/hudson/plugins/logparser/LogParserParser.java @@ -116,7 +116,7 @@ public LogParserResult parseLog(final Run build) throws IOException, Inter } // Open console log for reading and all other files for writing - try (final BufferedWriter writer = new BufferedWriter(new FileWriter(parsedFilePath))) { + try (BufferedWriter writer = new BufferedWriter(new FileWriter(parsedFilePath))) { // Record writers to links files in hash writers.put(LogParserConsts.ERROR, new BufferedWriter(new FileWriter( @@ -350,8 +350,8 @@ private void parseLogBody(final Run build, final BufferedWriter writer, fi // Read log file from start - line by line and apply the statuses as // found by the threads. - try (final InputStreamReader streamReader = new InputStreamReader(build.getLogInputStream(), charset); - final BufferedReader reader = new BufferedReader(streamReader)) { + try (InputStreamReader streamReader = new InputStreamReader(build.getLogInputStream(), charset); + BufferedReader reader = new BufferedReader(streamReader)) { String line; String status; int line_num = 0; diff --git a/src/main/java/hudson/plugins/logparser/LogParserReader.java b/src/main/java/hudson/plugins/logparser/LogParserReader.java index fd575f7..d380673 100755 --- a/src/main/java/hudson/plugins/logparser/LogParserReader.java +++ b/src/main/java/hudson/plugins/logparser/LogParserReader.java @@ -24,7 +24,7 @@ public synchronized LogParserLogPart readLogPart(final int threadNum) throws IOE int counter = 0; String line; - while (counter < numLines && ((line = reader.readLine()) != null)) { + while (counter < numLines && (line = reader.readLine()) != null) { lines[counter++] = line; } logger.log(Level.INFO, "Done reading log part " + logPartNum); diff --git a/src/main/java/hudson/plugins/logparser/LogParserUtils.java b/src/main/java/hudson/plugins/logparser/LogParserUtils.java index 74bf91c..57c6d13 100755 --- a/src/main/java/hudson/plugins/logparser/LogParserUtils.java +++ b/src/main/java/hudson/plugins/logparser/LogParserUtils.java @@ -24,16 +24,12 @@ public static String[] readParsingRules(final FilePath parsingRulesFile) throws } public static boolean skipParsingRule(final String parsingRule) { - boolean skip = false; - if (parsingRule == null || parsingRule.equals("") - || parsingRule.charAt(0) == '#' - || parsingRule.startsWith("\\s") - || parsingRule.startsWith("\r") || // Carriage return - parsingRule.contains("$header")) { // for now - disregard rules - // with header in them - skip = true; - } - return skip; + return parsingRule == null || parsingRule.equals("") + || parsingRule.charAt(0) == '#' + || parsingRule.startsWith("\\s") + || parsingRule.startsWith("\r") // Carriage return + || parsingRule.contains("$header"); // for now - disregard rules + // with header in them } public static String standardizeStatus(final String status) { @@ -75,10 +71,9 @@ public static CompiledPatterns compilePatterns( final String ruleParts[] = parsingRule.split("\\s"); String regexp = ruleParts[1]; String tag = ruleParts[0]; - if (!LogParserConsts.LEGAL_STATUS.contains(tag.toUpperCase(Locale.ENGLISH))) { - if (!Arrays.asList("OK", "END", "WARN").contains(tag.toUpperCase(Locale.ENGLISH))) { - extraTags.add(tag); - } + if (!LogParserConsts.LEGAL_STATUS.contains(tag.toUpperCase(Locale.ENGLISH)) + && !Arrays.asList("OK", "END", "WARN").contains(tag.toUpperCase(Locale.ENGLISH))) { + extraTags.add(tag); } final int firstDash = parsingRule.indexOf('/'); @@ -145,7 +140,7 @@ public static int getLinesPerThread() { } public static int countLines(final String filename) throws IOException { - try (final LineNumberReader reader = new LineNumberReader(new FileReader(filename))) { + try (LineNumberReader reader = new LineNumberReader(new FileReader(filename))) { int count = 0; while (reader.readLine() != null) { // Read the whole file to count the lines. diff --git a/src/main/java/hudson/plugins/logparser/LogParserWriter.java b/src/main/java/hudson/plugins/logparser/LogParserWriter.java index 10f86f0..3d4f90e 100755 --- a/src/main/java/hudson/plugins/logparser/LogParserWriter.java +++ b/src/main/java/hudson/plugins/logparser/LogParserWriter.java @@ -1,6 +1,5 @@ package hudson.plugins.logparser; -import hudson.Functions; import jenkins.model.Jenkins; import java.io.BufferedReader; @@ -36,7 +35,7 @@ public static void writeWrapperHtml(final String buildWrapperPath) + "build log\n" + "\n" + "\n"; - try (final BufferedWriter writer = new BufferedWriter(new FileWriter(buildWrapperPath))) { + try (BufferedWriter writer = new BufferedWriter(new FileWriter(buildWrapperPath))) { writer.write(wrapperHtml); } } @@ -57,7 +56,7 @@ public static void writeReferenceHtml(final String buildRefPath, + "\t\telement.display == 'none' ? element.display='block' : element.display='none';\n" + "\t}\n" + "\n"; - try (final BufferedWriter writer = new BufferedWriter(new FileWriter(buildRefPath))) { + try (BufferedWriter writer = new BufferedWriter(new FileWriter(buildRefPath))) { // Hudson stylesheets writer.write(LogParserConsts.getHtmlOpeningTags()); writer.write(refStart); // toggle links javascript @@ -110,7 +109,7 @@ private static void writeLinks(final BufferedWriter writer, final String linkListCount = statusCount.get(status).toString(); final String hudsonRoot = Jenkins.get().getRootUrl(); - final String iconLocation = String.format("%s/plugin/log-parser/images/", jenkins.model.Jenkins.RESOURCE_PATH).substring(1); + final String iconLocation = String.format("%s/plugin/log-parser/images/", Jenkins.RESOURCE_PATH).substring(1); final String styles = "