You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ki...@apache.org on 2018/11/20 22:24:26 UTC

svn commit: r1847069 [1/2] - in /poi/branches/hemf: ./ jenkins/ sonar/ sonar/examples/ sonar/excelant/ sonar/main/ sonar/ooxml-schema-encryption/ sonar/ooxml-schema-security/ sonar/ooxml-schema/ sonar/ooxml/ sonar/scratchpad/ src/examples/src/org/apach...

Author: kiwiwings
Date: Tue Nov 20 22:24:26 2018
New Revision: 1847069

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

Added:
    poi/branches/hemf/src/ooxml/testcases/org/apache/poi/ooxml/util/OOXMLLiteAgent.java
      - copied unchanged from r1847068, poi/trunk/src/ooxml/testcases/org/apache/poi/ooxml/util/OOXMLLiteAgent.java
    poi/branches/hemf/src/testcases/org/apache/poi/hssf/usermodel/DummyGraphics2d.java
      - copied unchanged from r1847068, poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/DummyGraphics2d.java
    poi/branches/hemf/test-data/slideshow/missing-blip-fill.pptx
      - copied unchanged from r1847068, poi/trunk/test-data/slideshow/missing-blip-fill.pptx
Removed:
    poi/branches/hemf/src/java/org/apache/poi/hssf/usermodel/DummyGraphics2d.java
    poi/branches/hemf/src/ooxml/testcases/org/apache/poi/ooxml/util/OOXMLLite.java
Modified:
    poi/branches/hemf/   (props changed)
    poi/branches/hemf/build.xml
    poi/branches/hemf/jenkins/create_jobs.groovy
    poi/branches/hemf/sonar/examples/pom.xml
    poi/branches/hemf/sonar/excelant/pom.xml
    poi/branches/hemf/sonar/main/pom.xml
    poi/branches/hemf/sonar/ooxml-schema-encryption/pom.xml
    poi/branches/hemf/sonar/ooxml-schema-security/pom.xml
    poi/branches/hemf/sonar/ooxml-schema/pom.xml
    poi/branches/hemf/sonar/ooxml/pom.xml
    poi/branches/hemf/sonar/pom.xml
    poi/branches/hemf/sonar/scratchpad/pom.xml
    poi/branches/hemf/src/examples/src/org/apache/poi/xssf/usermodel/examples/CreateTable.java
    poi/branches/hemf/src/integrationtest/build.xml
    poi/branches/hemf/src/integrationtest/org/apache/poi/BaseIntegrationTest.java
    poi/branches/hemf/src/integrationtest/org/apache/poi/TestAllFiles.java
    poi/branches/hemf/src/integrationtest/org/apache/poi/stress/AbstractFileHandler.java
    poi/branches/hemf/src/java/org/apache/poi/hssf/eventusermodel/MissingRecordAwareHSSFListener.java
    poi/branches/hemf/src/java/org/apache/poi/hssf/record/UnknownRecord.java
    poi/branches/hemf/src/java/org/apache/poi/ss/format/CellFormatPart.java
    poi/branches/hemf/src/java/org/apache/poi/ss/formula/Formula.java
    poi/branches/hemf/src/java/org/apache/poi/ss/formula/FormulaParser.java
    poi/branches/hemf/src/java/org/apache/poi/ss/formula/eval/OperandResolver.java
    poi/branches/hemf/src/java/org/apache/poi/ss/usermodel/DataFormatter.java
    poi/branches/hemf/src/ooxml/java/org/apache/poi/ooxml/extractor/ExtractorFactory.java
    poi/branches/hemf/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java
    poi/branches/hemf/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java
    poi/branches/hemf/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFColor.java
    poi/branches/hemf/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java
    poi/branches/hemf/src/ooxml/testcases/org/apache/poi/extractor/ooxml/TestExtractorFactory.java
    poi/branches/hemf/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestHxxFEncryption.java
    poi/branches/hemf/src/ooxml/testcases/org/apache/poi/sl/TestFonts.java
    poi/branches/hemf/src/ooxml/testcases/org/apache/poi/sl/TestHeadersFooters.java
    poi/branches/hemf/src/ooxml/testcases/org/apache/poi/sl/TestOleShape.java
    poi/branches/hemf/src/ooxml/testcases/org/apache/poi/sl/TestSlide.java
    poi/branches/hemf/src/ooxml/testcases/org/apache/poi/sl/TestTable.java
    poi/branches/hemf/src/ooxml/testcases/org/apache/poi/ss/format/TestCellFormatPart.java
    poi/branches/hemf/src/ooxml/testcases/org/apache/poi/ss/usermodel/TestEmbedOLEPackage.java
    poi/branches/hemf/src/ooxml/testcases/org/apache/poi/xslf/TestXSLFBugs.java
    poi/branches/hemf/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextShape.java
    poi/branches/hemf/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestSXSSFBugs.java
    poi/branches/hemf/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java
    poi/branches/hemf/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFTable.java
    poi/branches/hemf/src/scratchpad/src/org/apache/poi/extractor/ole2/OLE2ScratchpadExtractorFactory.java
    poi/branches/hemf/src/scratchpad/src/org/apache/poi/hslf/record/Notes.java
    poi/branches/hemf/src/scratchpad/testcases/org/apache/poi/hmef/TestAttachments.java
    poi/branches/hemf/src/scratchpad/testcases/org/apache/poi/hmef/attribute/TestMAPIAttributes.java
    poi/branches/hemf/src/scratchpad/testcases/org/apache/poi/hmef/attribute/TestTNEFAttributes.java
    poi/branches/hemf/src/scratchpad/testcases/org/apache/poi/hslf/model/TestHeadersFooters.java
    poi/branches/hemf/src/testcases/org/apache/poi/POIDataSamples.java
    poi/branches/hemf/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPictureData.java
    poi/branches/hemf/src/testcases/org/apache/poi/ss/usermodel/TestExcelStyleDateFormatter.java

Propchange: poi/branches/hemf/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Nov 20 22:24:26 2018
@@ -5,4 +5,4 @@
 /poi/branches/ss_border_property_template:1747847-1748074
 /poi/branches/xml_signature:1617139-1628347
 /poi/branches/xssf_structured_references:1747607-1747656
-/poi/trunk:693591-694881,695264-695420,695621,695649-711764,1839877-1840323,1840325-1843031,1843033-1845612
+/poi/trunk:693591-694881,695264-695420,695621,695649-711764,1839877-1840323,1840325-1843031,1843033-1845612,1845617-1847068

Modified: poi/branches/hemf/build.xml
URL: http://svn.apache.org/viewvc/poi/branches/hemf/build.xml?rev=1847069&r1=1847068&r2=1847069&view=diff
==============================================================================
--- poi/branches/hemf/build.xml (original)
+++ poi/branches/hemf/build.xml Tue Nov 20 22:24:26 2018
@@ -42,7 +42,7 @@ under the License.
 
     <description>The Apache POI project Ant build.</description>
 
-    <property name="version.id" value="4.0.1-SNAPSHOT"/>
+    <property name="version.id" value="4.0.2"/>
     <property name="release.rc" value="RC1"/>
 
     <property environment="env"/>
@@ -81,7 +81,7 @@ under the License.
       user.language and user.country are required as we have locale-sensitive formatters
     -->
     <property name="testpattern" value="Test*"/> <!--note: this excludes BaseTest* -->
-    <property name="POI.testdata.path" value="test-data"/>
+    <property name="POI.testdata.path" location="test-data"/>
     <property name="java.awt.headless" value="true"/>
     <property name="additionaljar" value=""/>
     <propertyreset name="user.language" value="en"/>
@@ -130,8 +130,12 @@ under the License.
     <property name="ooxml.output.dir" location="build/ooxml-classes"/>
     <property name="ooxml.output.test.dir" location="build/ooxml-test-classes"/>
     <property name="ooxml.testokfile" location="build/ooxml-testokfile.txt"/>
-    <property name="ooxml.lite.output.dir" location="build/ooxml-lite-classes"/>
-    <property name="ooxml.lite.testokfile" location="build/ooxml-lite-testokfile.txt"/>
+
+    <property name="ooxml.lite.agent" location="build/ooxml-lite-agent.jar"/>
+    <property name="ooxml.lite.report" location="build/ooxml-lite-report.txt"/>
+    <property name="ooxml.lite.jar" location="build/ooxml-lite-classes.jar"/>
+    <property name="ooxml.lite.includes" value="^(com/microsoft/schemas|org/(etsi|openxmlformats|w3/)|schemaorg_apache_xmlbeans)"/>
+
 
     <!-- Integration testing: -->
     <property name="integration.src.test" location="src/integrationtest"/>
@@ -331,8 +335,11 @@ under the License.
         <propertyref name="user.country"/>
         <propertyref name="javax.xml.stream.XMLInputFactory"/>
         <propertyref name="org.apache.commons.logging.Log"/>
-        <propertyref name="java.locale.providers"/>        <!-- required for Java 9 compilation -->
-        <propertyref name="version.id"/>    <!-- to detect if we are running on slow Gump VM -->
+        <!-- required for Java 9 compilation -->
+        <propertyref name="java.locale.providers"/>
+        <!-- to detect if we are running on slow Gump VM -->
+        <propertyref name="version.id"/>
+        <propertyref name="scratchpad.ignore"/>
     </propertyset>
 
     <!-- these need to be set differently when running with Java 9 -->
@@ -397,7 +404,8 @@ under the License.
 
     <path id="ooxml-lite.classpath">
         <path refid="ooxml.base.classpath"/>
-        <pathelement location="${ooxml.lite.output.dir}"/> <!-- instead of ooxml-xsds.jar use the filtered classes-->
+        <!-- instead of ooxml-xsds.jar use the filtered classes-->
+        <pathelement location="${ooxml.lite.jar}"/>
         <pathelement location="${ooxml.output.dir}"/>
         <pathelement location="${ooxml.output.test.dir}"/>
         <pathelement location="${main.output.test.dir}"/>
@@ -1015,8 +1023,6 @@ under the License.
             compile-scratchpad, compile-examples, compile-excelant"
             description="Compiles the POI main classes, scratchpad and examples"/>
 
-    <target name="compile-all" depends="compile,compile-ooxml-lite"/>
-
     <target name="compile-main" depends="init">
         <!-- compile the sources -->
         <javac target="${jdk.version.class}"
@@ -1127,6 +1133,7 @@ under the License.
             <classpath>
                 <path refid="ooxml.classpath"/>
                 <pathelement path="${ooxml.output.dir}"/>
+                <pathelement location="${scratchpad.output.dir}"/>
             </classpath>
         </javac>
         <copy todir="${examples.output.dir}">
@@ -1297,6 +1304,7 @@ under the License.
                 <pathelement location="${main.output.test.dir}"/>
                 <pathelement location="${examples.output.dir}"/>
                 <pathelement location="${main.ant.jar}"/>
+                <pathelement location="${scratchpad.output.dir}"/>
             </classpath>
         </javac>
         <!--copy todir="${integration.output.dir}">
@@ -1338,7 +1346,7 @@ under the License.
     <!-- Section: test (execute junit tests on test suites) -->
     <target name="test" depends="compile,jacocotask,test-main,test-scratchpad,test-ooxml,test-excelant"
             description="Tests main, scratchpad and ooxml"/>
