aboutsummaryrefslogtreecommitdiffstats
path: root/src/integrationtest
diff options
context:
space:
mode:
authorDominik Stadler <centic@apache.org>2021-01-03 11:50:04 +0000
committerDominik Stadler <centic@apache.org>2021-01-03 11:50:04 +0000
commite59e84a2139470b0f60c54b6dbdea6eafca03fb0 (patch)
tree4c6774192f399c5f8edfe57b51c8efeec6eaaa01 /src/integrationtest
parente08a1785c31d886399e6538bb2f10bb11d15ea56 (diff)
downloadpoi-e59e84a2139470b0f60c54b6dbdea6eafca03fb0.tar.gz
poi-e59e84a2139470b0f60c54b6dbdea6eafca03fb0.zip
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
Diffstat (limited to 'src/integrationtest')
-rw-r--r--src/integrationtest/org/apache/poi/stress/SlideShowHandler.java17
1 files 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();