Skip to content

Commit f5ab7df

Browse files
committed
8332494: java/util/zip/EntryCount64k.java failing with java.lang.RuntimeException: '\\A\\Z' missing from stderr
Reviewed-by: jpai, stefank, dholmes
1 parent 9f77793 commit f5ab7df

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

test/jdk/java/util/zip/EntryCount64k.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,6 @@ static void checkCanRead(File zipFile, int entryCount) throws Throwable {
163163
OutputAnalyzer a = ProcessTools.executeTestJava("-jar", zipFile.getName());
164164
a.shouldHaveExitValue(0);
165165
a.stdoutShouldMatch("\\AMain\\Z");
166-
a.stderrShouldMatch("\\A\\Z");
166+
a.stderrShouldMatchIgnoreDeprecatedWarnings("\\A\\Z");
167167
}
168168
}

test/lib/jdk/test/lib/process/OutputAnalyzer.java

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -665,7 +665,7 @@ public OutputAnalyzer shouldBeEmptyIgnoreVMWarnings() {
665665

666666
/**
667667
* Verify that the stderr contents of output buffer matches the pattern,
668-
* after filtering out the Hotespot warning messages
668+
* after filtering out the Hotspot warning messages
669669
*
670670
* @param pattern
671671
* @throws RuntimeException If the pattern was not found
@@ -681,6 +681,24 @@ public OutputAnalyzer stderrShouldMatchIgnoreVMWarnings(String pattern) {
681681
return this;
682682
}
683683

684+
/**
685+
* Verify that the stderr contents of output buffer matches the pattern,
686+
* after filtering out the Hotspot deprecation warning messages
687+
*
688+
* @param pattern
689+
* @throws RuntimeException If the pattern was not found
690+
*/
691+
public OutputAnalyzer stderrShouldMatchIgnoreDeprecatedWarnings(String pattern) {
692+
String stderr = getStderr().replaceAll(deprecatedmsg + "\\R", "");
693+
Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stderr);
694+
if (!matcher.find()) {
695+
reportDiagnosticSummary();
696+
throw new RuntimeException("'" + pattern
697+
+ "' missing from stderr");
698+
}
699+
return this;
700+
}
701+
684702
/**
685703
* Returns the contents of the output buffer (stdout and stderr), without those
686704
* JVM warning msgs, as list of strings. Output is split by newlines.

0 commit comments

Comments
 (0)