poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kiwiwi...@apache.org
Subject svn commit: r1845617 [1/5] - in /poi/branches/hemf: ./ jenkins/ maven/ sonar/ src/examples/src/org/apache/poi/hssf/usermodel/examples/ src/examples/src/org/apache/poi/ss/examples/ src/examples/src/org/apache/poi/xssf/usermodel/examples/ src/java/org/ap...
Date Fri, 02 Nov 2018 18:35:35 GMT
Author: kiwiwings
Date: Fri Nov  2 18:35:34 2018
New Revision: 1845617

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

Added:
    poi/branches/hemf/src/java/org/apache/poi/ss/formula/functions/Frequency.java
      - copied unchanged from r1845612, poi/trunk/src/java/org/apache/poi/ss/formula/functions/Frequency.java
    poi/branches/hemf/src/java/org/apache/poi/ss/formula/functions/Trend.java
      - copied unchanged from r1845612, poi/trunk/src/java/org/apache/poi/ss/formula/functions/Trend.java
    poi/branches/hemf/src/testcases/org/apache/poi/ss/formula/functions/TestFrequency.java
      - copied unchanged from r1845612, poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestFrequency.java
    poi/branches/hemf/src/testcases/org/apache/poi/ss/formula/functions/TestTrendFunctionsFromSpreadsheet.java
      - copied unchanged from r1845612, poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestTrendFunctionsFromSpreadsheet.java
    poi/branches/hemf/test-data/document/60316.dotx
      - copied unchanged from r1845612, poi/trunk/test-data/document/60316.dotx
    poi/branches/hemf/test-data/document/Bug62859.docx
      - copied unchanged from r1845612, poi/trunk/test-data/document/Bug62859.docx
    poi/branches/hemf/test-data/spreadsheet/62624.bin
      - copied unchanged from r1845612, poi/trunk/test-data/spreadsheet/62624.bin
    poi/branches/hemf/test-data/spreadsheet/62625.bin
      - copied unchanged from r1845612, poi/trunk/test-data/spreadsheet/62625.bin
    poi/branches/hemf/test-data/spreadsheet/62815.xlsb
      - copied unchanged from r1845612, poi/trunk/test-data/spreadsheet/62815.xlsb
    poi/branches/hemf/test-data/spreadsheet/62815.xlsb.txt
      - copied unchanged from r1845612, poi/trunk/test-data/spreadsheet/62815.xlsb.txt
    poi/branches/hemf/test-data/spreadsheet/62834.xlsx
      - copied unchanged from r1845612, poi/trunk/test-data/spreadsheet/62834.xlsx
    poi/branches/hemf/test-data/spreadsheet/Trend.xls
      - copied unchanged from r1845612, poi/trunk/test-data/spreadsheet/Trend.xls
Modified:
    poi/branches/hemf/   (props changed)
    poi/branches/hemf/.classpath
    poi/branches/hemf/.gitignore
    poi/branches/hemf/build.gradle
    poi/branches/hemf/build.xml
    poi/branches/hemf/jenkins/create_jobs.groovy
    poi/branches/hemf/maven/poi-ooxml-schemas.pom
    poi/branches/hemf/sonar/pom.xml
    poi/branches/hemf/src/examples/src/org/apache/poi/hssf/usermodel/examples/AddDimensionedImage.java
    poi/branches/hemf/src/examples/src/org/apache/poi/hssf/usermodel/examples/CellComments.java
    poi/branches/hemf/src/examples/src/org/apache/poi/ss/examples/AddDimensionedImage.java
    poi/branches/hemf/src/examples/src/org/apache/poi/xssf/usermodel/examples/NewLinesInCells.java
    poi/branches/hemf/src/java/org/apache/poi/POIDocument.java
    poi/branches/hemf/src/java/org/apache/poi/common/usermodel/fonts/FontFamily.java
    poi/branches/hemf/src/java/org/apache/poi/common/usermodel/fonts/FontPitch.java
    poi/branches/hemf/src/java/org/apache/poi/extractor/OLE2ExtractorFactory.java
    poi/branches/hemf/src/java/org/apache/poi/hpsf/Property.java
    poi/branches/hemf/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbookFactory.java
    poi/branches/hemf/src/java/org/apache/poi/poifs/macros/VBAMacroReader.java
    poi/branches/hemf/src/java/org/apache/poi/ss/format/CellDateFormatter.java
    poi/branches/hemf/src/java/org/apache/poi/ss/format/CellTextFormatter.java
    poi/branches/hemf/src/java/org/apache/poi/ss/formula/BaseFormulaEvaluator.java
    poi/branches/hemf/src/java/org/apache/poi/ss/formula/eval/FunctionEval.java
    poi/branches/hemf/src/java/org/apache/poi/ss/formula/ptg/RefPtgBase.java
    poi/branches/hemf/src/java/org/apache/poi/ss/usermodel/Sheet.java
    poi/branches/hemf/src/java/org/apache/poi/ss/usermodel/WorkbookFactory.java
    poi/branches/hemf/src/java/org/apache/poi/ss/util/CellReference.java
    poi/branches/hemf/src/java/org/apache/poi/ss/util/CellUtil.java
    poi/branches/hemf/src/java/org/apache/poi/util/IOUtils.java
    poi/branches/hemf/src/ooxml/java/org/apache/poi/ooxml/POIXMLDocumentPart.java
    poi/branches/hemf/src/ooxml/java/org/apache/poi/openxml4j/exceptions/InvalidFormatException.java
    poi/branches/hemf/src/ooxml/java/org/apache/poi/openxml4j/opc/OPCPackage.java
    poi/branches/hemf/src/ooxml/java/org/apache/poi/poifs/crypt/dsig/SignatureConfig.java
    poi/branches/hemf/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFShape.java
    poi/branches/hemf/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFText.java
    poi/branches/hemf/src/ooxml/java/org/apache/poi/xdgf/util/HierarchyPrinter.java
    poi/branches/hemf/src/ooxml/java/org/apache/poi/xdgf/util/VsdxToPng.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/XSLFColor.java
    poi/branches/hemf/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFNotes.java
    poi/branches/hemf/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFShape.java
    poi/branches/hemf/src/ooxml/java/org/apache/poi/xslf/util/PPTX2PNG.java
    poi/branches/hemf/src/ooxml/java/org/apache/poi/xssf/binary/XSSFBSheetHandler.java
    poi/branches/hemf/src/ooxml/java/org/apache/poi/xssf/binary/XSSFBUtils.java
    poi/branches/hemf/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFRow.java
    poi/branches/hemf/src/ooxml/java/org/apache/poi/xssf/usermodel/BaseXSSFFormulaEvaluator.java
    poi/branches/hemf/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java
    poi/branches/hemf/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFDrawing.java
    poi/branches/hemf/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRow.java
    poi/branches/hemf/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java
    poi/branches/hemf/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbookFactory.java
    poi/branches/hemf/src/ooxml/java/org/apache/poi/xssf/usermodel/helpers/ColumnHelper.java
    poi/branches/hemf/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFSDTContent.java
    poi/branches/hemf/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTable.java
    poi/branches/hemf/src/ooxml/testcases/org/apache/poi/ooxml/util/OOXMLLite.java
    poi/branches/hemf/src/ooxml/testcases/org/apache/poi/openxml4j/opc/ZipFileAssert.java
    poi/branches/hemf/src/ooxml/testcases/org/apache/poi/openxml4j/opc/compliance/TestOPCComplianceCoreProperties.java
    poi/branches/hemf/src/ooxml/testcases/org/apache/poi/sl/TestFonts.java
    poi/branches/hemf/src/ooxml/testcases/org/apache/poi/ss/TestWorkbookFactory.java
    poi/branches/hemf/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextParagraph.java
    poi/branches/hemf/src/ooxml/testcases/org/apache/poi/xssf/XSSFTestDataSamples.java
    poi/branches/hemf/src/ooxml/testcases/org/apache/poi/xssf/extractor/TestXSSFBEventBasedExcelExtractor.java
    poi/branches/hemf/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFWorkbook.java
    poi/branches/hemf/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java
    poi/branches/hemf/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFColGrouping.java
    poi/branches/hemf/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFDataValidation.java
    poi/branches/hemf/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFFormulaEvaluation.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/TestXSSFWorkbook.java
    poi/branches/hemf/src/ooxml/testcases/org/apache/poi/xssf/usermodel/charts/TestXSSFChartTitle.java
    poi/branches/hemf/src/ooxml/testcases/org/apache/poi/xssf/usermodel/helpers/TestColumnHelper.java
    poi/branches/hemf/src/ooxml/testcases/org/apache/poi/xssf/util/MemoryUsage.java
    poi/branches/hemf/src/ooxml/testcases/org/apache/poi/xwpf/extractor/TestXWPFWordExtractor.java
    poi/branches/hemf/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFSDT.java
    poi/branches/hemf/src/scratchpad/src/org/apache/poi/hwpf/dev/HWPFLister.java
    poi/branches/hemf/src/scratchpad/src/org/apache/poi/hwpf/model/FibBase.java
    poi/branches/hemf/src/testcases/org/apache/poi/poifs/macros/TestVBAMacroReader.java
    poi/branches/hemf/src/testcases/org/apache/poi/ss/formula/functions/AllSpreadsheetBasedTests.java
    poi/branches/hemf/src/testcases/org/apache/poi/ss/util/TestDateFormatConverter.java

Propchange: poi/branches/hemf/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Nov  2 18:35:34 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-1843354
+/poi/trunk:693591-694881,695264-695420,695621,695649-711764,1839877-1840323,1840325-1843031,1843033-1845612

Modified: poi/branches/hemf/.classpath
URL: http://svn.apache.org/viewvc/poi/branches/hemf/.classpath?rev=1845617&r1=1845616&r2=1845617&view=diff
==============================================================================
--- poi/branches/hemf/.classpath (original)
+++ poi/branches/hemf/.classpath Fri Nov  2 18:35:34 2018
@@ -18,7 +18,7 @@
 	<classpathentry kind="lib" path="lib/ant-1.10.1.jar"/>
 	<classpathentry kind="lib" path="lib/ant-launcher-1.10.1.jar"/>
 	<classpathentry kind="lib" path="lib/log4j-1.2.17.jar"/>
-	<classpathentry exported="true" kind="lib" path="ooxml-lib/xmlbeans-3.0.1.jar" sourcepath="ooxml-lib/xmlbeans-3.0.1.jar"/>
+	<classpathentry exported="true" kind="lib" path="ooxml-lib/xmlbeans-3.0.2.jar" sourcepath="ooxml-lib/xmlbeans-3.0.2.jar"/>
 	<classpathentry kind="lib" path="lib/hamcrest-core-1.3.jar"/>
 	<classpathentry kind="lib" path="lib/junit-4.12.jar"/>
 	<classpathentry kind="lib" path="ooxml-lib/curvesapi-1.05.jar"/>
