poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kiwiwi...@apache.org
Subject svn commit: r1848906 [1/3] - in /poi/branches/hemf: ./ src/examples/src/org/apache/poi/xslf/usermodel/ src/examples/src/org/apache/poi/xwpf/usermodel/examples/ src/integrationtest/org/apache/poi/ src/integrationtest/org/apache/poi/stress/ src/java/org/...
Date Fri, 14 Dec 2018 00:44:41 GMT
Author: kiwiwings
Date: Fri Dec 14 00:44:40 2018
New Revision: 1848906

URL: http://svn.apache.org/viewvc?rev=1848906&view=rev
Log:
merge trunk

Added:
    poi/branches/hemf/src/examples/src/org/apache/poi/xslf/usermodel/ChartFromScratch.java
      - copied unchanged from r1848905, poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/ChartFromScratch.java
    poi/branches/hemf/src/examples/src/org/apache/poi/xwpf/usermodel/examples/ChartFromScratch.java
      - copied unchanged from r1848905, poi/trunk/src/examples/src/org/apache/poi/xwpf/usermodel/examples/ChartFromScratch.java
    poi/branches/hemf/src/java/org/apache/poi/ss/formula/SheetRangeAndWorkbookIndexFormatter.java
      - copied unchanged from r1848905, poi/trunk/src/java/org/apache/poi/ss/formula/SheetRangeAndWorkbookIndexFormatter.java
    poi/branches/hemf/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBackground.java
      - copied unchanged from r1848905, poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBackground.java
    poi/branches/hemf/src/testcases/org/apache/poi/poifs/filesystem/TestFileMagic.java
      - copied unchanged from r1848905, poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestFileMagic.java
    poi/branches/hemf/src/testcases/org/apache/poi/ss/formula/SheetRangeAndWorkbookIndexFormatterTest.java
      - copied unchanged from r1848905, poi/trunk/src/testcases/org/apache/poi/ss/formula/SheetRangeAndWorkbookIndexFormatterTest.java
    poi/branches/hemf/test-data/document/60316.docx
      - copied unchanged from r1848905, poi/trunk/test-data/document/60316.docx
    poi/branches/hemf/test-data/document/60316b.dotx
      - copied unchanged from r1848905, poi/trunk/test-data/document/60316b.dotx
    poi/branches/hemf/test-data/slideshow/customGeo.ppt
      - copied unchanged from r1848905, poi/trunk/test-data/slideshow/customGeo.ppt
    poi/branches/hemf/test-data/slideshow/customGeo.pptx
      - copied unchanged from r1848905, poi/trunk/test-data/slideshow/customGeo.pptx
    poi/branches/hemf/test-data/slideshow/keyframes.pptx
      - copied unchanged from r1848905, poi/trunk/test-data/slideshow/keyframes.pptx
    poi/branches/hemf/test-data/slideshow/pp40only.ppt
      - copied unchanged from r1848905, poi/trunk/test-data/slideshow/pp40only.ppt
Removed:
    poi/branches/hemf/src/scratchpad/testcases/org/apache/poi/hslf/model/TestBackground.java
Modified:
    poi/branches/hemf/   (props changed)
    poi/branches/hemf/build.xml
    poi/branches/hemf/doap_POI.rdf
    poi/branches/hemf/src/integrationtest/org/apache/poi/TestAllFiles.java
    poi/branches/hemf/src/integrationtest/org/apache/poi/stress/XSSFFileHandler.java
    poi/branches/hemf/src/java/org/apache/poi/ddf/EscherProperties.java
    poi/branches/hemf/src/java/org/apache/poi/hpsf/VariantSupport.java
    poi/branches/hemf/src/java/org/apache/poi/hpsf/wellknown/PropertyIDMap.java
    poi/branches/hemf/src/java/org/apache/poi/hssf/model/InternalWorkbook.java
    poi/branches/hemf/src/java/org/apache/poi/hssf/record/RecordInputStream.java
    poi/branches/hemf/src/java/org/apache/poi/hssf/record/SSTRecord.java
    poi/branches/hemf/src/java/org/apache/poi/hssf/record/SharedFormulaRecord.java
    poi/branches/hemf/src/java/org/apache/poi/hssf/record/SharedValueRecordBase.java
    poi/branches/hemf/src/java/org/apache/poi/poifs/crypt/ChunkedCipherOutputStream.java
    poi/branches/hemf/src/java/org/apache/poi/poifs/crypt/cryptoapi/CryptoAPIEncryptor.java
    poi/branches/hemf/src/java/org/apache/poi/poifs/filesystem/FileMagic.java
    poi/branches/hemf/src/java/org/apache/poi/sl/draw/DrawBackground.java
    poi/branches/hemf/src/java/org/apache/poi/sl/draw/DrawFreeformShape.java
    poi/branches/hemf/src/java/org/apache/poi/sl/draw/DrawPaint.java
    poi/branches/hemf/src/java/org/apache/poi/sl/draw/DrawSimpleShape.java
    poi/branches/hemf/src/java/org/apache/poi/sl/draw/DrawTableShape.java
    poi/branches/hemf/src/java/org/apache/poi/sl/draw/PathGradientPaint.java
    poi/branches/hemf/src/java/org/apache/poi/sl/draw/geom/Context.java
    poi/branches/hemf/src/java/org/apache/poi/sl/draw/geom/PresetGeometries.java
    poi/branches/hemf/src/java/org/apache/poi/sl/usermodel/FreeformShape.java
    poi/branches/hemf/src/java/org/apache/poi/ss/formula/SheetNameFormatter.java
    poi/branches/hemf/src/java/org/apache/poi/ss/formula/functions/MatrixFunction.java
    poi/branches/hemf/src/java/org/apache/poi/ss/formula/ptg/Area3DPxg.java
    poi/branches/hemf/src/java/org/apache/poi/ss/formula/ptg/Ref3DPxg.java
    poi/branches/hemf/src/java/org/apache/poi/util/RecordFormatException.java
    poi/branches/hemf/src/java/org/apache/poi/util/StringUtil.java
    poi/branches/hemf/src/java/org/apache/poi/util/Units.java
    poi/branches/hemf/src/ooxml/java/org/apache/poi/ooxml/POIXMLDocumentPart.java
    poi/branches/hemf/src/ooxml/java/org/apache/poi/ooxml/extractor/CommandLineTextExtractor.java
    poi/branches/hemf/src/ooxml/java/org/apache/poi/ooxml/util/POIXMLConstants.java
    poi/branches/hemf/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ZipHelper.java
    poi/branches/hemf/src/ooxml/java/org/apache/poi/openxml4j/util/ZipInputStreamZipEntrySource.java
    poi/branches/hemf/src/ooxml/java/org/apache/poi/poifs/crypt/dsig/SignatureOutputStream.java
    poi/branches/hemf/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChart.java
    poi/branches/hemf/src/ooxml/java/org/apache/poi/xslf/usermodel/XMLSlideShow.java
    poi/branches/hemf/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFChart.java
    poi/branches/hemf/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFDrawing.java
    poi/branches/hemf/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFFreeformShape.java
    poi/branches/hemf/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSheet.java
    poi/branches/hemf/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSimpleShape.java
    poi/branches/hemf/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java
    poi/branches/hemf/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFChart.java
    poi/branches/hemf/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java
    poi/branches/hemf/src/ooxml/testcases/org/apache/poi/ooxml/TestPOIXMLProperties.java
    poi/branches/hemf/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestSignatureInfo.java
    poi/branches/hemf/src/ooxml/testcases/org/apache/poi/xddf/usermodel/TestNecessaryOOXMLClasses.java
    poi/branches/hemf/src/ooxml/testcases/org/apache/poi/xdgf/extractor/TestXDGFVisioExtractor.java
    poi/branches/hemf/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestPPTX2PNG.java
    poi/branches/hemf/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFSlide.java
    poi/branches/hemf/src/ooxml/testcases/org/apache/poi/xssf/XSSFTestDataSamples.java
    poi/branches/hemf/src/ooxml/testcases/org/apache/poi/xwpf/extractor/TestXWPFWordExtractor.java
    poi/branches/hemf/src/scratchpad/src/org/apache/poi/hslf/record/CurrentUserAtom.java
    poi/branches/hemf/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFAutoShape.java
    poi/branches/hemf/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFFill.java
    poi/branches/hemf/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFFreeformShape.java
    poi/branches/hemf/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFShape.java
    poi/branches/hemf/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSimpleShape.java
    poi/branches/hemf/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShow.java
    poi/branches/hemf/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShowImpl.java
    poi/branches/hemf/src/scratchpad/testcases/org/apache/poi/hslf/model/AllHSLFModelTests.java
    poi/branches/hemf/src/scratchpad/testcases/org/apache/poi/hslf/model/TestFreeform.java
    poi/branches/hemf/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/AllHSLFUserModelTests.java
    poi/branches/hemf/src/testcases/org/apache/poi/poifs/filesystem/TestPOIFSFileSystem.java
    poi/branches/hemf/src/testcases/org/apache/poi/ss/usermodel/TestExcelStyleDateFormatter.java

Propchange: poi/branches/hemf/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Dec 14 00:44:40 2018
@@ -1,6 +1,7 @@
 /poi/branches/common_sl:1661320-1691849
 /poi/branches/excelant:1069732-1073692
 /poi/branches/gsoc2012:1341450-1371650
+/poi/branches/hemf:1843341
 /poi/branches/hssf_cryptoapi:1753906-1762715
 /poi/branches/ss_border_property_template:1747847-1748074
 /poi/branches/xml_signature:1617139-1628347

Modified: poi/branches/hemf/build.xml
URL: http://svn.apache.org/viewvc/poi/branches/hemf/build.xml?rev=1848906&r1=1848905&r2=1848906&view=diff
==============================================================================
--- poi/branches/hemf/build.xml (original)
+++ poi/branches/hemf/build.xml Fri Dec 14 00:44:40 2018
@@ -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
@@ -342,17 +346,6 @@ under the License.
         <propertyref name="scratchpad.ignore"/>
     </propertyset>
 
-    <!-- these need to be set differently when running with Java 9 -->
-    <property name="java9addmods" value="-Dthis.is.a.dummy=true"/>
-    <property name="javadoc9addmods" value="-J-Dthis.is.a.dummy=true"/>
-    <property name="java9addmodsvalue" value="-Dthis.is.a.dummy=true"/>
-    <property name="java9addopens1" value="-Dthis.is.a.dummy=true"/>
-    <property name="java9addopens2" value="-Dthis.is.a.dummy=true"/>
-    <property name="java9addopens3" value="-Dthis.is.a.dummy=true"/>
-    <property name="java9addopens4" value="-Dthis.is.a.dummy=true"/>
-    <property name="java9addopens5" value="-Dthis.is.a.dummy=true"/>
-    <property name="java9addopens6" value="-Dthis.is.a.dummy=true"/>
-
     <path id="main.classpath">
         <pathelement location="${main.commons-logging.jar}"/>
         <pathelement location="${main.commons-codec.jar}"/>
