diff --git a/src/main/java/edu/hm/hafner/analysis/parser/MavenConsoleParser.java b/src/main/java/edu/hm/hafner/analysis/parser/MavenConsoleParser.java index 238e1a417..6654b8fe0 100644 --- a/src/main/java/edu/hm/hafner/analysis/parser/MavenConsoleParser.java +++ b/src/main/java/edu/hm/hafner/analysis/parser/MavenConsoleParser.java @@ -76,7 +76,7 @@ protected Optional createIssue(final Matcher matcher, final LookaheadStre int length = StringUtils.length(timestamp); String continuation = "^(?:.*\\s|)\\[(INFO|WARNING|ERROR)"; - while (!lookahead.hasNext(continuation)) { + while (lookahead.hasNext() && !lookahead.hasNext(continuation)) { message.append('\n'); message.append(StringUtils.substring(lookahead.next(), length)); } diff --git a/src/test/java/edu/hm/hafner/analysis/parser/MavenConsoleParserTest.java b/src/test/java/edu/hm/hafner/analysis/parser/MavenConsoleParserTest.java index 424d69834..342947b4e 100644 --- a/src/test/java/edu/hm/hafner/analysis/parser/MavenConsoleParserTest.java +++ b/src/test/java/edu/hm/hafner/analysis/parser/MavenConsoleParserTest.java @@ -25,6 +25,13 @@ protected MavenConsoleParserTest() { super("maven-console.txt"); } + @Test + void issue72011MavenEnforcerExceptionWhenEmpty() { + Report warnings = parse("issue72011.txt"); + + assertThat(warnings).isEmpty(); + } + @Test void issue70658RemovePrefixAndSuffixFromMavenPlugins() { Report warnings = parse("maven.3.9.1.log"); diff --git a/src/test/resources/edu/hm/hafner/analysis/parser/issue72011.txt b/src/test/resources/edu/hm/hafner/analysis/parser/issue72011.txt new file mode 100644 index 000000000..4b2349c89 --- /dev/null +++ b/src/test/resources/edu/hm/hafner/analysis/parser/issue72011.txt @@ -0,0 +1,15 @@ +[2023-09-13T11:34:06.033Z] [INFO] +[2023-09-13T11:34:06.033Z] [INFO] --- maven-enforcer-plugin:3.0.0-M3:enforce (enforce-maven) @ tframe-tgate-root --- +[2023-09-13T11:34:06.033Z] [INFO] Downloading from magenta-mirror: https://bin.t-mobile.at/artifactory/maven/org/apache/maven/enforcer/enforcer-api/3.0.0-M3/enforcer-api-3.0.0-M3.pom +[2023-09-13T11:34:06.033Z] [INFO] Downloaded from magenta-mirror: https://bin.t-mobile.at/artifactory/maven/org/apache/maven/enforcer/enforcer-api/3.0.0-M3/enforcer-api-3.0.0-M3.pom (2.8 kB at 123 kB/s) +[2023-09-13T11:34:06.033Z] [INFO] Downloading from magenta-mirror: https://bin.t-mobile.at/artifactory/maven/org/apache/maven/enforcer/enforcer-rules/3.0.0-M3/enforcer-rules-3.0.0-M3.pom +[2023-09-13T11:34:06.033Z] [INFO] Downloaded from magenta-mirror: https://bin.t-mobile.at/artifactory/maven/org/apache/maven/enforcer/enforcer-rules/3.0.0-M3/enforcer-rules-3.0.0-M3.pom (4.1 kB at 295 kB/s) +[2023-09-13T11:34:06.033Z] [INFO] Downloading from magenta-mirror: https://bin.t-mobile.at/artifactory/maven/commons-codec/commons-codec/1.12/commons-codec-1.12.pom +[2023-09-13T11:34:06.033Z] [INFO] Downloaded from magenta-mirror: https://bin.t-mobile.at/artifactory/maven/commons-codec/commons-codec/1.12/commons-codec-1.12.pom (14 kB at 1.2 MB/s) +[2023-09-13T11:34:06.033Z] [INFO] Downloading from magenta-mirror: https://bin.t-mobile.at/artifactory/maven/org/apache/maven/enforcer/enforcer-api/3.0.0-M3/enforcer-api-3.0.0-M3.jar +[2023-09-13T11:34:06.033Z] [INFO] Downloading from magenta-mirror: https://bin.t-mobile.at/artifactory/maven/commons-codec/commons-codec/1.12/commons-codec-1.12.jar +[2023-09-13T11:34:06.033Z] [INFO] Downloading from magenta-mirror: https://bin.t-mobile.at/artifactory/maven/org/apache/maven/enforcer/enforcer-rules/3.0.0-M3/enforcer-rules-3.0.0-M3.jar +[2023-09-13T11:34:06.033Z] [INFO] Downloaded from magenta-mirror: https://bin.t-mobile.at/artifactory/maven/org/apache/maven/enforcer/enforcer-api/3.0.0-M3/enforcer-api-3.0.0-M3.jar (12 kB at 585 kB/s) +[2023-09-13T11:34:06.033Z] [INFO] Downloaded from magenta-mirror: https://bin.t-mobile.at/artifactory/maven/org/apache/maven/enforcer/enforcer-rules/3.0.0-M3/enforcer-rules-3.0.0-M3.jar (107 kB at 5.1 MB/s) +[2023-09-13T11:34:06.033Z] [INFO] Downloaded from magenta-mirror: https://bin.t-mobile.at/artifactory/maven/commons-codec/commons-codec/1.12/commons-codec-1.12.jar (340 kB at 12 MB/s) +[2023-09-13T11:34:06.033Z] [INFO] ------------------------------------------------------------------------