@@ -30,13 +30,16 @@
 	<classpathentry exported="true" kind="lib" path="compile-lib/slf4j-api-1.7.25.jar"/>
 	<classpathentry kind="lib" path="compile-lib/bcpkix-jdk15on-1.60.jar"/>
 	<classpathentry kind="lib" path="compile-lib/bcprov-ext-jdk15on-1.60.jar"/>
+	<classpathentry kind="lib" path="ooxml-testlib/reflections.jar"/>
+	<classpathentry kind="lib" path="ooxml-testlib/guava.jar"/>
+	<classpathentry kind="lib" path="ooxml-testlib/javassist.jar"/>
 	<classpathentry exported="true" kind="lib" path="compile-lib/xmlsec-2.1.0.jar"/>
 	<classpathentry exported="true" kind="lib" path="lib/commons-codec-1.11.jar"/>
 	<classpathentry exported="true" kind="lib" path="lib/commons-logging-1.2.jar"/>
 	<classpathentry exported="true" kind="lib" path="lib/commons-collections4-4.2.jar"/>
 	<classpathentry kind="lib" path="lib/commons-math3-3.6.1.jar"/>
 	<classpathentry kind="lib" path="lib/xmlunit-core-2.5.1.jar"/>
-	<classpathentry kind="lib" path="lib/mockito-core-2.13.0.jar"/>
+	<classpathentry kind="lib" path="lib/mockito-core-2.21.0.jar"/>
 	<classpathentry kind="lib" path="lib/byte-buddy-1.7.9.jar"/>
 	<classpathentry kind="lib" path="lib/byte-buddy-agent-1.7.9.jar"/>
 	<classpathentry kind="lib" path="lib/objenesis-2.6.jar"/>

Modified: poi/branches/hemf/.gitignore
URL: http://svn.apache.org/viewvc/poi/branches/hemf/.gitignore?rev=1845617&r1=1845616&r2=1845617&view=diff
==============================================================================
--- poi/branches/hemf/.gitignore (original)
+++ poi/branches/hemf/.gitignore Fri Nov  2 18:35:34 2018
@@ -11,6 +11,7 @@ log*.*
 forrest.properties
 compile-lib/
 ooxml-lib/
+ooxml-testlib/
 
 # Eclipse
 /bin

