diff options
author | Andreas Beeker <kiwiwings@apache.org> | 2018-12-10 16:18:49 +0000 |
---|---|---|
committer | Andreas Beeker <kiwiwings@apache.org> | 2018-12-10 16:18:49 +0000 |
commit | 71027990ca1eea440959130d8f72b19281a0160d (patch) | |
tree | 26d355a8ff0012934236220e370622db7a582d19 /src | |
parent | cce4189e598a0dc8030b43b4b1226b5331d91322 (diff) | |
download | poi-71027990ca1eea440959130d8f72b19281a0160d.tar.gz poi-71027990ca1eea440959130d8f72b19281a0160d.zip |
#62999 - IBM JDK JIT causes AIOOBE in TexturePaintContext
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1848601 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
4 files changed, 28 insertions, 6 deletions
diff --git a/src/java/org/apache/poi/sl/draw/DrawBackground.java b/src/java/org/apache/poi/sl/draw/DrawBackground.java index 1e9d5945b3..c61f6dbb79 100644 --- a/src/java/org/apache/poi/sl/draw/DrawBackground.java +++ b/src/java/org/apache/poi/sl/draw/DrawBackground.java @@ -17,6 +17,8 @@ package org.apache.poi.sl.draw; +import static org.apache.poi.sl.draw.DrawPaint.fillPaintWorkaround; + import java.awt.Dimension; import java.awt.Graphics2D; import java.awt.Paint; @@ -59,10 +61,10 @@ public class DrawBackground extends DrawShape { if(fill != null) { graphics.setRenderingHint(Drawable.GRADIENT_SHAPE, anchor); graphics.setPaint(fill); - graphics.fill(anchor2); + fillPaintWorkaround(graphics, anchor2); } } - + protected Background<?,?> getShape() { return (Background<?,?>)shape; } diff --git a/src/java/org/apache/poi/sl/draw/DrawPaint.java b/src/java/org/apache/poi/sl/draw/DrawPaint.java index a830605385..80c5bcb00b 100644 --- a/src/java/org/apache/poi/sl/draw/DrawPaint.java +++ b/src/java/org/apache/poi/sl/draw/DrawPaint.java @@ -23,6 +23,7 @@ import java.awt.Graphics2D; import java.awt.LinearGradientPaint; import java.awt.Paint; import java.awt.RadialGradientPaint; +import java.awt.Shape; import java.awt.geom.AffineTransform; import java.awt.geom.Point2D; import java.awt.geom.Rectangle2D; @@ -605,4 +606,19 @@ public class DrawPaint { return (float)(1.055d * Math.pow(linRGB / 100000d, 1.0d/2.4d) - 0.055d); } } + + + static void fillPaintWorkaround(Graphics2D graphics, Shape shape) { + // the ibm jdk has a rendering/JIT bug, which throws an AIOOBE in + // TexturePaintContext$Int.setRaster(TexturePaintContext.java:476) + // this usually doesn't happen while debugging, because JIT doesn't jump in then. + try { + graphics.fill(shape); + } catch (ArrayIndexOutOfBoundsException e) { + LOG.log(POILogger.WARN, "IBM JDK failed with TexturePaintContext AIOOBE - try adding the following to the VM parameter:\n" + + "-Xjit:exclude={sun/java2d/pipe/AlphaPaintPipe.renderPathTile(Ljava/lang/Object;[BIIIIII)V} and " + + "search for 'JIT Problem Determination for IBM SDK using -Xjit' (http://www-01.ibm.com/support/docview.wss?uid=swg21294023) " + + "for how to add/determine further excludes", e); + } + } } diff --git a/src/java/org/apache/poi/sl/draw/DrawSimpleShape.java b/src/java/org/apache/poi/sl/draw/DrawSimpleShape.java index 35c3aa1207..a8d6fb534e 100644 --- a/src/java/org/apache/poi/sl/draw/DrawSimpleShape.java +++ b/src/java/org/apache/poi/sl/draw/DrawSimpleShape.java @@ -17,6 +17,8 @@ package org.apache.poi.sl.draw; +import static org.apache.poi.sl.draw.DrawPaint.fillPaintWorkaround; + import java.awt.BasicStroke; import java.awt.Color; import java.awt.Graphics2D; @@ -87,7 +89,7 @@ public class DrawSimpleShape extends DrawShape { graphics.setPaint(fillMod); java.awt.Shape s = o.getOutline(); graphics.setRenderingHint(Drawable.GRADIENT_SHAPE, s); - graphics.fill(s); + fillPaintWorkaround(graphics, s); } } } @@ -327,7 +329,7 @@ public class DrawSimpleShape extends DrawShape { graphics.setPaint(shadowColor); if(fill != null && p.isFilled()){ - graphics.fill(s); + fillPaintWorkaround(graphics, s); } else if (line != null && p.isStroked()) { graphics.draw(s); } diff --git a/src/java/org/apache/poi/sl/draw/DrawTableShape.java b/src/java/org/apache/poi/sl/draw/DrawTableShape.java index 905196fc90..703fb04d82 100644 --- a/src/java/org/apache/poi/sl/draw/DrawTableShape.java +++ b/src/java/org/apache/poi/sl/draw/DrawTableShape.java @@ -17,6 +17,8 @@ package org.apache.poi.sl.draw; +import static org.apache.poi.sl.draw.DrawPaint.fillPaintWorkaround; + import java.awt.Color; import java.awt.Graphics2D; import java.awt.Paint; @@ -83,8 +85,8 @@ public class DrawTableShape extends DrawShape { Paint fillPaint = drawPaint.getPaint(graphics, tc.getFillStyle().getPaint()); graphics.setPaint(fillPaint); Rectangle2D cellAnc = tc.getAnchor(); - graphics.fill(cellAnc); - + fillPaintWorkaround(graphics, cellAnc); + for (BorderEdge edge : BorderEdge.values()) { StrokeStyle stroke = tc.getBorderStyle(edge); if (stroke == null) { |