Browse Source

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
pull/564/head
Dominik Stadler 4 months ago
parent
commit
53cfc2cc96

+ 3
- 2
poi-integration/src/test/java/org/apache/poi/stress/TestAllFiles.java 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),

BIN
test-data/spreadsheet/stress.xls View File


Loading…
Cancel
Save