Modified: poi/branches/hemf/build.gradle
URL: http://svn.apache.org/viewvc/poi/branches/hemf/build.gradle?rev=1845617&r1=1845616&r2=1845617&view=diff
==============================================================================
--- poi/branches/hemf/build.gradle (original)
+++ poi/branches/hemf/build.gradle Fri Nov  2 18:35:34 2018
@@ -225,7 +225,7 @@ project('ooxml') {
     compileJava.dependsOn 'ant-compile-ooxml-xsds'
 
     dependencies {
-        compile 'org.apache.xmlbeans:xmlbeans:3.0.1'
+        compile 'org.apache.xmlbeans:xmlbeans:3.0.2'
         compile 'org.apache.commons:commons-collections4:4.2'
         compile 'org.apache.commons:commons-math3:3.6.1'
         compile 'org.apache.commons:commons-compress:1.18'

Modified: poi/branches/hemf/build.xml
URL: http://svn.apache.org/viewvc/poi/branches/hemf/build.xml?rev=1845617&r1=1845616&r2=1845617&view=diff
==============================================================================
--- poi/branches/hemf/build.xml (original)
+++ poi/branches/hemf/build.xml Fri Nov  2 18:35:34 2018
@@ -213,9 +213,9 @@ under the License.
     <property name="ooxml.curvesapi.jar" location="${ooxml.lib}/curvesapi-1.05.jar"/>
     <property name="ooxml.curvesapi.url"
               value="${repository.m2}/maven2/com/github/virtuald/curvesapi/1.05/curvesapi-1.05.jar"/>
-    <property name="ooxml.xmlbeans.jar" location="${ooxml.lib}/xmlbeans-3.0.1.jar"/>
+    <property name="ooxml.xmlbeans.jar" location="${ooxml.lib}/xmlbeans-3.0.2.jar"/>
     <property name="ooxml.xmlbeans.url"
-              value="https://repository.apache.org/content/repositories/releases/org/apache/xmlbeans/xmlbeans/3.0.1/xmlbeans-3.0.1.jar"/>
+              value="https://repository.apache.org/content/repositories/releases/org/apache/xmlbeans/xmlbeans/3.0.2/xmlbeans-3.0.2.jar"/>
     <property name="ooxml.commons-compress.jar" location="${main.lib}/commons-compress-1.18.jar"/>
     <property name="ooxml.commons-compress.url"
               value="${repository.m2}/maven2/org/apache/commons/commons-compress/1.18/commons-compress-1.18.jar"/>
@@ -289,7 +289,7 @@ under the License.
     <!-- build and distro settings -->
     <property name="jar.name" value="poi"/>
     <property name="build.site" location="build/site"/>
-    <property name="javadocs.report.dir" location="${build.site}/apidocs"/>
+    <property name="javadocs.report.dir" location="${build.site}/apidocs/dev"/>
     <property name="dist.dir" location="build/dist"/>
     <property name="halt.on.test.failure" value="true"/>
 
@@ -671,6 +671,7 @@ under the License.
                 <include name="curvesapi-1.04.jar"/>
                 <include name="xmlbeans-2.*.jar"/>
                 <include name="xmlbeans-3.0.0.jar"/>
+                <include name="xmlbeans-3.0.1.jar"/>
             </fileset>
             <fileset dir="${compile.lib}">
                 <include name="xercesImpl-*.jar"/>
@@ -1798,9 +1799,11 @@ under the License.
         <fail message="Apache Forrest is not installed."/>
     </target>
 
-    <target name="docs" depends="init, -check-forrest-installed, -check-docs, javadocs"
-            unless="main.docs.notRequired" description="Builds the POI website">
-
+    <target name="docs" depends="init, -check-forrest-installed, -check-docs, javadocs, -forrest-docs"
+            unless="main.docs.notRequired" 
+            description="Builds the POI website" />
+    <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"/>
         <exec executable="cmd" osfamily="windows">
             <arg value="/c"/>
@@ -1817,9 +1820,10 @@ under the License.
         </touch>
     </target>
 
-    <!-- Generates the API documentation. -->
+    <!-- Generates the latest/development API documentation. -->
     <target name="javadocs"
             description="Generates the API documentation">
+        <echo message="Generating latest Javadocs in ${javadocs.report.dir}"/>
         <javadoc verbose="false" author="true" destdir="${javadocs.report.dir}"
                  windowtitle="POI API Documentation" use="true" version="true"
                  maxmemory="384M" additionalparam="-notimestamp" locale="en_US"
@@ -2035,7 +2039,7 @@ under the License.
                 <packageset dir="@{src}" defaultexcludes="yes">
                     <include name="org/apache/poi/**"/>
                 </packageset>
-                <link offline="true" href="https://poi.apache.org/apidocs" packagelistLoc="${javadocs.report.dir}"/>
+                <link offline="true" href="https://poi.apache.org/apidocs/dev" packagelistLoc="${javadocs.report.dir}"/>
             </javadoc>
             <jar destfile="${dist.dir}/maven/@{dest}/@{dest}-${version.id}-javadoc.jar"
                  manifest="build/poi-manifest.mf">

Modified: poi/branches/hemf/jenkins/create_jobs.groovy
URL: http://svn.apache.org/viewvc/poi/branches/hemf/jenkins/create_jobs.groovy?rev=1845617&r1=1845616&r2=1845617&view=diff
==============================================================================
--- poi/branches/hemf/jenkins/create_jobs.groovy (original)
+++ poi/branches/hemf/jenkins/create_jobs.groovy Fri Nov  2 18:35:34 2018
@@ -610,7 +610,24 @@ dashboardView("P/POI-new") {
         //lastSuccessDescription()
         jacoco()
     }
-    description("Jobs related to building/testing Apache POI")
+    description("<table>\n" +
+            "  <tr>\n" +
+            "    <td><img src=\"https://poi.apache.org/images/project-header.png\" /></td>\n" +
+            "    <td>  \n" +
+            "      <p>Apache POI - the Java API for Microsoft Documents</p>\n" +
+            "      <p><b>Most of the POI Jobs are automatically generated by Jenkins Job DSL\n" +
+            "        at <a href=\"https://svn.apache.org/repos/asf/poi/trunk/jenkins\">https://svn.apache.org/repos/asf/poi/trunk/jenkins</a>,<br/>\n" +
+            "        see <a href=\"https://github.com/jenkinsci/job-dsl-plugin/wiki\">https://github.com/jenkinsci/job-dsl-plugin/wiki</a>\n" +
+            "        for more details about the DSL.</b>\n" +
+            "      </p>\n" +
+            "      <p>\n" +
+            "      <b><a href=\"job/POI-DSL-1.8/lastSuccessfulBuild/findbugsResult/\" target=\"_blank\">Findbugs report of latest build</a></b> -\n" +
+            "      <b><a href=\"https://builds.apache.org/analysis/dashboard?id=org.apache.poi%3Apoi-parent&did=1\" target=\"_blank\">Sonar reports</a></b> -\n" +
+            "      <b><a href=\"job/POI-DSL-1.8/lastSuccessfulBuild/artifact/build/coverage/index.html\" target=\"_blank\">Coverage of latest build</a></b>\n" +
+            "      </p>\n" +
+            "    </td>\n" +
+            "  </tr>\n" +
+            "</table>")
     filterBuildQueue(false)
     filterExecutors(false)
 

Modified: poi/branches/hemf/maven/poi-ooxml-schemas.pom
URL: http://svn.apache.org/viewvc/poi/branches/hemf/maven/poi-ooxml-schemas.pom?rev=1845617&r1=1845616&r2=1845617&view=diff
==============================================================================
--- poi/branches/hemf/maven/poi-ooxml-schemas.pom (original)
+++ poi/branches/hemf/maven/poi-ooxml-schemas.pom Fri Nov  2 18:35:34 2018
@@ -62,7 +62,7 @@
     <dependency>
       <groupId>org.apache.xmlbeans</groupId>
       <artifactId>xmlbeans</artifactId>
-      <version>3.0.1</version>
+      <version>3.0.2</version>
     </dependency>
   </dependencies>
 </project>

Modified: poi/branches/hemf/sonar/pom.xml
URL: http://svn.apache.org/viewvc/poi/branches/hemf/sonar/pom.xml?rev=1845617&r1=1845616&r2=1845617&view=diff
==============================================================================
--- poi/branches/hemf/sonar/pom.xml (original)
+++ poi/branches/hemf/sonar/pom.xml Fri Nov  2 18:35:34 2018
@@ -72,7 +72,7 @@
         <sonar.scm.disabled>true</sonar.scm.disabled>
 
         <!-- define some of the third-party or plugin-versions globally to use the same in all modules -->
-        <xmlbeans.version>3.0.1</xmlbeans.version>
+        <xmlbeans.version>3.0.2</xmlbeans.version>
         <junit.version>4.12</junit.version>
         <xmlunit.version>2.5.1</xmlunit.version>
         <mockito.version>2.13.0</mockito.version>

Modified: poi/branches/hemf/src/examples/src/org/apache/poi/hssf/usermodel/examples/AddDimensionedImage.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/examples/src/org/apache/poi/hssf/usermodel/examples/AddDimensionedImage.java?rev=1845617&r1=1845616&r2=1845617&view=diff
==============================================================================
--- poi/branches/hemf/src/examples/src/org/apache/poi/hssf/usermodel/examples/AddDimensionedImage.java (original)
+++ poi/branches/hemf/src/examples/src/org/apache/poi/hssf/usermodel/examples/AddDimensionedImage.java Fri Nov  2 18:35:34 2018
@@ -142,13 +142,13 @@ import org.apache.poi.ss.usermodel.Clien
 public class AddDimensionedImage {
 
     // Four constants that determine how - and indeed whether - the rows
-    // and columns an image may overlie should be expanded to accomodate that
+    // and columns an image may overlie should be expanded to accommodate that
     // image.
     // Passing EXPAND_ROW will result in the height of a row being increased
-    // to accomodate the image if it is not already larger. The image will
+    // to accommodate the image if it is not already larger. The image will
     // be layed across one or more columns.
     // Passing EXPAND_COLUMN will result in the width of the column being
-    // increased to accomodate the image if it is not already larger. The image
+    // increased to accommodate the image if it is not already larger. The image
     // will be layed across one or many rows.
     // Passing EXPAND_ROW_AND_COLUMN will result in the height of the row
     // bing increased along with the width of the column to accomdate the
@@ -266,7 +266,7 @@ public class AddDimensionedImage {
         }
 
         // Call methods to calculate how the image and sheet should be
-        // manipulated to accomodate the image; columns and then rows.
+        // manipulated to accommodate the image; columns and then rows.
         colClientAnchorDetail = this.fitImageToColumns(sheet, colNumber,
                 reqImageWidthMM, resizeBehaviour);
         rowClientAnchorDetail = this.fitImageToRows(sheet, rowNumber,
@@ -312,7 +312,7 @@ public class AddDimensionedImage {
     }
 
     /**
-     * Determines whether the sheets columns should be re-sized to accomodate
+     * Determines whether the sheets columns should be re-sized to accommodate
      * the image, adjusts the columns width if necessary and creates then
      * returns a ClientAnchorDetail object that facilitates construction of
      * an HSSFClientAnchor that will fix the image on the sheet and establish
@@ -348,7 +348,7 @@ public class AddDimensionedImage {
         colWidthMM = ConvertImageUnits.widthUnits2Millimetres(
                 (short)sheet.getColumnWidth(colNumber));
 
-        // Check that the column's width will accomodate the image at the
+        // Check that the column's width will accommodate the image at the
         // required dimension. If the width of the column is LESS than the
         // required width of the image, decide how the application should
         // respond - resize the column or overlay the image across one or more
@@ -396,7 +396,7 @@ public class AddDimensionedImage {
     }
 
     /**
-     * Determines whether the sheet's row should be re-sized to accomodate
+     * Determines whether the sheet's row should be re-sized to accommodate
      * the image, adjusts the rows height if necessary and creates then
      * returns a ClientAnchorDetail object that facilitates construction of
      * an HSSFClientAnchor that will fix the image on the sheet and establish
@@ -436,7 +436,7 @@ public class AddDimensionedImage {
         // Get the row's height in millimetres
         double rowHeightMM = row.getHeightInPoints() / ConvertImageUnits.POINTS_PER_MILLIMETRE;
 
-        // Check that the row's height will accomodate the image at the required
+        // Check that the row's height will accommodate the image at the required
         // dimensions. If the height of the row is LESS than the required height
         // of the image, decide how the application should respond - resize the
         // row or overlay the image across a series of rows.

Modified: poi/branches/hemf/src/examples/src/org/apache/poi/hssf/usermodel/examples/CellComments.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/examples/src/org/apache/poi/hssf/usermodel/examples/CellComments.java?rev=1845617&r1=1845616&r2=1845617&view=diff
==============================================================================
--- poi/branches/hemf/src/examples/src/org/apache/poi/hssf/usermodel/examples/CellComments.java (original)
+++ poi/branches/hemf/src/examples/src/org/apache/poi/hssf/usermodel/examples/CellComments.java Fri Nov  2 18:35:34 2018
@@ -17,18 +17,22 @@
 
 package org.apache.poi.hssf.usermodel.examples;
 
-import java.io.FileOutputStream;
-import java.io.IOException;
-
-import org.apache.poi.hssf.usermodel.HSSFCell;
-import org.apache.poi.hssf.usermodel.HSSFClientAnchor;
 import org.apache.poi.hssf.usermodel.HSSFComment;
-import org.apache.poi.hssf.usermodel.HSSFFont;
-import org.apache.poi.hssf.usermodel.HSSFPatriarch;
-import org.apache.poi.hssf.usermodel.HSSFRichTextString;
-import org.apache.poi.hssf.usermodel.HSSFSheet;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
-import org.apache.poi.hssf.util.HSSFColor.HSSFColorPredefined;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.ClientAnchor;
+import org.apache.poi.ss.usermodel.Comment;
+import org.apache.poi.ss.usermodel.CreationHelper;
+import org.apache.poi.ss.usermodel.Drawing;
+import org.apache.poi.ss.usermodel.Font;
+import org.apache.poi.ss.usermodel.IndexedColors;
+import org.apache.poi.ss.usermodel.RichTextString;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.ss.usermodel.WorkbookFactory;
+
+import java.io.FileOutputStream;
+import java.io.IOException;
 
 /**
  * Demonstrates how to work with excel cell comments.<p>
@@ -39,46 +43,64 @@ import org.apache.poi.hssf.util.HSSFColo
 public class CellComments {
 
     public static void main(String[] args) throws IOException  {
-        try (HSSFWorkbook wb = new HSSFWorkbook()) {
-            HSSFSheet sheet = wb.createSheet("Cell comments in POI HSSF");
+        createWorkbook(false, ".xls");
+        createWorkbook(true, ".xlsx");
+    }
+
+    private static void createWorkbook(boolean xssf, String extension) throws IOException {
+        try (Workbook wb = WorkbookFactory.create(xssf)) {
+            Sheet sheet = wb.createSheet("Cell comments in POI " + extension);
+            CreationHelper creationHelper = wb.getCreationHelper();
 
             // Create the drawing patriarch. This is the top level container for all shapes including cell comments.
-            HSSFPatriarch patr = sheet.createDrawingPatriarch();
+            Drawing<?> patr = sheet.createDrawingPatriarch();
 
             //create a cell in row 3
-            HSSFCell cell1 = sheet.createRow(3).createCell(1);
-            cell1.setCellValue(new HSSFRichTextString("Hello, World"));
+            Cell cell1 = sheet.createRow(3).createCell(1);
+            cell1.setCellValue(creationHelper.createRichTextString("Hello, World"));
 
             //anchor defines size and position of the comment in worksheet
-            HSSFComment comment1 = patr.createComment(new HSSFClientAnchor(0, 0, 0, 0, (short) 4, 2, (short) 6, 5));
+            ClientAnchor clientAnchor = creationHelper.createClientAnchor();
+            clientAnchor.setCol1(4);
+            clientAnchor.setRow1(2);
+            clientAnchor.setCol2(6);
+            clientAnchor.setRow2(5);
+            Comment comment1 = patr.createCellComment(clientAnchor);
 
             // set text in the comment
-            comment1.setString(new HSSFRichTextString("We can set comments in POI"));
+            comment1.setString(creationHelper.createRichTextString("We can set comments in POI"));
 
             //set comment author.
             //you can see it in the status bar when moving mouse over the commented cell
             comment1.setAuthor("Apache Software Foundation");
 
-            // The first way to assign comment to a cell is via HSSFCell.setCellComment method
+            // The first way to assign comment to a cell is via Cell.setCellComment method
             cell1.setCellComment(comment1);
 
             //create another cell in row 6
-            HSSFCell cell2 = sheet.createRow(6).createCell(1);
+            Cell cell2 = sheet.createRow(6).createCell(1);
             cell2.setCellValue(36.6);
 
 
-            HSSFComment comment2 = patr.createComment(new HSSFClientAnchor(0, 0, 0, 0, (short) 4, 8, (short) 6, 11));
-            //modify background color of the comment
-            comment2.setFillColor(204, 236, 255);
+            clientAnchor = creationHelper.createClientAnchor();
+            clientAnchor.setCol1(4);
+            clientAnchor.setRow1(8);
+            clientAnchor.setCol2(6);
+            clientAnchor.setRow2(11);
+            Comment comment2 = patr.createCellComment(clientAnchor);
+            //modify background color of the comment, only available in HSSF currently
+            if (wb instanceof HSSFWorkbook) {
+                ((HSSFComment) comment2).setFillColor(204, 236, 255);
+            }
 
-            HSSFRichTextString string = new HSSFRichTextString("Normal body temperature");
+            RichTextString string = creationHelper.createRichTextString("Normal body temperature");
 
             //apply custom font to the text in the comment
-            HSSFFont font = wb.createFont();
+            Font font = wb.createFont();
             font.setFontName("Arial");
             font.setFontHeightInPoints((short) 10);
             font.setBold(true);
-            font.setColor(HSSFColorPredefined.RED.getIndex());
+            font.setColor(IndexedColors.RED.getIndex());
             string.applyFont(font);
 
             comment2.setString(string);
@@ -94,7 +116,7 @@ public class CellComments {
             comment2.setRow(6);
             comment2.setColumn(1);
 
-            try (FileOutputStream out = new FileOutputStream("poi_comment.xls")) {
+            try (FileOutputStream out = new FileOutputStream("poi_comment" + extension)) {
                 wb.write(out);
             }
         }

Modified: poi/branches/hemf/src/examples/src/org/apache/poi/ss/examples/AddDimensionedImage.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/examples/src/org/apache/poi/ss/examples/AddDimensionedImage.java?rev=1845617&r1=1845616&r2=1845617&view=diff
==============================================================================
--- poi/branches/hemf/src/examples/src/org/apache/poi/ss/examples/AddDimensionedImage.java (original)
+++ poi/branches/hemf/src/examples/src/org/apache/poi/ss/examples/AddDimensionedImage.java Fri Nov  2 18:35:34 2018
@@ -202,13 +202,13 @@ import org.apache.poi.util.IOUtils;
 public class AddDimensionedImage {
 
     // Four constants that determine how - and indeed whether - the rows
-    // and columns an image may overlie should be expanded to accomodate that
+    // and columns an image may overlie should be expanded to accommodate that
     // image.
     // Passing EXPAND_ROW will result in the height of a row being increased
-    // to accomodate the image if it is not already larger. The image will
+    // to accommodate the image if it is not already larger. The image will
     // be layed across one or more columns.
     // Passing EXPAND_COLUMN will result in the width of the column being
-    // increased to accomodate the image if it is not already larger. The image
+    // increased to accommodate the image if it is not already larger. The image
     // will be layed across one or many rows.
     // Passing EXPAND_ROW_AND_COLUMN will result in the height of the row
     // bing increased along with the width of the column to accomdate the
@@ -348,7 +348,7 @@ public class AddDimensionedImage {
         }
 
         // Call methods to calculate how the image and sheet should be
-        // manipulated to accomodate the image; columns and then rows.
+        // manipulated to accommodate the image; columns and then rows.
         colClientAnchorDetail = this.fitImageToColumns(sheet, colNumber,
                 reqImageWidthMM, resizeBehaviour);
         rowClientAnchorDetail = this.fitImageToRows(sheet, rowNumber,
@@ -440,7 +440,7 @@ public class AddDimensionedImage {
         colWidthMM = ConvertImageUnits.widthUnits2Millimetres(
                 (short)sheet.getColumnWidth(colNumber));
 
-        // Check that the column's width will accomodate the image at the
+        // Check that the column's width will accommodate the image at the
         // required dimension. If the width of the column is LESS than the
         // required width of the image, decide how the application should
         // respond - resize the column or overlay the image across one or more
@@ -500,7 +500,7 @@ public class AddDimensionedImage {
     }
 
     /**
-     * Determines whether the sheets row should be re-sized to accomodate
+     * Determines whether the sheets row should be re-sized to accommodate
      * the image, adjusts the rows height if necessary and creates then
      * returns a ClientAnchorDetail object that facilitates construction of
      * a ClientAnchor that will fix the image on the sheet and establish
@@ -542,7 +542,7 @@ public class AddDimensionedImage {
         // Get the row's height in millimetres
         rowHeightMM = row.getHeightInPoints() / ConvertImageUnits.POINTS_PER_MILLIMETRE;
 
-        // Check that the row's height will accomodate the image at the required
+        // Check that the row's height will accommodate the image at the required
         // dimensions. If the height of the row is LESS than the required height
         // of the image, decide how the application should respond - resize the
         // row or overlay the image across a series of rows.

Modified: poi/branches/hemf/src/examples/src/org/apache/poi/xssf/usermodel/examples/NewLinesInCells.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/examples/src/org/apache/poi/xssf/usermodel/examples/NewLinesInCells.java?rev=1845617&r1=1845616&r2=1845617&view=diff
==============================================================================
--- poi/branches/hemf/src/examples/src/org/apache/poi/xssf/usermodel/examples/NewLinesInCells.java (original)
+++ poi/branches/hemf/src/examples/src/org/apache/poi/xssf/usermodel/examples/NewLinesInCells.java Fri Nov  2 18:35:34 2018
@@ -44,8 +44,8 @@ public class NewLinesInCells {
             cs.setWrapText(true);
             cell.setCellStyle(cs);
 
-            //increase row height to accomodate two lines of text
-            row.setHeightInPoints((2 * sheet.getDefaultRowHeightInPoints()));
+            //increase row height to accommodate two lines of text
+            row.setHeightInPoints(2 * sheet.getDefaultRowHeightInPoints());
 
             //adjust column width to fit the content
             sheet.autoSizeColumn(2);
@@ -55,5 +55,4 @@ public class NewLinesInCells {
             }
         }
     }
-
 }

Modified: poi/branches/hemf/src/java/org/apache/poi/POIDocument.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/java/org/apache/poi/POIDocument.java?rev=1845617&r1=1845616&r2=1845617&view=diff
==============================================================================
--- poi/branches/hemf/src/java/org/apache/poi/POIDocument.java (original)
+++ poi/branches/hemf/src/java/org/apache/poi/POIDocument.java Fri Nov  2 18:35:34 2018
@@ -33,6 +33,7 @@ import org.apache.poi.hpsf.DocumentSumma
 import org.apache.poi.hpsf.PropertySet;
 import org.apache.poi.hpsf.PropertySetFactory;
 import org.apache.poi.hpsf.SummaryInformation;
+import org.apache.poi.hpsf.WritingNotSupportedException;
 import org.apache.poi.poifs.crypt.EncryptionInfo;
 import org.apache.poi.poifs.crypt.Encryptor;
 import org.apache.poi.poifs.crypt.cryptoapi.CryptoAPIDecryptor;
@@ -176,6 +177,8 @@ public abstract class POIDocument implem
      *  
      *  @param setName The property to read
      *  @return The value of the given property or null if it wasn't found.
+     *
+     * @throws IOException If retrieving properties fails
      */
     @SuppressWarnings("WeakerAccess")
     protected PropertySet getPropertySet(String setName) throws IOException {
@@ -189,6 +192,8 @@ public abstract class POIDocument implem
      *  @param setName The property to read
      *  @param encryptionInfo the encryption descriptor in case of cryptoAPI encryption
      *  @return The value of the given property or null if it wasn't found.
+     *
+     * @throws IOException If retrieving properties fails
      */
     @SuppressWarnings("WeakerAccess")
     protected PropertySet getPropertySet(String setName, EncryptionInfo encryptionInfo) throws IOException {
@@ -305,7 +310,8 @@ public abstract class POIDocument implem
     }
 	
     /**
-     * Writes out a given ProperySet
+     * Writes out a given PropertySet
+     *
      * @param name the (POIFS Level) name of the property to write
      * @param set the PropertySet to write out 
      * @param outFS the NPOIFSFileSystem to write the property into
@@ -326,7 +332,7 @@ public abstract class POIDocument implem
             outFS.createOrUpdateDocument(bIn, name);
 
             logger.log(POILogger.INFO, "Wrote property set " + name + " of size " + data.length);
-        } catch(org.apache.poi.hpsf.WritingNotSupportedException wnse) {
+        } catch(WritingNotSupportedException ignored) {
             logger.log( POILogger.ERROR, "Couldn't write property set with name " + name + " as not supported by HPSF yet");
         }
     }
@@ -468,6 +474,8 @@ public abstract class POIDocument implem
 
     /**
      * @return the encryption info if the document is encrypted, otherwise {@code null}
+     *
+     * @throws IOException If retrieving the encryption information fails
      */
     public EncryptionInfo getEncryptionInfo() throws IOException {
         return null;

Modified: poi/branches/hemf/src/java/org/apache/poi/common/usermodel/fonts/FontFamily.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/java/org/apache/poi/common/usermodel/fonts/FontFamily.java?rev=1845617&r1=1845616&r2=1845617&view=diff
==============================================================================
--- poi/branches/hemf/src/java/org/apache/poi/common/usermodel/fonts/FontFamily.java (original)
+++ poi/branches/hemf/src/java/org/apache/poi/common/usermodel/fonts/FontFamily.java Fri Nov  2 18:35:34 2018
@@ -68,13 +68,15 @@ public enum FontFamily {
         }
         return null;
     }
-    
 
     /**
      * Get FontFamily from combined native id
+     *
+     * @param pitchAndFamily The PitchFamily to decode.
+     *
+     * @return The resulting FontFamily
      */
     public static FontFamily valueOfPitchFamily(byte pitchAndFamily) {
         return valueOf(pitchAndFamily >>> 4);
     }
-
-}
\ No newline at end of file
+}

Modified: poi/branches/hemf/src/java/org/apache/poi/common/usermodel/fonts/FontPitch.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/java/org/apache/poi/common/usermodel/fonts/FontPitch.java?rev=1845617&r1=1845616&r2=1845617&view=diff
==============================================================================
--- poi/branches/hemf/src/java/org/apache/poi/common/usermodel/fonts/FontPitch.java (original)
+++ poi/branches/hemf/src/java/org/apache/poi/common/usermodel/fonts/FontPitch.java Fri Nov  2 18:35:34 2018
@@ -59,6 +59,11 @@ public enum FontPitch {
      * Combine pitch and family to native id
      * 
      * @see <a href="https://msdn.microsoft.com/en-us/library/dd145037.aspx">LOGFONT structure</a>
+     *
+     * @param pitch The pitch-value, cannot be null
+     * @param family The family-value, cannot be null
+     *
+     * @return The resulting combined byte-value with pitch and family encoded into one byte
      */
     public static byte getNativeId(FontPitch pitch, FontFamily family) {
         return (byte)(pitch.getNativeId() | (family.getFlag() << 4));
@@ -66,9 +71,12 @@ public enum FontPitch {
 
     /**
      * Get FontPitch from native id
+     *
+     * @param pitchAndFamily The combined byte value for pitch and family
+     *
+     * @return The resulting FontPitch enumeration value
      */
     public static FontPitch valueOfPitchFamily(byte pitchAndFamily) {
         return valueOf(pitchAndFamily & 0x3);
     }
 }
-

Modified: poi/branches/hemf/src/java/org/apache/poi/extractor/OLE2ExtractorFactory.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/java/org/apache/poi/extractor/OLE2ExtractorFactory.java?rev=1845617&r1=1845616&r2=1845617&view=diff
==============================================================================
--- poi/branches/hemf/src/java/org/apache/poi/extractor/OLE2ExtractorFactory.java (original)
+++ poi/branches/hemf/src/java/org/apache/poi/extractor/OLE2ExtractorFactory.java Fri Nov  2 18:35:34 2018
@@ -65,6 +65,8 @@ public final class OLE2ExtractorFactory
      * Should this thread prefer event based over usermodel based extractors?
      * (usermodel extractors tend to be more accurate, but use more memory)
      * Default is false.
+     *
+     * @return true if event extractors should be preferred in the current thread, fals otherwise.
      */
     public static boolean getThreadPrefersEventExtractors() {
         return threadPreferEventExtractors.get();
@@ -74,6 +76,8 @@ public final class OLE2ExtractorFactory
      * Should all threads prefer event based over usermodel based extractors?
      * (usermodel extractors tend to be more accurate, but use more memory)
      * Default is to use the thread level setting, which defaults to false.
+     *
+     * @return true if event extractors should be preferred in all threads, fals otherwise.
      */
     public static Boolean getAllThreadsPreferEventExtractors() {
         return allPreferEventExtractors;
@@ -82,6 +86,8 @@ public final class OLE2ExtractorFactory
     /**
      * Should this thread prefer event based over usermodel based extractors?
      * Will only be used if the All Threads setting is null.
+     *
+     * @param preferEventExtractors If this threads should prefer event based extractors.
      */
     public static void setThreadPrefersEventExtractors(boolean preferEventExtractors) {
         threadPreferEventExtractors.set(preferEventExtractors);
@@ -90,6 +96,8 @@ public final class OLE2ExtractorFactory
     /**
      * Should all threads prefer event based over usermodel based extractors?
      * If set, will take preference over the Thread level setting.
+     *
+     * @param preferEventExtractors If all threads should prefer event based extractors.
      */
     public static void setAllThreadsPreferEventExtractors(Boolean preferEventExtractors) {
         allPreferEventExtractors = preferEventExtractors;
@@ -98,6 +106,8 @@ public final class OLE2ExtractorFactory
     /**
      * Should this thread use event based extractors is available?
      * Checks the all-threads one first, then thread specific.
+     *
+     * @return If the current thread should use event based extractors.
      */
     public static boolean getPreferEventExtractor() {
         if(allPreferEventExtractors != null) {
@@ -155,6 +165,16 @@ public final class OLE2ExtractorFactory
      * Create the Extractor, if possible. Generally needs the Scratchpad jar.
      * Note that this won't check for embedded OOXML resources either, use
      *  {@link org.apache.poi.ooxml.extractor.ExtractorFactory} for that.
+     *
+     * @param poifsDir The {@link DirectoryNode} pointing to a document.
+     *
+     * @return The resulting {@link POITextExtractor}, an exception is thrown if
+     *      no TextExtractor can be created for some reason.
+     *
+     * @throws IOException If converting the {@link DirectoryNode} into a HSSFWorkbook fails
+     * @throws OldFileFormatException If the {@link DirectoryNode} points to a format of
+     *      an unsupported version of Excel.
+     * @throws IllegalArgumentException If creating the Extractor fails
      */
     public static POITextExtractor createExtractor(DirectoryNode poifsDir) throws IOException {
         // Look for certain entries in the stream, to figure it
@@ -193,11 +213,17 @@ public final class OLE2ExtractorFactory
      * If there are no embedded documents, you'll get back an
      *  empty array. Otherwise, you'll get one open
      *  {@link POITextExtractor} for each embedded file.
+     *
+     * @param ext The extractor to look at for embedded documents
+     *
+     * @return An array of resulting extractors. Empty if no embedded documents are found.
+     *
+     * @throws IOException If converting the {@link DirectoryNode} into a HSSFWorkbook fails
+     * @throws OldFileFormatException If the {@link DirectoryNode} points to a format of
+     *      an unsupported version of Excel.
+     * @throws IllegalArgumentException If creating the Extractor fails
      */
-    @SuppressWarnings("unused")
-    public static POITextExtractor[] getEmbededDocsTextExtractors(POIOLE2TextExtractor ext)
-            throws IOException
-    {
+    public static POITextExtractor[] getEmbededDocsTextExtractors(POIOLE2TextExtractor ext) throws IOException {
         // All the embedded directories we spotted
         List<Entry> dirs = new ArrayList<>();
         // For anything else not directly held in as a POIFS directory
@@ -237,13 +263,12 @@ public final class OLE2ExtractorFactory
 
         ArrayList<POITextExtractor> e = new ArrayList<>();
         for (Entry dir : dirs) {
-            e.add(createExtractor(
-                    (DirectoryNode) dir
+            e.add(createExtractor((DirectoryNode) dir
             ));
         }
-        for (InputStream nonPOIF : nonPOIFS) {
+        for (InputStream stream : nonPOIFS) {
             try {
-                e.add(createExtractor(nonPOIF));
+                e.add(createExtractor(stream));
             } catch (Exception xe) {
                 // Ignore, invalid format
                 LOGGER.log(POILogger.WARN, xe);

Modified: poi/branches/hemf/src/java/org/apache/poi/hpsf/Property.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/java/org/apache/poi/hpsf/Property.java?rev=1845617&r1=1845616&r2=1845617&view=diff
==============================================================================
--- poi/branches/hemf/src/java/org/apache/poi/hpsf/Property.java (original)
+++ poi/branches/hemf/src/java/org/apache/poi/hpsf/Property.java Fri Nov  2 18:35:34 2018
@@ -248,12 +248,14 @@ public class Property {
     /**
      * Returns the property's size in bytes. This is always a multiple of 4.
      *
+     * @param property The integer property to check
+     *
      * @return the property's size in bytes
      *
      * @exception WritingNotSupportedException if HPSF does not yet support the
      * property's variant type.
      */
-    protected int getSize(int codepage) throws WritingNotSupportedException
+    protected int getSize(int property) throws WritingNotSupportedException
     {
         int length = Variant.getVariantLength(type);
         if (length >= 0  || type == Variant.VT_EMPTY) {
@@ -269,16 +271,16 @@ public class Property {
         if (type == Variant.VT_LPSTR || type == Variant.VT_LPWSTR) {
             ByteArrayOutputStream bos = new ByteArrayOutputStream();
             try {
-                length = write(bos, codepage) - 2*LittleEndianConsts.INT_SIZE;
+                length = write(bos, property) - 2*LittleEndianConsts.INT_SIZE;
                 /* Pad to multiples of 4. */
                 length += (4 - (length & 0x3)) & 0x3;
                 return length;
             } catch (IOException e) {
-                throw new WritingNotSupportedException(type, value);
+                throw new WritingNotSupportedException(type, this.value);
             }
         }
 
-        throw new WritingNotSupportedException(type, value);
+        throw new WritingNotSupportedException(type, this.value);
     }
 
 

Modified: poi/branches/hemf/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbookFactory.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbookFactory.java?rev=1845617&r1=1845616&r2=1845617&view=diff
==============================================================================
--- poi/branches/hemf/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbookFactory.java (original)
+++ poi/branches/hemf/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbookFactory.java Fri Nov  2 18:35:34 2018
@@ -32,6 +32,15 @@ import org.apache.poi.util.Internal;
 @Internal
 public class HSSFWorkbookFactory extends WorkbookFactory {
     /**
+     * Create a new empty Workbook
+     *
+     * @return The created workbook
+     */
+    public static HSSFWorkbook createWorkbook() {
+        return new HSSFWorkbook();
+    }
+
+    /**
      * Creates a HSSFWorkbook from the given NPOIFSFileSystem<p>
      * Note that in order to properly release resources the
      * Workbook should be closed after use.

Modified: poi/branches/hemf/src/java/org/apache/poi/poifs/macros/VBAMacroReader.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/java/org/apache/poi/poifs/macros/VBAMacroReader.java?rev=1845617&r1=1845616&r2=1845617&view=diff
==============================================================================
--- poi/branches/hemf/src/java/org/apache/poi/poifs/macros/VBAMacroReader.java (original)
+++ poi/branches/hemf/src/java/org/apache/poi/poifs/macros/VBAMacroReader.java Fri Nov  2 18:35:34 2018
@@ -20,9 +20,19 @@ package org.apache.poi.poifs.macros;
 import static org.apache.poi.util.StringUtil.endsWithIgnoreCase;
 import static org.apache.poi.util.StringUtil.startsWithIgnoreCase;
 
-import java.io.*;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.Closeable;
+import java.io.EOFException;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
 import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 import java.util.HashMap;
+import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipInputStream;
@@ -39,6 +49,8 @@ import org.apache.poi.util.CodePageUtil;
 import org.apache.poi.util.HexDump;
 import org.apache.poi.util.IOUtils;
 import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.POILogFactory;
+import org.apache.poi.util.POILogger;
 import org.apache.poi.util.RLEDecompressingInputStream;
 import org.apache.poi.util.StringUtil;
 
@@ -56,6 +68,10 @@ import org.apache.poi.util.StringUtil;
  * @since 3.15-beta2
  */
 public class VBAMacroReader implements Closeable {
+    private static final POILogger LOGGER = POILogFactory.getLogger(VBAMacroReader.class);
+
+    //arbitrary limit on size of strings to read, etc.
+    private static final int MAX_STRING_LENGTH = 20000;
     protected static final String VBA_PROJECT_OOXML = "vbaProject.bin";
     protected static final String VBA_PROJECT_POIFS = "VBA";
 
@@ -111,8 +127,13 @@ public class VBAMacroReader implements C
 
     public Map<String, Module> readMacroModules() throws IOException {
         final ModuleMap modules = new ModuleMap();
+        //ascii -> unicode mapping for module names
+        //preserve insertion order
+        final Map<String, String> moduleNameMap = new LinkedHashMap<>();
+
         findMacros(fs.getRoot(), modules);
-        findProjectProperties(fs.getRoot(), modules);
+        findModuleNameMap(fs.getRoot(), moduleNameMap, modules);
+        findProjectProperties(fs.getRoot(), moduleNameMap, modules);
 
         Map<String, Module> moduleSources = new HashMap<>();
         for (Map.Entry<String, ModuleImpl> entry : modules.entrySet()) {
@@ -327,19 +348,30 @@ public class VBAMacroReader implements C
         }
     }
 
-    protected void findProjectProperties(DirectoryNode node, ModuleMap modules) throws IOException {
+    protected void findProjectProperties(DirectoryNode node, Map<String, String> moduleNameMap, ModuleMap modules) throws IOException {
         for (Entry entry : node) {
             if ("project".equalsIgnoreCase(entry.getName())) {
                 DocumentNode document = (DocumentNode)entry;
-                DocumentInputStream dis = new DocumentInputStream(document);
-                readProjectProperties(dis, modules);
-            } else {
-                for (Entry child : node) {
-                    if (child instanceof DirectoryNode) {
-                        findProjectProperties((DirectoryNode)child, modules);
-                    }
+                try(DocumentInputStream dis = new DocumentInputStream(document)) {
+                    readProjectProperties(dis, moduleNameMap, modules);
+                    return;
                 }
+            } else if (entry instanceof DirectoryNode) {
+                findProjectProperties((DirectoryNode)entry, moduleNameMap, modules);
+            }
+        }
+    }
 
+    protected void findModuleNameMap(DirectoryNode node, Map<String, String> moduleNameMap, ModuleMap modules) throws IOException {
+        for (Entry entry : node) {
+            if ("projectwm".equalsIgnoreCase(entry.getName())) {
+                DocumentNode document = (DocumentNode)entry;
+                try(DocumentInputStream dis = new DocumentInputStream(document)) {
+                    readNameMapRecords(dis, moduleNameMap, modules.charset);
+                    return;
+                }
+            } else if (entry.isDirectoryEntry()) {
+                findModuleNameMap((DirectoryNode)entry, moduleNameMap, modules);
             }
         }
     }
@@ -426,10 +458,18 @@ public class VBAMacroReader implements C
     private static class ASCIIUnicodeStringPair {
         private final String ascii;
         private final String unicode;
+        private final int pushbackRecordId;
+
+        ASCIIUnicodeStringPair(String ascii, int pushbackRecordId) {
+            this.ascii = ascii;
+            this.unicode = "";
+            this.pushbackRecordId = pushbackRecordId;
+        }
 
         ASCIIUnicodeStringPair(String ascii, String unicode) {
             this.ascii = ascii;
             this.unicode = unicode;
+            pushbackRecordId = -1;
         }
 
         private String getAscii() {
@@ -439,6 +479,10 @@ public class VBAMacroReader implements C
         private String getUnicode() {
             return unicode;
         }
+
+        private int getPushbackRecordId() {
+            return pushbackRecordId;
+        }
     }
 
     private void processDirStream(Entry dir, ModuleMap modules) throws IOException {
@@ -447,7 +491,7 @@ public class VBAMacroReader implements C
         try (DocumentInputStream dis = new DocumentInputStream(dirDocumentNode)) {
             String streamName = null;
             int recordId = 0;
-            boolean inReferenceTwiddled = false;
+
             try (RLEDecompressingInputStream in = new RLEDecompressingInputStream(dis)) {
                 while (true) {
                     recordId = in.readShort();
@@ -485,7 +529,27 @@ public class VBAMacroReader implements C
                             if (dirState.equals(DIR_STATE.INFORMATION_RECORD)) {
                                 dirState = DIR_STATE.REFERENCES_RECORD;
                             }
-                            readStringPair(in, modules.charset, REFERENCE_NAME_RESERVED);
+                            ASCIIUnicodeStringPair stringPair = readStringPair(in,
+                                    modules.charset, REFERENCE_NAME_RESERVED, false);
+                            if (stringPair.getPushbackRecordId() == -1) {
+                                break;
+                            }
+                            //Special handling for when there's only an ascii string and a REFERENCED_REGISTERED
+                            //record that follows.
+                            //See https://github.com/decalage2/oletools/blob/master/oletools/olevba.py#L1516
+                            //and https://github.com/decalage2/oletools/pull/135 from (@c1fe)
+                            if (stringPair.getPushbackRecordId() != RecordType.REFERENCE_REGISTERED.id) {
+                                throw new IllegalArgumentException("Unexpected reserved character. "+
+                                        "Expected "+Integer.toHexString(REFERENCE_NAME_RESERVED)
+                                        + " or "+Integer.toHexString(RecordType.REFERENCE_REGISTERED.id)+
+                                        " not: "+Integer.toHexString(stringPair.getPushbackRecordId()));
+                            }
+                            //fall through!
+                        case REFERENCE_REGISTERED:
+                            //REFERENCE_REGISTERED must come immediately after
+                            //REFERENCE_NAME to allow for fall through in special case of bug 62625
+                            int recLength = in.readInt();
+                            trySkip(in, recLength);
                             break;
                         case MODULE_DOC_STRING:
                             int modDocStringLength = in.readInt();
@@ -546,19 +610,105 @@ public class VBAMacroReader implements C
         }
     }
 
-    private ASCIIUnicodeStringPair readStringPair(RLEDecompressingInputStream in, Charset charset, int reservedByte) throws IOException {
+
+
+    private ASCIIUnicodeStringPair readStringPair(RLEDecompressingInputStream in,
+                                                  Charset charset, int reservedByte) throws IOException {
+        return readStringPair(in, charset, reservedByte, true);
+    }
+
+    private ASCIIUnicodeStringPair readStringPair(RLEDecompressingInputStream in,
+                                                  Charset charset, int reservedByte,
+                                                  boolean throwOnUnexpectedReservedByte) throws IOException {
         int nameLength = in.readInt();
         String ascii = readString(in, nameLength, charset);
         int reserved = in.readShort();
+
         if (reserved != reservedByte) {
-            throw new IOException("Expected "+Integer.toHexString(reservedByte)+ "after name before Unicode name, but found: " +
-                    Integer.toHexString(reserved));
+            if (throwOnUnexpectedReservedByte) {
+                throw new IOException("Expected " + Integer.toHexString(reservedByte) +
+                        "after name before Unicode name, but found: " +
+                        Integer.toHexString(reserved));
+            } else {
+                return new ASCIIUnicodeStringPair(ascii, reserved);
+            }
         }
         int unicodeNameRecordLength = in.readInt();
         String unicode = readUnicodeString(in, unicodeNameRecordLength);
         return new ASCIIUnicodeStringPair(ascii, unicode);
     }
 
+    protected void readNameMapRecords(InputStream is,
+                                           Map<String, String> moduleNames, Charset charset) throws IOException {
+        //see 2.3.3 PROJECTwm Stream: Module Name Information
+        //multibytecharstring
+        String mbcs = null;
+        String unicode = null;
+        //arbitrary sanity threshold
+        final int maxNameRecords = 10000;
+        int records = 0;
+        while (++records < maxNameRecords) {
+            try {
+                int b = IOUtils.readByte(is);
+                //check for two 0x00 that mark end of record
+                if (b == 0) {
+                    b = IOUtils.readByte(is);
+                    if (b == 0) {
+                        return;
+                    }
+                }
+                mbcs = readMBCS(b, is, charset, MAX_STRING_LENGTH);
+            } catch (EOFException e) {
+                return;
+            }
+
+            try {
+                unicode = readUnicode(is, MAX_STRING_LENGTH);
+            } catch (EOFException e) {
+                return;
+            }
+            if (mbcs.trim().length() > 0 && unicode.trim().length() > 0) {
+                moduleNames.put(mbcs, unicode);
+            }
+
+        }
+        if (records >= maxNameRecords) {
+            LOGGER.log(POILogger.WARN, "Hit max name records to read ("+maxNameRecords+"). Stopped early.");
+        }
+    }
+
+    private static String readUnicode(InputStream is, int maxLength) throws IOException {
+        //reads null-terminated unicode string
+        ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        int b0 = IOUtils.readByte(is);
+        int b1 = IOUtils.readByte(is);
+
+        int read = 2;
+        while ((b0 + b1) != 0 && read < maxLength) {
+
+            bos.write(b0);
+            bos.write(b1);
+            b0 = IOUtils.readByte(is);
+            b1 = IOUtils.readByte(is);
+            read += 2;
+        }
+        if (read >= maxLength) {
+            LOGGER.log(POILogger.WARN, "stopped reading unicode name after "+read+" bytes");
+        }
+        return new String (bos.toByteArray(), StandardCharsets.UTF_16LE);
+    }
+
+    private static String readMBCS(int firstByte, InputStream is, Charset charset, int maxLength) throws IOException {
+        ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        int len = 0;
+        int b = firstByte;
+        while (b > 0 && len < maxLength) {
+            ++len;
+            bos.write(b);
+            b = IOUtils.readByte(is);
+        }
+        return new String(bos.toByteArray(), charset);
+    }
 
     /**
      * Read <tt>length</tt> bytes of MBCS (multi-byte character set) characters from the stream
@@ -570,7 +720,7 @@ public class VBAMacroReader implements C
      * @throws IOException If reading from the stream fails
      */
     private static String readString(InputStream stream, int length, Charset charset) throws IOException {
-        byte[] buffer = IOUtils.safelyAllocate(length, 20000);
+        byte[] buffer = IOUtils.safelyAllocate(length, MAX_STRING_LENGTH);
         int bytesRead = IOUtils.readFully(stream, buffer);
         if (bytesRead != length) {
             throw new IOException("Tried to read: "+length +
@@ -579,7 +729,8 @@ public class VBAMacroReader implements C
         return new String(buffer, 0, length, charset);
     }
 
-    protected void readProjectProperties(DocumentInputStream dis, ModuleMap modules) throws IOException {
+    protected void readProjectProperties(DocumentInputStream dis,
+                                         Map<String, String> moduleNameMap, ModuleMap modules) throws IOException {
         InputStreamReader reader = new InputStreamReader(dis, modules.charset);
         StringBuilder builder = new StringBuilder();
         char[] buffer = new char[512];
@@ -588,6 +739,9 @@ public class VBAMacroReader implements C
             builder.append(buffer, 0, read);
         }
         String properties = builder.toString();
+        //the module name map names should be in exactly the same order
+        //as the module names here. See 2.3.3 PROJECTwm Stream.
+        //At some point, we might want to enforce that.
         for (String line : properties.split("\r\n|\n\r")) {
             if (!line.startsWith("[")) {
                 String[] tokens = line.split("=");
@@ -595,28 +749,46 @@ public class VBAMacroReader implements C
                         && tokens[1].startsWith("\"") && tokens[1].endsWith("\"")) {
                     // Remove any double quotes
                     tokens[1] = tokens[1].substring(1, tokens[1].length() - 1);
-
                 }
-                if ("Document".equals(tokens[0])) {
+                if ("Document".equals(tokens[0]) && tokens.length > 1) {
                     String mn = tokens[1].substring(0, tokens[1].indexOf("/&H"));
-                    ModuleImpl module = modules.get(mn);
-                    module.moduleType = ModuleType.Document;
-                } else if ("Module".equals(tokens[0])) {
-                    ModuleImpl module = modules.get(tokens[1]);
-                    module.moduleType = ModuleType.Module;
-                } else if ("Class".equals(tokens[0])) {
-                    ModuleImpl module = modules.get(tokens[1]);
-                    module.moduleType = ModuleType.Class;
+                    ModuleImpl module = getModule(mn, moduleNameMap, modules);
+                    if (module != null) {
+                        module.moduleType = ModuleType.Document;
+                    } else {
+                        LOGGER.log(POILogger.WARN, "couldn't find module with name: "+mn);
+                    }
+                } else if ("Module".equals(tokens[0]) && tokens.length > 1) {
+                    ModuleImpl module = getModule(tokens[1], moduleNameMap, modules);
+                    if (module != null) {
+                        module.moduleType = ModuleType.Module;
+                    } else {
+                        LOGGER.log(POILogger.WARN, "couldn't find module with name: "+tokens[1]);
+                    }
+                } else if ("Class".equals(tokens[0]) && tokens.length > 1) {
+                    ModuleImpl module = getModule(tokens[1], moduleNameMap, modules);
+                    if (module != null) {
+                        module.moduleType = ModuleType.Class;
+                    } else {
+                        LOGGER.log(POILogger.WARN, "couldn't find module with name: "+tokens[1]);
+                    }
                 }
             }
         }
     }
+    //can return null!
+    private ModuleImpl getModule(String moduleName, Map<String, String> moduleNameMap, ModuleMap moduleMap) {
+        if (moduleNameMap.containsKey(moduleName)) {
+            return moduleMap.get(moduleNameMap.get(moduleName));
+        }
+        return moduleMap.get(moduleName);
+    }
 
     private String readUnicodeString(RLEDecompressingInputStream in, int unicodeNameRecordLength) throws IOException {
-        byte[] buffer = IOUtils.safelyAllocate(unicodeNameRecordLength, 20000);
+        byte[] buffer = IOUtils.safelyAllocate(unicodeNameRecordLength, MAX_STRING_LENGTH);
         int bytesRead = IOUtils.readFully(in, buffer);
         if (bytesRead != unicodeNameRecordLength) {
-
+            throw new EOFException();
         }
         return new String(buffer, StringUtil.UTF16LE);
     }

Modified: poi/branches/hemf/src/java/org/apache/poi/ss/format/CellDateFormatter.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/java/org/apache/poi/ss/format/CellDateFormatter.java?rev=1845617&r1=1845616&r2=1845617&view=diff
==============================================================================
--- poi/branches/hemf/src/java/org/apache/poi/ss/format/CellDateFormatter.java (original)
+++ poi/branches/hemf/src/java/org/apache/poi/ss/format/CellDateFormatter.java Fri Nov  2 18:35:34 2018
@@ -50,6 +50,7 @@ public class CellDateFormatter extends C
         private int hStart = -1;
         private int hLen;
 
+        @Override
         public String handlePart(Matcher m, String part, CellFormatType type,
                 StringBuffer desc) {
 

Modified: poi/branches/hemf/src/java/org/apache/poi/ss/format/CellTextFormatter.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/java/org/apache/poi/ss/format/CellTextFormatter.java?rev=1845617&r1=1845616&r2=1845617&view=diff
==============================================================================
--- poi/branches/hemf/src/java/org/apache/poi/ss/format/CellTextFormatter.java (original)
+++ poi/branches/hemf/src/java/org/apache/poi/ss/format/CellTextFormatter.java Fri Nov  2 18:35:34 2018
@@ -16,10 +16,7 @@
 ==================================================================== */
 package org.apache.poi.ss.format;
 
-import org.apache.poi.ss.format.CellFormatPart.PartHandler;
-
 import java.util.Locale;
-import java.util.regex.Matcher;
 
 /**
  * This class implements printing out text.
@@ -38,15 +35,12 @@ public class CellTextFormatter extends C
         final int[] numPlaces = new int[1];
 
         desc = CellFormatPart.parseFormat(format, CellFormatType.TEXT,
-                new PartHandler() {
-                    public String handlePart(Matcher m, String part,
-                            CellFormatType type, StringBuffer desc) {
-                        if (part.equals("@")) {
-                            numPlaces[0]++;
-                            return "\u0000";
-                        }
-                        return null;
+                (m, part, type, desc) -> {
+                    if (part.equals("@")) {
+                        numPlaces[0]++;
+                        return "\u0000";
                     }
+                    return null;
                 }).toString();
 
         // Remember the "@" positions in last-to-first order (to make insertion easier)
@@ -66,8 +60,8 @@ public class CellTextFormatter extends C
             text = text.toUpperCase(Locale.ROOT);
         }
         toAppendTo.append(desc);
-        for (int i = 0; i < textPos.length; i++) {
-            int pos = start + textPos[i];
+        for (int textPo : textPos) {
+            int pos = start + textPo;
             toAppendTo.replace(pos, pos + 1, text);
         }
     }

Modified: poi/branches/hemf/src/java/org/apache/poi/ss/formula/BaseFormulaEvaluator.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/java/org/apache/poi/ss/formula/BaseFormulaEvaluator.java?rev=1845617&r1=1845616&r2=1845617&view=diff
==============================================================================
--- poi/branches/hemf/src/java/org/apache/poi/ss/formula/BaseFormulaEvaluator.java (original)
+++ poi/branches/hemf/src/java/org/apache/poi/ss/formula/BaseFormulaEvaluator.java Fri Nov  2 18:35:34 2018
@@ -65,6 +65,14 @@ public abstract class BaseFormulaEvaluat
     }
 
     /**
+     * internal use
+     * @return evaluation workbook
+     */
+    protected EvaluationWorkbook getEvaluationWorkbook() {
+        return _bookEvaluator.getWorkbook();
+    }
+    
+    /**
      * Should be called whenever there are major changes (e.g. moving sheets) to input cells
      * in the evaluated workbook.  If performance is not critical, a single call to this method
      * may be used instead of many specific calls to the notify~ methods.
@@ -208,14 +216,19 @@ public abstract class BaseFormulaEvaluat
         return evaluateFormulaCell(cell);
     }
 
-    protected static void setCellType(Cell cell, CellValue cv) {
+    /**
+     * set the cell type
+     * @param cell
+     * @param cv
+     */
+    protected void setCellType(Cell cell, CellValue cv) {
         CellType cellType = cv.getCellType();
         switch (cellType) {
             case BOOLEAN:
             case ERROR:
             case NUMERIC:
             case STRING:
-                cell.setCellType(cellType);
+                setCellType(cell, cellType);
                 return;
             case BLANK:
                 // never happens - blanks eventually get translated to zero
@@ -227,6 +240,15 @@ public abstract class BaseFormulaEvaluat
                 throw new IllegalStateException("Unexpected cell value type (" + cellType + ")");
         }
     }
+
+    /**
+     * Override if a different variation is needed, e.g. passing the evaluator to the cell method
+     * @param cell
+     * @param cellType
+     */
+    protected void setCellType(Cell cell, CellType cellType) {
+        cell.setCellType(cellType);
+    }
     
     protected abstract RichTextString createRichTextString(String str);
     

Modified: poi/branches/hemf/src/java/org/apache/poi/ss/formula/eval/FunctionEval.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/java/org/apache/poi/ss/formula/eval/FunctionEval.java?rev=1845617&r1=1845616&r2=1845617&view=diff
==============================================================================
--- poi/branches/hemf/src/java/org/apache/poi/ss/formula/eval/FunctionEval.java (original)
+++ poi/branches/hemf/src/java/org/apache/poi/ss/formula/eval/FunctionEval.java Fri Nov  2 18:35:34 2018
@@ -115,7 +115,7 @@ public final class FunctionEval {
         // 47: DVAR
         retval[48] = TextFunction.TEXT;
         // 49: LINEST
-        // 50: TREND
+        retval[50] = new Trend();
         // 51: LOGEST
         // 52: GROWTH
 
@@ -243,7 +243,8 @@ public final class FunctionEval {
 
         // 247: DB
         // 252: FEQUENCY
-        
+        retval[252] = Frequency.instance;
+
         retval[FunctionID.EXTERNAL_FUNC] = null; // ExternalFunction is a FreeRefFunction, nominally 255
 
         retval[261] = new Errortype();

Modified: poi/branches/hemf/src/java/org/apache/poi/ss/formula/ptg/RefPtgBase.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/java/org/apache/poi/ss/formula/ptg/RefPtgBase.java?rev=1845617&r1=1845616&r2=1845617&view=diff
==============================================================================
--- poi/branches/hemf/src/java/org/apache/poi/ss/formula/ptg/RefPtgBase.java (original)
+++ poi/branches/hemf/src/java/org/apache/poi/ss/formula/ptg/RefPtgBase.java Fri Nov  2 18:35:34 2018
@@ -43,7 +43,7 @@ public abstract class RefPtgBase extends
 
     /**
      * YK: subclasses of RefPtgBase are used by the FormulaParser and FormulaEvaluator accross HSSF and XSSF.
-     * The bit mask should accomodate the maximum number of avaiable columns, i.e. 0x3FFF.
+     * The bit mask should accommodate the maximum number of avaiable columns, i.e. 0x3FFF.
      *
      * @see org.apache.poi.ss.SpreadsheetVersion
      */

Modified: poi/branches/hemf/src/java/org/apache/poi/ss/usermodel/Sheet.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/java/org/apache/poi/ss/usermodel/Sheet.java?rev=1845617&r1=1845616&r2=1845617&view=diff
==============================================================================
--- poi/branches/hemf/src/java/org/apache/poi/ss/usermodel/Sheet.java (original)
+++ poi/branches/hemf/src/java/org/apache/poi/ss/usermodel/Sheet.java Fri Nov  2 18:35:34 2018
@@ -1006,7 +1006,10 @@ public interface Sheet extends Iterable<
 
     /**
      * Sets array formula to specified region for result.
-     *
+     * <p>
+     * Note if there are shared formulas this will invalidate any 
+     * {@link FormulaEvaluator} instances based on this workbook
+     *</p>
      * @param formula text representation of the formula
      * @param range Region of array formula for result.
      * @return the {@link CellRange} of cells affected by this change

Modified: poi/branches/hemf/src/java/org/apache/poi/ss/usermodel/WorkbookFactory.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/java/org/apache/poi/ss/usermodel/WorkbookFactory.java?rev=1845617&r1=1845616&r2=1845617&view=diff
==============================================================================
--- poi/branches/hemf/src/java/org/apache/poi/ss/usermodel/WorkbookFactory.java (original)
+++ poi/branches/hemf/src/java/org/apache/poi/ss/usermodel/WorkbookFactory.java Fri Nov  2 18:35:34 2018
@@ -44,6 +44,24 @@ import org.apache.poi.util.Removal;
  */
 public class WorkbookFactory {
     /**
+     * Create a new empty Workbook, either XSSF or HSSF depending
+     * on the parameter
+     *
+     * @param xssf If an XSSFWorkbook or a HSSFWorkbook should be created
+     *
+     * @return The created workbook
+     *
+     * @throws IOException if an error occurs while reading the data
+     */
+    public static Workbook create(boolean xssf) throws IOException {
+        if(xssf) {
+            return createXSSFWorkbook();
+        } else {
+            return createHSSFWorkbook();
+        }
+    }
+
+    /**
      * Creates a HSSFWorkbook from the given NPOIFSFileSystem<p>
      *
      * Note that in order to properly release resources the
@@ -296,6 +314,11 @@ public class WorkbookFactory {
         return createWorkbook("org.apache.poi.xssf.usermodel.XSSFWorkbookFactory", args);
     }
 
+    /**
+     * Does the actual call to HSSF or XSSF to do the creation.
+     * Uses reflection, so that this class can be in the Core non-OOXML
+     *  POI jar without errors / broken references to the OOXML / XSSF code.
+     */
     private static Workbook createWorkbook(String factoryClass, Object args[]) throws IOException, EncryptedDocumentException {
         try {
             Class<?> clazz = WorkbookFactory.class.getClassLoader().loadClass(factoryClass);
@@ -307,6 +330,8 @@ public class WorkbookFactory {
                     c = boolean.class;
                 } else if (InputStream.class.isAssignableFrom(c)) {
                     c = InputStream.class;
+                } else if (File.class.isAssignableFrom(c)) {
+                    c = File.class;
                 }
                 argsClz[i++] = c;
             }

Modified: poi/branches/hemf/src/java/org/apache/poi/ss/util/CellReference.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/java/org/apache/poi/ss/util/CellReference.java?rev=1845617&r1=1845616&r2=1845617&view=diff
==============================================================================
--- poi/branches/hemf/src/java/org/apache/poi/ss/util/CellReference.java (original)
+++ poi/branches/hemf/src/java/org/apache/poi/ss/util/CellReference.java Fri Nov  2 18:35:34 2018
@@ -132,7 +132,7 @@ public class CellReference {
         if (rowRef.length() == 0) {
             _rowIndex = -1;
         } else {
-            // throws NumberFormatException if rowRef is not convertable to an int
+            // throws NumberFormatException if rowRef is not convertible to an int
             _rowIndex = Integer.parseInt(rowRef)-1; // -1 to convert 1-based to zero-based
         }
     }
@@ -336,10 +336,10 @@ public class CellReference {
             if(colStr.toUpperCase(Locale.ROOT).compareTo(lastCol) > 0) {
                 return false;
             }
-        } else {
+        } /*else {
             // apparent column name has less chars than max
             // no need to check range
-        }
+        }*/
         return true;
     }
 
@@ -426,7 +426,7 @@ public class CellReference {
         //   AreaReference.separateAreaRefs()
         //   SheetNameFormatter.format() (inverse)
 
-        StringBuffer sb = new StringBuffer(indexOfSheetNameDelimiter);
+        StringBuilder sb = new StringBuilder(indexOfSheetNameDelimiter);
 
         for(int i=1; i<lastQuotePos; i++) { // Note boundaries - skip outer quotes
             char ch = reference.charAt(i);
@@ -495,11 +495,7 @@ public class CellReference {
 
     @Override
     public String toString() {
-        StringBuffer sb = new StringBuffer(64);
-        sb.append(getClass().getName()).append(" [");
-        sb.append(formatAsString());
-        sb.append("]");
-        return sb.toString();
+        return getClass().getName() + " [" + formatAsString() + "]";
     }
 
     /**

Modified: poi/branches/hemf/src/java/org/apache/poi/ss/util/CellUtil.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/java/org/apache/poi/ss/util/CellUtil.java?rev=1845617&r1=1845616&r2=1845617&view=diff
==============================================================================
--- poi/branches/hemf/src/java/org/apache/poi/ss/util/CellUtil.java (original)
+++ poi/branches/hemf/src/java/org/apache/poi/ss/util/CellUtil.java Fri Nov  2 18:35:34 2018
@@ -420,7 +420,7 @@ public final class CellUtil {
     }
 
     /**
-     * Utility method that returns the named short value form the given map.
+     * Utility method that returns the named short value from the given map.
      *
      * @param properties map of named properties (String -> Object)
      * @param name property name
@@ -436,7 +436,7 @@ public final class CellUtil {
     }
 
     /**
-     * Utility method that returns the named int value form the given map.
+     * Utility method that returns the named int value from the given map.
      *
      * @param properties map of named properties (String -> Object)
      * @param name property name
@@ -452,7 +452,7 @@ public final class CellUtil {
     }
     
     /**
-     * Utility method that returns the named BorderStyle value form the given map.
+     * Utility method that returns the named BorderStyle value from the given map.
      *
      * @param properties map of named properties (String -> Object)
      * @param name property name
@@ -483,7 +483,7 @@ public final class CellUtil {
     }
     
     /**
-     * Utility method that returns the named FillPatternType value form the given map.
+     * Utility method that returns the named FillPatternType value from the given map.
      *
      * @param properties map of named properties (String -> Object)
      * @param name property name
@@ -515,7 +515,7 @@ public final class CellUtil {
     }
     
     /**
-     * Utility method that returns the named HorizontalAlignment value form the given map.
+     * Utility method that returns the named HorizontalAlignment value from the given map.
      *
      * @param properties map of named properties (String -> Object)
      * @param name property name
@@ -547,7 +547,7 @@ public final class CellUtil {
     }
     
     /**
-     * Utility method that returns the named VerticalAlignment value form the given map.
+     * Utility method that returns the named VerticalAlignment value from the given map.
      *
      * @param properties map of named properties (String -> Object)
      * @param name property name
@@ -579,7 +579,7 @@ public final class CellUtil {
     }
 
     /**
-     * Utility method that returns the named boolean value form the given map.
+     * Utility method that returns the named boolean value from the given map.
      *
      * @param properties map of properties (String -> Object)
      * @param name property name
@@ -594,7 +594,7 @@ public final class CellUtil {
         }
         return false;
     }
-    
+
     /**
      * Utility method that puts the given value to the given map.
      *

Modified: poi/branches/hemf/src/java/org/apache/poi/util/IOUtils.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/java/org/apache/poi/util/IOUtils.java?rev=1845617&r1=1845616&r2=1845617&view=diff
==============================================================================
--- poi/branches/hemf/src/java/org/apache/poi/util/IOUtils.java (original)
+++ poi/branches/hemf/src/java/org/apache/poi/util/IOUtils.java Fri Nov  2 18:35:34 2018
@@ -571,6 +571,22 @@ public final class IOUtils {
         return new byte[(int)length];
     }
 
+    /**
+     * Simple utility function to check that you haven't hit EOF
+     * when reading a byte.
+     *
+     * @param is inputstream to read
+     * @return byte read, unless
+     * @throws IOException on IOException or EOF if -1 is read
+     */
+    public static int readByte(InputStream is) throws IOException {
+        int b = is.read();
+        if (b == -1) {
+            throw new EOFException();
+        }
+        return b;
+    }
+
     private static void throwRFE(long length, int maxLength) {
         throw new RecordFormatException("Tried to allocate an array of length "+length +
                 ", but "+ maxLength+" is the maximum for this record type.\n" +

Modified: poi/branches/hemf/src/ooxml/java/org/apache/poi/ooxml/POIXMLDocumentPart.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/ooxml/java/org/apache/poi/ooxml/POIXMLDocumentPart.java?rev=1845617&r1=1845616&r2=1845617&view=diff
==============================================================================
--- poi/branches/hemf/src/ooxml/java/org/apache/poi/ooxml/POIXMLDocumentPart.java (original)
+++ poi/branches/hemf/src/ooxml/java/org/apache/poi/ooxml/POIXMLDocumentPart.java Fri Nov  2 18:35:34 2018
@@ -42,6 +42,7 @@ import org.apache.poi.util.POILogger;
 import org.apache.poi.xddf.usermodel.chart.XDDFChart;
 import org.apache.poi.xssf.usermodel.XSSFRelation;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.apache.poi.xwpf.usermodel.XWPFRelation;
 
 /**
  * Represents an entry of a OOXML package.
@@ -613,6 +614,14 @@ public class POIXMLDocumentPart {
      */
     protected void read(POIXMLFactory factory, Map<PackagePart, POIXMLDocumentPart> context) throws OpenXML4JException {
         PackagePart pp = getPackagePart();
+
+        if (pp.getContentType().equals(XWPFRelation.TEMPLATE.getContentType())) {
+            logger.log(POILogger.WARN,
+                    "POI does not currently support template.main+xml (glossary) parts.  " +
+                    "Skipping this part for now.");
+            return;
+        }
+
         // add mapping a second time, in case of initial caller hasn't done so
         POIXMLDocumentPart otherChild = context.put(pp, this);
         if (otherChild != null && otherChild != this) {

Modified: poi/branches/hemf/src/ooxml/java/org/apache/poi/openxml4j/exceptions/InvalidFormatException.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/ooxml/java/org/apache/poi/openxml4j/exceptions/InvalidFormatException.java?rev=1845617&r1=1845616&r2=1845617&view=diff
==============================================================================
--- poi/branches/hemf/src/ooxml/java/org/apache/poi/openxml4j/exceptions/InvalidFormatException.java (original)
+++ poi/branches/hemf/src/ooxml/java/org/apache/poi/openxml4j/exceptions/InvalidFormatException.java Fri Nov  2 18:35:34 2018
@@ -18,7 +18,7 @@
 package org.apache.poi.openxml4j.exceptions;
 
 @SuppressWarnings("serial")
-public final class InvalidFormatException extends OpenXML4JException{
+public final class InvalidFormatException extends OpenXML4JException {
 
 	public InvalidFormatException(String message){
 		super(message);

Modified: poi/branches/hemf/src/ooxml/java/org/apache/poi/openxml4j/opc/OPCPackage.java
URL: http://svn.apache.org/viewvc/poi/branches/hemf/src/ooxml/java/org/apache/poi/openxml4j/opc/OPCPackage.java?rev=1845617&r1=1845616&r2=1845617&view=diff
==============================================================================
--- poi/branches/hemf/src/ooxml/java/org/apache/poi/openxml4j/opc/OPCPackage.java (original)
+++ poi/branches/hemf/src/ooxml/java/org/apache/poi/openxml4j/opc/OPCPackage.java Fri Nov  2 18:35:34 2018
@@ -291,6 +291,8 @@ public abstract class OPCPackage impleme
 	 * @param in
 	 *            The InputStream to read the package from
 	 * @return A PackageBase object
+	 *
+	 * @throws InvalidFormatException
 	 */
 	public static OPCPackage open(InputStream in) throws InvalidFormatException,
 			IOException {



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


Mime
View raw message