Allow all IndexOutOfBoundsException to have either empty message or some message

Newer JDKs add a more useful exception message, so we need to be a bit more
lenient for these in integration tests

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1914708 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dominik Stadler 2023-12-16 12:09:02 +00:00
parent 399e99630c
commit 53cfc2cc96
2 changed files with 3 additions and 2 deletions

View File

@ -287,9 +287,10 @@ public class TestAllFiles {
errPrefix + " for " + exClass + " expected message '" + exMessage + "' but had '" + actMsg + "': " + e);
if (actMsg != null &&
// sometimes ArrayIndexOutOfBoundsException has null-message?!?
// in newer JDK versions IndexOutOfBoundsException switch from empty message
// to more useful content
// so skip the check for this type of exception if expected message is null
(exMessage != null || !ArrayIndexOutOfBoundsException.class.isAssignableFrom(exClass))) {
(exMessage != null || !IndexOutOfBoundsException.class.isAssignableFrom(exClass))) {
assertNotNull(exMessage,
errPrefix + "Expected message was null, but actMsg wasn't: Message: " + actMsg + ": " + e);
assertTrue(actMsg.contains(exMessage),

Binary file not shown.