diff options
-rw-r--r-- | src/integrationtest/org/apache/poi/stress/SlideShowHandler.java | 11 | ||||
-rw-r--r-- | src/integrationtest/org/apache/poi/stress/TestAllFiles.java | 10 |
2 files changed, 12 insertions, 9 deletions
diff --git a/src/integrationtest/org/apache/poi/stress/SlideShowHandler.java b/src/integrationtest/org/apache/poi/stress/SlideShowHandler.java index 315b47eac6..9a1defbf21 100644 --- a/src/integrationtest/org/apache/poi/stress/SlideShowHandler.java +++ b/src/integrationtest/org/apache/poi/stress/SlideShowHandler.java @@ -155,13 +155,10 @@ public abstract class SlideShowHandler extends POIFSFileHandler { // We saw exceptions with JDK 8 on Windows in the Jenkins CI which // seem to only be triggered by some font (maybe Calibri?!) // We cannot avoid this, so let's try to not make the tests fail in this case - Assumptions.assumeFalse( - e.getMessage().equals("-1") && - ExceptionUtils.readStackTrace(e).contains("ExtendedTextSourceLabel.getJustificationInfos"), - "JDK sometimes fails at this point on some fonts on Windows machines, but we " + - "should not fail the build because of this: " + ExceptionUtils.readStackTrace(e)); - - throw e; + if (!"-1".equals(e.getMessage()) || + !ExceptionUtils.readStackTrace(e).contains("ExtendedTextSourceLabel.getJustificationInfos")) { + throw e; + } } graphics.dispose(); diff --git a/src/integrationtest/org/apache/poi/stress/TestAllFiles.java b/src/integrationtest/org/apache/poi/stress/TestAllFiles.java index 81c31d3a21..52ca60412e 100644 --- a/src/integrationtest/org/apache/poi/stress/TestAllFiles.java +++ b/src/integrationtest/org/apache/poi/stress/TestAllFiles.java @@ -165,13 +165,14 @@ public class TestAllFiles { exec.execute(); fail(errPrefix + "Expected failed assertion"); } catch (AssertionFailedError e) { - assertEquals(exMessage, e.getMessage(), errPrefix); + String actMsg = pathReplace(e.getMessage()); + assertEquals(exMessage, actMsg, errPrefix); } catch (Throwable e) { fail(errPrefix + "Unexpected exception", e); } } else if (exClass != null) { Exception e = assertThrows((Class<? extends Exception>)exClass, exec); - String actMsg = e.getMessage(); + String actMsg = pathReplace(e.getMessage()); if (NullPointerException.class.isAssignableFrom(exClass)) { // with Java 16+ NullPointerExceptions may contain a message ... but apparently not always ?! assertTrue(jreVersion >= 16 || actMsg == null, errPrefix); @@ -186,4 +187,9 @@ public class TestAllFiles { assertDoesNotThrow(exec, errPrefix); } } + + private static String pathReplace(String msg) { + // Windows path replacement + return msg == null ? null : msg.replace('\\', '/'); + } } |