aboutsummaryrefslogtreecommitdiffstats
path: root/poi-integration/src/test/java
diff options
context:
space:
mode:
authorDominik Stadler <centic@apache.org>2023-08-09 09:53:54 +0000
committerDominik Stadler <centic@apache.org>2023-08-09 09:53:54 +0000
commitb757cf607eedfbe02763a8209f83897a85892790 (patch)
tree3198b43fc692b30992658d67b04de0bdecf74846 /poi-integration/src/test/java
parentfdeae16b0c617400d53266e36fc6123e59bbaed0 (diff)
downloadpoi-b757cf607eedfbe02763a8209f83897a85892790.tar.gz
poi-b757cf607eedfbe02763a8209f83897a85892790.zip
Try to adjust for strange null-message for ArrayIndexOutOfBoundsException
Some CI runs seem to throw the exception with an empty message instead of the expected text. I could not reproduce this consistently and so we only can disable a check in this case. git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1911572 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi-integration/src/test/java')
-rw-r--r--poi-integration/src/test/java/org/apache/poi/stress/TestAllFiles.java13
1 files changed, 9 insertions, 4 deletions
diff --git a/poi-integration/src/test/java/org/apache/poi/stress/TestAllFiles.java b/poi-integration/src/test/java/org/apache/poi/stress/TestAllFiles.java
index b636459146..3972a8671b 100644
--- a/poi-integration/src/test/java/org/apache/poi/stress/TestAllFiles.java
+++ b/poi-integration/src/test/java/org/apache/poi/stress/TestAllFiles.java
@@ -265,14 +265,19 @@ public class TestAllFiles {
// it sometimes has a message and sometimes not!
if (NullPointerException.class.isAssignableFrom(exClass)) {
if (actMsg != null) {
- assertTrue(actMsg.contains(exMessage), errPrefix + "Message: "+actMsg+" - didn't contain: "+exMessage);
+ assertTrue(actMsg.contains(exMessage), errPrefix + "Message: " + actMsg + " - didn't contain: " + exMessage);
}
} else {
// verify that message is either null for both or set for both
assertTrue(actMsg != null || isBlank(exMessage),
- errPrefix + " for " + exClass + " expected message '" + exMessage + "' but had '" + actMsg + "'");
-
- if (actMsg != null) {
+ errPrefix + " for " + exClass + " expected message '" + exMessage + "' but had '" + actMsg + "': " + e);
+
+ if (actMsg != null &&
+ // sometimes ArrayIndexOutOfBoundsException has null-message?!?
+ // so skip the check for this type of exception if expected message is null
+ (exMessage != null || !ArrayIndexOutOfBoundsException.class.isAssignableFrom(exClass))) {
+ assertNotNull(exMessage,
+ errPrefix + "Expected message was null, but actMsg wasn't: Message: " + actMsg + ": " + e);
assertTrue(actMsg.contains(exMessage),
errPrefix + "Message: " + actMsg + " - didn't contain: " + exMessage);
}