]> source.dussan.org Git - poi.git/commitdiff
#62999 - IBM JDK JIT causes AIOOBE in TexturePaintContext
authorAndreas Beeker <kiwiwings@apache.org>
Mon, 10 Dec 2018 16:18:49 +0000 (16:18 +0000)
committerAndreas Beeker <kiwiwings@apache.org>
Mon, 10 Dec 2018 16:18:49 +0000 (16:18 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1848601 13f79535-47bb-0310-9956-ffa450edef68

build.xml
src/java/org/apache/poi/sl/draw/DrawBackground.java
src/java/org/apache/poi/sl/draw/DrawPaint.java
src/java/org/apache/poi/sl/draw/DrawSimpleShape.java
src/java/org/apache/poi/sl/draw/DrawTableShape.java

index b3254f46568e4ba0793d471139c350fe3de2d915..ad9b2de51ed9f14284341203b720d208f44e891f 100644 (file)
--- a/build.xml
+++ b/build.xml
@@ -60,6 +60,10 @@ under the License.
     <property name="jdk.version.class" value="1.8" description="JDK version of generated class files"/>
     <property name="compile.debug" value="true"/>
 
+    <condition property="isIBMVM">
+        <contains string="${java.vendor}" substring="IBM" casesensitive="false"/>
+    </condition>
+
     <!--
         Logging is suppressed by default.
         To redirect log output to console, run ant with -Dorg.apache.poi.util.POILogger=org.apache.poi.util.SystemOutLogger
@@ -1239,6 +1243,7 @@ under the License.
             <jvmarg value="${java9addopens6}" />
             <!-- jvmarg value="-Duser.timezone=UTC"/ -->
             <jvmarg value="${file.leak.detector}" />
+            <jvmarg value="-Xjit:exclude={sun/java2d/pipe/AlphaPaintPipe.renderPathTile(Ljava/lang/Object;[BIIIIII)V}" if:true="${isIBMVM}"/>
             <formatter type="plain"/>
             <formatter type="xml"/>
             <batchtest todir="${ooxml.reports.test}">
@@ -1306,6 +1311,7 @@ under the License.
                 <pathelement location="${main.ant.jar}"/>
                 <pathelement location="${scratchpad.output.dir}"/>
             </classpath>
+            <exclude name="**/HeapDump**" if:true="${isIBMVM}"/>
         </javac>
         <!--copy todir="${integration.output.dir}">
             <fileset dir="${integration.resource1.dir}"/>
@@ -1455,6 +1461,7 @@ under the License.
                 <jvmarg value="${java9addopens5}" />
                 <jvmarg value="${java9addopens6}" />
                 <jvmarg value="${file.leak.detector}" />
+                <jvmarg value="-Xjit:exclude={sun/java2d/pipe/AlphaPaintPipe.renderPathTile(Ljava/lang/Object;[BIIIIII)V}" if:true="${isIBMVM}"/>
                 <formatter type="plain"/>
                 <formatter type="xml"/>
                 <batchtest todir="${main.reports.test}">
@@ -1527,6 +1534,7 @@ under the License.
                 <jvmarg value="${java9addopens4}" />
                 <jvmarg value="${java9addopens5}" />
                 <jvmarg value="${java9addopens6}" />
+                <jvmarg value="-Xjit:exclude={sun/java2d/pipe/AlphaPaintPipe.renderPathTile(Ljava/lang/Object;[BIIIIII)V}" if:true="${isIBMVM}"/>
                 <formatter type="plain"/>
                 <formatter type="xml"/>
                 <batchtest todir="${scratchpad.reports.test}">
@@ -1581,6 +1589,7 @@ under the License.
                   <jvmarg value="${java9addopens6}" />
                   <!-- jvmarg value="-Duser.timezone=UTC"/ -->
                   <jvmarg value="${file.leak.detector}" />
+                  <jvmarg value="-Xjit:exclude={sun/java2d/pipe/AlphaPaintPipe.renderPathTile(Ljava/lang/Object;[BIIIIII)V}" if:true="${isIBMVM}"/>
                   <formatter type="plain"/>
                   <formatter type="xml"/>
                   <batchtest todir="${ooxml.reports.test}">
@@ -1616,6 +1625,7 @@ under the License.
                   <jvmarg value="${java9addopens4}" />
                   <jvmarg value="${java9addopens5}" />
                   <jvmarg value="${java9addopens6}" />
+                  <jvmarg value="-Xjit:exclude={sun/java2d/pipe/AlphaPaintPipe.renderPathTile(Ljava/lang/Object;[BIIIIII)V}" if:true="${isIBMVM}"/>
                   <formatter type="plain"/>
                   <formatter type="xml"/>
                   <batchtest todir="${ooxml.reports.test}">
@@ -1667,6 +1677,7 @@ under the License.
                 <jvmarg value="${java9addopens4}" />
                 <jvmarg value="${java9addopens5}" />
                 <jvmarg value="${java9addopens6}" />
+                <jvmarg value="-Xjit:exclude={sun/java2d/pipe/AlphaPaintPipe.renderPathTile(Ljava/lang/Object;[BIIIIII)V}" if:true="${isIBMVM}"/>
                 <formatter type="plain"/>
                 <formatter type="xml"/>
                 <batchtest todir="${integration.reports.test}">
@@ -1755,6 +1766,7 @@ under the License.
                 <jvmarg value="${java9addopens5}" />
                 <jvmarg value="${java9addopens6}" />
                 <jvmarg value="${file.leak.detector}" />
+                <jvmarg value="-Xjit:exclude={sun/java2d/pipe/AlphaPaintPipe.renderPathTile(Ljava/lang/Object;[BIIIIII)V}" if:true="${isIBMVM}"/>
                 <formatter type="plain"/>
                 <formatter type="xml"/>
                 <batchtest todir="${excelant.reports.test}">
@@ -2885,4 +2897,8 @@ under the License.
     <target name="test-env" description="tests if ant is available on the jenkins slave">
       <echo>Using Ant: ${ant.version} from ${ant.home}</echo>    
     </target>
+
+    <target name="foo">
+        <echo>${isIBMVM}</echo>
+    </target>
 </project>
index 1e9d5945b35eaacbad0b5fd6bb3ed23f3f4c5315..c61f6dbb79c0dbcb438b359cc4aece37c6482de3 100644 (file)
@@ -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;
     }
index a830605385da39c6abdec3dff3d70e26957f7082..80c5bcb00bdec831b4bc2b022e0cf245856388d8 100644 (file)
@@ -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);
+        }
+    }
 }
index 35c3aa1207f9ab427116b47587fdf00d8e9c4aec..a8d6fb534e7d5a777579dc53b8c4ad899d39c312 100644 (file)
@@ -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);
               }
index 905196fc903251b461b717a7f12961e7c5841f56..703fb04d829b667dfa82e93460e2de1a85cbbf4e 100644 (file)
@@ -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) {