8332494: java/util/zip/EntryCount64k.java failing with java.lang.RuntimeException: '\\A\\Z' missing from stderr

Reviewed-by: jpai, stefank, dholmes
This commit is contained in:
Axel Boldt-Christmas 2024-05-21 06:14:44 +00:00
parent 9f7779305c
commit f5ab7dff40
2 changed files with 21 additions and 3 deletions

View File

@ -163,6 +163,6 @@ public class EntryCount64k {
OutputAnalyzer a = ProcessTools.executeTestJava("-jar", zipFile.getName());
a.shouldHaveExitValue(0);
a.stdoutShouldMatch("\\AMain\\Z");
a.stderrShouldMatch("\\A\\Z");
a.stderrShouldMatchIgnoreDeprecatedWarnings("\\A\\Z");
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -665,7 +665,7 @@ public final class OutputAnalyzer {
/**
* Verify that the stderr contents of output buffer matches the pattern,
* after filtering out the Hotespot warning messages
* after filtering out the Hotspot warning messages
*
* @param pattern
* @throws RuntimeException If the pattern was not found
@ -681,6 +681,24 @@ public final class OutputAnalyzer {
return this;
}
/**
* Verify that the stderr contents of output buffer matches the pattern,
* after filtering out the Hotspot deprecation warning messages
*
* @param pattern
* @throws RuntimeException If the pattern was not found
*/
public OutputAnalyzer stderrShouldMatchIgnoreDeprecatedWarnings(String pattern) {
String stderr = getStderr().replaceAll(deprecatedmsg + "\\R", "");
Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stderr);
if (!matcher.find()) {
reportDiagnosticSummary();
throw new RuntimeException("'" + pattern
+ "' missing from stderr");
}
return this;
}
/**
* Returns the contents of the output buffer (stdout and stderr), without those
* JVM warning msgs, as list of strings. Output is split by newlines.