Skip to content

Commit

Permalink
Allow all IndexOutOfBoundsException to have either empty message or s…
Browse files Browse the repository at this point in the history
…ome 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
  • Loading branch information
centic9 committed Dec 16, 2023
1 parent 399e996 commit 53cfc2c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,10 @@ private static void verify(String file, Executable exec, Class<? extends Throwab
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),
Expand Down
Binary file modified test-data/spreadsheet/stress.xls
Binary file not shown.

0 comments on commit 53cfc2c

Please sign in to comment.