From e59e84a2139470b0f60c54b6dbdea6eafca03fb0 Mon Sep 17 00:00:00 2001 From: Dominik Stadler Date: Sun, 3 Jan 2021 11:50:04 +0000 Subject: Avoid test failing on Windows with JDK 8 because of an ArrayIndexOutOfBoundsException when handling fonts git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1885058 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/poi/stress/SlideShowHandler.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/integrationtest/org/apache/poi/stress/SlideShowHandler.java b/src/integrationtest/org/apache/poi/stress/SlideShowHandler.java index b5a1104d2b..2fd0965157 100644 --- a/src/integrationtest/org/apache/poi/stress/SlideShowHandler.java +++ b/src/integrationtest/org/apache/poi/stress/SlideShowHandler.java @@ -40,6 +40,8 @@ import org.apache.poi.sl.usermodel.SlideShowFactory; import org.apache.poi.sl.usermodel.TextParagraph; import org.apache.poi.sl.usermodel.TextRun; import org.apache.poi.sl.usermodel.TextShape; +import org.junit.jupiter.api.Assumptions; +import org.junit.platform.commons.util.ExceptionUtils; public abstract class SlideShowHandler extends POIFSFileHandler { public void handleSlideShow(SlideShow ss) throws IOException { @@ -146,8 +148,19 @@ public abstract class SlideShowHandler extends POIFSFileHandler { graphics.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON); graphics.setRenderingHint(Drawable.BUFFERED_IMAGE, new WeakReference<>(img)); - // draw stuff - s.draw(graphics); + try { + // draw stuff + s.draw(graphics); + } catch (ArrayIndexOutOfBoundsException e) { + // 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.assumeTrue( + 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"); + } graphics.dispose(); img.flush(); -- cgit v1.2.3