Author: centic
Date: Wed Aug  9 09:53:54 2023
New Revision: 1911572

URL: http://svn.apache.org/viewvc?rev=1911572&view=rev
Log:
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.

Modified:
    
poi/trunk/poi-integration/src/test/java/org/apache/poi/stress/TestAllFiles.java
    poi/trunk/test-data/spreadsheet/stress.xls

Modified: 
poi/trunk/poi-integration/src/test/java/org/apache/poi/stress/TestAllFiles.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/poi-integration/src/test/java/org/apache/poi/stress/TestAllFiles.java?rev=1911572&r1=1911571&r2=1911572&view=diff
==============================================================================
--- 
poi/trunk/poi-integration/src/test/java/org/apache/poi/stress/TestAllFiles.java 
(original)
+++ 
poi/trunk/poi-integration/src/test/java/org/apache/poi/stress/TestAllFiles.java 
Wed Aug  9 09:53:54 2023
@@ -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 + "'");
+                        errPrefix + " for " + exClass + " expected message '" 
+ exMessage + "' but had '" + actMsg + "': " + e);
 
-                if (actMsg != null) {
+                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);
                 }

Modified: poi/trunk/test-data/spreadsheet/stress.xls
URL: 
http://svn.apache.org/viewvc/poi/trunk/test-data/spreadsheet/stress.xls?rev=1911572&r1=1911571&r2=1911572&view=diff
==============================================================================
Binary files - no diff available.



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to