Skip to content

Commit

Permalink
[JENKINS-72011] Do not read from empty stream.
Browse files Browse the repository at this point in the history
  • Loading branch information
uhafner committed Sep 15, 2023
1 parent 565bacf commit 476ccc5
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ protected Optional<Issue> 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)) {

Check warning on line 79 in src/main/java/edu/hm/hafner/analysis/parser/MavenConsoleParser.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 79 is only partially covered, one branch is missing
message.append('\n');
message.append(StringUtils.substring(lookahead.next(), length));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
15 changes: 15 additions & 0 deletions src/test/resources/edu/hm/hafner/analysis/parser/issue72011.txt
Original file line number Diff line number Diff line change
@@ -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] ------------------------------------------------------------------------

0 comments on commit 476ccc5

Please sign in to comment.