@@ -1180,6 +1173,59 @@ under the License.
         </copy>
     </target>
 
+    <macrodef name="poiunit" xmlns:jacoco="antlib:org.jacoco.ant">
+        <attribute name="failureproperty"/>
+        <attribute name="heap" default="512"/>
+        <attribute name="showoutput" default="false"/>
+        <attribute name="jacocodest" default="build/jacoco-dest.exec"/>
+        <element name="elements" implicit="true"/>
+        <sequential>
+            <local name="no.jit.sherlock"/>
+            <!-- see http://www-01.ibm.com/support/docview.wss?uid=swg21294023 on how to determine the method strings -->
+            <property name="no.jit.sherlock">
+                sun/java2d/pipe/AAShapePipe.renderTiles(Lsun/java2d/SunGraphics2D;Ljava/awt/Shape;Lsun/java2d/pipe/AATileGenerator;[I)V
+                sun/java2d/pipe/AlphaPaintPipe.renderPathTile(Ljava/lang/Object;[BIIIIII)V
+                java/awt/TexturePaintContext.getRaster(IIII)Ljava/awt/image/Raster;
+            </property>
+            <script language="javascript">
+                var before = project.getProperty("no.jit.sherlock");
+                project.setProperty("no.jit.sherlock", before.trim().replace(/ *(\S+) */g,"exclude={$1}").replace(/\s/g,","));
+            </script>
+
+            <local name="ooxml.lite.agent.exists"/>
+            <available property="ooxml.lite.agent.exists" file="${ooxml.lite.agent}"/>
+
+            <jacoco:coverage enabled="${coverage.enabled}" excludes="${coverage.excludes}" destfile="@{jacocodest}">
+                <junit printsummary="yes" fork="yes" forkmode="once" haltonfailure="${halt.on.test.failure}"
+                       failureproperty="@{failureproperty}" showoutput="@{showoutput}">
+                    <syspropertyset refid="junit.properties"/>
+                    <sysproperty key="java.io.tmpdir" value="${tempdir}"/>
+                    <jvmarg value="-Xmx@{heap}M"/>
+                    <jvmarg value="-ea"/>
+
+                    <!-- these need to be set differently when running with Java 9 -->
+                    <jvmarg value="${java9addmods}" if:set="${java9addmods}" />
+                    <jvmarg value="${java9addmodsvalue}" if:set="${java9addmodsvalue}" />
+                    <jvmarg value="${java9addopens1}" if:set="${java9addopens1}" />
+                    <jvmarg value="${java9addopens2}" if:set="${java9addopens2}" />
+                    <jvmarg value="${java9addopens3}" if:set="${java9addopens3}" />
+                    <jvmarg value="${java9addopens4}" if:set="${java9addopens4}" />
+                    <jvmarg value="${java9addopens5}" if:set="${java9addopens5}" />
+                    <jvmarg value="${java9addopens6}" if:set="${java9addopens6}" />
+
+                    <jvmarg value="-javaagent:${ooxml.lite.agent}=${ooxml.lite.report}|${ooxml.lite.includes}" if:true="${ooxml.lite.agent.exists}"/>
+
+                    <!-- jvmarg value="-Duser.timezone=UTC"/ -->
+                    <jvmarg value="${file.leak.detector}" />
+                    <jvmarg value="-Xjit:verbose={compileStart|compileEnd},vlog=build/jit.log,${no.jit.sherlock}" if:true="${isIBMVM}"/>
+                    <formatter type="plain"/>
+                    <formatter type="xml"/>
+                    <elements/>
+                </junit>
+            </jacoco:coverage>
+        </sequential>
+    </macrodef>
+
     <target name="retest-ooxml" depends="jar">
         <delete dir="${ooxml.reports.test}"/>
         <delete dir="${ooxml.output.test.dir}"/>
@@ -1219,39 +1265,23 @@ under the License.
         <copy todir="${ooxml.output.dir}">
             <fileset dir="${ooxml.resource1.dir}"/>
         </copy>
-        <junit printsummary="yes" fork="yes" forkmode="once" haltonfailure="${halt.on.test.failure}"
-               failureproperty="ooxml.test.failed">
+
+        <poiunit failureproperty="ooxml.test.failed" heap="768">
             <classpath>
                 <path refid="test.ooxml.lite.verify.classpath"/>
                 <path refid="test.jar.classpath"/>
             </classpath>
-            <syspropertyset refid="junit.properties"/>
-            <sysproperty key="java.io.tmpdir" value="${tempdir}"/>
-            <jvmarg value="-Xmx768M"/>
-            <jvmarg value="-ea"/>
-            <jvmarg value="${java9addmods}" />
-            <jvmarg value="${java9addmodsvalue}" />
-            <jvmarg value="${java9addopens1}" />
-            <jvmarg value="${java9addopens2}" />
-            <jvmarg value="${java9addopens3}" />
-            <jvmarg value="${java9addopens4}" />
-            <jvmarg value="${java9addopens5}" />
-            <jvmarg value="${java9addopens6}" />
-            <!-- jvmarg value="-Duser.timezone=UTC"/ -->
-            <jvmarg value="${file.leak.detector}" />
-            <formatter type="plain"/>
-            <formatter type="xml"/>
             <batchtest todir="${ooxml.reports.test}">
                 <fileset dir="${ooxml.src.test}">
-                     <include name="**/${testpattern}.java"/>
-                     <exclude name="**/TestUnfixedBugs.java"/>
-                     <exclude name="**/All*Tests.java"/>
-                     <exclude name="**/TestSignatureInfo.java"/>
-                     <exclude name="**/${testexcludepattern}.java"/>
-                     <patternset refid="exclude-scratchpad-test" if:true="${scratchpad.ignore}"/>
+                    <include name="**/${testpattern}.java"/>
+                    <exclude name="**/TestUnfixedBugs.java"/>
+                    <exclude name="**/All*Tests.java"/>
+                    <exclude name="**/TestSignatureInfo.java"/>
+                    <exclude name="**/${testexcludepattern}.java"/>
+                    <patternset refid="exclude-scratchpad-test" if:true="${scratchpad.ignore}"/>
                 </fileset>
             </batchtest>
-        </junit>
+        </poiunit>
     </target>
 
     <target name="compile-excelant" depends="compile-main,compile-ooxml">
@@ -1306,6 +1336,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}"/>
@@ -1436,39 +1467,22 @@ under the License.
     <target name="test-main" unless="main.test.notRequired"
             depends="compile-main, -test-main-check,jacocotask" xmlns:jacoco="antlib:org.jacoco.ant"
             description="tests POI classes that deal with the Microsoft Office binary (BIFF8) file formats (excludes OOXML)">
-        <jacoco:coverage enabled="${coverage.enabled}" excludes="${coverage.excludes}" destfile="build/jacoco-main.exec">
-            <junit fork="yes" forkmode="once" printsummary="yes" haltonfailure="${halt.on.test.failure}"
-                   failureproperty="main.test.failed" showoutput="true">
-                <classpath refid="test.classpath"/>
-                <classpath refid="test.jar.classpath"/>
-                <syspropertyset refid="junit.properties"/>
-                <sysproperty key="java.io.tmpdir" value="${tempdir}"/>
-                <jvmarg value="-ea"/>
-                <jvmarg value="-Xmx256m"/>
-                <!-- jvmarg value="-Duser.timezone=UTC"/ -->
-                <jvmarg value="${java9addmods}" />
-                <jvmarg value="${java9addmodsvalue}" />
-                <jvmarg value="${java9addopens1}" />
-                <jvmarg value="${java9addopens2}" />
-                <jvmarg value="${java9addopens3}" />
-                <jvmarg value="${java9addopens4}" />
-                <jvmarg value="${java9addopens5}" />
-                <jvmarg value="${java9addopens6}" />
-                <jvmarg value="${file.leak.detector}" />
-                <formatter type="plain"/>
-                <formatter type="xml"/>
-                <batchtest todir="${main.reports.test}">
-                    <fileset dir="${main.src.test}">
-                        <include name="**/${testpattern}.java"/>
-                        <exclude name="**/All*Tests.java"/>
-                        <exclude name="**/TestUnfixedBugs.java"/>
-                        <exclude name="**/TestcaseRecordInputStream.java"/>
-                        <exclude name="**/${testexcludepattern}.java"/>
-                        <patternset refid="exclude-scratchpad-test" if:true="${scratchpad.ignore}"/>
-                    </fileset>
-                </batchtest>
-            </junit>
-        </jacoco:coverage>
+        <poiunit failureproperty="main.test.failed" heap="256" showoutput="true" jacocodest="build/jacoco-main.exec">
+            <classpath>
+                <path refid="test.classpath"/>
+                <path refid="test.jar.classpath"/>
+            </classpath>
+            <batchtest todir="${main.reports.test}">
+                <fileset dir="${main.src.test}">
+                    <include name="**/${testpattern}.java"/>
+                    <exclude name="**/All*Tests.java"/>
+                    <exclude name="**/TestUnfixedBugs.java"/>
+                    <exclude name="**/TestcaseRecordInputStream.java"/>
+                    <exclude name="**/${testexcludepattern}.java"/>
+                    <patternset refid="exclude-scratchpad-test" if:true="${scratchpad.ignore}"/>
+                </fileset>
+            </batchtest>
+        </poiunit>
         <delete file="${main.testokfile}"/>
         <antcall target="-test-main-write-testfile"/>
     </target>
@@ -1500,45 +1514,23 @@ under the License.
         </uptodate>
     </target>
 
-    <target name="test-scratchpad" depends="compile-main,compile-scratchpad,-test-scratchpad-check,jacocotask,test-scratchpad-download-resources"
+    <target name="test-scratchpad" depends="compile-main,compile-scratchpad,-test-scratchpad-check,test-scratchpad-download-resources"
             unless="scratchpad.test.notRequired" xmlns:jacoco="antlib:org.jacoco.ant"
             description="test non-OOXML scratchpad classes">
-        <jacoco:coverage enabled="${coverage.enabled}" excludes="${coverage.excludes}" destfile="build/jacoco-scratchpad.exec">
-            <junit printsummary="yes" fork="yes" forkmode="once" haltonfailure="${halt.on.test.failure}"
-                   failureproperty="scratchpad.test.failed">
-                <classpath refid="test.scratchpad.classpath"/>
-                <classpath refid="test.jar.classpath"/>
-                <syspropertyset refid="junit.properties"/>
-                <sysproperty key="java.io.tmpdir" value="${tempdir}"/>
-                <jvmarg value="-ea"/>
-                <!-- jvmarg value="-Duser.timezone=UTC"/ -->
-                <jvmarg value="${file.leak.detector}" />
-                <!--
-                  YK: ensure that JUnit has enough memory to run tests.
-                  Without the line below tests fail on Mac OS X with jdk-1.6.26
-                  and on Windows with jdk-1.5.22
-                -->
-                <jvmarg value="-Xmx512m"/>
-                <jvmarg value="${java9addmods}" />
-                <jvmarg value="${java9addmodsvalue}" />
-                <jvmarg value="${java9addopens1}" />
-                <jvmarg value="${java9addopens2}" />
-                <jvmarg value="${java9addopens3}" />
-                <jvmarg value="${java9addopens4}" />
-                <jvmarg value="${java9addopens5}" />
-                <jvmarg value="${java9addopens6}" />
-                <formatter type="plain"/>
-                <formatter type="xml"/>
-                <batchtest todir="${scratchpad.reports.test}">
-                    <fileset dir="${scratchpad.src.test}">
-                        <include name="**/${testpattern}.java"/>
-                        <exclude name="**/AllTests.java"/>
-                        <exclude name="**/${testexcludepattern}.java"/>
-                        <patternset refid="exclude-scratchpad-test" if:true="${scratchpad.ignore}"/>
-                    </fileset>
-                </batchtest>
-            </junit>
-        </jacoco:coverage>
+        <poiunit failureproperty="scratchpad.test.failed" heap="512" jacocodest="build/jacoco-scratchpad.exec">
+            <classpath>
+                <path refid="test.scratchpad.classpath"/>
+                <path refid="test.jar.classpath"/>
+            </classpath>
+            <batchtest todir="${scratchpad.reports.test}">
+                <fileset dir="${scratchpad.src.test}">
+                    <include name="**/${testpattern}.java"/>
+                    <exclude name="**/AllTests.java"/>
+                    <exclude name="**/${testexcludepattern}.java"/>
+                    <patternset refid="exclude-scratchpad-test" if:true="${scratchpad.ignore}"/>
+                </fileset>
+            </batchtest>
+        </poiunit>
         <delete file="${scratchpad.testokfile}"/>
         <antcall target="-test-scratchpad-write-testfile"/>
     </target>
@@ -1559,72 +1551,35 @@ under the License.
         <attribute name="classpath"/>
         <attribute name="type"/>
         <sequential>
-            <jacoco:coverage enabled="${coverage.enabled}" excludes="${coverage.excludes}" destfile="build/jacoco-@{type}.exec">
-              <junit printsummary="yes" fork="yes" forkmode="once" haltonfailure="${halt.on.test.failure}"
-                     failureproperty="ooxml.test.failed">
-                  <classpath>
-                      <path refid="@{classpath}"/>
-                      <path refid="test.jar.classpath"/>
-                  </classpath>
-                  <syspropertyset refid="junit.properties"/>
-                  <sysproperty key="java.io.tmpdir" value="${tempdir}"/>
-                  <jvmarg value="-Xmx768M"/>
-                  <jvmarg value="-ea"/>
-                  <jvmarg value="-javaagent:${ooxml.lite.agent}=${ooxml.lite.report}|${ooxml.lite.includes}"/>
-                  <jvmarg value="${java9addmods}" />
-                  <jvmarg value="${java9addmodsvalue}" />
-                  <jvmarg value="${java9addopens1}" />
-                  <jvmarg value="${java9addopens2}" />
-                  <jvmarg value="${java9addopens3}" />
-                  <jvmarg value="${java9addopens4}" />
-                  <jvmarg value="${java9addopens5}" />
-                  <jvmarg value="${java9addopens6}" />
-                  <!-- jvmarg value="-Duser.timezone=UTC"/ -->
-                  <jvmarg value="${file.leak.detector}" />
-                  <formatter type="plain"/>
-                  <formatter type="xml"/>
-                  <batchtest todir="${ooxml.reports.test}">
-                      <fileset dir="${ooxml.src.test}">
-                          <include name="**/${testpattern}.java"/>
-                          <exclude name="**/TestUnfixedBugs.java"/>
-                          <exclude name="**/All*Tests.java"/>
-                          <exclude name="**/TestSignatureInfo.java"/>
-                          <exclude name="**/${testexcludepattern}.java"/>
-                          <patternset refid="exclude-scratchpad-test" if:true="${scratchpad.ignore}"/>
-                      </fileset>
-                  </batchtest>
-              </junit>
-            </jacoco:coverage>
-            <jacoco:coverage enabled="${coverage.enabled}" excludes="${coverage.excludes}" destfile="build/jacoco-@{type}-xmlsec.exec">
-              <junit printsummary="yes" fork="yes" forkmode="once" haltonfailure="${halt.on.test.failure}"
-                     failureproperty="ooxml.xmlsec.test.failed">
-                  <classpath>
-                      <path refid="@{classpath}"/>
-                      <path refid="test.jar.classpath"/>
-                      <path refid="ooxml.xmlsec.classpath"/>
-                  </classpath>
-                  <syspropertyset refid="junit.properties"/>
-                  <sysproperty key="java.io.tmpdir" value="${tempdir}"/>
-                  <jvmarg value="-javaagent:${ooxml.lite.agent}=${ooxml.lite.report}|${ooxml.lite.includes}"/>
-                  <jvmarg value="-Xmx768M"/>
-                  <jvmarg value="-ea"/>
-                  <jvmarg value="${java9addmods}" />
-                  <jvmarg value="${java9addmodsvalue}" />
-                  <jvmarg value="${java9addopens1}" />
-                  <jvmarg value="${java9addopens2}" />
-                  <jvmarg value="${java9addopens3}" />
-                  <jvmarg value="${java9addopens4}" />
-                  <jvmarg value="${java9addopens5}" />
-                  <jvmarg value="${java9addopens6}" />
-                  <formatter type="plain"/>
-                  <formatter type="xml"/>
-                  <batchtest todir="${ooxml.reports.test}">
-                      <fileset dir="${ooxml.src.test}">
-                            <include name="**/TestSignatureInfo.java"/>
-                      </fileset>
-                  </batchtest>
-              </junit>
-            </jacoco:coverage>
+            <poiunit failureproperty="ooxml.test.failed" heap="768" jacocodest="build/jacoco-@{type}.exec">
+                <classpath>
+                    <path refid="@{classpath}"/>
+                    <path refid="test.jar.classpath"/>
+                </classpath>
+                <batchtest todir="${ooxml.reports.test}">
+                    <fileset dir="${ooxml.src.test}">
+                        <include name="**/${testpattern}.java"/>
+                        <exclude name="**/TestUnfixedBugs.java"/>
+                        <exclude name="**/All*Tests.java"/>
+                        <exclude name="**/TestSignatureInfo.java"/>
+                        <exclude name="**/${testexcludepattern}.java"/>
+                        <patternset refid="exclude-scratchpad-test" if:true="${scratchpad.ignore}"/>
+                    </fileset>
+                </batchtest>
+            </poiunit>
+
+            <poiunit failureproperty="ooxml.xmlsec.test.failed" heap="768" jacocodest="build/jacoco-@{type}-xmlsec.exec">
+                <classpath>
+                    <path refid="@{classpath}"/>
+                    <path refid="test.jar.classpath"/>
+                    <path refid="ooxml.xmlsec.classpath"/>
+                </classpath>
+                <batchtest todir="${ooxml.reports.test}">
+                    <fileset dir="${ooxml.src.test}">
+                        <include name="**/TestSignatureInfo.java"/>
+                    </fileset>
+                </batchtest>
+            </poiunit>
         </sequential>
     </macrodef>
 
@@ -1650,34 +1605,16 @@ under the License.
             unless="integration.test.notRequired" xmlns:jacoco="antlib:org.jacoco.ant">
         <propertyreset name="org.apache.poi.util.POILogger" value="org.apache.poi.util.CommonsLogger"/>
         <delete dir="build" includes="test-integration.log*"/>
-        <jacoco:coverage enabled="${coverage.enabled}" excludes="${coverage.excludes}" destfile="build/jacoco-integration.exec">
-            <junit printsummary="yes" fork="yes" forkmode="once" haltonfailure="${halt.on.test.failure}"
-                   failureproperty="integration.test.failed" showoutput="true">
-                <classpath refid="test.integration.classpath"/>
-                <syspropertyset refid="junit.properties"/>
-                <sysproperty key="java.io.tmpdir" value="${tempdir}"/>
-                <jvmarg value="-ea"/>
-                <jvmarg value="-Xmx1512M"/>
-                <jvmarg value="-javaagent:${ooxml.lite.agent}=${ooxml.lite.report}|${ooxml.lite.includes}"/>
-                <jvmarg value="${java9addmods}" />
-                <jvmarg value="${java9addmodsvalue}" />
-                <jvmarg value="${java9addopens1}" />
-                <jvmarg value="${java9addopens2}" />
-                <jvmarg value="${java9addopens3}" />
-                <jvmarg value="${java9addopens4}" />
-                <jvmarg value="${java9addopens5}" />
-                <jvmarg value="${java9addopens6}" />
-                <formatter type="plain"/>
-                <formatter type="xml"/>
-                <batchtest todir="${integration.reports.test}">
-                    <fileset dir="${integration.src.test}">
-                        <include name="**/${testpattern}.java"/>
-                        <exclude name="**/${testexcludepattern}.java"/>
-                        <patternset refid="exclude-scratchpad-test" if:true="${scratchpad.ignore}"/>
-                    </fileset>
-                </batchtest>
-            </junit>
-        </jacoco:coverage>
+        <poiunit failureproperty="integration.test.failed" heap="1512" showoutput="true" jacocodest="build/jacoco-integration.exec">
+            <classpath refid="test.integration.classpath"/>
+            <batchtest todir="${integration.reports.test}">
+                <fileset dir="${integration.src.test}">
+                    <include name="**/${testpattern}.java"/>
+                    <exclude name="**/${testexcludepattern}.java"/>
+                    <patternset refid="exclude-scratchpad-test" if:true="${scratchpad.ignore}"/>
+                </fileset>
+            </batchtest>
+        </poiunit>
         <delete file="${integration.testokfile}"/>
         <antcall target="-test-integration-write-testfile"/>
     </target>
@@ -1739,33 +1676,16 @@ under the License.
 
     <target name="test-excelant" depends="compile-excelant,-test-excelant-check,jacocotask"
             unless="excelant.test.notRequired" xmlns:jacoco="antlib:org.jacoco.ant">
-        <jacoco:coverage enabled="${coverage.enabled}" excludes="${coverage.excludes}" destfile="build/jacoco-excelant.exec">
-            <junit printsummary="yes" fork="yes" forkmode="once" haltonfailure="${halt.on.test.failure}"
-                   failureproperty="excelant.test.failed">
-                <classpath refid="test.excelant.classpath"/>
-                <syspropertyset refid="junit.properties"/>
-                <sysproperty key="java.io.tmpdir" value="${tempdir}"/>
-                <jvmarg value="-ea"/>
-                <jvmarg value="${java9addmods}" />
-                <jvmarg value="${java9addmodsvalue}" />
-                <jvmarg value="${java9addopens1}" />
-                <jvmarg value="${java9addopens2}" />
-                <jvmarg value="${java9addopens3}" />
-                <jvmarg value="${java9addopens4}" />
-                <jvmarg value="${java9addopens5}" />
-                <jvmarg value="${java9addopens6}" />
-                <jvmarg value="${file.leak.detector}" />
-                <formatter type="plain"/>
-                <formatter type="xml"/>
-                <batchtest todir="${excelant.reports.test}">
-                    <fileset dir="${excelant.src.test}">
-                        <include name="**/${testpattern}.java"/>
-                        <exclude name="**/${testexcludepattern}.java"/>
-                        <patternset refid="exclude-scratchpad-test" if:true="${scratchpad.ignore}"/>
-                    </fileset>
-                </batchtest>
-            </junit>
-        </jacoco:coverage>
+        <poiunit failureproperty="excelant.test.failed" jacocodest="build/jacoco-excelant.exec">
+            <classpath refid="test.excelant.classpath"/>
+            <batchtest todir="${excelant.reports.test}">
+                <fileset dir="${excelant.src.test}">
+                    <include name="**/${testpattern}.java"/>
+                    <exclude name="**/${testexcludepattern}.java"/>
+                    <patternset refid="exclude-scratchpad-test" if:true="${scratchpad.ignore}"/>
+                </fileset>
+            </batchtest>
+        </poiunit>
         <delete file="${excelant.testokfile}"/>
         <antcall target="-test-excelant-write-testfile"/>
     </target>
@@ -1791,6 +1711,9 @@ under the License.
     <target name="docs" depends="init, -check-forrest-installed, -check-docs, javadocs, -forrest-docs"
             unless="main.docs.notRequired" 
             description="Builds the POI website" />
+
+    <target name="site" depends="-forrest-docs"/>
+
     <target name="-forrest-docs" depends="-check-forrest-installed, -check-docs"
             unless="main.docs.notRequired" description="Builds the HTML pages of the POI website">
         <exec executable="${env.FORREST_HOME}/bin/forrest" osfamily="unix"/>
@@ -1828,7 +1751,7 @@ under the License.
                 <include name="org/apache/poi/**"/>
             </packageset>
             
-            <arg value="${javadoc9addmods}"/>
+            <arg value="${javadoc9addmods}" if:set="${javadoc9addmods}"/>
 
             <doctitle><![CDATA[<h1>POI API Documentation</h1>]]></doctitle>
             <bottom>
@@ -2113,6 +2036,7 @@ under the License.
                       sonar/*/src/**,
                       compile-lib/**,
                       ooxml-lib/**,
+                      ooxml-testlib/**,
                       scripts/**,
                       TEST*,
                       *.ipr,
@@ -2303,7 +2227,10 @@ under the License.
         </forbiddenapis>
     </target>
 
-    <target name="findbugs" depends="jar">
+    <!-- disabling findbugs until jenkins is updated to a current IBM JDK
+         see https://stackoverflow.com/a/48561534/2066598
+         this should be replaced by spotbugs when available in the jenkins warnings plugin -->
+    <target name="findbugs" depends="jar" unless="${isIBMVM}">
         <downloadfile src="${findbugs.url}" dest="${findbugs.jar}"/>
 
         <property name="findbugs.home" value="build/findbugs" />
@@ -2453,7 +2380,7 @@ under the License.
             <copy todir="${repo}">
                 <mappedresources>
                     <!-- add sha-512 when nexus rules are updated (1/2) -->
-                    <fileset dir="build/dist/maven" includes="@{artifactId}/**" excludes="**/*.sha512"/>
+                    <fileset dir="build/dist/maven" includes="@{artifactId}/**" excludes="**/*.sha512,**/*.sha256"/>
                     <regexpmapper from="^([^/]+)/(.*)$$" to="org/apache/poi/\1/${version.id}/\2" handledirsep="true"/>
                 </mappedresources>
             </copy>

Modified: poi/branches/hemf/doap_POI.rdf
URL: http://svn.apache.org/viewvc/poi/branches/hemf/doap_POI.rdf?rev=1848906&r1=1848905&r2=1848906&view=diff
==============================================================================
--- poi/branches/hemf/doap_POI.rdf (original)
+++ poi/branches/hemf/doap_POI.rdf Fri Dec 14 00:44:40 2018
@@ -37,6 +37,13 @@
     <category rdf:resource="https://projects.apache.org/category/library" />
     <release>
       <Version>
+        <name>Apache POI 4.0.1</name>
+        <created>2018-12-03</created>
+        <revision>4.0.1</revision>
+      </Version>
+    </release>
+    <release>
+      <Version>
         <name>Apache POI 4.0.0</name>
         <created>2018-09-07</created>
         <revision>4.0.0</revision>

Modified: poi/branches/hemf/src/integrationtest/org/apache/poi/TestAllFiles.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/integrationtest/org/apache/poi/TestAllFiles.java?rev=1848906&r1=1848905&r2=1848906&view=diff
==============================================================================
--- poi/branches/hemf/src/integrationtest/org/apache/poi/TestAllFiles.java (original)
+++ poi/branches/hemf/src/integrationtest/org/apache/poi/TestAllFiles.java Fri Dec 14 00:44:40 2018
@@ -289,6 +289,7 @@ public class TestAllFiles {
         "document/Bug50955.doc",
         "document/57843.doc",
         "slideshow/PPT95.ppt",
+        "slideshow/pp40only.ppt",
         "slideshow/Divino_Revelado.pptx",
         "openxml4j/OPCCompliance_CoreProperties_DCTermsNamespaceLimitedUseFAIL.docx",
         "openxml4j/OPCCompliance_CoreProperties_DoNotUseCompatibilityMarkupFAIL.docx",

Modified: poi/branches/hemf/src/integrationtest/org/apache/poi/stress/XSSFFileHandler.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/integrationtest/org/apache/poi/stress/XSSFFileHandler.java?rev=1848906&r1=1848905&r2=1848906&view=diff
==============================================================================
--- poi/branches/hemf/src/integrationtest/org/apache/poi/stress/XSSFFileHandler.java (original)
+++ poi/branches/hemf/src/integrationtest/org/apache/poi/stress/XSSFFileHandler.java Fri Dec 14 00:44:40 2018
@@ -35,7 +35,6 @@ import java.util.Iterator;
 import java.util.Locale;
 import java.util.Set;
 
-import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.transform.TransformerException;
 
 import org.apache.poi.EncryptedDocumentException;
@@ -148,7 +147,7 @@ public class XSSFFileHandler extends Spr
     }
     
     private void exportToXML(XSSFWorkbook wb) throws SAXException,
-            ParserConfigurationException, TransformerException {
+            TransformerException {
         for (XSSFMap map : wb.getCustomXMLMappings()) {
             XSSFExportToXml exporter = new XSSFExportToXml(map);
 
@@ -165,7 +164,6 @@ public class XSSFFileHandler extends Spr
         // zip-bomb
         EXPECTED_ADDITIONAL_FAILURES.add("spreadsheet/54764.xlsx");
         EXPECTED_ADDITIONAL_FAILURES.add("spreadsheet/54764-2.xlsx");
-        EXPECTED_ADDITIONAL_FAILURES.add("spreadsheet/54764.xlsx");
         EXPECTED_ADDITIONAL_FAILURES.add("spreadsheet/poc-xmlbomb.xlsx");
         EXPECTED_ADDITIONAL_FAILURES.add("spreadsheet/poc-xmlbomb-empty.xlsx");
         // strict OOXML
@@ -185,18 +183,19 @@ public class XSSFFileHandler extends Spr
     public void handleAdditional(File file) throws Exception {
         // redirect stdout as the examples often write lots of text
         PrintStream oldOut = System.out;
+        String testFile = file.getParentFile().getName() + "/" + file.getName();
         try {
             System.setOut(new NullPrintStream());
             FromHowTo.main(new String[]{file.getAbsolutePath()});
             XLSX2CSV.main(new String[]{file.getAbsolutePath()});
 
             assertFalse("Expected Extraction to fail for file " + file + " and handler " + this + ", but did not fail!",
-                    EXPECTED_ADDITIONAL_FAILURES.contains(file.getParentFile().getName() + "/" + file.getName()));
+                    EXPECTED_ADDITIONAL_FAILURES.contains(testFile));
 
         } catch (OLE2NotOfficeXmlFileException e) {
             // we have some files that are not actually OOXML and thus cannot be tested here
         } catch (IllegalArgumentException | InvalidFormatException | POIXMLException | IOException e) {
-            if(!EXPECTED_ADDITIONAL_FAILURES.contains(file.getParentFile().getName() + "/" + file.getName())) {
+            if(!EXPECTED_ADDITIONAL_FAILURES.contains(testFile)) {
                 throw e;
             }
         } finally {

Modified: poi/branches/hemf/src/java/org/apache/poi/ddf/EscherProperties.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/java/org/apache/poi/ddf/EscherProperties.java?rev=1848906&r1=1848905&r2=1848906&view=diff
==============================================================================
--- poi/branches/hemf/src/java/org/apache/poi/ddf/EscherProperties.java (original)
+++ poi/branches/hemf/src/java/org/apache/poi/ddf/EscherProperties.java Fri Dec 14 00:44:40 2018
@@ -26,6 +26,7 @@ import java.util.Map;
  *
  * @author Glen Stampoultzis (glens at apache.org)
  */
+@SuppressWarnings("WeakerAccess")
 public final class EscherProperties {
 
 	// Property constants
@@ -117,6 +118,15 @@ public final class EscherProperties {
 	public static final short GEOMETRY__ADJUST8VALUE = 334;
 	public static final short GEOMETRY__ADJUST9VALUE = 335;
 	public static final short GEOMETRY__ADJUST10VALUE = 336;
+	public static final short GEOMETRY__PCONNECTIONSITES = 337;
+	public static final short GEOMETRY__PCONNECTIONSITESDIR = 338;
+	public static final short GEOMETRY__XLIMO = 339;
+	public static final short GEOMETRY__YLIMO = 340;
+	public static final short GEOMETRY__PADJUSTHANDLES = 341;
+	public static final short GEOMETRY__PGUIDES = 342;
+	public static final short GEOMETRY__PINSCRIBE = 343;
+	public static final short GEOMETRY__CXK = 344;
+	public static final short GEOMETRY__PFRAGMENTS = 345;
 	public static final short GEOMETRY__SHADOWok = 378;
 	public static final short GEOMETRY__3DOK = 379;
 	public static final short GEOMETRY__LINEOK = 380;
@@ -333,6 +343,9 @@ public final class EscherProperties {
 
 	private static final Map<Short, EscherPropertyMetaData> properties = initProps();
 
+	private EscherProperties() {
+	}
+
 	private static Map<Short, EscherPropertyMetaData> initProps() {
 		Map<Short, EscherPropertyMetaData> m = new HashMap<>();
 		addProp(m, TRANSFORM__ROTATION, "transform.rotation");
@@ -423,6 +436,15 @@ public final class EscherProperties {
 		addProp(m, GEOMETRY__ADJUST8VALUE, "geometry.adjust8value");
 		addProp(m, GEOMETRY__ADJUST9VALUE, "geometry.adjust9value");
 		addProp(m, GEOMETRY__ADJUST10VALUE, "geometry.adjust10value");
+		addProp(m, GEOMETRY__PCONNECTIONSITES, "geometry.pConnectionSites");
+		addProp(m, GEOMETRY__PCONNECTIONSITESDIR, "geometry.pConnectionSitesDir");
+		addProp(m, GEOMETRY__XLIMO, "geometry.xLimo");
+		addProp(m, GEOMETRY__YLIMO, "geometry.yLimo");
+		addProp(m, GEOMETRY__PADJUSTHANDLES, "geometry.pAdjustHandles");
+		addProp(m, GEOMETRY__PGUIDES, "geometry.pGuides");
+		addProp(m, GEOMETRY__PINSCRIBE, "geometry.pInscribe");
+		addProp(m, GEOMETRY__CXK, "geometry.cxk");
+		addProp(m, GEOMETRY__PFRAGMENTS, "geometry.pFragments");
 		addProp(m, GEOMETRY__SHADOWok, "geometry.shadowOK");
 		addProp(m, GEOMETRY__3DOK, "geometry.3dok");
 		addProp(m, GEOMETRY__LINEOK, "geometry.lineok");
@@ -641,20 +663,20 @@ public final class EscherProperties {
 	}
 
 	private static void addProp(Map<Short, EscherPropertyMetaData> m, int s, String propName) {
-		m.put(Short.valueOf((short) s), new EscherPropertyMetaData(propName));
+		m.put((short) s, new EscherPropertyMetaData(propName));
 	}
 
 	private static void addProp(Map<Short, EscherPropertyMetaData> m, int s, String propName, byte type) {
-		m.put(Short.valueOf((short) s), new EscherPropertyMetaData(propName, type));
+		m.put((short) s, new EscherPropertyMetaData(propName, type));
 	}
 
 	public static String getPropertyName(short propertyId) {
-		EscherPropertyMetaData o = properties.get(Short.valueOf(propertyId));
+		EscherPropertyMetaData o = properties.get(propertyId);
 		return o == null ? "unknown" : o.getDescription();
 	}
 
 	public static byte getPropertyType(short propertyId) {
-		EscherPropertyMetaData escherPropertyMetaData = properties.get(Short.valueOf(propertyId));
+		EscherPropertyMetaData escherPropertyMetaData = properties.get(propertyId);
 		return escherPropertyMetaData == null ? 0 : escherPropertyMetaData.getType();
 	}
 }

Modified: poi/branches/hemf/src/java/org/apache/poi/hpsf/VariantSupport.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/java/org/apache/poi/hpsf/VariantSupport.java?rev=1848906&r1=1848905&r2=1848906&view=diff
==============================================================================
--- poi/branches/hemf/src/java/org/apache/poi/hpsf/VariantSupport.java (original)
+++ poi/branches/hemf/src/java/org/apache/poi/hpsf/VariantSupport.java Fri Dec 14 00:44:40 2018
@@ -36,7 +36,7 @@ import org.apache.poi.util.POILogger;
  * Supports reading and writing of variant data.<p>
  *
  * <strong>FIXME (3):</strong> Reading and writing should be made more
- * uniform than it is now. The following items should be resolved:<p>
+ * uniform than it is now. The following items should be resolved:
  *
  * <ul>
  *

Modified: poi/branches/hemf/src/java/org/apache/poi/hpsf/wellknown/PropertyIDMap.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/java/org/apache/poi/hpsf/wellknown/PropertyIDMap.java?rev=1848906&r1=1848905&r2=1848906&view=diff
==============================================================================
--- poi/branches/hemf/src/java/org/apache/poi/hpsf/wellknown/PropertyIDMap.java (original)
+++ poi/branches/hemf/src/java/org/apache/poi/hpsf/wellknown/PropertyIDMap.java Fri Dec 14 00:44:40 2018
@@ -33,8 +33,11 @@ import org.apache.poi.hpsf.SummaryInform
  * The methods {@link #getSummaryInformationProperties} and {@link
  * #getDocumentSummaryInformationProperties} return singleton {@link
  * PropertyIDMap}s. An application that wants to extend these maps
- * should treat them as unmodifiable, copy them and modifiy the
+ * should treat them as unmodifiable, copy them and modify the
  * copies.
+ *
+ * Trying to modify the map directly will cause exceptions
+ * {@link UnsupportedOperationException} to be thrown.
  */
 public class PropertyIDMap implements Map<Long,String> {
 
@@ -490,11 +493,13 @@ public class PropertyIDMap implements Ma
 
     @Override
     public String put(Long key, String value) {
+        //noinspection ConstantConditions
         return idMap.put(key, value);
     }
 
     @Override
     public String remove(Object key) {
+        //noinspection ConstantConditions
         return idMap.remove(key);
     }
 

Modified: poi/branches/hemf/src/java/org/apache/poi/hssf/model/InternalWorkbook.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/java/org/apache/poi/hssf/model/InternalWorkbook.java?rev=1848906&r1=1848905&r2=1848906&view=diff
==============================================================================
--- poi/branches/hemf/src/java/org/apache/poi/hssf/model/InternalWorkbook.java (original)
+++ poi/branches/hemf/src/java/org/apache/poi/hssf/model/InternalWorkbook.java Fri Dec 14 00:44:40 2018
@@ -2276,6 +2276,8 @@ public final class InternalWorkbook {
 
     /**
      * Only for internal calls - code based on this is not supported ...
+     *
+     * @return The list of records.
      */
     @Internal
     public WorkbookRecordList getWorkbookRecordList() {

Modified: poi/branches/hemf/src/java/org/apache/poi/hssf/record/RecordInputStream.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/java/org/apache/poi/hssf/record/RecordInputStream.java?rev=1848906&r1=1848905&r2=1848906&view=diff
==============================================================================
--- poi/branches/hemf/src/java/org/apache/poi/hssf/record/RecordInputStream.java (original)
+++ poi/branches/hemf/src/java/org/apache/poi/hssf/record/RecordInputStream.java Fri Dec 14 00:44:40 2018
@@ -33,8 +33,9 @@ import org.apache.poi.util.LittleEndianI
 import org.apache.poi.util.RecordFormatException;
 
 /**
- * Title:  Record Input Stream<P>
- * Description:  Wraps a stream and provides helper methods for the construction of records.<P>
+ * Title:  Record Input Stream
+ *
+ * Description:  Wraps a stream and provides helper methods for the construction of records.
  */
 public final class RecordInputStream implements LittleEndianInput {
 
@@ -142,6 +143,15 @@ public final class RecordInputStream imp
 		_nextSid = readNextSid();
 	}
 
+	static LittleEndianInput getLEI(InputStream is) {
+		if (is instanceof LittleEndianInput) {
+			// accessing directly is an optimisation
+			return (LittleEndianInput) is;
+		}
+		// less optimal, but should work OK just the same. Often occurs in junit tests.
+		return new LittleEndianInputStream(is);
+	}
+
 	/**
 	 * @return the number of bytes available in the current BIFF record
 	 * @see #remaining()
@@ -295,12 +305,9 @@ public final class RecordInputStream imp
 		return _dataInput.readUShort();
 	}
 
-	/**
-	 *
-	 * @return a double - might return NaN
-	 */
 	@Override
     public double readDouble() {
+        // YK: Excel doesn't write NaN but instead converts the cell type into {@link CellType#ERROR}.
 		return Double.longBitsToDouble(readLong());
 	}
 	

Modified: poi/branches/hemf/src/java/org/apache/poi/hssf/record/SSTRecord.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/java/org/apache/poi/hssf/record/SSTRecord.java?rev=1848906&r1=1848905&r2=1848906&view=diff
==============================================================================
--- poi/branches/hemf/src/java/org/apache/poi/hssf/record/SSTRecord.java (original)
+++ poi/branches/hemf/src/java/org/apache/poi/hssf/record/SSTRecord.java Fri Dec 14 00:44:40 2018
@@ -161,7 +161,7 @@ public final class SSTRecord extends Con
      * <P>
      * The data consists of sets of string data. This string data is
      * arranged as follows:
-     * <P>
+     * </P><P>
      * <pre>
      * short  string_length;   // length of string data
      * byte   string_flag;     // flag specifying special string
@@ -176,9 +176,9 @@ public final class SSTRecord extends Con
      * byte[] extension;       // optional extension (length of array
      *                         // is extend_length)
      * </pre>
-     * <P>
+     * </P><P>
      * The string_flag is bit mapped as follows:
-     * <P>
+     * </P><P>
      * <TABLE summary="string_flag mapping">
      *   <TR>
      *      <TH>Bit number</TH>
@@ -232,7 +232,7 @@ public final class SSTRecord extends Con
      * associated data. The UnicodeString class can handle the byte[]
      * vs short[] nature of the actual string data
      *
-     * @param in the RecordInputstream to read the record from
+     * @param in the RecordInputStream to read the record from
      */
     public SSTRecord(RecordInputStream in) {
         // this method is ALWAYS called after construction -- using

Modified: poi/branches/hemf/src/java/org/apache/poi/hssf/record/SharedFormulaRecord.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/java/org/apache/poi/hssf/record/SharedFormulaRecord.java?rev=1848906&r1=1848905&r2=1848906&view=diff
==============================================================================
--- poi/branches/hemf/src/java/org/apache/poi/hssf/record/SharedFormulaRecord.java (original)
+++ poi/branches/hemf/src/java/org/apache/poi/hssf/record/SharedFormulaRecord.java Fri Dec 14 00:44:40 2018
@@ -77,7 +77,7 @@ public final class SharedFormulaRecord e
 
     public String toString()
     {
-        StringBuffer buffer = new StringBuffer();
+        StringBuilder buffer = new StringBuilder();
 
         buffer.append("[SHARED FORMULA (").append(HexDump.intToHex(sid)).append("]\n");
         buffer.append("    .range      = ").append(getRange()).append("\n");
@@ -99,6 +99,10 @@ public final class SharedFormulaRecord e
     }
 
     /**
+     * Convert formula into an array of {@link Ptg} tokens.
+     *
+     * @param formula The record to break into tokens, cannot be null
+     *
      * @return the equivalent {@link Ptg} array that the formula would have, were it not shared.
      */
     public Ptg[] getFormulaTokens(FormulaRecord formula) {

Modified: poi/branches/hemf/src/java/org/apache/poi/hssf/record/SharedValueRecordBase.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/java/org/apache/poi/hssf/record/SharedValueRecordBase.java?rev=1848906&r1=1848905&r2=1848906&view=diff
==============================================================================
--- poi/branches/hemf/src/java/org/apache/poi/hssf/record/SharedValueRecordBase.java (original)
+++ poi/branches/hemf/src/java/org/apache/poi/hssf/record/SharedValueRecordBase.java Fri Dec 14 00:44:40 2018
@@ -42,6 +42,8 @@ public abstract class SharedValueRecordB
 
 	/**
 	 * reads only the range (1 {@link CellRangeAddress8Bit}) from the stream
+	 *
+	 * @param in The interface for reading the record data.
 	 */
 	public SharedValueRecordBase(LittleEndianInput in) {
 		_range = new CellRangeAddress8Bit(in);
@@ -99,14 +101,12 @@ public abstract class SharedValueRecordB
 			&& r.getLastColumn() >= colIx;
 	}
 	/**
-	 * @return {@code true} if (rowIx, colIx) describes the first cell in this shared value
-	 * object's range
-	 * 
 	 * @param rowIx the row index
 	 * @param colIx the column index
-	 * 
-	 * @return {@code true} if its the first cell in this shared value object range
-	 * 
+	 *
+	 * @return {@code true} if (rowIx, colIx) describes the first cell in this shared value
+	 * object's range
+	 *
 	 * @see #getRange()
 	 */
 	public final boolean isFirstCell(int rowIx, int colIx) {

Modified: poi/branches/hemf/src/java/org/apache/poi/poifs/crypt/ChunkedCipherOutputStream.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/java/org/apache/poi/poifs/crypt/ChunkedCipherOutputStream.java?rev=1848906&r1=1848905&r2=1848906&view=diff
==============================================================================
--- poi/branches/hemf/src/java/org/apache/poi/poifs/crypt/ChunkedCipherOutputStream.java (original)
+++ poi/branches/hemf/src/java/org/apache/poi/poifs/crypt/ChunkedCipherOutputStream.java Fri Dec 14 00:44:40 2018
@@ -99,6 +99,13 @@ public abstract class ChunkedCipherOutpu
         return initCipherForBlock(cipher, block, lastChunk);
     }
 
+    // helper method to break a recursion loop introduced because of an IBMJCE bug, i.e. not resetting on Cipher.doFinal()
+    @Internal
+    protected Cipher initCipherForBlockNoFlush(Cipher existing, int block, boolean lastChunk)
+    throws IOException, GeneralSecurityException {
+        return initCipherForBlock(cipher, block, lastChunk);
+    }
+
     protected abstract Cipher initCipherForBlock(Cipher existing, int block, boolean lastChunk)
     throws IOException, GeneralSecurityException;
 
@@ -212,13 +219,30 @@ public abstract class ChunkedCipherOutpu
      * @throws IllegalBlockSizeException 
      * @throws ShortBufferException
      */
-    protected int invokeCipher(int posInChunk, boolean doFinal) throws GeneralSecurityException {
+    protected int invokeCipher(int posInChunk, boolean doFinal) throws GeneralSecurityException, IOException {
         byte plain[] = (plainByteFlags.isEmpty()) ? null : chunk.clone();
 
         int ciLen = (doFinal)
             ? cipher.doFinal(chunk, 0, posInChunk, chunk)
             : cipher.update(chunk, 0, posInChunk, chunk);
 
+        if (doFinal && "IBMJCE".equals(cipher.getProvider().getName()) && "RC4".equals(cipher.getAlgorithm())) {
+            // workaround for IBMs cipher not resetting on doFinal
+
+            int index = (int)(pos >> chunkBits);
+            boolean lastChunk;
+            if (posInChunk==0) {
+                index--;
+                posInChunk = chunk.length;
+                lastChunk = false;
+            } else {
+                // pad the last chunk
+                lastChunk = true;
+            }
+
+            cipher = initCipherForBlockNoFlush(cipher, index, lastChunk);
+        }
+
         if (plain != null) {
             int i = plainByteFlags.nextSetBit(0);
             while (i >= 0 && i < posInChunk) {

Modified: poi/branches/hemf/src/java/org/apache/poi/poifs/crypt/cryptoapi/CryptoAPIEncryptor.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/java/org/apache/poi/poifs/crypt/cryptoapi/CryptoAPIEncryptor.java?rev=1848906&r1=1848905&r2=1848906&view=diff
==============================================================================
--- poi/branches/hemf/src/java/org/apache/poi/poifs/crypt/cryptoapi/CryptoAPIEncryptor.java (original)
+++ poi/branches/hemf/src/java/org/apache/poi/poifs/crypt/cryptoapi/CryptoAPIEncryptor.java Fri Dec 14 00:44:40 2018
@@ -207,9 +207,15 @@ public class CryptoAPIEncryptor extends
         protected Cipher initCipherForBlock(Cipher cipher, int block, boolean lastChunk)
         throws IOException, GeneralSecurityException {
             flush();
+            return initCipherForBlockNoFlush(cipher, block, lastChunk);
+        }
+
+        @Override
+        protected Cipher initCipherForBlockNoFlush(Cipher existing, int block, boolean lastChunk)
+        throws GeneralSecurityException {
             EncryptionInfo ei = getEncryptionInfo();
             SecretKey sk = getSecretKey();
-            return CryptoAPIDecryptor.initCipherForBlock(cipher, block, ei, sk, Cipher.ENCRYPT_MODE);
+            return CryptoAPIDecryptor.initCipherForBlock(existing, block, ei, sk, Cipher.ENCRYPT_MODE);
         }
 
         @Override

Modified: poi/branches/hemf/src/java/org/apache/poi/poifs/filesystem/FileMagic.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/java/org/apache/poi/poifs/filesystem/FileMagic.java?rev=1848906&r1=1848905&r2=1848906&view=diff
==============================================================================
--- poi/branches/hemf/src/java/org/apache/poi/poifs/filesystem/FileMagic.java (original)
+++ poi/branches/hemf/src/java/org/apache/poi/poifs/filesystem/FileMagic.java Fri Dec 14 00:44:40 2018
@@ -78,7 +78,7 @@ public enum FileMagic {
     /** PDF document */
     PDF("%PDF"),
     /** Some different HTML documents */
-    HTML("<!DOCTYP".getBytes(UTF_8), "<html".getBytes(UTF_8)),
+    HTML("<!DOCTYP".getBytes(UTF_8), "<html".getBytes(UTF_8), "<HTML".getBytes(UTF_8)),
     WORD2(new byte[]{ (byte)0xdb, (byte)0xa5, 0x2d, 0x00}),
     // keep UNKNOWN always as last enum!
     /** UNKNOWN magic */
@@ -101,17 +101,8 @@ public enum FileMagic {
 
     public static FileMagic valueOf(byte[] magic) {
         for (FileMagic fm : values()) {
-            int i=0;
-            boolean found = true;
             for (byte[] ma : fm.magic) {
-                for (byte m : ma) {
-                    byte d = magic[i++];
-                    if (!(d == m || (m == 0x70 && (d == 0x10 || d == 0x20 || d == 0x40)))) {
-                        found = false;
-                        break;
-                    }
-                }
-                if (found) {
+                if (findMagic(ma, magic)) {
                     return fm;
                 }
             }
@@ -119,6 +110,17 @@ public enum FileMagic {
         return UNKNOWN;
     }
 
+    private static boolean findMagic(byte[] cmp, byte[] actual) {
+        int i=0;
+        for (byte m : cmp) {
+            byte d = actual[i++];
+            if (!(d == m || (m == 0x70 && (d == 0x10 || d == 0x20 || d == 0x40)))) {
+                return false;
+            }
+        }
+        return true;
+    }
+
 
     /**
      * Get the file magic of the supplied {@link File}<p>

Modified: poi/branches/hemf/src/java/org/apache/poi/sl/draw/DrawBackground.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/java/org/apache/poi/sl/draw/DrawBackground.java?rev=1848906&r1=1848905&r2=1848906&view=diff
==============================================================================
--- poi/branches/hemf/src/java/org/apache/poi/sl/draw/DrawBackground.java (original)
+++ poi/branches/hemf/src/java/org/apache/poi/sl/draw/DrawBackground.java Fri Dec 14 00:44:40 2018
@@ -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 Draw
         if(fill != null) {
             graphics.setRenderingHint(Drawable.GRADIENT_SHAPE, anchor);
             graphics.setPaint(fill);
-            graphics.fill(anchor2);
+            fillPaintWorkaround(graphics, anchor2);
         }
     }
-    
+
     protected Background<?,?> getShape() {
         return (Background<?,?>)shape;
     }

Modified: poi/branches/hemf/src/java/org/apache/poi/sl/draw/DrawFreeformShape.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/java/org/apache/poi/sl/draw/DrawFreeformShape.java?rev=1848906&r1=1848905&r2=1848906&view=diff
==============================================================================
--- poi/branches/hemf/src/java/org/apache/poi/sl/draw/DrawFreeformShape.java (original)
+++ poi/branches/hemf/src/java/org/apache/poi/sl/draw/DrawFreeformShape.java Fri Dec 14 00:44:40 2018
@@ -17,43 +17,11 @@
 
 package org.apache.poi.sl.draw;
 
-import java.awt.Graphics2D;
-import java.awt.geom.AffineTransform;
-import java.awt.geom.Path2D;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.poi.sl.draw.geom.Outline;
-import org.apache.poi.sl.draw.geom.Path;
-import org.apache.poi.sl.usermodel.*;
+import org.apache.poi.sl.usermodel.FreeformShape;
 
+@SuppressWarnings("WeakerAccess")
 public class DrawFreeformShape extends DrawAutoShape {
     public DrawFreeformShape(FreeformShape<?,?> shape) {
         super(shape);
     }
-
-    protected Collection<Outline> computeOutlines(Graphics2D graphics) {
-        List<Outline> lst = new ArrayList<>();
-        FreeformShape<?,?> fsh = (FreeformShape<?, ?>) getShape();
-        Path2D sh = fsh.getPath();
-
-        AffineTransform tx = (AffineTransform)graphics.getRenderingHint(Drawable.GROUP_TRANSFORM);
-        if (tx == null) {
-            tx = new AffineTransform();
-        }
-
-        java.awt.Shape canvasShape = tx.createTransformedShape(sh);
-
-        FillStyle fs = fsh.getFillStyle();
-        StrokeStyle ss = fsh.getStrokeStyle();
-        Path path = new Path(fs != null, ss != null);
-        lst.add(new Outline(canvasShape, path));
-        return lst;
-    }
-
-    @Override
-    protected TextShape<?,? extends TextParagraph<?,?,? extends TextRun>> getShape() {
-        return (TextShape<?,? extends TextParagraph<?,?,? extends TextRun>>)shape;
-    }
 }

Modified: poi/branches/hemf/src/java/org/apache/poi/sl/draw/DrawPaint.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/java/org/apache/poi/sl/draw/DrawPaint.java?rev=1848906&r1=1848905&r2=1848906&view=diff
==============================================================================
--- poi/branches/hemf/src/java/org/apache/poi/sl/draw/DrawPaint.java (original)
+++ poi/branches/hemf/src/java/org/apache/poi/sl/draw/DrawPaint.java Fri Dec 14 00:44:40 2018
@@ -23,13 +23,17 @@ 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;
 import java.awt.image.BufferedImage;
 import java.io.IOException;
 import java.io.InputStream;
+import java.util.Map;
 import java.util.Objects;
+import java.util.TreeMap;
+import java.util.function.BiFunction;
 
 import org.apache.poi.sl.usermodel.AbstractColorStyle;
 import org.apache.poi.sl.usermodel.ColorStyle;
@@ -197,28 +201,17 @@ public class DrawPaint {
 
             @Override
             public int getShade() {
-                int shade = orig.getShade();
-                switch (modifier) {
-                    case DARKEN:
-                        return Math.min(100000, Math.max(0,shade)+40000);
-                    case DARKEN_LESS:
-                        return Math.min(100000, Math.max(0,shade)+20000);
-                    default:
-                        return shade;
-                }
+                return scale(orig.getShade(), PaintModifier.DARKEN_LESS, PaintModifier.DARKEN);
             }
 
             @Override
             public int getTint() {
-                int tint = orig.getTint();
-                switch (modifier) {
-                    case LIGHTEN:
-                        return Math.min(100000, Math.max(0,tint)+40000);
-                    case LIGHTEN_LESS:
-                        return Math.min(100000, Math.max(0,tint)+20000);
-                    default:
-                        return tint;
-                }
+                return scale(orig.getTint(), PaintModifier.LIGHTEN_LESS, PaintModifier.LIGHTEN);
+            }
+
+            private int scale(int value, PaintModifier lessModifier, PaintModifier moreModifier) {
+                int delta = (modifier == lessModifier ? 20000 : (modifier == moreModifier ? 40000 : 0));
+                return Math.min(100000, Math.max(0,value)+delta);
             }
         };
 
@@ -300,7 +293,7 @@ public class DrawPaint {
         Color result = color.getColor();
 
         double alpha = getAlpha(result, color);
-        double hsl[] = RGB2HSL(result); // values are in the range [0..100] (usually ...)
+        double[] hsl = RGB2HSL(result); // values are in the range [0..100] (usually ...)
         applyHslModOff(hsl, 0, color.getHueMod(), color.getHueOff());
         applyHslModOff(hsl, 1, color.getSatMod(), color.getSatOff());
         applyHslModOff(hsl, 2, color.getLumMod(), color.getLumOff());
@@ -344,7 +337,7 @@ public class DrawPaint {
      * @param mod the modulation adjustment
      * @param off the offset adjustment
      */
-    private static void applyHslModOff(double hsl[], int hslPart, int mod, int off) {
+    private static void applyHslModOff(double[] hsl, int hslPart, int mod, int off) {
         if (mod == -1) {
             mod = 100000;
         }
@@ -363,7 +356,7 @@ public class DrawPaint {
      *
      * For a shade, the equation is luminance * %tint.
      */
-    private static void applyShade(double hsl[], ColorStyle fc) {
+    private static void applyShade(double[] hsl, ColorStyle fc) {
         int shade = fc.getShade();
         if (shade == -1) {
             return;
@@ -380,7 +373,7 @@ public class DrawPaint {
      * For a tint, the equation is luminance * %tint + (1-%tint).
      * (Note that 1-%tint is equal to the lumOff value in DrawingML.)
      */
-    private static void applyTint(double hsl[], ColorStyle fc) {
+    private static void applyTint(double[] hsl, ColorStyle fc) {
         int tint = fc.getTint();
         if (tint == -1) {
             return;
@@ -403,70 +396,63 @@ public class DrawPaint {
         }
 
         Rectangle2D anchor = DrawShape.getAnchor(graphics, shape);
-        final double h = anchor.getHeight(), w = anchor.getWidth(), x = anchor.getX(), y = anchor.getY();
 
         AffineTransform at = AffineTransform.getRotateInstance(Math.toRadians(angle), anchor.getCenterX(), anchor.getCenterY());
 
-        double diagonal = Math.sqrt(h * h + w * w);
-        Point2D p1 = new Point2D.Double(x + w / 2 - diagonal / 2, y + h / 2);
-        p1 = at.transform(p1, null);
-
-        Point2D p2 = new Point2D.Double(x + w, y + h / 2);
-        p2 = at.transform(p2, null);
+        double diagonal = Math.sqrt(Math.pow(anchor.getWidth(),2) + Math.pow(anchor.getHeight(),2));
+        final Point2D p1 = at.transform(new Point2D.Double(anchor.getCenterX() - diagonal / 2, anchor.getCenterY()), null);
+        final Point2D p2 = at.transform(new Point2D.Double(anchor.getMaxX(), anchor.getCenterY()), null);
 
 //        snapToAnchor(p1, anchor);
 //        snapToAnchor(p2, anchor);
 
-        if (p1.equals(p2)) {
-            // gradient paint on the same point throws an exception ... and doesn't make sense
-            return null;
-        }
-
-        float[] fractions = fill.getGradientFractions();
-        Color[] colors = new Color[fractions.length];
-
-        int i = 0;
-        for (ColorStyle fc : fill.getGradientColors()) {
-            // if fc is null, use transparent color to get color of background
-            colors[i++] = (fc == null) ? TRANSPARENT : applyColorTransform(fc);
-        }
-
-        return new LinearGradientPaint(p1, p2, fractions, colors);
+        // gradient paint on the same point throws an exception ... and doesn't make sense
+        return (p1.equals(p2)) ? null : safeFractions((f,c)->new LinearGradientPaint(p1,p2,f,c), fill);
     }
 
+
     @SuppressWarnings("WeakerAccess")
     protected Paint createRadialGradientPaint(GradientPaint fill, Graphics2D graphics) {
         Rectangle2D anchor = DrawShape.getAnchor(graphics, shape);
 
-        Point2D pCenter = new Point2D.Double(anchor.getX() + anchor.getWidth()/2,
-                anchor.getY() + anchor.getHeight()/2);
+        final Point2D pCenter = new Point2D.Double(anchor.getCenterX(), anchor.getCenterY());
 
-        float radius = (float)Math.max(anchor.getWidth(), anchor.getHeight());
+        final float radius = (float)Math.max(anchor.getWidth(), anchor.getHeight());
 
-        float[] fractions = fill.getGradientFractions();
-        Color[] colors = new Color[fractions.length];
-
-        int i=0;
-        for (ColorStyle fc : fill.getGradientColors()) {
-            colors[i++] = applyColorTransform(fc);
-        }
-
-        return new RadialGradientPaint(pCenter, radius, fractions, colors);
+        return safeFractions((f,c)->new RadialGradientPaint(pCenter,radius,f,c), fill);
     }
 
     @SuppressWarnings({"WeakerAccess", "unused"})
     protected Paint createPathGradientPaint(GradientPaint fill, Graphics2D graphics) {
         // currently we ignore an eventually center setting
 
+        return safeFractions(PathGradientPaint::new, fill);
+    }
+
+    private Paint safeFractions(BiFunction<float[],Color[],Paint> init, GradientPaint fill) {
         float[] fractions = fill.getGradientFractions();
-        Color[] colors = new Color[fractions.length];
+        final ColorStyle[] styles = fill.getGradientColors();
+
+        // need to remap the fractions, because Java doesn't like repeating fraction values
+        Map<Float,Color> m = new TreeMap<>();
+        for (int i = 0; i<fractions.length; i++) {
+            // if fc is null, use transparent color to get color of background
+            m.put(fractions[i], (styles[i] == null ? TRANSPARENT : applyColorTransform(styles[i])));
+        }
+
+        final Color[] colors = new Color[m.size()];
+        if (fractions.length != m.size()) {
+            fractions = new float[m.size()];
+        }
 
         int i=0;
-        for (ColorStyle fc : fill.getGradientColors()) {
-            colors[i++] = applyColorTransform(fc);
+        for (Map.Entry<Float,Color> me : m.entrySet()) {
+            fractions[i] = me.getKey();
+            colors[i] = me.getValue();
+            i++;
         }
 
-        return new PathGradientPaint(colors, fractions);
+        return init.apply(fractions, colors);
     }
 
     /**
@@ -620,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);
+        }
+    }
 }

Modified: poi/branches/hemf/src/java/org/apache/poi/sl/draw/DrawSimpleShape.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/java/org/apache/poi/sl/draw/DrawSimpleShape.java?rev=1848906&r1=1848905&r2=1848906&view=diff
==============================================================================
--- poi/branches/hemf/src/java/org/apache/poi/sl/draw/DrawSimpleShape.java (original)
+++ poi/branches/hemf/src/java/org/apache/poi/sl/draw/DrawSimpleShape.java Fri Dec 14 00:44:40 2018
@@ -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 Dra
                         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 Dra
               graphics.setPaint(shadowColor);
 
               if(fill != null && p.isFilled()){
-                  graphics.fill(s);
+                  fillPaintWorkaround(graphics, s);
               } else if (line != null && p.isStroked()) {
                   graphics.draw(s);
               }
@@ -410,14 +412,20 @@ public class DrawSimpleShape extends Dra
         }
         for (Path p : geom) {
 
-            double w = p.getW(), h = p.getH(), scaleX = Units.toPoints(1), scaleY = scaleX;
+            double w = p.getW(), h = p.getH(), scaleX, scaleY;
             if (w == -1) {
                 w = Units.toEMU(anchor.getWidth());
+                scaleX = Units.toPoints(1);
+            } else if (anchor.getWidth() == 0) {
+                scaleX = 1;
             } else {
                 scaleX = anchor.getWidth() / w;
             }
             if (h == -1) {
                 h = Units.toEMU(anchor.getHeight());
+                scaleY = Units.toPoints(1);
+            } else if (anchor.getHeight() == 0) {
+                scaleY = 1;
             } else {
                 scaleY = anchor.getHeight() / h;
             }

Modified: poi/branches/hemf/src/java/org/apache/poi/sl/draw/DrawTableShape.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/java/org/apache/poi/sl/draw/DrawTableShape.java?rev=1848906&r1=1848905&r2=1848906&view=diff
==============================================================================
--- poi/branches/hemf/src/java/org/apache/poi/sl/draw/DrawTableShape.java (original)
+++ poi/branches/hemf/src/java/org/apache/poi/sl/draw/DrawTableShape.java Fri Dec 14 00:44:40 2018
@@ -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 Draw
                 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) {

Modified: poi/branches/hemf/src/java/org/apache/poi/sl/draw/PathGradientPaint.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/java/org/apache/poi/sl/draw/PathGradientPaint.java?rev=1848906&r1=1848905&r2=1848906&view=diff
==============================================================================
--- poi/branches/hemf/src/java/org/apache/poi/sl/draw/PathGradientPaint.java (original)
+++ poi/branches/hemf/src/java/org/apache/poi/sl/draw/PathGradientPaint.java Fri Dec 14 00:44:40 2018
@@ -23,21 +23,24 @@ import java.awt.MultipleGradientPaint.Cy
 import java.awt.geom.*;
 import java.awt.image.*;
 
+import org.apache.poi.util.Internal;
+
+@Internal
 class PathGradientPaint implements Paint {
 
     // http://asserttrue.blogspot.de/2010/01/how-to-iimplement-custom-paint-in-50.html
-    protected final Color colors[];
-    protected final float fractions[];
-    protected final int capStyle;
-    protected final int joinStyle;
-    protected final int transparency;
+    private final Color[] colors;
+    private final float[] fractions;
+    private final int capStyle;
+    private final int joinStyle;
+    private final int transparency;
 
     
-    public PathGradientPaint(Color colors[], float fractions[]) {
-        this(colors,fractions,BasicStroke.CAP_ROUND,BasicStroke.JOIN_ROUND);
+    PathGradientPaint(float[] fractions, Color[] colors) {
+        this(fractions,colors,BasicStroke.CAP_ROUND,BasicStroke.JOIN_ROUND);
     }
     
-    public PathGradientPaint(Color colors[], float fractions[], int capStyle, int joinStyle) {
+    private PathGradientPaint(float[] fractions, Color[] colors, int capStyle, int joinStyle) {
         this.colors = colors.clone();
         this.fractions = fractions.clone();
         this.capStyle = capStyle;
@@ -66,26 +69,26 @@ class PathGradientPaint implements Paint
     }
 
     class PathGradientContext implements PaintContext {
-        protected final Rectangle deviceBounds;
-        protected final Rectangle2D userBounds;
+        final Rectangle deviceBounds;
+        final Rectangle2D userBounds;
         protected final AffineTransform xform;
-        protected final RenderingHints hints;
+        final RenderingHints hints;
 
         /**
          * for POI: the shape will be only known when the subclasses determines the concrete implementation 
          * in the draw/-content method, so we need to postpone the setting/creation as long as possible
          **/
         protected final Shape shape;
-        protected final PaintContext pCtx;
-        protected final int gradientSteps;
+        final PaintContext pCtx;
+        final int gradientSteps;
         WritableRaster raster;
 
-        public PathGradientContext(
-              ColorModel cm
-            , Rectangle deviceBounds
-            , Rectangle2D userBounds
-            , AffineTransform xform
-            , RenderingHints hints
+        PathGradientContext(
+                ColorModel cm
+                , Rectangle deviceBounds
+                , Rectangle2D userBounds
+                , AffineTransform xform
+                , RenderingHints hints
         ) {
             shape = (Shape)hints.get(Drawable.GRADIENT_SHAPE);
             if (shape == null) {
@@ -139,7 +142,7 @@ class PathGradientPaint implements Paint
             return childRaster;
         }
 
-        protected int getGradientSteps(Shape gradientShape) {
+        int getGradientSteps(Shape gradientShape) {
             Rectangle rect = gradientShape.getBounds();
             int lower = 1;
             int upper = (int)(Math.max(rect.getWidth(),rect.getHeight())/2.0);
@@ -158,7 +161,7 @@ class PathGradientPaint implements Paint
         
         
         
-        protected void createRaster() {
+        void createRaster() {
             ColorModel cm = getColorModel();
             raster = cm.createCompatibleWritableRaster((int)deviceBounds.getWidth(), (int)deviceBounds.getHeight());
             BufferedImage img = new BufferedImage(cm, raster, false, null);
@@ -168,7 +171,7 @@ class PathGradientPaint implements Paint
             graphics.transform(xform);
 
             Raster img2 = pCtx.getRaster(0, 0, gradientSteps, 1);
-            int rgb[] = new int[cm.getNumComponents()];
+            int[] rgb = new int[cm.getNumComponents()];
 
             for (int i = gradientSteps-1; i>=0; i--) {
                 img2.getPixel(i, 0, rgb);

Modified: poi/branches/hemf/src/java/org/apache/poi/sl/draw/geom/Context.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/java/org/apache/poi/sl/draw/geom/Context.java?rev=1848906&r1=1848905&r2=1848906&view=diff
==============================================================================
--- poi/branches/hemf/src/java/org/apache/poi/sl/draw/geom/Context.java (original)
+++ poi/branches/hemf/src/java/org/apache/poi/sl/draw/geom/Context.java Fri Dec 14 00:44:40 2018
@@ -22,11 +22,18 @@ package org.apache.poi.sl.draw.geom;
 import java.awt.geom.Rectangle2D;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.regex.Pattern;
 
 public class Context {
-    final Map<String, Double> _ctx = new HashMap<>();
-    final IAdjustableShape _props;
-    final Rectangle2D _anchor;
+    private static final Pattern DOUBLE_PATTERN = Pattern.compile(
+        "[\\x00-\\x20]*[+-]?(NaN|Infinity|((((\\p{Digit}+)(\\.)?((\\p{Digit}+)?)" +
+        "([eE][+-]?(\\p{Digit}+))?)|(\\.(\\p{Digit}+)([eE][+-]?(\\p{Digit}+))?)|" +
+        "(((0[xX](\\p{XDigit}+)(\\.)?)|(0[xX](\\p{XDigit}+)?(\\.)(\\p{XDigit}+)))" +
+        "[pP][+-]?(\\p{Digit}+)))[fFdD]?))[\\x00-\\x20]*");
+
+    private final Map<String, Double> _ctx = new HashMap<>();
+    private final IAdjustableShape _props;
+    private final Rectangle2D _anchor;
     
     public Context(CustomGeometry geom, Rectangle2D anchor, IAdjustableShape props){
         _props = props;
@@ -39,23 +46,22 @@ public class Context {
         }
     }
 
-    public Rectangle2D getShapeAnchor(){
+    Rectangle2D getShapeAnchor(){
         return _anchor;
     }
 
-    public Guide getAdjustValue(String name){
+    Guide getAdjustValue(String name){
         // ignore HSLF props for now ... the results with default value are usually better - see #59004
         return (_props.getClass().getName().contains("hslf")) ? null : _props.getAdjustValue(name);
     }
 
     public double getValue(String key){
-        if(key.matches("(\\+|-)?\\d+")){
+        if(DOUBLE_PATTERN.matcher(key).matches()){
             return Double.parseDouble(key);
         }
 
-        Double val = _ctx.get(key);
         // BuiltInGuide throws IllegalArgumentException if key is not defined
-        return (val != null) ? val : evaluate(BuiltInGuide.valueOf("_"+key));
+        return _ctx.containsKey(key) ? _ctx.get(key) : evaluate(BuiltInGuide.valueOf("_"+key));
     }
 
     public double evaluate(Formula fmla){

Modified: poi/branches/hemf/src/java/org/apache/poi/sl/draw/geom/PresetGeometries.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/java/org/apache/poi/sl/draw/geom/PresetGeometries.java?rev=1848906&r1=1848905&r2=1848906&view=diff
==============================================================================
--- poi/branches/hemf/src/java/org/apache/poi/sl/draw/geom/PresetGeometries.java (original)
+++ poi/branches/hemf/src/java/org/apache/poi/sl/draw/geom/PresetGeometries.java Fri Dec 14 00:44:40 2018
@@ -27,12 +27,12 @@ import javax.xml.bind.JAXBElement;
 import javax.xml.bind.JAXBException;
 import javax.xml.bind.Unmarshaller;
 import javax.xml.stream.EventFilter;
-import javax.xml.stream.XMLEventReader;
 import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.events.StartElement;
 import javax.xml.stream.events.XMLEvent;
+import javax.xml.transform.stream.StreamSource;
 
 import org.apache.poi.sl.draw.binding.CTCustomGeometry2D;
 import org.apache.poi.util.POILogFactory;
@@ -61,27 +61,30 @@ public class PresetGeometries extends Li
         };
         
         XMLInputFactory staxFactory = StaxHelper.newXMLInputFactory();
-        XMLEventReader staxReader = staxFactory.createXMLEventReader(is);
-        XMLEventReader staxFiltRd = staxFactory.createFilteredReader(staxReader, startElementFilter);
-        // ignore StartElement:
-        /* XMLEvent evDoc = */ staxFiltRd.nextEvent();
-        // JAXB:
-        JAXBContext jaxbContext = JAXBContext.newInstance(BINDING_PACKAGE);
-        Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
-
-        long cntElem = 0;
-        while (staxFiltRd.peek() != null) {
-            StartElement evRoot = (StartElement)staxFiltRd.peek();
-            String name = evRoot.getName().getLocalPart();
-            JAXBElement<CTCustomGeometry2D> el = unmarshaller.unmarshal(staxReader, CTCustomGeometry2D.class);
-            CTCustomGeometry2D cus = el.getValue();
-            cntElem++;
-            
-            if(containsKey(name)) {
-                LOG.log(POILogger.WARN, "Duplicate definition of " + name);
+        XMLStreamReader streamReader = staxFactory.createXMLStreamReader(new StreamSource(is));
+        try {
+            // ignore StartElement:
+            streamReader.nextTag();
+
+            // JAXB:
+            JAXBContext jaxbContext = JAXBContext.newInstance(BINDING_PACKAGE);
+            Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
+
+            long cntElem = 0;
+            while (streamReader.hasNext() && streamReader.nextTag() == XMLStreamConstants.START_ELEMENT) {
+                String name = streamReader.getLocalName();
+                JAXBElement<CTCustomGeometry2D> el = unmarshaller.unmarshal(streamReader, CTCustomGeometry2D.class);
+                CTCustomGeometry2D cus = el.getValue();
+                cntElem++;
+
+                if (containsKey(name)) {
+                    LOG.log(POILogger.WARN, "Duplicate definition of " + name);
+                }
+                put(name, new CustomGeometry(cus));
             }
-            put(name, new CustomGeometry(cus));
-        }       
+        } finally {
+            streamReader.close();
+        }
     }
     
     /**

Modified: poi/branches/hemf/src/java/org/apache/poi/sl/usermodel/FreeformShape.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/java/org/apache/poi/sl/usermodel/FreeformShape.java?rev=1848906&r1=1848905&r2=1848906&view=diff
==============================================================================
--- poi/branches/hemf/src/java/org/apache/poi/sl/usermodel/FreeformShape.java (original)
+++ poi/branches/hemf/src/java/org/apache/poi/sl/usermodel/FreeformShape.java Fri Dec 14 00:44:40 2018
@@ -24,16 +24,15 @@ public interface FreeformShape<
     P extends TextParagraph<S,P,? extends TextRun>
 > extends AutoShape<S,P> {
     /**
-     * Gets the shape path.
-     * <p>
-     *     The path is translated in the shape's coordinate system, i.e.
-     *     freeform.getPath().getBounds2D() equals to freeform.getAnchor()
-     *     (small discrepancies are possible due to rounding errors)
-     * </p>
+     * Gets the shape path.<p>
+     *
+     * The path is translated in the shape's coordinate system, i.e.
+     * freeform.getPath2D().getBounds2D() equals to freeform.getAnchor()
+     * (small discrepancies are possible due to rounding errors)
      *
      * @return the path
      */
-    Path2D.Double getPath();
+    Path2D getPath();
 
     /**
      * Set the shape path
@@ -41,5 +40,5 @@ public interface FreeformShape<
      * @param path  shape outline
      * @return the number of points written
      */
-    int setPath(Path2D.Double path);
+    int setPath(Path2D path);
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message