From b757cf607eedfbe02763a8209f83897a85892790 Mon Sep 17 00:00:00 2001 From: Dominik Stadler Date: Wed, 9 Aug 2023 09:53:54 +0000 Subject: [PATCH] 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 --- .../org/apache/poi/stress/TestAllFiles.java | 13 +++++++++---- test-data/spreadsheet/stress.xls | Bin 62976 -> 62976 bytes 2 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); } diff --git a/test-data/spreadsheet/stress.xls b/test-data/spreadsheet/stress.xls index f792d02ef355458bd06c866ebfdbe225c74686b1..76b80d3e770ee7d1f6981b1054b66c88caea02a9 100644 GIT binary patch delta 475 zcmZp8!`$$Oc|!^d@6v^rzArj;ld<69BH6{03t8G3yEp%2InK<K3d}Xr9e9wxENe3l2Z#xGV}9_ zTNwlxvL?^B2xmRQ%)pSi`L~6v0%P-L$;cM5&5QE4@k_00Wnd7R!oVQ4h=JkIdIpAh zyBQd~PBJijJ2`p%m4MBM>a{}@_W_Muz`)Aj%izSo#&8{oQ$Y4G*f9w)Y+;)W3^a)= zdVC-i3_u?)0I6l2T>4RUa^)2j!I!5Q7&xyoFf`s}U^w}dfkANdx+_7llMPt-7ky#@ E02xhxY5)KL delta 484 zcmZp8!`$$Oc|!^d?`lrJrJN^kGB)@>wd|Z+$kNU@Yx7T*p8T-E zd=sZU6C=}P1#VdkQe<);Hz!yW#A0V=VqluQfJcOjgJA+A0|Nty`+!Ge@(XTWpdt{9 ziwDNifwTPJtO78rjzZ}=DqdWA=-a|1}|V>W$}9ZH5@OiG*2Taune&Ps_k6GzBg1@#`ID1BYD~_$q9XX?Gy{XgRR)F$cNrLNJY`@| N*gXGAknEyQEC81keh&Zu -- 2.39.5