-    <target name="test-all" depends="test,test-ooxml-lite,testcoveragereport"
+    <target name="test-all" depends="test,test-integration,test-ooxml-lite,testcoveragereport"
             description="Tests main, scratchpad, ooxml, ooxml-lite, and coveragereport"/>
 
     <target name="testcoveragereport" depends="init,jacocotask" description="create test-report" xmlns:jacoco="antlib:org.jacoco.ant" if="coverage.enabled">
@@ -1385,9 +1393,7 @@ under the License.
                 <group name="OOXML">
                     <classfiles>
                         <fileset dir="${ooxml.output.dir}"/>
-                        <!-- there are no actual POI classes in build/ooxml-lite-classes, only generated code...
-                        <fileset dir="${ooxml.lite.output.dir}"/>
-                        -->
+                        <!-- there are no actual POI classes in build/ooxml-lite-classes, only generated code... -->
                     </classfiles>
                     <sourcefiles encoding="UTF-8">
                         <fileset dir="${ooxml.src}"/>
@@ -1564,6 +1570,7 @@ under the License.
                   <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}" />
@@ -1598,6 +1605,7 @@ under the License.
                   </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}" />
@@ -1620,7 +1628,7 @@ under the License.
         </sequential>
     </macrodef>
 
-    <target name="test-ooxml" depends="compile-main,compile-ooxml,-test-ooxml-check,jacocotask" unless="ooxml.test.notRequired"
+    <target name="test-ooxml" depends="compile-main,compile-ooxml,-test-ooxml-check,jacocotask,-ooxml-lite-agent" unless="ooxml.test.notRequired"
             description="test OOXML classes">
         <ooxml-test-runner classpath="test.ooxml.classpath" type="ooxml"/>
         <delete file="${ooxml.testokfile}"/>
@@ -1638,7 +1646,7 @@ under the License.
         </uptodate>
     </target>
 
-    <target name="test-integration" depends="compile-integration,-test-integration-check,jacocotask"
+    <target name="test-integration" depends="compile-integration,-test-integration-check,jacocotask,-ooxml-lite-agent"
             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*"/>
@@ -1650,6 +1658,7 @@ under the License.
                 <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}" />
@@ -1677,57 +1686,28 @@ under the License.
         <echo file="${integration.testokfile}" append="false" message="testok"/>
     </target>
 
-    <!-- Section: test-ooxml-lite -->
-    <target name="-compile-ooxml-lite-check">
-        <uptodate property="ooxml.lite.test.notRequired" targetfile="${ooxml.lite.testokfile}">
-            <srcfiles dir="${ooxml.src}"/>
-            <srcfiles dir="${ooxml.src.test}"/>
-            <srcfiles file="${ooxml.xsds.jar}"/>
-            <srcfiles file="${ooxml.security.jar}"/>
-        </uptodate>
-    </target>
-
-    <target name="compile-ooxml-lite" depends="-compile-ooxml-lite-check,compile-ooxml"
-            unless="ooxml.lite.test.notRequired">
-        <delete file="${ooxml.lite.testokfile}"/>
-        <echo message="Running ooxml-lite generator"/>
-
-        <property name="ooxml.lite-merged.dir" location="build/ooxml-lite-merged"/>
-        <mkdir dir="${ooxml.lite-merged.dir}"/>
-
-        <jar destfile="${ooxml.lite-merged.dir}/ooxml-lite-merged.jar">
-            <zipfileset includes="**/*" src="${ooxml.xsds.jar}"/>
-            <zipfileset includes="**/*" src="${ooxml.security.jar}"/>
+    <!-- the ooxml lite agent collects referenced schema files while other junit tests are run, -->
+    <!-- therefore its best to compile the ooxml lite jar after all usual tests are done -->
+    <target name="compile-ooxml-lite" depends="compile-ooxml,-ooxml-lite-agent,test-ooxml">
+        <echo message="Create ooxml-lite schemas"/>
+
+        <copy file="${ooxml.lite.report}" tofile="${ooxml.lite.report}-pat" overwrite="true"/>
+        <replaceregexp file="${ooxml.lite.report}-pat" byline="true" match="(.*)" replace="\1.class${line.separator}\1$*.class"/>
+
+        <patternset id="xsbfiles">
+            <includesfile name="${ooxml.lite.report}-pat"/>
+            <include name="schemaorg_apache_xmlbeans/system/**/*.xsb"/>
+            <include name="schemaorg_apache_xmlbeans/element/**/*.xsb"/>
+        </patternset>
+
+        <jar destfile="${ooxml.lite.jar}" duplicate="preserve">
+            <zipfileset src="${ooxml.xsds.jar}">
+                <patternset refid="xsbfiles"/>
+            </zipfileset>
+            <zipfileset src="${ooxml.security.jar}">
+                <patternset refid="xsbfiles"/>
+            </zipfileset>
         </jar>
-
-        <java classname="org.apache.poi.ooxml.util.OOXMLLite" fork="yes"
-            failonerror="true">
-            <classpath>
-                <pathelement path="${ooxml.lite-merged.dir}/ooxml-lite-merged.jar"/>
-            </classpath>
-            <classpath refid="test.ooxml.classpath"/>
-            <classpath refid="ooxml.xmlsec.classpath"/>
-            <syspropertyset refid="junit.properties"/>
-            <sysproperty key="java.io.tmpdir" value="${tempdir}"/>
-            <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}" />
-            <jvmarg value="${file.leak.detector}" />
-            <arg value="-ooxml"/>
-            <arg value="${ooxml.lite-merged.dir}/ooxml-lite-merged.jar"/>
-            <arg value="-test"/>
-            <arg value="${ooxml.output.test.dir}"/>
-            <arg value="-dest"/>
-            <arg value="${ooxml.lite.output.dir}"/>
-        </java>
-
-        <echo file="${ooxml.lite.testokfile}" append="false" message="testok"/>
     </target>
 
     <target name="test-ooxml-lite" depends="jacocotask,compile-ooxml-xsds,compile-ooxml-lite">
@@ -1736,6 +1716,15 @@ under the License.
         <ooxml-test-runner classpath="ooxml-lite.classpath" type="ooxml-lite"/>
     </target>
 
+    <target name="-ooxml-lite-agent" depends="jacocotask,compile-ooxml-xsds,compile-ooxml">
+        <jar destfile="${ooxml.lite.agent}">
+            <fileset dir="${ooxml.output.test.dir}" includes="org/apache/poi/ooxml/util/OOXMLLiteAgent*.class"/>
+            <manifest>
+                <attribute name="Premain-Class" value="org.apache.poi.ooxml.util.OOXMLLiteAgent"/>
+            </manifest>
+        </jar>
+    </target>
+
     <!-- Section: test-excelant -->
     <target name="-test-excelant-check">
         <uptodate property="excelant.test.notRequired" targetfile="${excelant.testokfile}">
@@ -1953,14 +1942,15 @@ under the License.
     </target>
 
     <macrodef name="maven-jar">
-        <attribute name="dir"/>
+        <attribute name="src"/>
         <sequential>
             <local name="destfile"/>
             <pathconvert property="destfile" targetos="unix">
-                <path><pathelement path="@{dir}"/></path>
+                <path><pathelement path="@{src}"/></path>
                 <mapper>
                     <chainedmapper>
                         <filtermapper>
+                            <replaceregex pattern=".jar" replace="" flags="g"/>
                             <replaceregex pattern="ooxml-lite" replace="ooxml-schemas" flags="g"/>
                             <replaceregex pattern="(.java|.src)$$" replace="-sources"/>
                             <replaceregex pattern=".*(?:build|src).?(.*)?" replace="\1"/>
@@ -1971,33 +1961,39 @@ under the License.
                     </chainedmapper>
                 </mapper>
             </pathconvert>
+            <local name="isjar"/>
+            <condition property="isjar">
+                <contains string="@{src}" substring=".jar"/>
+            </condition>
+
             <jar destfile="build/dist/maven/${destfile}.jar"
                  manifest="build/poi-manifest.mf">
-                <fileset dir="@{dir}"/>
+                <fileset dir="@{src}" unless:true="${isjar}"/>
+                <zipfileset src="@{src}" if:true="${isjar}"/>
                 <metainf dir="legal/"/>
             </jar>
         </sequential>
     </macrodef>
 
-    <target name="jar" depends="compile-all, compile-version, -manifest" description="Creates jar files for distribution">
-        <maven-jar dir="${main.output.dir}"/>
-        <maven-jar dir="${scratchpad.output.dir}"/>
-        <maven-jar dir="${ooxml.output.dir}"/>
-        <maven-jar dir="${examples.output.dir}"/>
-        <maven-jar dir="${excelant.output.dir}"/>
-        <maven-jar dir="${ooxml.lite.output.dir}"/>
+    <target name="jar" depends="compile, compile-version, compile-ooxml-lite, -manifest" description="Creates jar files for distribution">
+        <maven-jar src="${main.output.dir}"/>
+        <maven-jar src="${scratchpad.output.dir}"/>
+        <maven-jar src="${ooxml.output.dir}"/>
+        <maven-jar src="${examples.output.dir}"/>
+        <maven-jar src="${excelant.output.dir}"/>
+        <maven-jar src="${ooxml.lite.jar}"/>
     </target>
 
-    <target name="jar-src" depends="compile-all, compile-version, -manifest" description="Sources for Maven">
-        <maven-jar dir="${main.src}"/>
-        <maven-jar dir="${scratchpad.src}"/>
-        <maven-jar dir="${ooxml.src}"/>
-        <maven-jar dir="${examples.src}"/>
-        <maven-jar dir="${excelant.src}"/>
+    <target name="jar-src" depends="compile, compile-version, -manifest" description="Sources for Maven">
+        <maven-jar src="${main.src}"/>
+        <maven-jar src="${scratchpad.src}"/>
+        <maven-jar src="${ooxml.src}"/>
+        <maven-jar src="${examples.src}"/>
+        <maven-jar src="${excelant.src}"/>
     </target>
 
     <target name="integration-test-jar" depends="compile-integration,-manifest" description="target for packaging the integration-test code for mass regression test runs">
-        <maven-jar dir="${integration.output.test.dir}"/>
+        <maven-jar src="${integration.output.test.dir}"/>
     </target>
 
     <target name="-do-jar-check-javadocs-package-list">
@@ -2112,6 +2108,7 @@ under the License.
                       lib/**,
                       bin/**,
                       out/**,
+                      tmp/**,
                       sonar/**/target/**,
                       sonar/*/src/**,
                       compile-lib/**,
@@ -2167,14 +2164,12 @@ under the License.
        </mvn:mvn>
     </target>
 
-    <target name="dist" depends="clean, compile-all, test-all, rat-check, forbidden-apis-check, docs, jar, release-notes, assemble"
+    <target name="dist" depends="clean, compile, test-all, rat-check, forbidden-apis-check, docs, jar, release-notes, assemble"
             description="Creates the entire distribution into build/dist, from scratch">
     </target>
 
     <!-- continuous integration targets -->
-    <target name="gump" depends="compile-all, test-all, jar"
-        description="Target for running with Apache Gump continuous integration. Builds and tests POI and generates jar artifacts." />
-    <target name="jenkins" depends="compile-all, test-all, test-integration, jar, javadocs, assemble, findbugs, release-notes, rat-check, forbidden-apis-check"
+    <target name="jenkins" depends="compile, test-all, jar, javadocs, assemble, findbugs, release-notes, rat-check, forbidden-apis-check"
         description="Target run by Jenkins on a continuous basis. Builds and tests POI, generates artifacts and documentation, and searches for problems."/>
 
     <available property="maven.ant.tasks.present" classname="org.apache.maven.artifact.ant.Pom"/>

Modified: poi/branches/hemf/jenkins/create_jobs.groovy
URL: http://svn.apache.org/viewvc/poi/branches/hemf/jenkins/create_jobs.groovy?rev=1847069&r1=1847068&r2=1847069&view=diff
==============================================================================
--- poi/branches/hemf/jenkins/create_jobs.groovy (original)
+++ poi/branches/hemf/jenkins/create_jobs.groovy Tue Nov 20 22:24:26 2018
@@ -114,7 +114,8 @@ def defaultTrigger = 'H/15 * * * *'
 def defaultEmail = 'dev@poi.apache.org'
 def defaultAnt = 'Ant 1.9.9'
 // currently a lot of H?? slaves don't have Ant installed ... H21 seems to have a SVN problem
-def defaultSlaves = '(ubuntu||beam)&&!cloud-slave&&!H15&&!H17&&!H18&&!H24&&!ubuntu-4&&!H21'
+// H35 fails with ImageIO create cache file errors, although the java.io.tmpdir is writable
+def defaultSlaves = '(ubuntu||beam)&&!cloud-slave&&!H15&&!H17&&!H18&&!H24&&!ubuntu-4&&!H21&&!H35'
 
 def jdkMapping = [
         '1.6': 'JDK 1.6 (latest)',
@@ -376,7 +377,7 @@ poijobs.each { poijob ->
                     }
                 } else if (poijob.noScratchpad) {
                     ant {
-                        targets(['clean', 'compile-all'] + (poijob.properties ?: []))
+                        targets(['clean', 'compile'] + (poijob.properties ?: []))
                         prop('coverage.enabled', true)
                         antInstallation(antRT)
                     }
@@ -529,20 +530,18 @@ on that machine correctly.
  */
 matrixJob('POI-DSL-Test-Environment') {
     description(
-            '''
-Check installed version of Java/Ant on all build-nodes
+'''Check installed version of Java/Ant on all build-nodes
 
 This job is used to verify which machines actually have the required programs installed.
 
-Unfortunately we often see builds break because of changes/new machines...'''
-    )
+Unfortunately we often see builds break because of changes/new machines...''')
 
     /*throttleConcurrentBuilds {
         maxPerNode(1)
         maxTotal(1)
     }*/
     logRotator {
-        numToKeep(5)
+        numToKeep(1)
         artifactNumToKeep(1)
     }
     axes {
@@ -559,37 +558,54 @@ Unfortunately we often see builds break
                 'JDK 11 b23 (early access build) (Windows Only)',
 
                 'JDK 12 (latest)',
-                'JDK 12 b8 (early access build) (Windows Only)'
-        )
-        label('Nodes',
-				'arm1',
-                'beam1','beam2','beam3','beam4','beam5','beam6','beam7','beam8','beam9',
-                'beam10','beam11','beam12','beam13','beam14','beam15','beam16',
-                'H0','H1','H10','H11','H12','H13','H14','H15','H16','H17','H18','H19',
-                'H2','H20','H21','H22','H23','H24','H25','H26','H27','H28','H29',
-                'H3','H30','H31','H32','H33','H34','H35',
-                'H4','H5','H6','H7','H8','H9',
-                'ubuntu-1','ubuntu-2','ubuntu-4','ubuntu-6','ubuntu-eu2','ubuntu-eu3','ubuntu-ppc64le','ubuntu-us1',
-                'windows-2012-1','windows-2012-2','windows-2012-3','windows-2016-1','windows-2016-2','windows-2016-3'
+                'OpenJDK 12 b18 (early access build)'
         )
+        elasticAxis {
+            name('Nodes')
+            labelString('!cloud-slave&&!H15&&!H17&&!H18&&!H24&&!ubuntu-4&&!H21&&!H35&&!websites1&&!couchdb&&!plc4x&&!ppc64le')
+            ignoreOffline(true)
+        }
     }
     steps {
-        /*if (poijob.windows) {
-            context.batchFile(cmd)
-        } else {*/
-        shell('''
-which javac
+        conditionalSteps {
+            condition {
+                fileExists('/usr', BaseDir.WORKSPACE)
+                runner('DontRun')
+                steps {
+                    shell(
+'''which javac
 javac -version
 echo '<?xml version="1.0"?><project name="POI Build" default="test"><target name="test"><echo>Using Ant: ${ant.version} from ${ant.home}</echo></target></project>' > build.xml
 ''')
-        //}
-        ant {
-            antInstallation(defaultAnt)
-        }
-    }
+                    ant {
+                        antInstallation(defaultAnt)
+                    }
 
-    publishers {
-        mailer('centic@poi.apache.org' /* defaultEmail */, false, false)
+                }
+            }
+        }
+        conditionalSteps {
+            condition {
+                fileExists('c:\\windows', BaseDir.WORKSPACE)
+                runner('DontRun')
+                steps {
+                    batchFile {
+                        command(
+'''@echo off
+echo .
+where javac.exe
+echo .
+javac -version
+echo .
+echo ^<?xml version=^"1.0^"?^>^<project name=^"POI Build^" default=^"test^"^>^<target name=^"test^"^>^<echo^>Using Ant: ${ant.version} from ${ant.home}^</echo^>^</target^>^</project^> > build.xml
+''')
+                    }
+                    ant {
+                        antInstallation(defaultAnt + ' (Windows)')
+                    }
+                }
+            }
+        }
     }
 }
 

Modified: poi/branches/hemf/sonar/examples/pom.xml
URL: http://svn.apache.org/viewvc/poi/branches/hemf/sonar/examples/pom.xml?rev=1847069&r1=1847068&r2=1847069&view=diff
==============================================================================
--- poi/branches/hemf/sonar/examples/pom.xml (original)
+++ poi/branches/hemf/sonar/examples/pom.xml Tue Nov 20 22:24:26 2018
@@ -6,7 +6,7 @@
     <parent>
         <groupId>org.apache.poi</groupId>
         <artifactId>poi-parent</artifactId>
-        <version>4.0.1-SNAPSHOT</version>
+        <version>4.0.2-SNAPSHOT</version>
     </parent>
     <artifactId>poi-examples</artifactId>
     <packaging>jar</packaging>

Modified: poi/branches/hemf/sonar/excelant/pom.xml
URL: http://svn.apache.org/viewvc/poi/branches/hemf/sonar/excelant/pom.xml?rev=1847069&r1=1847068&r2=1847069&view=diff
==============================================================================
--- poi/branches/hemf/sonar/excelant/pom.xml (original)
+++ poi/branches/hemf/sonar/excelant/pom.xml Tue Nov 20 22:24:26 2018
@@ -6,7 +6,7 @@
     <parent>
         <groupId>org.apache.poi</groupId>
         <artifactId>poi-parent</artifactId>
-        <version>4.0.1-SNAPSHOT</version>
+        <version>4.0.2-SNAPSHOT</version>
     </parent>
     <artifactId>poi-excelant</artifactId>
     <packaging>jar</packaging>

Modified: poi/branches/hemf/sonar/main/pom.xml
URL: http://svn.apache.org/viewvc/poi/branches/hemf/sonar/main/pom.xml?rev=1847069&r1=1847068&r2=1847069&view=diff
==============================================================================
--- poi/branches/hemf/sonar/main/pom.xml (original)
+++ poi/branches/hemf/sonar/main/pom.xml Tue Nov 20 22:24:26 2018
@@ -6,7 +6,7 @@
     <parent>
         <groupId>org.apache.poi</groupId>
         <artifactId>poi-parent</artifactId>
-        <version>4.0.1-SNAPSHOT</version>
+        <version>4.0.2-SNAPSHOT</version>
     </parent>
     <artifactId>poi-main</artifactId>
     <packaging>jar</packaging>
@@ -103,7 +103,7 @@
                 <artifactId>maven-surefire-plugin</artifactId>
                 <version>${maven.plugin.surefire.version}</version>
                 <configuration>
-                    <argLine>@{argLine} -Duser.language=en -Duser.country=US -Xmx1024m -Djava.io.tmpdir=target/tmp -XX:-OmitStackTraceInFastThrow</argLine>
+                    <argLine>@{argLine} -Duser.language=en -Duser.country=US -Xmx1024m -Djava.io.tmpdir=${basedir}/target/tmp -XX:-OmitStackTraceInFastThrow</argLine>
                 </configuration>
             </plugin>
 		</plugins>

Modified: poi/branches/hemf/sonar/ooxml-schema-encryption/pom.xml
URL: http://svn.apache.org/viewvc/poi/branches/hemf/sonar/ooxml-schema-encryption/pom.xml?rev=1847069&r1=1847068&r2=1847069&view=diff
==============================================================================
--- poi/branches/hemf/sonar/ooxml-schema-encryption/pom.xml (original)
+++ poi/branches/hemf/sonar/ooxml-schema-encryption/pom.xml Tue Nov 20 22:24:26 2018
@@ -6,7 +6,7 @@
     <parent>
         <groupId>org.apache.poi</groupId>
         <artifactId>poi-parent</artifactId>
-        <version>4.0.1-SNAPSHOT</version>
+        <version>4.0.2-SNAPSHOT</version>
         <relativePath>..</relativePath>
     </parent>
     <artifactId>poi-ooxml-schema-encryption</artifactId>

Modified: poi/branches/hemf/sonar/ooxml-schema-security/pom.xml
URL: http://svn.apache.org/viewvc/poi/branches/hemf/sonar/ooxml-schema-security/pom.xml?rev=1847069&r1=1847068&r2=1847069&view=diff
==============================================================================
--- poi/branches/hemf/sonar/ooxml-schema-security/pom.xml (original)
+++ poi/branches/hemf/sonar/ooxml-schema-security/pom.xml Tue Nov 20 22:24:26 2018
@@ -6,7 +6,7 @@
     <parent>
         <groupId>org.apache.poi</groupId>
         <artifactId>poi-parent</artifactId>
-        <version>4.0.1-SNAPSHOT</version>
+        <version>4.0.2-SNAPSHOT</version>
         <relativePath>..</relativePath>
     </parent>
     <artifactId>poi-ooxml-schema-security</artifactId>

Modified: poi/branches/hemf/sonar/ooxml-schema/pom.xml
URL: http://svn.apache.org/viewvc/poi/branches/hemf/sonar/ooxml-schema/pom.xml?rev=1847069&r1=1847068&r2=1847069&view=diff
==============================================================================
--- poi/branches/hemf/sonar/ooxml-schema/pom.xml (original)
+++ poi/branches/hemf/sonar/ooxml-schema/pom.xml Tue Nov 20 22:24:26 2018
@@ -6,7 +6,7 @@
     <parent>
         <groupId>org.apache.poi</groupId>
         <artifactId>poi-parent</artifactId>
-        <version>4.0.1-SNAPSHOT</version>
+        <version>4.0.2-SNAPSHOT</version>
         <relativePath>..</relativePath>
     </parent>
     <artifactId>poi-ooxml-schema</artifactId>

Modified: poi/branches/hemf/sonar/ooxml/pom.xml
URL: http://svn.apache.org/viewvc/poi/branches/hemf/sonar/ooxml/pom.xml?rev=1847069&r1=1847068&r2=1847069&view=diff
==============================================================================
--- poi/branches/hemf/sonar/ooxml/pom.xml (original)
+++ poi/branches/hemf/sonar/ooxml/pom.xml Tue Nov 20 22:24:26 2018
@@ -6,7 +6,7 @@
     <parent>
         <groupId>org.apache.poi</groupId>
         <artifactId>poi-parent</artifactId>
-        <version>4.0.1-SNAPSHOT</version>
+        <version>4.0.2-SNAPSHOT</version>
     </parent>
     <artifactId>poi-ooxml</artifactId>
     <packaging>jar</packaging>
@@ -93,7 +93,7 @@
                 <artifactId>maven-surefire-plugin</artifactId>
                 <version>${maven.plugin.surefire.version}</version>
                 <configuration>
-                    <argLine>@{argLine} -Duser.language=en -Duser.country=US -Xmx1024m -Djava.io.tmpdir=target/tmp -XX:-OmitStackTraceInFastThrow</argLine>
+                    <argLine>@{argLine} -Duser.language=en -Duser.country=US -Xmx1024m -Djava.io.tmpdir=${basedir}/target/tmp -XX:-OmitStackTraceInFastThrow</argLine>
                 </configuration>
             </plugin>
         </plugins>

Modified: poi/branches/hemf/sonar/pom.xml
URL: http://svn.apache.org/viewvc/poi/branches/hemf/sonar/pom.xml?rev=1847069&r1=1847068&r2=1847069&view=diff
==============================================================================
--- poi/branches/hemf/sonar/pom.xml (original)
+++ poi/branches/hemf/sonar/pom.xml Tue Nov 20 22:24:26 2018
@@ -4,7 +4,7 @@
     <groupId>org.apache.poi</groupId>
     <artifactId>poi-parent</artifactId>
     <packaging>pom</packaging>
-    <version>4.0.1-SNAPSHOT</version>
+    <version>4.0.2-SNAPSHOT</version>
     <name>Apache POI - the Java API for Microsoft Documents</name>
     <description>Maven build of Apache POI for Sonar checks</description>
     <url>http://poi.apache.org/</url>
@@ -117,7 +117,7 @@
                         <org.apache.poi.util.POILogger>org.apache.poi.util.NullLogger</org.apache.poi.util.POILogger>
                     </systemPropertyVariables>
                     <!-- use to following to analyze OOM issues:	-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp -->
-                    <argLine>@{argLine} -Duser.language=en -Duser.country=US -Xmx1024m -Djava.io.tmpdir=target/tmp
+                    <argLine>@{argLine} -Duser.language=en -Duser.country=US -Xmx1024m -Djava.io.tmpdir=${basedir}/target/tmp
                     </argLine>
                     <excludes>
                         <exclude>**/All*Tests.java</exclude>

Modified: poi/branches/hemf/sonar/scratchpad/pom.xml
URL: http://svn.apache.org/viewvc/poi/branches/hemf/sonar/scratchpad/pom.xml?rev=1847069&r1=1847068&r2=1847069&view=diff
==============================================================================
--- poi/branches/hemf/sonar/scratchpad/pom.xml (original)
+++ poi/branches/hemf/sonar/scratchpad/pom.xml Tue Nov 20 22:24:26 2018
@@ -6,7 +6,7 @@
     <parent>
         <groupId>org.apache.poi</groupId>
         <artifactId>poi-parent</artifactId>
-        <version>4.0.1-SNAPSHOT</version>
+        <version>4.0.2-SNAPSHOT</version>
     </parent>
     <artifactId>poi-scratchpad</artifactId>
     <packaging>jar</packaging>

Modified: poi/branches/hemf/src/examples/src/org/apache/poi/xssf/usermodel/examples/CreateTable.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/examples/src/org/apache/poi/xssf/usermodel/examples/CreateTable.java?rev=1847069&r1=1847068&r2=1847069&view=diff
==============================================================================
--- poi/branches/hemf/src/examples/src/org/apache/poi/xssf/usermodel/examples/CreateTable.java (original)
+++ poi/branches/hemf/src/examples/src/org/apache/poi/xssf/usermodel/examples/CreateTable.java Tue Nov 20 22:24:26 2018
@@ -19,7 +19,6 @@ package org.apache.poi.xssf.usermodel.ex
 import java.io.FileOutputStream;
 import java.io.IOException;
 
-import org.apache.poi.ss.usermodel.Workbook;
 import org.apache.poi.ss.util.AreaReference;
 import org.apache.poi.ss.util.CellReference;
 import org.apache.poi.xssf.usermodel.XSSFCell;
@@ -36,8 +35,8 @@ public class CreateTable {
 
     public static void main(String[] args) throws IOException {
 
-        try (Workbook wb = new XSSFWorkbook()) {
-            XSSFSheet sheet = (XSSFSheet) wb.createSheet();
+        try (XSSFWorkbook wb = new XSSFWorkbook()) {
+            XSSFSheet sheet = wb.createSheet();
 
             // Set which area the table should be placed in
             AreaReference reference = wb.getCreationHelper().createAreaReference(
@@ -78,10 +77,6 @@ public class CreateTable {
                     }
                 }
             }
-            // Create the columns
-            table.createColumn("Column 1");
-            table.createColumn("Column 2");
-            table.createColumn("Column 3");
 
             // Save
             try (FileOutputStream fileOut = new FileOutputStream("ooxml-table.xlsx")) {

Modified: poi/branches/hemf/src/integrationtest/build.xml
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/integrationtest/build.xml?rev=1847069&r1=1847068&r2=1847069&view=diff
==============================================================================
--- poi/branches/hemf/src/integrationtest/build.xml (original)
+++ poi/branches/hemf/src/integrationtest/build.xml Tue Nov 20 22:24:26 2018
@@ -82,7 +82,9 @@ Before running this, you should execute
 
     <target name="runCompileTest" depends="init" description="Verify that we can compile most examples without including excelant or scratchpad jars">
         <!-- clean out old stuff in build-dir -->
-        <delete dir="${build}"/>
+        <delete dir="${build}" quiet="true" failonerror="false"/>
+        <!-- ... try again - on Windows, the JaCoCo ant task seems to keep files open and hence the lib directory can't be removed -->
+        <delete dir="${build}" quiet="true" failonerror="false"/>
         <mkdir dir="${build}"/>
 
         <!-- select latest built jar files without scratchpad.jar -->

Modified: poi/branches/hemf/src/integrationtest/org/apache/poi/BaseIntegrationTest.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/integrationtest/org/apache/poi/BaseIntegrationTest.java?rev=1847069&r1=1847068&r2=1847069&view=diff
==============================================================================
--- poi/branches/hemf/src/integrationtest/org/apache/poi/BaseIntegrationTest.java (original)
+++ poi/branches/hemf/src/integrationtest/org/apache/poi/BaseIntegrationTest.java Tue Nov 20 22:24:26 2018
@@ -16,17 +16,24 @@
 ==================================================================== */
 package org.apache.poi;
 
-import org.apache.poi.hslf.exceptions.OldPowerPointFormatException;
-import org.apache.poi.hssf.OldExcelFormatException;
-import org.apache.poi.hwpf.OldWordFileFormatException;
-import org.apache.poi.poifs.filesystem.OfficeXmlFileException;
-import org.apache.poi.stress.*;
-import org.junit.Assume;
+import static org.junit.Assert.assertNotNull;
 
-import java.io.*;
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
 import java.util.zip.ZipException;
 
-import static org.junit.Assert.assertNotNull;
+import org.apache.poi.poifs.filesystem.OfficeXmlFileException;
+import org.apache.poi.stress.FileHandler;
+import org.apache.poi.stress.HSLFFileHandler;
+import org.apache.poi.stress.HSSFFileHandler;
+import org.apache.poi.stress.HWPFFileHandler;
+import org.apache.poi.stress.XSLFFileHandler;
+import org.apache.poi.stress.XSSFFileHandler;
+import org.apache.poi.stress.XWPFFileHandler;
+import org.junit.Assume;
 
 public class BaseIntegrationTest {
 	private final File rootDir;
@@ -53,12 +60,13 @@ public class BaseIntegrationTest {
 
         	// use XWPF instead of HWPF and XSSF instead of HSSF as the file seems to have the wrong extension
 			handleWrongExtension(inputFile, e);
-		} catch (OldWordFileFormatException | OldExcelFormatException | OldPowerPointFormatException e) {
-        	// at least perform extracting tests on these old files
         } catch (OldFileFormatException e) {
-            // Not even text extraction is supported for these: handler.handleExtracting(inputFile);
-			//noinspection ConstantConditions
-			Assume.assumeFalse("File " + file + " excluded because it is unsupported old Excel format", true);
+        	if (e.getClass().equals(OldFileFormatException.class)) {
+				// Not even text extraction is supported for these: handler.handleExtracting(inputFile);
+				//noinspection ConstantConditions
+				Assume.assumeFalse("File " + file + " excluded because it is unsupported old Excel format", true);
+			}
+			// otherwise try at least to perform extracting tests on these old files
         } catch (EncryptedDocumentException e) {
         	// Do not try to read encrypted files
 			//noinspection ConstantConditions

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=1847069&r1=1847068&r2=1847069&view=diff
==============================================================================
--- poi/branches/hemf/src/integrationtest/org/apache/poi/TestAllFiles.java (original)
+++ poi/branches/hemf/src/integrationtest/org/apache/poi/TestAllFiles.java Tue Nov 20 22:24:26 2018
@@ -90,6 +90,7 @@ import org.junit.runners.Parameterized.P
 @RunWith(Parameterized.class)
 public class TestAllFiles {
     private static final File ROOT_DIR = new File("test-data");
+    private static final boolean IGNORE_SCRATCHPAD = Boolean.getBoolean("scratchpad.ignore");
 
     public static final String[] SCAN_EXCLUDES = new String[] { "**/.svn/**", "lost+found", "**/.git/**" };
 
@@ -98,6 +99,7 @@ public class TestAllFiles {
     
     // map file extensions to the actual mappers
     public static final Map<String, FileHandler> HANDLERS = new HashMap<>();
+
     static {
         // Excel
         HANDLERS.put(".xls", new HSSFFileHandler());
@@ -107,17 +109,17 @@ public class TestAllFiles {
         HANDLERS.put(".xlsb", new XSSFBFileHandler());
 
         // Word
-        HANDLERS.put(".doc", new HWPFFileHandler());
+        HANDLERS.put(".doc", IGNORE_SCRATCHPAD ? new HPSFFileHandler() : new HWPFFileHandler());
         HANDLERS.put(".docx", new XWPFFileHandler());
         HANDLERS.put(".dotx", new XWPFFileHandler());
         HANDLERS.put(".docm", new XWPFFileHandler());
 
         // OpenXML4J files
-        HANDLERS.put(".ooxml", new OPCFileHandler());		// OPCPackage
-        HANDLERS.put(".zip", new OPCFileHandler());      // OPCPackage
+        HANDLERS.put(".ooxml", new OPCFileHandler());
+        HANDLERS.put(".zip", new OPCFileHandler());
 
         // Powerpoint
-        HANDLERS.put(".ppt", new HSLFFileHandler());
+        HANDLERS.put(".ppt", IGNORE_SCRATCHPAD ? new HPSFFileHandler() : new HSLFFileHandler());
         HANDLERS.put(".pptx", new XSLFFileHandler());
         HANDLERS.put(".pptm", new XSLFFileHandler());
         HANDLERS.put(".ppsm", new XSLFFileHandler());
@@ -126,13 +128,13 @@ public class TestAllFiles {
         HANDLERS.put(".potx", new XSLFFileHandler());
 
         // Outlook
-        HANDLERS.put(".msg", new HSMFFileHandler());
+        HANDLERS.put(".msg", IGNORE_SCRATCHPAD ? new HPSFFileHandler() : new HSMFFileHandler());
 
         // Publisher
-        HANDLERS.put(".pub", new HPBFFileHandler());
+        HANDLERS.put(".pub", IGNORE_SCRATCHPAD ? new HPSFFileHandler() : new HPBFFileHandler());
 
         // Visio - binary
-        HANDLERS.put(".vsd", new HDGFFileHandler());
+        HANDLERS.put(".vsd", IGNORE_SCRATCHPAD ? new HPSFFileHandler() : new HDGFFileHandler());
         
         // Visio - ooxml
         HANDLERS.put(".vsdm", new XDGFFileHandler());
@@ -153,7 +155,7 @@ public class TestAllFiles {
         HANDLERS.put(".adm", new HPSFFileHandler());
 
         // Microsoft TNEF
-        HANDLERS.put(".dat", new HMEFFileHandler());
+        HANDLERS.put(".dat", IGNORE_SCRATCHPAD ? new HPSFFileHandler() : new HMEFFileHandler());
 
         // TODO: are these readable by some of the formats?
         HANDLERS.put(".wri", new NullFileHandler());
@@ -300,7 +302,7 @@ public class TestAllFiles {
         "spreadsheet/54764-2.xlsx",   // see TestXSSFBugs.bug54764()
         "spreadsheet/54764.xlsx",     // see TestXSSFBugs.bug54764()
         "poifs/unknown_properties.msg", // POIFS properties corrupted
-        "poifs/only-zero-byte-streams.ole2", // No actual contents
+        (IGNORE_SCRATCHPAD ? "" : "poifs/only-zero-byte-streams.ole2"), // No actual contents
         "spreadsheet/poc-xmlbomb.xlsx",  // contains xml-entity-expansion
         "spreadsheet/poc-xmlbomb-empty.xlsx",  // contains xml-entity-expansion
         "spreadsheet/poc-shared-strings.xlsx",  // contains shared-string-entity-expansion
@@ -438,8 +440,17 @@ public class TestAllFiles {
             }
         }
 
-        // let some file handlers do additional stuff
-        handler.handleAdditional(inputFile);
+        try {
+            // let some file handlers do additional stuff
+            handler.handleAdditional(inputFile);
+        } catch (AssumptionViolatedException e) {
+            // file handler ignored this file
+        } catch (Exception e) {
+            if(!EXPECTED_FAILURES.contains(file) && !AbstractFileHandler.EXPECTED_EXTRACTOR_FAILURES.contains(file)) {
+                System.out.println("Failed: " + file);
+                throw new Exception("While handling " + file, e);
+            }
+        }
     }
 
     public static String getExtension(String file) {

Modified: poi/branches/hemf/src/integrationtest/org/apache/poi/stress/AbstractFileHandler.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/integrationtest/org/apache/poi/stress/AbstractFileHandler.java?rev=1847069&r1=1847068&r2=1847069&view=diff
==============================================================================
--- poi/branches/hemf/src/integrationtest/org/apache/poi/stress/AbstractFileHandler.java (original)
+++ poi/branches/hemf/src/integrationtest/org/apache/poi/stress/AbstractFileHandler.java Tue Nov 20 22:24:26 2018
@@ -79,26 +79,26 @@ public abstract class AbstractFileHandle
         long modified = file.lastModified();
         
         POITextExtractor extractor = null;
-        try  {
+        try {
             extractor = ExtractorFactory.createExtractor(file);
             assertNotNull("Should get a POITextExtractor but had none for file " + file, extractor);
 
             assertNotNull("Should get some text but had none for file " + file, extractor.getText());
-            
+
             // also try metadata
             @SuppressWarnings("resource")
             POITextExtractor metadataExtractor = extractor.getMetadataTextExtractor();
             assertNotNull(metadataExtractor.getText());
 
-            assertFalse("Expected Extraction to fail for file " + file + " and handler " + this + ", but did not fail!", 
+            assertFalse("Expected Extraction to fail for file " + file + " and handler " + this + ", but did not fail!",
                     EXPECTED_EXTRACTOR_FAILURES.contains(file.getParentFile().getName() + "/" + file.getName()));
-            
+
             assertEquals("File should not be modified by extractor", length, file.length());
             assertEquals("File should not be modified by extractor", modified, file.lastModified());
-            
+
             handleExtractingAsStream(file);
-            
-            if(extractor instanceof POIOLE2TextExtractor) {
+
+            if (extractor instanceof POIOLE2TextExtractor) {
                 try (HPSFPropertiesExtractor hpsfExtractor = new HPSFPropertiesExtractor((POIOLE2TextExtractor) extractor)) {
                     assertNotNull(hpsfExtractor.getDocumentSummaryInformationText());
                     assertNotNull(hpsfExtractor.getSummaryInformationText());
@@ -115,6 +115,10 @@ public abstract class AbstractFileHandle
             String msg = "org.apache.poi.EncryptedDocumentException: Export Restrictions in place - please install JCE Unlimited Strength Jurisdiction Policy files";
             assumeFalse(msg.equals(e.getMessage()));
             throw e;
+        } catch (IllegalStateException e) {
+            if (!e.getMessage().contains("POI Scratchpad jar missing") || !Boolean.getBoolean("scratchpad.ignore")) {
+                throw e;
+            }
         } finally {
             IOUtils.closeQuietly(extractor);
         }

Modified: poi/branches/hemf/src/java/org/apache/poi/hssf/eventusermodel/MissingRecordAwareHSSFListener.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/java/org/apache/poi/hssf/eventusermodel/MissingRecordAwareHSSFListener.java?rev=1847069&r1=1847068&r2=1847069&view=diff
==============================================================================
--- poi/branches/hemf/src/java/org/apache/poi/hssf/eventusermodel/MissingRecordAwareHSSFListener.java (original)
+++ poi/branches/hemf/src/java/org/apache/poi/hssf/eventusermodel/MissingRecordAwareHSSFListener.java Tue Nov 20 22:24:26 2018
@@ -94,8 +94,6 @@ public final class MissingRecordAwareHSS
 					break;
 				case RowRecord.sid:
 					RowRecord rowrec = (RowRecord) record;
-					//System.out.println("Row " + rowrec.getRowNumber() + " found, first column at "
-					//        + rowrec.getFirstCol() + " last column at " + rowrec.getLastCol());
 
 					// If there's a jump in rows, fire off missing row records
 					if (lastRowRow + 1 < rowrec.getRowNumber()) {

Modified: poi/branches/hemf/src/java/org/apache/poi/hssf/record/UnknownRecord.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/java/org/apache/poi/hssf/record/UnknownRecord.java?rev=1847069&r1=1847068&r2=1847069&view=diff
==============================================================================
--- poi/branches/hemf/src/java/org/apache/poi/hssf/record/UnknownRecord.java (original)
+++ poi/branches/hemf/src/java/org/apache/poi/hssf/record/UnknownRecord.java Tue Nov 20 22:24:26 2018
@@ -80,13 +80,10 @@ public final class UnknownRecord extends
     public UnknownRecord(RecordInputStream in) {
         _sid = in.getSid();
         _rawData = in.readRemainder();
-//        if (false && getBiffName(_sid) == null) {
-//            // unknown sids in the range 0x0004-0x0013 are probably 'sub-records' of ObjectRecord
-//            // those sids are in a different number space.
-//            // TODO - put unknown OBJ sub-records in a different class
-//            System.out.println("Unknown record 0x" + 
-//                               Integer.toHexString(_sid).toUpperCase(Locale.ROOT));
-//        }
+
+        // TODO - put unknown OBJ sub-records in a different class
+        // unknown sids in the range 0x0004-0x0013 are probably 'sub-records' of ObjectRecord
+        // those sids are in a different number space.
     }
 
     /**

Modified: poi/branches/hemf/src/java/org/apache/poi/ss/format/CellFormatPart.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/java/org/apache/poi/ss/format/CellFormatPart.java?rev=1847069&r1=1847068&r2=1847069&view=diff
==============================================================================
--- poi/branches/hemf/src/java/org/apache/poi/ss/format/CellFormatPart.java (original)
+++ poi/branches/hemf/src/java/org/apache/poi/ss/format/CellFormatPart.java Tue Nov 20 22:24:26 2018
@@ -54,26 +54,22 @@ public class CellFormatPart {
     private final CellFormatter format;
     private final CellFormatType type;
 
-    private static final Map<String, Color> NAMED_COLORS;
+    static final Map<String, Color> NAMED_COLORS;
 
     static {
         NAMED_COLORS = new TreeMap<>(
                 String.CASE_INSENSITIVE_ORDER);
 
-        Map<Integer,HSSFColor> colors = HSSFColor.getIndexHash();
-        for (HSSFColor color : colors.values()) {
-            Class<? extends HSSFColor> type = color.getClass();
-            String name = type.getSimpleName();
-            if (name.equals(name.toUpperCase(Locale.ROOT))) {
-                short[] rgb = color.getTriplet();
-                Color c = new Color(rgb[0], rgb[1], rgb[2]);
-                NAMED_COLORS.put(name, c);
-                if (name.indexOf('_') > 0)
-                    NAMED_COLORS.put(name.replace('_', ' '), c);
-                if (name.indexOf("_PERCENT") > 0)
-                    NAMED_COLORS.put(name.replace("_PERCENT", "%").replace('_',
-                            ' '), c);
-            }
+        for (HSSFColor.HSSFColorPredefined color : HSSFColor.HSSFColorPredefined.values()) {
+            String name = color.name();
+            short[] rgb = color.getTriplet();
+            Color c = new Color(rgb[0], rgb[1], rgb[2]);
+            NAMED_COLORS.put(name, c);
+            if (name.indexOf('_') > 0)
+                NAMED_COLORS.put(name.replace('_', ' '), c);
+            if (name.indexOf("_PERCENT") > 0)
+                NAMED_COLORS.put(name.replace("_PERCENT", "%").replace('_',
+                        ' '), c);
         }
     }
 

Modified: poi/branches/hemf/src/java/org/apache/poi/ss/formula/Formula.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/java/org/apache/poi/ss/formula/Formula.java?rev=1847069&r1=1847068&r2=1847069&view=diff
==============================================================================
--- poi/branches/hemf/src/java/org/apache/poi/ss/formula/Formula.java (original)
+++ poi/branches/hemf/src/java/org/apache/poi/ss/formula/Formula.java Tue Nov 20 22:24:26 2018
@@ -48,19 +48,15 @@ public class Formula {
 	private Formula(byte[] byteEncoding, int encodedTokenLen) {
 		_byteEncoding = byteEncoding.clone();
 		_encodedTokenLen = encodedTokenLen;
-//		if (false) { // set to true to eagerly check Ptg decoding
-//			LittleEndianByteArrayInputStream in = new LittleEndianByteArrayInputStream(byteEncoding);
-//			Ptg.readTokens(encodedTokenLen, in);
-//			int nUnusedBytes = _byteEncoding.length - in.getReadIndex();
-//			if (nUnusedBytes > 0) {
-//				// TODO - this seems to occur when IntersectionPtg is present
-//				// This example file "IntersectionPtg.xls"
-//				// used by test: TestIntersectionPtg.testReading()
-//				// has 10 bytes unused at the end of the formula
-//				// 10 extra bytes are just 0x01 and 0x00
-//				System.out.println(nUnusedBytes + " unused bytes at end of formula");
-//			}
-//		}
+
+		// TODO - this seems to occur when IntersectionPtg is present
+		// This example file "IntersectionPtg.xls"
+		// used by test: TestIntersectionPtg.testReading()
+		// has 10 bytes unused at the end of the formula
+		// 10 extra bytes are just 0x01 and 0x00
+		// LittleEndianByteArrayInputStream in = new LittleEndianByteArrayInputStream(byteEncoding);
+		// Ptg.readTokens(encodedTokenLen, in);
+		// int nUnusedBytes = _byteEncoding.length - in.getReadIndex();
 	}
 	/**
 	 * Convenience method for {@link #read(int, LittleEndianInput, int)}

Modified: poi/branches/hemf/src/java/org/apache/poi/ss/formula/FormulaParser.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/java/org/apache/poi/ss/formula/FormulaParser.java?rev=1847069&r1=1847068&r2=1847069&view=diff
==============================================================================
--- poi/branches/hemf/src/java/org/apache/poi/ss/formula/FormulaParser.java (original)
+++ poi/branches/hemf/src/java/org/apache/poi/ss/formula/FormulaParser.java Tue Nov 20 22:24:26 2018
@@ -234,7 +234,6 @@ public final class FormulaParser {
             _inIntersection = false;
         }
         _pointer += Character.charCount(look);
-        //System.out.println(new StringBuilder("Got char: ").appendCodePoint(look)).toString();
     }
     private void resetPointer(int ptr) {
         _pointer = ptr;

Modified: poi/branches/hemf/src/java/org/apache/poi/ss/formula/eval/OperandResolver.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/java/org/apache/poi/ss/formula/eval/OperandResolver.java?rev=1847069&r1=1847068&r2=1847069&view=diff
==============================================================================
--- poi/branches/hemf/src/java/org/apache/poi/ss/formula/eval/OperandResolver.java (original)
+++ poi/branches/hemf/src/java/org/apache/poi/ss/formula/eval/OperandResolver.java Tue Nov 20 22:24:26 2018
@@ -88,8 +88,7 @@ public final class OperandResolver {
         CellRangeAddress range =  cell.getArrayFormulaRange();
         int relativeRowIndex = cell.getRowIndex() - range.getFirstRow();
         int relativeColIndex = cell.getColumnIndex() - range.getFirstColumn();
-        //System.out.println("Row: " + relativeRowIndex + " Col: " + relativeColIndex);
-        
+
         if (ae.isColumn()) {
             if (ae.isRow()) {
                 return ae.getRelativeValue(0, 0);

Modified: poi/branches/hemf/src/java/org/apache/poi/ss/usermodel/DataFormatter.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/java/org/apache/poi/ss/usermodel/DataFormatter.java?rev=1847069&r1=1847068&r2=1847069&view=diff
==============================================================================
--- poi/branches/hemf/src/java/org/apache/poi/ss/usermodel/DataFormatter.java (original)
+++ poi/branches/hemf/src/java/org/apache/poi/ss/usermodel/DataFormatter.java Tue Nov 20 22:24:26 2018
@@ -450,7 +450,6 @@ public class DataFormatter implements Ob
             
             // Strip custom text in quotes and escaped characters for now as it can cause performance problems in fractions.
             //String strippedFormatStr = formatStr.replaceAll("\\\\ ", " ").replaceAll("\\\\.", "").replaceAll("\"[^\"]*\"", " ").replaceAll("\\?", "#");
-            //System.out.println("formatStr: "+strippedFormatStr);
             return new FractionFormat(defaultFractionWholePartFormat, defaultFractionFractionPartFormat);
         }
         

Modified: poi/branches/hemf/src/ooxml/java/org/apache/poi/ooxml/extractor/ExtractorFactory.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/ooxml/java/org/apache/poi/ooxml/extractor/ExtractorFactory.java?rev=1847069&r1=1847068&r2=1847069&view=diff
==============================================================================
--- poi/branches/hemf/src/ooxml/java/org/apache/poi/ooxml/extractor/ExtractorFactory.java (original)
+++ poi/branches/hemf/src/ooxml/java/org/apache/poi/ooxml/extractor/ExtractorFactory.java Tue Nov 20 22:24:26 2018
@@ -16,24 +16,20 @@
 ==================================================================== */
 package org.apache.poi.ooxml.extractor;
 
-import java.io.ByteArrayInputStream;
 import java.io.File;
-import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
+import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.Iterator;
+import java.util.List;
 
 import org.apache.poi.EncryptedDocumentException;
+import org.apache.poi.extractor.OLE2ExtractorFactory;
 import org.apache.poi.extractor.POIOLE2TextExtractor;
 import org.apache.poi.extractor.POITextExtractor;
-import org.apache.poi.extractor.OLE2ExtractorFactory;
-import org.apache.poi.hsmf.MAPIMessage;
-import org.apache.poi.hsmf.datatypes.AttachmentChunks;
-import org.apache.poi.hsmf.extractor.OutlookTextExtactor;
 import org.apache.poi.hssf.extractor.ExcelExtractor;
 import org.apache.poi.hssf.record.crypto.Biff8EncryptionKey;
-import org.apache.poi.hwpf.extractor.WordExtractor;
 import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
 import org.apache.poi.openxml4j.opc.OPCPackage;
 import org.apache.poi.openxml4j.opc.PackageAccess;
@@ -46,9 +42,9 @@ import org.apache.poi.poifs.filesystem.D
 import org.apache.poi.poifs.filesystem.DirectoryNode;
 import org.apache.poi.poifs.filesystem.Entry;
 import org.apache.poi.poifs.filesystem.FileMagic;
-import org.apache.poi.poifs.filesystem.POIFSFileSystem;
 import org.apache.poi.poifs.filesystem.NotOLE2FileException;
 import org.apache.poi.poifs.filesystem.OfficeXmlFileException;
+import org.apache.poi.poifs.filesystem.POIFSFileSystem;
 import org.apache.poi.sl.extractor.SlideShowExtractor;
 import org.apache.poi.util.IOUtils;
 import org.apache.poi.util.NotImplemented;
@@ -311,6 +307,7 @@ public final class ExtractorFactory {
             throw new IllegalStateException("The extractor didn't know which POIFS it came from!");
         }
 
+        // provide ExcelExtractor also in OOXML module, because scratchpad is not necessary for it
         if (ext instanceof ExcelExtractor) {
             // These are in MBD... under the root
             Iterator<Entry> it = root.getEntries();
@@ -320,34 +317,14 @@ public final class ExtractorFactory {
                     dirs.add(entry);
                 }
             }
-        } else if (ext instanceof WordExtractor) {
-            // These are in ObjectPool -> _... under the root
+        } else {
             try {
-                DirectoryEntry op = (DirectoryEntry) root.getEntry("ObjectPool");
-                Iterator<Entry> it = op.getEntries();
-                while (it.hasNext()) {
-                    Entry entry = it.next();
-                    if (entry.getName().startsWith("_")) {
-                        dirs.add(entry);
-                    }
-                }
-            } catch (FileNotFoundException e) {
-                logger.log(POILogger.INFO, "Ignoring FileNotFoundException while extracting Word document", e.getLocalizedMessage());
-                // ignored here
-            }
-        //} else if(ext instanceof PowerPointExtractor) {
-            // Tricky, not stored directly in poifs
-            // TODO
-        } else if (ext instanceof OutlookTextExtactor) {
-            // Stored in the Attachment blocks
-            MAPIMessage msg = ((OutlookTextExtactor)ext).getMAPIMessage();
-            for (AttachmentChunks attachment : msg.getAttachmentFiles()) {
-                if (attachment.getAttachData() != null) {
-                    byte[] data = attachment.getAttachData().getValue();
-                    nonPOIFS.add( new ByteArrayInputStream(data) );
-                } else if (attachment.getAttachmentDirectory() != null) {
-                    dirs.add(attachment.getAttachmentDirectory().getDirectory());
-                }
+                Class<?> clazz = Class.forName("org.apache.poi.extractor.ole2.OLE2ScratchpadExtractorFactory");
+                Method m = clazz.getDeclaredMethod("identifyEmbeddedResources", POIOLE2TextExtractor.class, List.class, List.class);
+                m.invoke(null, ext, dirs, nonPOIFS);
+            } catch (ReflectiveOperationException e) {
+                logger.log(POILogger.WARN, "POI Scratchpad jar not included ", e.getLocalizedMessage());
+                return new POITextExtractor[0];
             }
         }
 

Modified: poi/branches/hemf/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java?rev=1847069&r1=1847068&r2=1847069&view=diff
==============================================================================
--- poi/branches/hemf/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java (original)
+++ poi/branches/hemf/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java Tue Nov 20 22:24:26 2018
@@ -170,16 +170,24 @@ public class XSLFPictureShape extends XS
     
     @SuppressWarnings("WeakerAccess")
     protected String getBlipLink(){
-        String link = getBlip().getLink();
-        if (link.isEmpty()) return null;
-        return link;
+        CTBlip blip = getBlip();
+        if (blip != null) {
+            String link = blip.getLink();
+            return (link.isEmpty()) ? null : link;
+        } else {
+            return null;
+        }
     }
 
     @SuppressWarnings("WeakerAccess")
     protected String getBlipId(){
-        String id = getBlip().getEmbed();
-        if (id.isEmpty()) return null;
-        return id;
+        CTBlip blip = getBlip();
+        if (blip != null) {
+            String id = blip.getEmbed();
+            return (id.isEmpty()) ? null : id;
+        } else {
+            return null;
+        }
     }
 
     @Override

Modified: poi/branches/hemf/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java?rev=1847069&r1=1847068&r2=1847069&view=diff
==============================================================================
--- poi/branches/hemf/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java (original)
+++ poi/branches/hemf/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java Tue Nov 20 22:24:26 2018
@@ -381,7 +381,10 @@ public class SXSSFWorkbook implements Wo
             Enumeration<? extends ZipArchiveEntry> en = zipEntrySource.getEntries();
             while (en.hasMoreElements()) {
                 ZipArchiveEntry ze = en.nextElement();
-                zos.putArchiveEntry(new ZipArchiveEntry(ze.getName()));
+                ZipArchiveEntry zeOut = new ZipArchiveEntry(ze.getName());
+                zeOut.setSize(ze.getSize());
+                zeOut.setTime(ze.getTime());
+                zos.putArchiveEntry(zeOut);
                 try (final InputStream is = zipEntrySource.getInputStream(ze)) {
                     if (is instanceof ZipArchiveThresholdInputStream) {
                         // #59743 - disable Threshold handling for SXSSF copy

Modified: poi/branches/hemf/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFColor.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFColor.java?rev=1847069&r1=1847068&r2=1847069&view=diff
==============================================================================
--- poi/branches/hemf/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFColor.java (original)
+++ poi/branches/hemf/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFColor.java Tue Nov 20 22:24:26 2018
@@ -47,7 +47,7 @@ public class XSSFColor extends ExtendedC
      * @deprecated 3.17 beta 1 - pass the workbook styles indexed color map, if any
      */
     @Deprecated
-    @Removal(version="3.19")
+    @Removal(version="4.2")
     public XSSFColor(CTColor color) {
         this(color, new DefaultIndexedColorMap());
     }
@@ -59,6 +59,7 @@ public class XSSFColor extends ExtendedC
      * @deprecated 4.0.0 - use the factory {@link #from(CTColor, IndexedColorMap)} method instead to check for null CTColor instances.  Make private eventually
      */
     @Deprecated
+    @Removal(version = "4.2")
     public XSSFColor(CTColor color, IndexedColorMap map) {
         this.ctColor = color;
         this.indexedColorMap = map;
@@ -72,7 +73,7 @@ public class XSSFColor extends ExtendedC
      * @see #from(CTColor, IndexedColorMap)
      */
     @Deprecated
-    @Removal(version="4.1")
+    @Removal(version="4.2")
     public XSSFColor() {
         this(CTColor.Factory.newInstance(), new DefaultIndexedColorMap());
     }
@@ -84,7 +85,18 @@ public class XSSFColor extends ExtendedC
     public XSSFColor(IndexedColorMap colorMap) {
         this(CTColor.Factory.newInstance(), colorMap);
     }
-    
+
+    /**
+     * Create an instance of XSSFColor from the awt Color
+     * @param clr awt Color
+     * @deprecated 3.17 beta 1 - pass the workbook styles indexed color map, if any
+     */
+    @Deprecated
+    @Removal(version="4.2")
+    public XSSFColor(java.awt.Color clr) {
+        this(clr, new DefaultIndexedColorMap());
+    }
+
     /**
      * TEST ONLY
      * @param clr awt Color

Modified: poi/branches/hemf/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java?rev=1847069&r1=1847068&r2=1847069&view=diff
==============================================================================
--- poi/branches/hemf/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java (original)
+++ poi/branches/hemf/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java Tue Nov 20 22:24:26 2018
@@ -4109,18 +4109,17 @@ public class XSSFSheet extends POIXMLDoc
         int tableNumber = getPackagePart().getPackage().getPartsByContentType(XSSFRelation.TABLE.getContentType()).size() + 1;
 
         // the id could already be taken after insertion/deletion of different tables
-        outerloop:
-        while(true) {
+        boolean loop = true;
+        while(loop) {
+            loop = false;
             for (PackagePart packagePart : getPackagePart().getPackage().getPartsByContentType(XSSFRelation.TABLE.getContentType())) {
                 String fileName = XSSFRelation.TABLE.getFileName(tableNumber);
                 if(fileName.equals(packagePart.getPartName().getName())) {
                     // duplicate found, increase the number and start iterating again
                     tableNumber++;
-                    continue outerloop;
+                    loop = true;
                 }
             }
-
-            break;
         }
 
         RelationPart rp = createRelationship(XSSFRelation.TABLE, XSSFFactory.getInstance(), tableNumber, false);

Modified: poi/branches/hemf/src/ooxml/testcases/org/apache/poi/extractor/ooxml/TestExtractorFactory.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/ooxml/testcases/org/apache/poi/extractor/ooxml/TestExtractorFactory.java?rev=1847069&r1=1847068&r2=1847069&view=diff
==============================================================================
--- poi/branches/hemf/src/ooxml/testcases/org/apache/poi/extractor/ooxml/TestExtractorFactory.java (original)
+++ poi/branches/hemf/src/ooxml/testcases/org/apache/poi/extractor/ooxml/TestExtractorFactory.java Tue Nov 20 22:24:26 2018
@@ -33,27 +33,18 @@ import org.apache.poi.POIDataSamples;
 import org.apache.poi.UnsupportedFileFormatException;
 import org.apache.poi.extractor.POIOLE2TextExtractor;
 import org.apache.poi.extractor.POITextExtractor;
-import org.apache.poi.hdgf.extractor.VisioTextExtractor;
-import org.apache.poi.hpbf.extractor.PublisherTextExtractor;
-import org.apache.poi.hsmf.extractor.OutlookTextExtactor;
 import org.apache.poi.hssf.HSSFTestDataSamples;
 import org.apache.poi.hssf.OldExcelFormatException;
 import org.apache.poi.hssf.extractor.EventBasedExcelExtractor;
 import org.apache.poi.hssf.extractor.ExcelExtractor;
-import org.apache.poi.hwpf.extractor.Word6Extractor;
-import org.apache.poi.hwpf.extractor.WordExtractor;
 import org.apache.poi.ooxml.extractor.ExtractorFactory;
 import org.apache.poi.ooxml.extractor.POIXMLTextExtractor;
 import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
 import org.apache.poi.openxml4j.opc.OPCPackage;
 import org.apache.poi.openxml4j.opc.PackageAccess;
 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
-import org.apache.poi.sl.extractor.SlideShowExtractor;
-import org.apache.poi.xdgf.extractor.XDGFVisioExtractor;
-import org.apache.poi.xssf.extractor.XSSFBEventBasedExcelExtractor;
 import org.apache.poi.xssf.extractor.XSSFEventBasedExcelExtractor;
 import org.apache.poi.xssf.extractor.XSSFExcelExtractor;
-import org.apache.poi.xwpf.extractor.XWPFWordExtractor;
 import org.apache.xmlbeans.XmlException;
 import org.junit.Test;
 
@@ -108,21 +99,21 @@ public class TestExtractorFactory {
     }
 
     private static final Object[] TEST_SET = {
-        "Excel", xls, ExcelExtractor.class, 200,
-        "Excel - xlsx", xlsx, XSSFExcelExtractor.class, 200,
-        "Excel - xltx", xltx, XSSFExcelExtractor.class, -1,
-        "Excel - xlsb", xlsb, XSSFBEventBasedExcelExtractor.class, -1,
-        "Word", doc, WordExtractor.class, 120,
-        "Word - docx", docx, XWPFWordExtractor.class, 120,
-        "Word - dotx", dotx, XWPFWordExtractor.class, -1,
-        "Word 6", doc6, Word6Extractor.class, 20,
-        "Word 95", doc95, Word6Extractor.class, 120,
-        "PowerPoint", ppt, SlideShowExtractor.class, 120,
-        "PowerPoint - pptx", pptx, SlideShowExtractor.class, 120,
-        "Visio", vsd, VisioTextExtractor.class, 50,
-        "Visio - vsdx", vsdx, XDGFVisioExtractor.class, 20,
-        "Publisher", pub, PublisherTextExtractor.class, 50,
-        "Outlook msg", msg, OutlookTextExtactor.class, 50,
+        "Excel", xls, "ExcelExtractor", 200,
+        "Excel - xlsx", xlsx, "XSSFExcelExtractor", 200,
+        "Excel - xltx", xltx, "XSSFExcelExtractor", -1,
+        "Excel - xlsb", xlsb, "XSSFBEventBasedExcelExtractor", -1,
+        "Word", doc, "WordExtractor", 120,
+        "Word - docx", docx, "XWPFWordExtractor", 120,
+        "Word - dotx", dotx, "XWPFWordExtractor", -1,
+        "Word 6", doc6, "Word6Extractor", 20,
+        "Word 95", doc95, "Word6Extractor", 120,
+        "PowerPoint", ppt, "SlideShowExtractor", 120,
+        "PowerPoint - pptx", pptx, "SlideShowExtractor", 120,
+        "Visio", vsd, "VisioTextExtractor", 50,
+        "Visio - vsdx", vsdx, "XDGFVisioExtractor", 20,
+        "Publisher", pub, "PublisherTextExtractor", 50,
+        "Outlook msg", msg, "OutlookTextExtactor", 50,
 
         // TODO Support OOXML-Strict, see bug #57699
         // xlsxStrict
@@ -138,7 +129,7 @@ public class TestExtractorFactory {
     public void testFile() throws Exception {
         for (int i = 0; i < TEST_SET.length; i += 4) {
             try (POITextExtractor ext = ExtractorFactory.createExtractor((File) TEST_SET[i + 1])) {
-                testExtractor(ext, (String) TEST_SET[i], (Class) TEST_SET[i + 2], (Integer) TEST_SET[i + 3]);
+                testExtractor(ext, (String) TEST_SET[i], (String) TEST_SET[i + 2], (Integer) TEST_SET[i + 3]);
             }
         }
     }
@@ -180,15 +171,15 @@ public class TestExtractorFactory {
             }
             try (FileInputStream fis = new FileInputStream(testFile);
                  POITextExtractor ext = poifsIS.apply(fis)) {
-                testExtractor(ext, (String) TEST_SET[i], (Class) TEST_SET[i + 2], (Integer) TEST_SET[i + 3]);
+                testExtractor(ext, (String) TEST_SET[i], (String) TEST_SET[i + 2], (Integer) TEST_SET[i + 3]);
             } catch (IllegalArgumentException e) {
                 fail("failed to process "+testFile);
             }
         }
     }
 
-    private void testExtractor(final POITextExtractor ext, final String testcase, final Class extrClass, final Integer minLength) {
-        assertTrue("invalid extractor for " + testcase, extrClass.isInstance(ext));
+    private void testExtractor(final POITextExtractor ext, final String testcase, final String extrClass, final Integer minLength) {
+        assertEquals("invalid extractor for " + testcase, extrClass, ext.getClass().getSimpleName());
         final String actual = ext.getText();
         if (minLength == -1) {
             assertContains(actual.toLowerCase(Locale.ROOT), "test");
@@ -215,7 +206,7 @@ public class TestExtractorFactory {
 
             try (final OPCPackage pkg = OPCPackage.open(testFile, PackageAccess.READ);
                  final POITextExtractor ext = ExtractorFactory.createExtractor(pkg)) {
-                testExtractor(ext, (String) TEST_SET[i], (Class) TEST_SET[i + 2], (Integer) TEST_SET[i + 3]);
+                testExtractor(ext, (String) TEST_SET[i], (String) TEST_SET[i + 2], (Integer) TEST_SET[i + 3]);
                 pkg.revert();
             }
         }
@@ -334,16 +325,22 @@ public class TestExtractorFactory {
                 int numWord = 0, numXls = 0, numPpt = 0, numMsg = 0, numWordX = 0;
                 for (POITextExtractor embed : embeds) {
                     assertTrue(embed.getText().length() > 20);
-                    if (embed instanceof SlideShowExtractor) {
-                        numPpt++;
-                    } else if (embed instanceof ExcelExtractor) {
-                        numXls++;
-                    } else if (embed instanceof WordExtractor) {
-                        numWord++;
-                    } else if (embed instanceof OutlookTextExtactor) {
-                        numMsg++;
-                    } else if (embed instanceof XWPFWordExtractor) {
-                        numWordX++;
+                    switch (embed.getClass().getSimpleName()) {
+                        case "SlideShowExtractor":
+                            numPpt++;
+                            break;
+                        case "ExcelExtractor":
+                            numXls++;
+                            break;
+                        case "WordExtractor":
+                            numWord++;
+                            break;
+                        case "OutlookTextExtactor":
+                            numMsg++;
+                            break;
+                        case "XWPFWordExtractor":
+                            numWordX++;
+                            break;
                     }
                 }
 

Modified: poi/branches/hemf/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestHxxFEncryption.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestHxxFEncryption.java?rev=1847069&r1=1847068&r2=1847069&view=diff
==============================================================================
--- poi/branches/hemf/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestHxxFEncryption.java (original)
+++ poi/branches/hemf/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestHxxFEncryption.java Tue Nov 20 22:24:26 2018
@@ -23,6 +23,7 @@ import static org.apache.poi.POIDataSamp
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
@@ -35,9 +36,8 @@ import java.util.Collection;
 import org.apache.poi.POIDataSamples;
 import org.apache.poi.POIDocument;
 import org.apache.poi.extractor.POITextExtractor;
-import org.apache.poi.ooxml.extractor.ExtractorFactory;
-import org.apache.poi.hslf.usermodel.HSLFSlideShowImpl;
 import org.apache.poi.hssf.record.crypto.Biff8EncryptionKey;
+import org.apache.poi.ooxml.extractor.ExtractorFactory;
 import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
 import org.apache.poi.poifs.crypt.cryptoapi.CryptoAPIEncryptionHeader;
 import org.apache.poi.poifs.storage.RawDataUtil;
@@ -64,21 +64,24 @@ public class TestHxxFEncryption {
 
     @Parameters(name="{1}")
     public static Collection<Object[]> data() throws IOException {
+        final String base64 =
+            "H4sIAAAAAAAAAF1Uu24bMRDs/RULVwkgCUhSpHaZwkDgpHJH8fZ0G/Nx4ZI6y13yG/mRfIb9R5mlZFlIpdPtcnZmdnjPf57/vvx6+f3h6obuv3"+
+            "ylbY5bEiVHe1fEpUp5pOgkrK0iabehm7FyoZi1ks8xcvHiQu8h5bLnorTlnUvkJ/YPOHKsLVInAqCs91KakuaxLq4w3g00SgCo9Xou1UnCmSBe"+
+            "MhpRY6qHmXVFteQfQJ5yUaaOw4qXwgPVjPGAqhNH5bBHAfTmwqqoSkLdFT/J3nC0eZBRk7yiu5s7yoU+r+9l3tDtm5A3jgt6AQxNOY2ya+U4sK"+
+            "XZ+YczbpfSVVuzFOuunKraqIVD2ND3yVXauT3TNthR/O3IJAM7gzTOGeIcXZvj14ahotW8wSognlMu0Yyp/Fi7O6s+CK6haUUjtPCji7MVcgqH"+
+            "jh+42tqeqPDMroJ/lBAE4AZbJbJu6Fu35ej42Tw9mYeTwVXoBKJiPeFV94q2rZJAyNEPo/qOdWYLBpq3B2JX8GDZeJ14mZf3tOQWBmpd9yQ7kI"+
+            "DCY/jmkj1oGOicFy62r9vutC5uJsVEMFgmAXXfYcC6BRBKNHCybALFJolnrDcPXNLl+K60Vctt09YZT7YgbeOICGJ/ZgC2JztOnm1JhX3eJXni"+
+            "U5Bqhezzlu334vD/Ajr3yDGXw5G9IZ6aLmLfQafY42N3J7cjj1LaXOHihSrcC5ThmuYIB5FX5AU8tKlnNG9Dn1EnsdD4KcnPhsSNPRiXtz461b"+
+            "VZw8Pm6vn0afh4fvr0D5P/+cMuBAAA";
+        final String x = new String(RawDataUtil.decompress(base64), StandardCharsets.UTF_8);
+
         return Arrays.asList(
             // binary rc4
             new Object[]{ getDocumentInstance(), "password_tika_binaryrc4.doc", "tika", "This is an encrypted Word 2007 File." },
             // cryptoapi
             new Object[]{ getDocumentInstance(), "password_password_cryptoapi.doc", "password", "This is a test" },
             // binary rc4
-            new Object[]{ getSpreadSheetInstance(), "password.xls", "password",
-                x("H4sIAAAAAAAAAF1Uu24bMRDs/RULVwkgCUhSpHaZwkDgpHJH8fZ0G/Nx4ZI6y13yG/mRfIb9R5mlZFlIpdPtcnZmdnjPf57/vvx6+f3h6obuv3"+
-                  "ylbY5bEiVHe1fEpUp5pOgkrK0iabehm7FyoZi1ks8xcvHiQu8h5bLnorTlnUvkJ/YPOHKsLVInAqCs91KakuaxLq4w3g00SgCo9Xou1UnCmSBe"+
-                  "MhpRY6qHmXVFteQfQJ5yUaaOw4qXwgPVjPGAqhNH5bBHAfTmwqqoSkLdFT/J3nC0eZBRk7yiu5s7yoU+r+9l3tDtm5A3jgt6AQxNOY2ya+U4sK"+
-                  "XZ+YczbpfSVVuzFOuunKraqIVD2ND3yVXauT3TNthR/O3IJAM7gzTOGeIcXZvj14ahotW8wSognlMu0Yyp/Fi7O6s+CK6haUUjtPCji7MVcgqH"+
-                  "jh+42tqeqPDMroJ/lBAE4AZbJbJu6Fu35ej42Tw9mYeTwVXoBKJiPeFV94q2rZJAyNEPo/qOdWYLBpq3B2JX8GDZeJ14mZf3tOQWBmpd9yQ7kI"+
-                  "DCY/jmkj1oGOicFy62r9vutC5uJsVEMFgmAXXfYcC6BRBKNHCybALFJolnrDcPXNLl+K60Vctt09YZT7YgbeOICGJ/ZgC2JztOnm1JhX3eJXni"+
-                  "U5Bqhezzlu334vD/Ajr3yDGXw5G9IZ6aLmLfQafY42N3J7cjj1LaXOHihSrcC5ThmuYIB5FX5AU8tKlnNG9Dn1EnsdD4KcnPhsSNPRiXtz461b"+
-                  "VZw8Pm6vn0afh4fvr0D5P/+cMuBAAA") },
+            new Object[]{ getSpreadSheetInstance(), "password.xls", "password", x },
             // cryptoapi
             new Object[]{ getSpreadSheetInstance(), "35897-type4.xls", "freedom", "Sheet1\nhello there!" },
             // cryptoapi (PPT only supports cryptoapi...)
@@ -86,10 +89,6 @@ public class TestHxxFEncryption {
         );
     }
 
-    private static String x(String base64) throws IOException {
-        return new String(RawDataUtil.decompress(base64), StandardCharsets.UTF_8);
-    }
-    
     @Test
     public void extract() throws IOException, OpenXML4JException, XmlException {
         File f = sampleDir.getFile(file);
@@ -112,7 +111,7 @@ public class TestHxxFEncryption {
         newPassword(null);
     }
     
-    public void newPassword(String newPass) throws IOException, OpenXML4JException, XmlException {
+    private void newPassword(String newPass) throws IOException, OpenXML4JException, XmlException {
         File f = sampleDir.getFile(file);
         Biff8EncryptionKey.setCurrentUserPassword(password);
         try (POITextExtractor te1 = ExtractorFactory.createExtractor(f)) {
@@ -156,10 +155,14 @@ public class TestHxxFEncryption {
             try (POITextExtractor te3 = ExtractorFactory.createExtractor(new ByteArrayInputStream(bos.toByteArray()));
                  POIDocument doc = (POIDocument) te3.getDocument()) {
                 // need to cache data (i.e. read all data) before changing the key size
-                if (doc instanceof HSLFSlideShowImpl) {
-                    HSLFSlideShowImpl hss = (HSLFSlideShowImpl) doc;
-                    hss.getPictureData();
-                    hss.getDocumentSummaryInformation();
+                Class<?> clazz = doc.getClass();
+                if ("HSLFSlideShowImpl".equals(clazz.getSimpleName())) {
+                    try {
+                        clazz.getDeclaredMethod("getPictureData").invoke(doc);
+                    } catch (ReflectiveOperationException e) {
+                        fail("either scratchpad jar is included and this should work or the clazz should be != HSLFSlideShowImpl");
+                    }
+                    doc.getDocumentSummaryInformation();
                 }
                 EncryptionInfo ei = doc.getEncryptionInfo();
                 assertNotNull(ei);

Modified: poi/branches/hemf/src/ooxml/testcases/org/apache/poi/sl/TestFonts.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/ooxml/testcases/org/apache/poi/sl/TestFonts.java?rev=1847069&r1=1847068&r2=1847069&view=diff
==============================================================================
--- poi/branches/hemf/src/ooxml/testcases/org/apache/poi/sl/TestFonts.java (original)
+++ poi/branches/hemf/src/ooxml/testcases/org/apache/poi/sl/TestFonts.java Tue Nov 20 22:24:26 2018
@@ -38,7 +38,6 @@ import java.util.Map;
 
 import org.apache.poi.POIDataSamples;
 import org.apache.poi.common.usermodel.fonts.FontGroup;
-import org.apache.poi.hslf.usermodel.HSLFSlideShow;
 import org.apache.poi.sl.draw.DrawFactory;
 import org.apache.poi.sl.draw.Drawable;
 import org.apache.poi.sl.usermodel.Slide;
@@ -93,9 +92,9 @@ public class TestFonts {
     }
 
     @Test
-    public void resizeToFitTextHSLF() throws IOException {
+    public void resizeToFitTextHSLF() throws IOException, ReflectiveOperationException {
         assumeFalse(xslfOnly());
-        SlideShow<?,?> ppt = new HSLFSlideShow();
+        SlideShow<?,?> ppt = (SlideShow<?,?>)Class.forName("org.apache.poi.hslf.usermodel.HSLFSlideShow").newInstance();
         resizeToFitText(ppt);
         ppt.close();
     }

Modified: poi/branches/hemf/src/ooxml/testcases/org/apache/poi/sl/TestHeadersFooters.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/ooxml/testcases/org/apache/poi/sl/TestHeadersFooters.java?rev=1847069&r1=1847068&r2=1847069&view=diff
==============================================================================
--- poi/branches/hemf/src/ooxml/testcases/org/apache/poi/sl/TestHeadersFooters.java (original)
+++ poi/branches/hemf/src/ooxml/testcases/org/apache/poi/sl/TestHeadersFooters.java Tue Nov 20 22:24:26 2018
@@ -20,19 +20,12 @@
 package org.apache.poi.sl;
 
 import static org.apache.poi.sl.SLCommonUtils.openSampleSlideshow;
-import static org.apache.poi.sl.SLCommonUtils.xslfOnly;
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
-import static org.junit.Assume.assumeFalse;
 
 import java.io.IOException;
 import java.util.List;
 
-import org.apache.poi.hslf.model.HeadersFooters;
-import org.apache.poi.hslf.usermodel.HSLFSlide;
-import org.apache.poi.hslf.usermodel.HSLFTextParagraph;
 import org.apache.poi.sl.usermodel.Shape;
 import org.apache.poi.sl.usermodel.Slide;
 import org.apache.poi.sl.usermodel.SlideShow;
@@ -42,33 +35,6 @@ import org.junit.Test;
 
 public class TestHeadersFooters {
     @Test
-    public void bug58144a() throws IOException {
-        assumeFalse(xslfOnly());
-        SlideShow<?,?> ppt = openSampleSlideshow("bug58144-headers-footers-2003.ppt");
-        HSLFSlide sl = (HSLFSlide)ppt.getSlides().get(0);
-        HeadersFooters hfs = sl.getHeadersFooters();
-        assertNull(hfs.getHeaderText());
-        assertEquals("Confidential", hfs.getFooterText());
-        List<List<HSLFTextParagraph>> llp = sl.getTextParagraphs();
-        assertEquals("Test", HSLFTextParagraph.getText(llp.get(0)));
-        assertFalse(llp.get(0).get(0).isHeaderOrFooter());
-        ppt.close();
-    }
-    
-    @Test
-    public void bug58144b() throws IOException {
-        assumeFalse(xslfOnly());
-        SlideShow<?,?> ppt = openSampleSlideshow("bug58144-headers-footers-2007.ppt");
-        Slide<?,?> sl =  ppt.getSlides().get(0);
-        HeadersFooters hfs2 = ((HSLFSlide)sl).getHeadersFooters();
-        assertNull(hfs2.getHeaderText());
-        assertEquals("Slide footer", hfs2.getFooterText());
-
-        testSlideShow(ppt);
-        ppt.close();
-    }
-    
-    @Test
     public void bug58144c() throws IOException {
         SlideShow<?,?> ppt = openSampleSlideshow("bug58144-headers-footers-2007.pptx");
         testSlideShow(ppt);



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