Author: kiwiwings
Date: Wed Sep 17 21:12:36 2014
New Revision: 1625828

URL: http://svn.apache.org/r1625828
Log:
merge with trunk

Added:
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/util/SAXHelper.java   
(props changed)
      - copied unchanged from r1625777, 
poi/trunk/src/ooxml/java/org/apache/poi/util/SAXHelper.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xssf/usermodel/helpers/XSSFPaswordHelper.java
      - copied unchanged from r1625765, 
poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/helpers/XSSFPaswordHelper.java
    
poi/branches/xml_signature/src/ooxml/testcases/org/apache/poi/xssf/model/TestThemesTable.java
      - copied unchanged from r1625765, 
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/model/TestThemesTable.java
    poi/branches/xml_signature/test-data/spreadsheet/56730.xlsx
      - copied unchanged from r1625765, 
poi/trunk/test-data/spreadsheet/56730.xlsx
    poi/branches/xml_signature/test-data/spreadsheet/Themes.xlsx
      - copied unchanged from r1625765, 
poi/trunk/test-data/spreadsheet/Themes.xlsx
    
poi/branches/xml_signature/test-data/spreadsheet/workbookProtection-sheet_password-2013.xlsx
      - copied unchanged from r1625765, 
poi/trunk/test-data/spreadsheet/workbookProtection-sheet_password-2013.xlsx
    
poi/branches/xml_signature/test-data/spreadsheet/workbookProtection-workbook_password-2013.xlsx
      - copied unchanged from r1625765, 
poi/trunk/test-data/spreadsheet/workbookProtection-workbook_password-2013.xlsx
    
poi/branches/xml_signature/test-data/spreadsheet/workbookProtection-workbook_password_user_range-2010.xlsx
      - copied unchanged from r1625765, 
poi/trunk/test-data/spreadsheet/workbookProtection-workbook_password_user_range-2010.xlsx
Modified:
    poi/branches/xml_signature/KEYS
    poi/branches/xml_signature/build.xml
    
poi/branches/xml_signature/src/examples/src/org/apache/poi/xssf/eventusermodel/examples/FromHowTo.java
    poi/branches/xml_signature/src/java/org/apache/poi/hssf/dev/BiffViewer.java
    
poi/branches/xml_signature/src/java/org/apache/poi/hssf/record/AbstractEscherHolderRecord.java
    
poi/branches/xml_signature/src/java/org/apache/poi/hssf/record/DConRefRecord.java
    
poi/branches/xml_signature/src/java/org/apache/poi/hssf/record/DrawingGroupRecord.java
    
poi/branches/xml_signature/src/java/org/apache/poi/hssf/record/PasswordRecord.java
    
poi/branches/xml_signature/src/java/org/apache/poi/hssf/record/aggregates/WorksheetProtectionBlock.java
    
poi/branches/xml_signature/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java
    
poi/branches/xml_signature/src/java/org/apache/poi/hssf/usermodel/HSSFClientAnchor.java
    
poi/branches/xml_signature/src/java/org/apache/poi/hssf/usermodel/HSSFPatriarch.java
    
poi/branches/xml_signature/src/java/org/apache/poi/hssf/usermodel/HSSFShape.java
    
poi/branches/xml_signature/src/java/org/apache/poi/poifs/crypt/CryptoFunctions.java
    
poi/branches/xml_signature/src/java/org/apache/poi/poifs/crypt/HashAlgorithm.java
    
poi/branches/xml_signature/src/java/org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java
    
poi/branches/xml_signature/src/java/org/apache/poi/ss/SpreadsheetVersion.java
    
poi/branches/xml_signature/src/java/org/apache/poi/ss/formula/WorkbookEvaluator.java
    poi/branches/xml_signature/src/java/org/apache/poi/util/ArrayUtil.java
    poi/branches/xml_signature/src/java/org/apache/poi/util/XMLHelper.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/POIXMLProperties.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/POIXMLPropertiesTextExtractor.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/openxml4j/opc/PackageRelationshipCollection.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ContentTypeManager.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/unmarshallers/PackagePropertiesUnmarshaller.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/poifs/crypt/dsig/SignatureInfo.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/util/DocumentHelper.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xslf/XSLFSlideShow.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xslf/extractor/XSLFPowerPointExtractor.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xslf/model/geom/CustomGeometry.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xslf/usermodel/DrawingTable.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xslf/usermodel/DrawingTableRow.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xslf/usermodel/DrawingTextBody.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xslf/usermodel/RenderableShape.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xslf/usermodel/XMLSlideShow.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFCommentAuthors.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFComments.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFCommonSlideData.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFFreeformShape.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTable.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTableRow.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTableStyles.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextShape.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xssf/eventusermodel/ReadOnlySharedStringsTable.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xssf/eventusermodel/XSSFSheetXMLHandler.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xssf/extractor/XSSFEventBasedExcelExtractor.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xssf/extractor/XSSFExportToXml.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xssf/extractor/XSSFImportFromXML.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xssf/model/CommentsTable.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xssf/model/MapInfo.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xssf/model/SingleXmlCells.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xssf/model/ThemesTable.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFChart.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFColor.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFPivotCacheDefinition.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFPivotTable.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRow.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheetConditionalFormatting.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFTable.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xssf/usermodel/helpers/ColumnHelper.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xssf/usermodel/helpers/XSSFRowShifter.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xssf/util/CTColComparator.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xwpf/model/XWPFCommentsDecorator.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xwpf/model/XWPFHyperlinkDecorator.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xwpf/usermodel/AbstractXWPFSDT.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFComment.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFFootnote.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFFootnotes.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFHeaderFooter.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFLatentStyles.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFNumbering.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFParagraph.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFRun.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFSDTContent.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFStyles.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTable.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTableCell.java
    
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTableRow.java
    
poi/branches/xml_signature/src/ooxml/testcases/org/apache/poi/TestPOIXMLProperties.java
    
poi/branches/xml_signature/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestPackage.java
    
poi/branches/xml_signature/src/ooxml/testcases/org/apache/poi/poifs/crypt/PkiTestUtils.java
    
poi/branches/xml_signature/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestSignatureInfo.java
    
poi/branches/xml_signature/src/ooxml/testcases/org/apache/poi/xslf/TestXSLFSlideShow.java
    
poi/branches/xml_signature/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXMLSlideShow.java
    
poi/branches/xml_signature/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFSimpleShape.java
    
poi/branches/xml_signature/src/ooxml/testcases/org/apache/poi/xssf/TestSheetProtection.java
    
poi/branches/xml_signature/src/ooxml/testcases/org/apache/poi/xssf/TestWorkbookProtection.java
    
poi/branches/xml_signature/src/ooxml/testcases/org/apache/poi/xssf/extractor/TestXSSFExportToXML.java
    
poi/branches/xml_signature/src/ooxml/testcases/org/apache/poi/xssf/model/TestCalculationChain.java
    
poi/branches/xml_signature/src/ooxml/testcases/org/apache/poi/xssf/model/TestMapInfo.java
    
poi/branches/xml_signature/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java
    
poi/branches/xml_signature/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFColGrouping.java
    
poi/branches/xml_signature/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFColor.java
    
poi/branches/xml_signature/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFFont.java
    
poi/branches/xml_signature/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFFormulaEvaluation.java
    
poi/branches/xml_signature/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFRichTextString.java
    
poi/branches/xml_signature/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java
    
poi/branches/xml_signature/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheetShiftRows.java
    
poi/branches/xml_signature/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFTable.java
    
poi/branches/xml_signature/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFWorkbook.java
    
poi/branches/xml_signature/src/ooxml/testcases/org/apache/poi/xssf/usermodel/extensions/TestXSSFCellFill.java
    
poi/branches/xml_signature/src/ooxml/testcases/org/apache/poi/xssf/usermodel/helpers/TestColumnHelper.java
    
poi/branches/xml_signature/src/ooxml/testcases/org/apache/poi/xssf/util/TestCTColComparator.java
    
poi/branches/xml_signature/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFDocument.java
    
poi/branches/xml_signature/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFParagraph.java
    
poi/branches/xml_signature/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFRun.java
    
poi/branches/xml_signature/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFStyles.java
    
poi/branches/xml_signature/src/scratchpad/src/org/apache/poi/hwpf/model/NilPICFAndBinData.java
    
poi/branches/xml_signature/src/scratchpad/src/org/apache/poi/hwpf/model/PlfLfo.java
    
poi/branches/xml_signature/src/scratchpad/src/org/apache/poi/hwpf/model/Sttb.java
    
poi/branches/xml_signature/src/testcases/org/apache/poi/hssf/model/TestDrawingShapes.java
    
poi/branches/xml_signature/src/testcases/org/apache/poi/hssf/record/TestDConRefRecord.java
    
poi/branches/xml_signature/src/testcases/org/apache/poi/ss/usermodel/BaseTestConditionalFormatting.java

Modified: poi/branches/xml_signature/KEYS
URL: 
http://svn.apache.org/viewvc/poi/branches/xml_signature/KEYS?rev=1625828&r1=1625827&r2=1625828&view=diff
==============================================================================
--- poi/branches/xml_signature/KEYS (original)
+++ poi/branches/xml_signature/KEYS Wed Sep 17 21:12:36 2014
@@ -1753,3 +1753,46 @@ W45jdvBkYoPdQtS+8Vy+q0997zobctz8i5hfXzxg
 7PoqJGZ6UdBVwyb0qZqs6KLGQkEyJ8358ivjJsjxUR8diK027wWnW/s=
 =/Vu1
 -----END PGP PUBLIC KEY BLOCK-----
+pub   2048R/26062CE3 2014-08-17 [expires: 2016-08-16]
+uid                  Andreas Beeker <[email protected]>
+uid                  Andreas Beeker (kiwiwings) <[email protected]>
+sub   2048R/EE864ED6 2014-08-17 [expires: 2016-08-16]
+
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+Version: GnuPG v1
+
+mQENBFPwtjQBCADWg7jYCGq+QFGfB8nLLQs/WEw4XJiAY9q65qWX1clNuVgTF9Nn
+ABBOy4KiSDR9XWmARZlC2trKfdoFEnNJ6EnFkLhOjzZKiy4jkyxCctKfbV+sMzCm
+ODjjNQtn+nYmOu7a8Xg3g3vTnikkuHZqWvK0O0VYouW/p1NHelUejQbOPuUKukD1
+omzskuYgteTZ9Jn8efJMIymg9dGubuvN4HvUdEO0/u6K2MCZjIqNEPeqWIuZXeMb
++4nGv2r0jSQAU94g3hueooqbUf+Mk2+H5O1d/h2Cii9qVvi6gELdVw9H+5Ir9AFc
+ynsmvxrPIxraBMPgrXmvPFOTlqlizyFv2O7pABEBAAG0MkFuZHJlYXMgQmVla2Vy
+IChraXdpd2luZ3MpIDxhbmRyZWFzLmJlZWtlckBnbXguZGU+iQE+BBMBAgAoBQJT
+8LY0AhsDBQkDwmcABgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAAKCRCpPhxLJgYs
+4wvFB/9hEV8LzHUpD0X/vM9pfW1ZbTl2GNiZfuMh6/KlqB3C4gL3SLLRlk4mEPM3
+qlZWCqZiWVp5zz1C/j/+BLJW3c+j3rCUEAsobsR6HkxBr7N0LUnurbMXyiOvdg4l
+AS42Vi1JrydFdih1HCI3NiGMHAV/8NEdtmLt7Ue8Opx01R6rwXBomX5BHJXnzbZR
+bCbdor/UnO8ff5K4jwd6yhY0BV+bI2uD+vGq9nMld0JGj7W7qB+HzOAxpINtHksQ
+htTV/PBWjHTCNhOdGh1zyoyvJSshm1NkvwBVZYMs/0ujApcqxAXytGXonLiMmZME
+COjxAigph8T4PCEKdIqdsVxkC2ybtCVBbmRyZWFzIEJlZWtlciA8a2l3aXdpbmdz
+QGFwYWNoZS5vcmc+iQE+BBMBAgAoBQJT8RApAhsDBQkDwmcABgsJCAcDAgYVCAIJ
+CgsEFgIDAQIeAQIXgAAKCRCpPhxLJgYs4732CAC0tb5Wqjf3+/2M6ZzsJR9lqOI6
+SIwaxu0qnHVUJNzRrF01886uae7k086RCVvEXmSxnmGk86odbx/e7gD0esC9xoxz
+GRdo5AtMEh18b4fRsq3cdywPDUjvgQBvWXw+jhpJbJe7RRRKZS6X0dRLACn24tGw
+GPOkn1cE5gkHxUraEk84PKi69znCULasPOV1X46xU2j42N+v0XC3F1ZgFTesvBPh
+O9Nfaj99GnxpL8PmWyKvKm8SSLTmzLoZ+cXSNGGjJtsrnQn5tmhmEgp5K4DX7lsx
++lmfJ9X7+OUxgVHdkesz69d3h+9wBtVl6WqaA+Ocn/0xWr0X55J1OsW+1N2SuQEN
+BFPwtjQBCACln6mHC8Js3T3KJgNydimOCAFhLmS4e0ur03Y1nckB9zB/pMTLulDg
+tZwWSin3Kd40VZDyKi6mqOp5ldz6AsZ2CSx1GfI9iVhfuFqOaiBLqpNpdvf9nGL9
+OVoy1SdwTXgnboiIFtbTG3sVwD4x4qTRbmT22Ln/mIAICR2wxFBkzpbIQ7MfR/zE
+gRh2VlRUUrWUsnYdOh0xfxuYgsnPCjpTY8hvEno3H6kzXKmj2GQJtawMVs5bRo/G
+CM9lBBR/PAhB65ACzLmUUSsxjlmjZw0tCcOufg1RyAF/l6YVw1UOJaqXBfSPeZkL
+QBj9p8VNpasX/acIfpEaZLE8QhoO11ajABEBAAGJASUEGAECAA8FAlPwtjQCGwwF
+CQPCZwAACgkQqT4cSyYGLOPzLggAjHrdpMjZrHM5WqnxkJ1Eib1g14aScMGdOIw9
+NOSQ2AGvJjbSy4xyMEUg3S14I73JGYtJu8g9YvCHbuWiyzySBIuGNinMI/ZjET/w
+1noqoNaSlIY4UfFh30g+OikEzP9WXmo0Scg0XH/fJhX1wCpM/TVlphX0yNGmmkNB
+BqerRXC7Md4XOy001vvXZGM7vy+xOotyBOy/D4WNERSz3GVS3juCQGMWvMdqKQa+
+qoiVaXWfFHwg8u4bSHunrzNja17GyaZHdCEmM9vFzlaqBkoLWCMwIcaKnX9stQJp
+FZwpzgut7DanaPcCDk7LMBbntaJwRC72M0qcj16SUAdAuGt1yQ==
+=0DjT
+-----END PGP PUBLIC KEY BLOCK-----

Modified: poi/branches/xml_signature/build.xml
URL: 
http://svn.apache.org/viewvc/poi/branches/xml_signature/build.xml?rev=1625828&r1=1625827&r2=1625828&view=diff
==============================================================================
--- poi/branches/xml_signature/build.xml (original)
+++ poi/branches/xml_signature/build.xml Wed Sep 17 21:12:36 2014
@@ -164,13 +164,17 @@ under the License.
     <property name="ooxml.xmlbeans26.jar" 
location="${ooxml.lib}/xmlbeans-2.6.0.jar"/>
     <property name="ooxml.xmlbeans26.url"
               
value="${repository.m2}/maven2/org/apache/xmlbeans/xmlbeans/2.6.0/xmlbeans-2.6.0.jar"/>
-
+       
     <!-- coverage libs -->
     <property name="jacoco.zip" 
location="${main.lib}/jacoco-0.7.1.201405082137.zip"/>
     <property name="jacoco.url" 
value="${repository.m2}/maven2/org/jacoco/jacoco/0.7.1.201405082137/jacoco-0.7.1.201405082137.zip"/>
     <property name="asm.jar" location="${main.lib}/asm-all-5.0.3.jar"/>
     <property name="asm.url" 
value="${repository.m2}/maven2/org/ow2/asm/asm-all/5.0.3/asm-all-5.0.3.jar"/>
        
+       <!-- for testing with older Xerces implementation -->
+    <property name="xerces.jar" location="${main.lib}/xercesImpl-2.6.1.jar"/>
+    <property name="xerces.url" 
value="${repository.m2}/maven2/xerces/xercesImpl/2.6.1//xercesImpl-2.6.1.jar"/>
+
     <!-- license checks -->
     <property name="rat.jar" location="${main.lib}/apache-rat-0.10.jar"/>
     <property name="rat.url" 
value="${repository.m2}/maven2/org/apache/rat/apache-rat/0.10/apache-rat-0.10.jar"/>
@@ -254,6 +258,7 @@ under the License.
         <path refid="main.classpath"/>
         <pathelement location="${main.output.dir}"/>
         <pathelement location="${main.output.test.dir}"/>
+       <pathelement location="${additionaljar}"/>
     </path>
 
     <path id="test.scratchpad.classpath">
@@ -261,6 +266,7 @@ under the License.
         <pathelement location="${main.output.test.dir}"/>
         <pathelement location="${scratchpad.output.dir}"/>
         <pathelement location="${scratchpad.output.test.dir}"/>
+       <pathelement location="${additionaljar}"/>
     </path>
 
     <path id="test.ooxml.classpath">
@@ -268,6 +274,7 @@ under the License.
         <pathelement location="${ooxml.output.dir}"/>
         <pathelement location="${ooxml.output.test.dir}"/>
         <pathelement location="${main.output.test.dir}"/>
+       <pathelement location="${additionaljar}"/>
     </path>
 
     <path id="ooxml-lite.classpath">
@@ -300,6 +307,7 @@ under the License.
         <pathelement location="${excelant.output.dir}"/>
         <pathelement location="${excelant.output.test.dir}"/>
         <pathelement location="${main.output.test.dir}"/>
+       <pathelement location="${additionaljar}"/>
     </path>
 
     <path id="lib.jacoco">
@@ -372,6 +380,7 @@ under the License.
                                <include name="jacoco-0.6*"/>
                                <include name="log4j-1.2.13*"/>
                                <include name="org.jacoco.*-0.6.*"/>
+                               <include name="dom4j*"/>
                        </fileset>
                </delete>
 
@@ -388,6 +397,7 @@ under the License.
                     <available file="${asm.jar}"/>
                     <available file="${jacoco.zip}"/>
                     <available file="${rat.jar}"/>
+                    <available file="${xerces.jar}"/>
                 </and>
                 <isset property="disconnected"/>
             </or>
@@ -439,6 +449,10 @@ under the License.
             </patternset>
         </unzip>
         <antcall target="downloadfile">
+            <param name="sourcefile" value="${xerces.url}"/>
+            <param name="destfile" value="${xerces.jar}"/>
+        </antcall>
+        <antcall target="downloadfile">
             <param name="sourcefile" value="${rat.url}"/>
             <param name="destfile" value="${rat.jar}"/>
         </antcall>

Modified: 
poi/branches/xml_signature/src/examples/src/org/apache/poi/xssf/eventusermodel/examples/FromHowTo.java
URL: 
http://svn.apache.org/viewvc/poi/branches/xml_signature/src/examples/src/org/apache/poi/xssf/eventusermodel/examples/FromHowTo.java?rev=1625828&r1=1625827&r2=1625828&view=diff
==============================================================================
--- 
poi/branches/xml_signature/src/examples/src/org/apache/poi/xssf/eventusermodel/examples/FromHowTo.java
 (original)
+++ 
poi/branches/xml_signature/src/examples/src/org/apache/poi/xssf/eventusermodel/examples/FromHowTo.java
 Wed Sep 17 21:12:36 2014
@@ -115,6 +115,7 @@ public class FromHowTo {
                        if(nextIsString) {
                                int idx = Integer.parseInt(lastContents);
                                lastContents = new 
XSSFRichTextString(sst.getEntryAt(idx)).toString();
+            nextIsString = false;
                        }
 
                        // v => contents of a cell

Modified: 
poi/branches/xml_signature/src/java/org/apache/poi/hssf/dev/BiffViewer.java
URL: 
http://svn.apache.org/viewvc/poi/branches/xml_signature/src/java/org/apache/poi/hssf/dev/BiffViewer.java?rev=1625828&r1=1625827&r2=1625828&view=diff
==============================================================================
--- poi/branches/xml_signature/src/java/org/apache/poi/hssf/dev/BiffViewer.java 
(original)
+++ poi/branches/xml_signature/src/java/org/apache/poi/hssf/dev/BiffViewer.java 
Wed Sep 17 21:12:36 2014
@@ -145,7 +145,7 @@ public final class BiffViewer {
                        case DatRecord.sid:            return new DatRecord(in);
                        case DataFormatRecord.sid:     return new 
DataFormatRecord(in);
                        case DateWindow1904Record.sid: return new 
DateWindow1904Record(in);
-               case DConRefRecord.sid: return new DConRefRecord(in);
+                       case DConRefRecord.sid: return new DConRefRecord(in);
                        case DefaultColWidthRecord.sid:return new 
DefaultColWidthRecord(in);
                        case DefaultDataLabelTextPropertiesRecord.sid: return 
new DefaultDataLabelTextPropertiesRecord(in);
                        case DefaultRowHeightRecord.sid: return new 
DefaultRowHeightRecord(in);

Modified: 
poi/branches/xml_signature/src/java/org/apache/poi/hssf/record/AbstractEscherHolderRecord.java
URL: 
http://svn.apache.org/viewvc/poi/branches/xml_signature/src/java/org/apache/poi/hssf/record/AbstractEscherHolderRecord.java?rev=1625828&r1=1625827&r2=1625828&view=diff
==============================================================================
--- 
poi/branches/xml_signature/src/java/org/apache/poi/hssf/record/AbstractEscherHolderRecord.java
 (original)
+++ 
poi/branches/xml_signature/src/java/org/apache/poi/hssf/record/AbstractEscherHolderRecord.java
 Wed Sep 17 21:12:36 2014
@@ -57,20 +57,19 @@ public abstract class AbstractEscherHold
     public AbstractEscherHolderRecord(RecordInputStream in)
     {
         escherRecords = new ArrayList<EscherRecord>();
-        if (! DESERIALISE )
-        {
+        if (! DESERIALISE ) {
             rawDataContainer.concatenate(in.readRemainder());
-        }
-        else
-        {
+        } else {
             byte[] data = in.readAllContinuedRemainder();
             convertToEscherRecords( 0, data.length, data );
         }
     }
 
     protected void convertRawBytesToEscherRecords() {
-        byte[] rawData = getRawData();
-       convertToEscherRecords(0, rawData.length, rawData);
+        if (! DESERIALISE ) {
+            byte[] rawData = getRawData();
+               convertToEscherRecords(0, rawData.length, rawData);
+        }
     }
     private void convertToEscherRecords( int offset, int size, byte[] data )
     {
@@ -224,7 +223,7 @@ public abstract class AbstractEscherHold
 
     public EscherRecord getEscherRecord(int index)
     {
-        return (EscherRecord) escherRecords.get(index);
+        return escherRecords.get(index);
     }
 
     /**

Modified: 
poi/branches/xml_signature/src/java/org/apache/poi/hssf/record/DConRefRecord.java
URL: 
http://svn.apache.org/viewvc/poi/branches/xml_signature/src/java/org/apache/poi/hssf/record/DConRefRecord.java?rev=1625828&r1=1625827&r2=1625828&view=diff
==============================================================================
--- 
poi/branches/xml_signature/src/java/org/apache/poi/hssf/record/DConRefRecord.java
 (original)
+++ 
poi/branches/xml_signature/src/java/org/apache/poi/hssf/record/DConRefRecord.java
 Wed Sep 17 21:12:36 2014
@@ -18,10 +18,11 @@
  */
 package org.apache.poi.hssf.record;
 
-import org.apache.poi.util.ArrayUtil;
 import org.apache.poi.util.LittleEndian;
 import org.apache.poi.util.LittleEndianOutput;
 
+import java.util.Arrays;
+
 /**
  * DConRef records specify a range in a workbook (internal or external) that 
serves as a data source
  * for pivot tables or data consolidation.
@@ -273,7 +274,7 @@ public class DConRefRecord extends Stand
      */
     public byte[] getPath()
     {
-        return ArrayUtil.copyOf(path, path.length);
+        return Arrays.copyOf(path, path.length);
     }
 
     /**
@@ -291,7 +292,7 @@ public class DConRefRecord extends Stand
             {
                 offset++;
             }
-            String out = new String(ArrayUtil.copyOfRange(path, offset, 
path.length));
+            String out = new String(Arrays.copyOfRange(path, offset, 
path.length));
             //UNC paths have \u0003 chars as path separators.
             out = out.replaceAll("\u0003", "/");
             return out;

Modified: 
poi/branches/xml_signature/src/java/org/apache/poi/hssf/record/DrawingGroupRecord.java
URL: 
http://svn.apache.org/viewvc/poi/branches/xml_signature/src/java/org/apache/poi/hssf/record/DrawingGroupRecord.java?rev=1625828&r1=1625827&r2=1625828&view=diff
==============================================================================
--- 
poi/branches/xml_signature/src/java/org/apache/poi/hssf/record/DrawingGroupRecord.java
 (original)
+++ 
poi/branches/xml_signature/src/java/org/apache/poi/hssf/record/DrawingGroupRecord.java
 Wed Sep 17 21:12:36 2014
@@ -118,7 +118,7 @@ public final class DrawingGroupRecord ex
                 writeHeader( data, offset, segmentLength );
             writtenActualData += 4;
             offset += 4;
-            ArrayUtil.arraycopy( rawData, writtenRawData, data, offset, 
segmentLength );
+            System.arraycopy( rawData, writtenRawData, data, offset, 
segmentLength );
             offset += segmentLength;
             writtenRawData += segmentLength;
             writtenActualData += segmentLength;

Modified: 
poi/branches/xml_signature/src/java/org/apache/poi/hssf/record/PasswordRecord.java
URL: 
http://svn.apache.org/viewvc/poi/branches/xml_signature/src/java/org/apache/poi/hssf/record/PasswordRecord.java?rev=1625828&r1=1625827&r2=1625828&view=diff
==============================================================================
--- 
poi/branches/xml_signature/src/java/org/apache/poi/hssf/record/PasswordRecord.java
 (original)
+++ 
poi/branches/xml_signature/src/java/org/apache/poi/hssf/record/PasswordRecord.java
 Wed Sep 17 21:12:36 2014
@@ -17,6 +17,7 @@
 
 package org.apache.poi.hssf.record;
 
+import org.apache.poi.poifs.crypt.CryptoFunctions;
 import org.apache.poi.util.HexDump;
 import org.apache.poi.util.LittleEndianOutput;
 
@@ -39,23 +40,13 @@ public final class PasswordRecord extend
         field_1_password = in.readShort();
     }
 
-    //this is the world's lamest "security".  thanks to Wouter van Vugt for 
making me
-    //not have to try real hard.  -ACO
+    /**
+     * Return the password hash
+     *
+     * @deprecated use {@link CryptoFunctions#createXorVerifier1(String)}
+     */
     public static short hashPassword(String password) {
-        byte[] passwordCharacters = password.getBytes();
-        int hash = 0;
-        if (passwordCharacters.length > 0) {
-            int charIndex = passwordCharacters.length;
-            while (charIndex-- > 0) {
-                hash = ((hash >> 14) & 0x01) | ((hash << 1) & 0x7fff);
-                hash ^= passwordCharacters[charIndex];
-            }
-            // also hash with charcount
-            hash = ((hash >> 14) & 0x01) | ((hash << 1) & 0x7fff);
-            hash ^= passwordCharacters.length;
-            hash ^= (0x8000 | ('N' << 8) | 'K');
-        }
-        return (short)hash;
+        return (short)CryptoFunctions.createXorVerifier1(password);
     }
 
     /**

Modified: 
poi/branches/xml_signature/src/java/org/apache/poi/hssf/record/aggregates/WorksheetProtectionBlock.java
URL: 
http://svn.apache.org/viewvc/poi/branches/xml_signature/src/java/org/apache/poi/hssf/record/aggregates/WorksheetProtectionBlock.java?rev=1625828&r1=1625827&r2=1625828&view=diff
==============================================================================
--- 
poi/branches/xml_signature/src/java/org/apache/poi/hssf/record/aggregates/WorksheetProtectionBlock.java
 (original)
+++ 
poi/branches/xml_signature/src/java/org/apache/poi/hssf/record/aggregates/WorksheetProtectionBlock.java
 Wed Sep 17 21:12:36 2014
@@ -24,6 +24,7 @@ import org.apache.poi.hssf.record.Protec
 import org.apache.poi.hssf.record.Record;
 import org.apache.poi.hssf.record.RecordFormatException;
 import org.apache.poi.hssf.record.ScenarioProtectRecord;
+import org.apache.poi.poifs.crypt.CryptoFunctions;
 
 /**
  * Groups the sheet protection records for a worksheet.
@@ -186,7 +187,7 @@ public final class WorksheetProtectionBl
                ProtectRecord prec = getProtect();
                PasswordRecord pass = getPassword();
                prec.setProtect(true);
-               pass.setPassword(PasswordRecord.hashPassword(password));
+               
pass.setPassword((short)CryptoFunctions.createXorVerifier1(password));
                if (_objectProtectRecord == null && shouldProtectObjects) {
                        ObjectProtectRecord rec = createObjectProtect();
                        rec.setProtect(true);

Modified: 
poi/branches/xml_signature/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java
URL: 
http://svn.apache.org/viewvc/poi/branches/xml_signature/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java?rev=1625828&r1=1625827&r2=1625828&view=diff
==============================================================================
--- 
poi/branches/xml_signature/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java
 (original)
+++ 
poi/branches/xml_signature/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java
 Wed Sep 17 21:12:36 2014
@@ -828,6 +828,29 @@ public final class HSSFCellStyle impleme
     }
        
     /**
+     * Get the reading order, for RTL/LTR ordering of
+     *  the text.
+     * <p>0 means Context (Default), 1 means Left To Right,
+     *  and 2 means Right to Left</p>
+     *
+     * @return order - the reading order (0,1,2)
+     */
+    public short getReadingOrder() {
+        return _format.getReadingOrder();
+    }
+    /**
+     * Sets the reading order, for RTL/LTR ordering of
+     *  the text.
+     * <p>0 means Context (Default), 1 means Left To Right,
+     *  and 2 means Right to Left</p>
+     *
+     * @param order - the reading order (0,1,2)
+     */
+    public void setReadingOrder(short order) {
+        _format.setReadingOrder(order);
+    }
+    
+    /**
      * Verifies that this style belongs to the supplied Workbook.
      * Will throw an exception if it belongs to a different one.
      * This is normally called when trying to assign a style to a

Modified: 
poi/branches/xml_signature/src/java/org/apache/poi/hssf/usermodel/HSSFClientAnchor.java
URL: 
http://svn.apache.org/viewvc/poi/branches/xml_signature/src/java/org/apache/poi/hssf/usermodel/HSSFClientAnchor.java?rev=1625828&r1=1625827&r2=1625828&view=diff
==============================================================================
--- 
poi/branches/xml_signature/src/java/org/apache/poi/hssf/usermodel/HSSFClientAnchor.java
 (original)
+++ 
poi/branches/xml_signature/src/java/org/apache/poi/hssf/usermodel/HSSFClientAnchor.java
 Wed Sep 17 21:12:36 2014
@@ -42,6 +42,10 @@ public final class HSSFClientAnchor exte
     /**
      * Creates a new client anchor and sets the top-left and bottom-right
      * coordinates of the anchor.
+     * 
+     * Note: Microsoft Excel seems to sometimes disallow 
+     * higher y1 than y2 or higher x1 than x2, you might need to 
+     * reverse them and draw shapes vertically or horizontally flipped! 
      *
      * @param dx1  the x coordinate within the first cell.
      * @param dy1  the y coordinate within the first cell.
@@ -186,8 +190,12 @@ public final class HSSFClientAnchor exte
     }
 
     /**
-     * Dets the top-left and bottom-right
-     * coordinates of the anchor.
+     * Sets the top-left and bottom-right coordinates of 
+     * the anchor.
+     * 
+     * Note: Microsoft Excel seems to sometimes disallow 
+     * higher y1 than y2 or higher x1 than x2, you might need to 
+     * reverse them and draw shapes vertically or horizontally flipped! 
      *
      * @param x1   the x coordinate within the first cell.
      * @param y1   the y coordinate within the first cell.

Modified: 
poi/branches/xml_signature/src/java/org/apache/poi/hssf/usermodel/HSSFPatriarch.java
URL: 
http://svn.apache.org/viewvc/poi/branches/xml_signature/src/java/org/apache/poi/hssf/usermodel/HSSFPatriarch.java?rev=1625828&r1=1625827&r2=1625828&view=diff
==============================================================================
--- 
poi/branches/xml_signature/src/java/org/apache/poi/hssf/usermodel/HSSFPatriarch.java
 (original)
+++ 
poi/branches/xml_signature/src/java/org/apache/poi/hssf/usermodel/HSSFPatriarch.java
 Wed Sep 17 21:12:36 2014
@@ -171,6 +171,10 @@ public final class HSSFPatriarch impleme
     /**
      * Creates a simple shape.  This includes such shapes as lines, rectangles,
      * and ovals.
+     * 
+     * Note: Microsoft Excel seems to sometimes disallow 
+     * higher y1 than y2 or higher x1 than x2 in the anchor, you might need to 
+     * reverse them and draw shapes vertically or horizontally flipped! 
      *
      * @param anchor the client anchor describes how this group is attached
      *               to the sheet.

Modified: 
poi/branches/xml_signature/src/java/org/apache/poi/hssf/usermodel/HSSFShape.java
URL: 
http://svn.apache.org/viewvc/poi/branches/xml_signature/src/java/org/apache/poi/hssf/usermodel/HSSFShape.java?rev=1625828&r1=1625827&r2=1625828&view=diff
==============================================================================
--- 
poi/branches/xml_signature/src/java/org/apache/poi/hssf/usermodel/HSSFShape.java
 (original)
+++ 
poi/branches/xml_signature/src/java/org/apache/poi/hssf/usermodel/HSSFShape.java
 Wed Sep 17 21:12:36 2014
@@ -27,6 +27,11 @@ import java.io.IOException;
 
 /**
  * An abstract shape.
+ * 
+ * Note: Microsoft Excel seems to sometimes disallow 
+ * higher y1 than y2 or higher x1 than x2 in the anchor, you might need to 
+ * reverse them and draw shapes vertically or horizontally flipped via
+ * setFlipVertical() or setFlipHorizontally(). 
  */
 public abstract class HSSFShape {
     public static final int LINEWIDTH_ONE_PT = 12700;

Modified: 
poi/branches/xml_signature/src/java/org/apache/poi/poifs/crypt/CryptoFunctions.java
URL: 
http://svn.apache.org/viewvc/poi/branches/xml_signature/src/java/org/apache/poi/poifs/crypt/CryptoFunctions.java?rev=1625828&r1=1625827&r2=1625828&view=diff
==============================================================================
--- 
poi/branches/xml_signature/src/java/org/apache/poi/poifs/crypt/CryptoFunctions.java
 (original)
+++ 
poi/branches/xml_signature/src/java/org/apache/poi/poifs/crypt/CryptoFunctions.java
 Wed Sep 17 21:12:36 2014
@@ -181,14 +181,20 @@ public class CryptoFunctions {
     }
 
     /**
-     * 
+     * Initialize a new cipher object with the given cipher properties
+     * If the given algorithm is not implemented in the JCE, it will try to 
load it from the bouncy castle
+     * provider.
      *
-     * @param key
-     * @param chain
-     * @param vec
+     * @param key the secrect key
+     * @param cipherAlgorithm the cipher algorithm
+     * @param chain the chaining mode
+     * @param vec the initialization vector (IV), can be null
      * @param cipherMode Cipher.DECRYPT_MODE or Cipher.ENCRYPT_MODE
+     * @param padding
      * @return the requested cipher
      * @throws GeneralSecurityException
+     * @throws EncryptedDocumentException if the initialization failed or if 
an algorithm was specified,
+     *   which depends on a missing bouncy castle provider 
      */
     public static Cipher getCipher(Key key, CipherAlgorithm cipherAlgorithm, 
ChainingMode chain, byte[] vec, int cipherMode, String padding) {
         int keySizeInBytes = key.getEncoded().length;
@@ -227,10 +233,26 @@ public class CryptoFunctions {
         }
     }    
     
+    /**
+     * Returns a new byte array with a truncated to the given size. 
+     * If the hash has less then size bytes, it will be filled with 0x36-bytes
+     *
+     * @param hash the to be truncated/filled hash byte array
+     * @param size the size of the returned byte array
+     * @return the padded hash
+     */
     public static byte[] getBlock36(byte[] hash, int size) {
         return getBlockX(hash, size, (byte)0x36);
     }
 
+    /**
+     * Returns a new byte array with a truncated to the given size. 
+     * If the hash has less then size bytes, it will be filled with 0-bytes
+     *
+     * @param hash the to be truncated/filled hash byte array
+     * @param size the size of the returned byte array
+     * @return the padded hash
+     */
     public static byte[] getBlock0(byte[] hash, int size) {
         return getBlockX(hash, size, (byte)0);
     }
@@ -334,11 +356,11 @@ public class CryptoFunctions {
         byte[] generatedKey = new byte[4];
 
         //Maximum length of the password is 15 chars.
-        final int intMaxPasswordLength = 15; 
+        final int maxPasswordLength = 15; 
         
         if (!"".equals(password)) {
             // Truncate the password to 15 characters
-            password = password.substring(0, Math.min(password.length(), 
intMaxPasswordLength));
+            password = password.substring(0, Math.min(password.length(), 
maxPasswordLength));
 
             // Construct a new NULL-terminated string consisting of 
single-byte characters:
             //  -- > Get the single-byte values by iterating through the 
Unicode characters of the truncated Password.
@@ -362,7 +384,7 @@ public class CryptoFunctions {
             //          the most significant, if the bit is set, XOR the keys 
high-order word with the corresponding word from 
             //          the Encryption Matrix
             for (int i = 0; i < arrByteChars.length; i++) {
-                int tmp = intMaxPasswordLength - arrByteChars.length + i;
+                int tmp = maxPasswordLength - arrByteChars.length + i;
                 for (int intBit = 0; intBit < 7; intBit++) {
                     if ((arrByteChars[i] & (0x0001 << intBit)) != 0) {
                         highOrderWord ^= EncryptionMatrix[tmp][intBit];
@@ -372,22 +394,28 @@ public class CryptoFunctions {
             
             // Compute the low-order word of the new key:
             
-            // Initialize with 0
-            int lowOrderWord = 0;
+            // SET Verifier TO 0x0000
+            short verifier = 0;
 
-            // For each character in the password, going backwards
-            for (int i = arrByteChars.length - 1; i >= 0; i--) {
-                // low-order word = (((low-order word SHR 14) AND 0x0001) OR 
(low-order word SHL 1) AND 0x7FFF)) XOR character
-                lowOrderWord = (((lowOrderWord >> 14) & 0x0001) | 
((lowOrderWord << 1) & 0x7FFF)) ^ arrByteChars[i];
+            // FOR EACH PasswordByte IN PasswordArray IN REVERSE ORDER
+            for (int i = arrByteChars.length-1; i >= 0; i--) {
+                // SET Verifier TO Intermediate3 BITWISE XOR PasswordByte
+                verifier = rotateLeftBase15Bit(verifier);
+                verifier ^= arrByteChars[i];
             }
 
-            // Lastly,low-order word = (((low-order word SHR 14) AND 0x0001) 
OR (low-order word SHL 1) AND 0x7FFF)) XOR password length XOR 0xCE4B.
-            lowOrderWord = (((lowOrderWord >> 14) & 0x0001) | ((lowOrderWord 
<< 1) & 0x7FFF)) ^ arrByteChars.length ^ 0xCE4B;
+            // as we haven't prepended the password length into the input array
+            // we need to do it now separately ...
+            verifier = rotateLeftBase15Bit(verifier);
+            verifier ^= arrByteChars.length;
+            
+            // RETURN Verifier BITWISE XOR 0xCE4B
+            verifier ^= 0xCE4B; // (0x8000 | ('N' << 8) | 'K')
 
             // The byte order of the result shall be reversed [password 
"Example": 0x64CEED7E becomes 7EEDCE64],
             // and that value shall be hashed as defined by the attribute 
values.
             
-            LittleEndian.putShort(generatedKey, 0, (short)lowOrderWord);
+            LittleEndian.putShort(generatedKey, 0, verifier);
             LittleEndian.putShort(generatedKey, 2, (short)highOrderWord);
         }
         
@@ -424,7 +452,7 @@ public class CryptoFunctions {
      * @see <a 
href="http://msdn.microsoft.com/en-us/library/dd905229.aspx";>2.3.7.4 Binary 
Document Password Verifier Derivation Method 2</a>
      * 
      * @param password the password
-     * @return the verifier
+     * @return the verifier (actually a short value)
      */
     public static int createXorVerifier1(String password) {
         // the verifier for method 1 is part of the verifier for method 2
@@ -483,4 +511,25 @@ public class CryptoFunctions {
     private static byte rotateLeft(byte bits, int shift) {
         return (byte)(((bits & 0xff) << shift) | ((bits & 0xff) >>> (8 - 
shift)));
     }
+    
+    private static short rotateLeftBase15Bit(short verifier) {
+        /*
+         * IF (Verifier BITWISE AND 0x4000) is 0x0000
+         *    SET Intermediate1 TO 0
+         * ELSE
+         *    SET Intermediate1 TO 1
+         * ENDIF
+         */
+        short intermediate1 = (short)(((verifier & 0x4000) == 0) ? 0 : 1);
+        /*
+         *  SET Intermediate2 TO Verifier MULTIPLED BY 2
+         *  SET most significant bit of Intermediate2 TO 0
+         */
+        short intermediate2 = (short)((verifier<<1) & 0x7FFF);
+        /*
+         *  SET Intermediate3 TO Intermediate1 BITWISE OR Intermediate2
+         */
+        short intermediate3 = (short)(intermediate1 | intermediate2);
+        return intermediate3;
+    }
 }

Modified: 
poi/branches/xml_signature/src/java/org/apache/poi/poifs/crypt/HashAlgorithm.java
URL: 
http://svn.apache.org/viewvc/poi/branches/xml_signature/src/java/org/apache/poi/poifs/crypt/HashAlgorithm.java?rev=1625828&r1=1625827&r2=1625828&view=diff
==============================================================================
--- 
poi/branches/xml_signature/src/java/org/apache/poi/poifs/crypt/HashAlgorithm.java
 (original)
+++ 
poi/branches/xml_signature/src/java/org/apache/poi/poifs/crypt/HashAlgorithm.java
 Wed Sep 17 21:12:36 2014
@@ -68,4 +68,11 @@ public enum HashAlgorithm {
         }
         throw new EncryptedDocumentException("hash algorithm not found");
     }
+    
+    public static HashAlgorithm fromString(String string) {
+        for (HashAlgorithm ha : values()) {
+            if (ha.ecmaString.equalsIgnoreCase(string) || 
ha.jceId.equalsIgnoreCase(string)) return ha;
+        }
+        throw new EncryptedDocumentException("hash algorithm not found");
+    }
 }
\ No newline at end of file

Modified: 
poi/branches/xml_signature/src/java/org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java
URL: 
http://svn.apache.org/viewvc/poi/branches/xml_signature/src/java/org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java?rev=1625828&r1=1625827&r2=1625828&view=diff
==============================================================================
--- 
poi/branches/xml_signature/src/java/org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java
 (original)
+++ 
poi/branches/xml_signature/src/java/org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java
 Wed Sep 17 21:12:36 2014
@@ -153,7 +153,8 @@ public class NPOIFSFileSystem extends Bl
      *  when you're done to have the underlying file closed, as the file is
      *  kept open during normal operation to read the data out.</p> 
      *  
-     * @param file the File from which to read the data
+     * @param file the File from which to read or read/write the data
+     * @param readOnly whether the POIFileSystem will only be used in 
read-only mode
      *
      * @exception IOException on errors reading, or on invalid data
      */
@@ -165,20 +166,40 @@ public class NPOIFSFileSystem extends Bl
     
     /**
      * <p>Creates a POIFSFileSystem from an open <tt>FileChannel</tt>. This 
uses 
-     *  less memory than creating from an <tt>InputStream</tt>.</p>
+     *  less memory than creating from an <tt>InputStream</tt>. The stream will
+     *  be used in read-only mode.</p>
      *  
      * <p>Note that with this constructor, you will need to call {@link 
#close()}
      *  when you're done to have the underlying Channel closed, as the channel 
is
      *  kept open during normal operation to read the data out.</p> 
      *  
-     * @param channel the FileChannel from which to read and write the data
+     * @param channel the FileChannel from which to read the data
      *
      * @exception IOException on errors reading, or on invalid data
      */
     public NPOIFSFileSystem(FileChannel channel)
          throws IOException
     {
-       this(channel, null, false, false);
+       this(channel, true);
+    }
+    
+    /**
+     * <p>Creates a POIFSFileSystem from an open <tt>FileChannel</tt>. This 
uses 
+     *  less memory than creating from an <tt>InputStream</tt>.</p>
+     *  
+     * <p>Note that with this constructor, you will need to call {@link 
#close()}
+     *  when you're done to have the underlying Channel closed, as the channel 
is
+     *  kept open during normal operation to read the data out.</p> 
+     *  
+     * @param channel the FileChannel from which to read or read/write the data
+     * @param readOnly whether the POIFileSystem will only be used in 
read-only mode
+     *
+     * @exception IOException on errors reading, or on invalid data
+     */
+    public NPOIFSFileSystem(FileChannel channel, boolean readOnly)
+         throws IOException
+    {
+       this(channel, null, readOnly, false);
     }
     
     private NPOIFSFileSystem(FileChannel channel, File srcFile, boolean 
readOnly, boolean closeChannelOnError)

Modified: 
poi/branches/xml_signature/src/java/org/apache/poi/ss/SpreadsheetVersion.java
URL: 
http://svn.apache.org/viewvc/poi/branches/xml_signature/src/java/org/apache/poi/ss/SpreadsheetVersion.java?rev=1625828&r1=1625827&r2=1625828&view=diff
==============================================================================
--- 
poi/branches/xml_signature/src/java/org/apache/poi/ss/SpreadsheetVersion.java 
(original)
+++ 
poi/branches/xml_signature/src/java/org/apache/poi/ss/SpreadsheetVersion.java 
Wed Sep 17 21:12:36 2014
@@ -21,105 +21,111 @@ import org.apache.poi.ss.util.CellRefere
 
 /**
  * This enum allows spreadsheets from multiple Excel versions to be handled by 
the common code.
- * Properties of this enum correspond to attributes of the <i>spreadsheet</i> 
that are easily
+ * <p>Properties of this enum correspond to attributes of the 
<i>spreadsheet</i> that are easily
  * discernable to the user.  It is not intended to deal with low-level issues 
like file formats.
- * <p/>
- *
- * @author Josh Micich
- * @author Yegor Kozlov
  */
 public enum SpreadsheetVersion {
-       /**
-        * Excel97 format aka BIFF8
-        * <ul>
-        * <li>The total number of available columns is 256 (2^8)</li>
-        * <li>The total number of available rows is 64k (2^16)</li>
-        * <li>The maximum number of arguments to a function is 30</li>
-        * <li>Number of conditional format conditions on a cell is 3</li>
+    /**
+     * Excel97 format aka BIFF8
+     * <ul>
+     * <li>The total number of available columns is 256 (2^8)</li>
+     * <li>The total number of available rows is 64k (2^16)</li>
+     * <li>The maximum number of arguments to a function is 30</li>
+     * <li>Number of conditional format conditions on a cell is 3</li>
+     * <li>Number of cell styles is 4000</li>
      * <li>Length of text cell contents is 32767</li>
-        * </ul>
-        */
-       EXCEL97(0x10000, 0x0100, 30, 3, 32767),
-
-       /**
-        * Excel2007
-        *
-        * <ul>
-        * <li>The total number of available columns is 16K (2^14)</li>
-        * <li>The total number of available rows is 1M (2^20)</li>
-        * <li>The maximum number of arguments to a function is 255</li>
-        * <li>Number of conditional format conditions on a cell is unlimited
-        * (actually limited by available memory in Excel)</li>
+     * </ul>
+     */
+    EXCEL97(0x10000, 0x0100, 30, 3, 4000, 32767),
+
+    /**
+     * Excel2007
+     *
+     * <ul>
+     * <li>The total number of available columns is 16K (2^14)</li>
+     * <li>The total number of available rows is 1M (2^20)</li>
+     * <li>The maximum number of arguments to a function is 255</li>
+     * <li>Number of conditional format conditions on a cell is unlimited
+     * (actually limited by available memory in Excel)</li>
+     * <li>Number of cell styles is 64000</li>
      * <li>Length of text cell contents is 32767</li>
-        * <ul>
-        */
-       EXCEL2007(0x100000, 0x4000, 255, Integer.MAX_VALUE, 32767);
-
-       private final int _maxRows;
-       private final int _maxColumns;
-       private final int _maxFunctionArgs;
-       private final int _maxCondFormats;
+     * <ul>
+     */
+    EXCEL2007(0x100000, 0x4000, 255, Integer.MAX_VALUE, 64000, 32767);
+
+    private final int _maxRows;
+    private final int _maxColumns;
+    private final int _maxFunctionArgs;
+    private final int _maxCondFormats;
+    private final int _maxCellStyles;
     private final int _maxTextLength;
 
-       private SpreadsheetVersion(int maxRows, int maxColumns, int 
maxFunctionArgs, int maxCondFormats, int maxText) {
-               _maxRows = maxRows;
-               _maxColumns = maxColumns;
-               _maxFunctionArgs = maxFunctionArgs;
-               _maxCondFormats = maxCondFormats;
+    private SpreadsheetVersion(int maxRows, int maxColumns, int 
maxFunctionArgs, int maxCondFormats, int maxCellStyles, int maxText) {
+        _maxRows = maxRows;
+        _maxColumns = maxColumns;
+        _maxFunctionArgs = maxFunctionArgs;
+        _maxCondFormats = maxCondFormats;
+        _maxCellStyles = maxCellStyles;
         _maxTextLength = maxText;
     }
 
-       /**
-        * @return the maximum number of usable rows in each spreadsheet
-        */
-       public int getMaxRows() {
-               return _maxRows;
-       }
-
-       /**
-        * @return the last (maximum) valid row index, equals to <code> 
getMaxRows() - 1 </code>
-        */
-       public int getLastRowIndex() {
-               return _maxRows - 1;
-       }
-
-       /**
-        * @return the maximum number of usable columns in each spreadsheet
-        */
-       public int getMaxColumns() {
-               return _maxColumns;
-       }
-
-       /**
-        * @return the last (maximum) valid column index, equals to <code> 
getMaxColumns() - 1 </code>
-        */
-       public int getLastColumnIndex() {
-               return _maxColumns - 1;
-       }
-
-       /**
-        * @return the maximum number arguments that can be passed to a 
multi-arg function (e.g. COUNTIF)
-        */
-       public int getMaxFunctionArgs() {
-               return _maxFunctionArgs;
-       }
-
-       /**
-        *
-        * @return the maximum number of conditional format conditions on a cell
-        */
-       public int getMaxConditionalFormats() {
-               return _maxCondFormats;
-       }
-
-       /**
-        *
-        * @return the last valid column index in a ALPHA-26 representation
-        *  (<code>IV</code> or <code>XFD</code>).
-        */
-       public String getLastColumnName() {
-               return 
CellReference.convertNumToColString(getLastColumnIndex());
-       }
+    /**
+     * @return the maximum number of usable rows in each spreadsheet
+     */
+    public int getMaxRows() {
+        return _maxRows;
+    }
+
+    /**
+     * @return the last (maximum) valid row index, equals to <code> 
getMaxRows() - 1 </code>
+     */
+    public int getLastRowIndex() {
+        return _maxRows - 1;
+    }
+
+    /**
+     * @return the maximum number of usable columns in each spreadsheet
+     */
+    public int getMaxColumns() {
+        return _maxColumns;
+    }
+
+    /**
+     * @return the last (maximum) valid column index, equals to <code> 
getMaxColumns() - 1 </code>
+     */
+    public int getLastColumnIndex() {
+        return _maxColumns - 1;
+    }
+
+    /**
+     * @return the maximum number arguments that can be passed to a multi-arg 
function (e.g. COUNTIF)
+     */
+    public int getMaxFunctionArgs() {
+        return _maxFunctionArgs;
+    }
+
+    /**
+     * @return the maximum number of conditional format conditions on a cell
+     */
+    public int getMaxConditionalFormats() {
+        return _maxCondFormats;
+    }
+
+    /**
+     * @return the maximum number of cell styles per spreadsheet
+     */
+    public int getMaxCellStyles() {
+        return _maxCellStyles;
+    }
+
+    /**
+     *
+     * @return the last valid column index in a ALPHA-26 representation
+     *  (<code>IV</code> or <code>XFD</code>).
+     */
+    public String getLastColumnName() {
+        return CellReference.convertNumToColString(getLastColumnIndex());
+    }
 
     /**
      * @return the maximum length of a text cell
@@ -127,5 +133,4 @@ public enum SpreadsheetVersion {
     public int getMaxTextLength() {
         return _maxTextLength;
     }
-
 }

Modified: 
poi/branches/xml_signature/src/java/org/apache/poi/ss/formula/WorkbookEvaluator.java
URL: 
http://svn.apache.org/viewvc/poi/branches/xml_signature/src/java/org/apache/poi/ss/formula/WorkbookEvaluator.java?rev=1625828&r1=1625827&r2=1625828&view=diff
==============================================================================
--- 
poi/branches/xml_signature/src/java/org/apache/poi/ss/formula/WorkbookEvaluator.java
 (original)
+++ 
poi/branches/xml_signature/src/java/org/apache/poi/ss/formula/WorkbookEvaluator.java
 Wed Sep 17 21:12:36 2014
@@ -39,6 +39,7 @@ import org.apache.poi.ss.formula.eval.Nu
 import org.apache.poi.ss.formula.eval.OperandResolver;
 import org.apache.poi.ss.formula.eval.StringEval;
 import org.apache.poi.ss.formula.eval.ValueEval;
+import org.apache.poi.ss.formula.function.FunctionMetadataRegistry;
 import org.apache.poi.ss.formula.functions.Choose;
 import org.apache.poi.ss.formula.functions.FreeRefFunction;
 import org.apache.poi.ss.formula.functions.Function;
@@ -486,12 +487,15 @@ public final class WorkbookEvaluator {
                                                continue;
                                        }
                                        if (evaluatedPredicate) {
-                                               // nothing to skip - true param 
folows
+                                               // nothing to skip - true param 
follows
                                        } else {
                                                int dist = attrPtg.getData();
                                                i+= 
countTokensToBeSkipped(ptgs, i, dist);
                                                Ptg nextPtg = ptgs[i+1];
-                                               if (ptgs[i] instanceof AttrPtg 
&& nextPtg instanceof FuncVarPtg) {
+                                               if (ptgs[i] instanceof AttrPtg 
&& nextPtg instanceof FuncVarPtg && 
+                                                       // in order to verify 
that there is no third param, we need to check 
+                                                       // if we really have 
the IF next or some other FuncVarPtg as third param, e.g. ROW()/COLUMN()!
+                                                       
((FuncVarPtg)nextPtg).getFunctionIndex() == 
FunctionMetadataRegistry.FUNCTION_INDEX_IF) {
                                                        // this is an if 
statement without a false param (as opposed to MissingArgPtg as the false param)
                                                        i++;
                                                        
stack.push(BoolEval.FALSE);

Modified: poi/branches/xml_signature/src/java/org/apache/poi/util/ArrayUtil.java
URL: 
http://svn.apache.org/viewvc/poi/branches/xml_signature/src/java/org/apache/poi/util/ArrayUtil.java?rev=1625828&r1=1625827&r2=1625828&view=diff
==============================================================================
--- poi/branches/xml_signature/src/java/org/apache/poi/util/ArrayUtil.java 
(original)
+++ poi/branches/xml_signature/src/java/org/apache/poi/util/ArrayUtil.java Wed 
Sep 17 21:12:36 2014
@@ -106,89 +106,4 @@ public class ArrayUtil
        // We're done - array will now have everything moved as required
     }
 
-    /**
-     * Copies the specified array, truncating or padding with zeros (if
-     * necessary) so the copy has the specified length. This method is 
temporary
-     * replace for Arrays.copyOf() until we start to require JDK 1.6.
-     * 
-     * @param source
-     *            the array to be copied
-     * @param newLength
-     *            the length of the copy to be returned
-     * @return a copy of the original array, truncated or padded with zeros to
-     *         obtain the specified length
-     * @throws NegativeArraySizeException
-     *             if <tt>newLength</tt> is negative
-     * @throws NullPointerException
-     *             if <tt>original</tt> is null
-     */
-    public static byte[] copyOf( byte[] source, int newLength )
-    {
-        byte[] result = new byte[newLength];
-        System.arraycopy( source, 0, result, 0,
-                Math.min( source.length, newLength ) );
-        return result;
-    }
-
-    /**
-     * Copies the specified array into specified result array, truncating or
-     * padding with zeros (if necessary) so the copy has the specified length.
-     * This method is temporary replace for Arrays.copyOf() until we start to
-     * require JDK 1.6.
-     * 
-     * @param source
-     *            the array to be copied
-     * @param result
-     *            the array to be filled and returned
-     * @throws NegativeArraySizeException
-     *             if <tt>newLength</tt> is negative
-     * @throws NullPointerException
-     *             if <tt>original</tt> is null
-     */
-    public static <T> T[] copyOf( T[] source, T[] result )
-    {
-        System.arraycopy( source, 0, result, 0,
-                Math.min( source.length, result.length ) );
-        return result;
-    }
-
-    /**
-     * Copies the specified range of the specified array into a new array.
-     * The initial index of the range (<tt>from</tt>) must lie between zero
-     * and <tt>original.length</tt>, inclusive.  The value at
-     * <tt>original[from]</tt> is placed into the initial element of the copy
-     * (unless <tt>from == original.length</tt> or <tt>from == to</tt>).
-     * Values from subsequent elements in the original array are placed into
-     * subsequent elements in the copy.  The final index of the range
-     * (<tt>to</tt>), which must be greater than or equal to <tt>from</tt>,
-     * may be greater than <tt>original.length</tt>, in which case
-     * <tt>(byte)0</tt> is placed in all elements of the copy whose index is
-     * greater than or equal to <tt>original.length - from</tt>.  The length
-     * of the returned array will be <tt>to - from</tt>.
-     *
-     * This method is temporary
-     * replace for Arrays.copyOfRange() until we start to require JDK 1.6.
-     *
-     * @param original the array from which a range is to be copied
-     * @param from the initial index of the range to be copied, inclusive
-     * @param to the final index of the range to be copied, exclusive.
-     *     (This index may lie outside the array.)
-     * @return a new array containing the specified range from the original 
array,
-     *     truncated or padded with zeros to obtain the required length
-     * @throws ArrayIndexOutOfBoundsException if <tt>from &lt; 0</tt>
-     *     or <tt>from &gt; original.length()</tt>
-     * @throws IllegalArgumentException if <tt>from &gt; to</tt>
-     * @throws NullPointerException if <tt>original</tt> is null
-     * @since 1.6
-     */
-    public static byte[] copyOfRange(byte[] original, int from, int to) {
-        int newLength = to - from;
-        if (newLength < 0)
-            throw new IllegalArgumentException(from + " > " + to);
-        byte[] copy = new byte[newLength];
-        System.arraycopy(original, from, copy, 0,
-                Math.min(original.length - from, newLength));
-        return copy;
-    }
-
 }

Modified: poi/branches/xml_signature/src/java/org/apache/poi/util/XMLHelper.java
URL: 
http://svn.apache.org/viewvc/poi/branches/xml_signature/src/java/org/apache/poi/util/XMLHelper.java?rev=1625828&r1=1625827&r2=1625828&view=diff
==============================================================================
--- poi/branches/xml_signature/src/java/org/apache/poi/util/XMLHelper.java 
(original)
+++ poi/branches/xml_signature/src/java/org/apache/poi/util/XMLHelper.java Wed 
Sep 17 21:12:36 2014
@@ -19,7 +19,6 @@ package org.apache.poi.util;
 
 import javax.xml.XMLConstants;
 import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
 
 /**
  * Helper methods for working with javax.xml classes.
@@ -27,22 +26,31 @@ import javax.xml.parsers.ParserConfigura
  */
 public final class XMLHelper
 {
+    private static POILogger logger = POILogFactory.getLogger(XMLHelper.class);
+    
     /**
      * Creates a new DocumentBuilderFactory, with sensible defaults
      */
     public static DocumentBuilderFactory getDocumentBuilderFactory() {
+        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+        factory.setExpandEntityReferences(false);
+        trySetSAXFeature(factory, XMLConstants.FEATURE_SECURE_PROCESSING, 
true);
+        trySetSAXFeature(factory, 
"http://xml.org/sax/features/external-general-entities";, false);
+        trySetSAXFeature(factory, 
"http://xml.org/sax/features/external-parameter-entities";, false);
+        trySetSAXFeature(factory, 
"http://apache.org/xml/features/nonvalidating/load-external-dtd";, false);
+        trySetSAXFeature(factory, 
"http://apache.org/xml/features/nonvalidating/load-dtd-grammar";, false);
+        return factory;
+    }
+    
+    private static void trySetSAXFeature(DocumentBuilderFactory 
documentBuilderFactory, String feature, boolean enabled) {
         try {
-            DocumentBuilderFactory factory = 
DocumentBuilderFactory.newInstance();
-            factory.setXIncludeAware(false);
-            factory.setExpandEntityReferences(false);
-            factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
-            
factory.setFeature("http://xml.org/sax/features/external-general-entities";, 
false);
-            
factory.setFeature("http://xml.org/sax/features/external-parameter-entities";, 
false);
-            
factory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd";,
 false);
-            
factory.setFeature("http://apache.org/xml/features/nonvalidating/load-dtd-grammar";,
 false);
-            return factory;
-        } catch (ParserConfigurationException e) {
-            throw new RuntimeException("Broken XML Setup", e);
+            documentBuilderFactory.setFeature(feature, enabled);
+        } catch (Exception e) {
+            logger.log(POILogger.WARN, "SAX Feature unsupported", feature, e);
+        } catch (AbstractMethodError ame) {
+            logger.log(POILogger.WARN, "Cannot set SAX feature because 
outdated XML parser in classpath", feature, ame);
         }
     }
+    
+
 }

Modified: 
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/POIXMLProperties.java
URL: 
http://svn.apache.org/viewvc/poi/branches/xml_signature/src/ooxml/java/org/apache/poi/POIXMLProperties.java?rev=1625828&r1=1625827&r2=1625828&view=diff
==============================================================================
--- 
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/POIXMLProperties.java 
(original)
+++ 
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/POIXMLProperties.java 
Wed Sep 17 21:12:36 2014
@@ -285,6 +285,117 @@ public class POIXMLProperties {
                public 
org.openxmlformats.schemas.officeDocument.x2006.extendedProperties.CTProperties 
getUnderlyingProperties() {
                        return props.getProperties();
                }
+               
+        public String getTemplate() {
+            if (props.getProperties().isSetTemplate()) {
+                return props.getProperties().getTemplate();
+            }
+            return null;
+        }
+        public String getManager() {
+            if (props.getProperties().isSetManager()) {
+                return props.getProperties().getManager();
+            }
+            return null;
+        }
+        public String getCompany() {
+            if (props.getProperties().isSetCompany()) {
+                return props.getProperties().getCompany();
+            }
+            return null;
+        }
+        public String getPresentationFormat() {
+            if (props.getProperties().isSetPresentationFormat()) {
+                return props.getProperties().getPresentationFormat();
+            }
+            return null;
+        }
+        public String getApplication() {
+            if (props.getProperties().isSetApplication()) {
+                return props.getProperties().getApplication();
+            }
+            return null;
+        }
+        public String getAppVersion() {
+            if (props.getProperties().isSetAppVersion()) {
+                return props.getProperties().getAppVersion();
+            }
+            return null;
+        }
+
+        public int getPages() {
+            if (props.getProperties().isSetPages()) {
+                return props.getProperties().getPages();
+            }
+            return -1;
+        }
+        public int getWords() {
+            if (props.getProperties().isSetWords()) {
+                return props.getProperties().getWords();
+            }
+            return -1;
+        }
+        public int getCharacters() {
+            if (props.getProperties().isSetCharacters()) {
+                return props.getProperties().getCharacters();
+            }
+            return -1;
+        }
+        public int getCharactersWithSpaces() {
+            if (props.getProperties().isSetCharactersWithSpaces()) {
+                return props.getProperties().getCharactersWithSpaces();
+            }
+            return -1;
+        }
+        public int getLines() {
+            if (props.getProperties().isSetLines()) {
+                return props.getProperties().getLines();
+            }
+            return -1;
+        }
+        public int getParagraphs() {
+            if (props.getProperties().isSetParagraphs()) {
+                return props.getProperties().getParagraphs();
+            }
+            return -1;
+        }
+        public int getSlides() {
+            if (props.getProperties().isSetSlides()) {
+                return props.getProperties().getSlides();
+            }
+            return -1;
+        }
+        public int getNotes() {
+            if (props.getProperties().isSetNotes()) {
+                return props.getProperties().getNotes();
+            }
+            return -1;
+        }
+        public int getTotalTime()  {
+            if (props.getProperties().isSetTotalTime()) {
+                return props.getProperties().getTotalTime();
+            }
+            return -1;
+        }
+        public int getHiddenSlides()  {
+            if (props.getProperties().isSetHiddenSlides()) {
+                return props.getProperties().getHiddenSlides();
+            }
+            return -1;
+        }
+        public int getMMClips() {
+            if (props.getProperties().isSetMMClips()) {
+                return props.getProperties().getMMClips();
+            }
+            return -1;
+        }
+
+        public String getHyperlinkBase() {
+            if (props.getProperties().isSetHyperlinkBase()) {
+                return props.getProperties().getHyperlinkBase();
+            }
+            return null;
+        }
        }
 
        /**
@@ -371,25 +482,46 @@ public class POIXMLProperties {
                 *
                 * @return next property id starting with 2
                 */
-               protected int nextPid(){
+               @SuppressWarnings("deprecation")
+        protected int nextPid(){
                        int propid = 1;
-                       for(CTProperty p : 
props.getProperties().getPropertyList()){
+                       for(CTProperty p : 
props.getProperties().getPropertyArray()){
                                if(p.getPid() > propid) propid = p.getPid();
                        }
                        return propid + 1;
                }
 
-               /**
-                * Check if a property with this name already exists in the 
collection of custom properties
-                *
-                * @param name the name to check
-                * @return whether a property with the given name exists in the 
custom properties
-                */
-               public boolean contains(String name){
-                       for(CTProperty p : 
props.getProperties().getPropertyList()){
-                               if(p.getName().equals(name)) return true;
-                       }
-                       return false;
-               }
-       }
+       /**
+         * Check if a property with this name already exists in the collection 
of custom properties
+         *
+         * @param name the name to check
+         * @return whether a property with the given name exists in the custom 
properties
+         */
+        @SuppressWarnings("deprecation")
+        public boolean contains(String name) {
+            for(CTProperty p : props.getProperties().getPropertyArray()){
+                if(p.getName().equals(name)) return true;
+            }
+            return false;
+        }
+        
+        /**
+         * Retrieve the custom property with this name, or null if none exists.
+         *
+         * You will need to test the various isSetX methods to work out
+         *  what the type of the property is, before fetching the 
+         *  appropriate value for it.
+         *
+         * @param name the name of the property to fetch
+         */
+        @SuppressWarnings("deprecation")
+        public CTProperty getProperty(String name) {
+            for(CTProperty p : props.getProperties().getPropertyArray()){
+                if(p.getName().equals(name)) {
+                    return p;
+                }
+            }
+            return null;
+        }
+    }
 }

Modified: 
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/POIXMLPropertiesTextExtractor.java
URL: 
http://svn.apache.org/viewvc/poi/branches/xml_signature/src/ooxml/java/org/apache/poi/POIXMLPropertiesTextExtractor.java?rev=1625828&r1=1625827&r2=1625828&view=diff
==============================================================================
--- 
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/POIXMLPropertiesTextExtractor.java
 (original)
+++ 
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/POIXMLPropertiesTextExtractor.java
 Wed Sep 17 21:12:36 2014
@@ -19,7 +19,6 @@ package org.apache.poi;
 
 import java.math.BigDecimal;
 import java.util.Date;
-import java.util.List;
 
 import org.apache.poi.openxml4j.opc.internal.PackagePropertiesPart;
 import 
org.openxmlformats.schemas.officeDocument.x2006.customProperties.CTProperty;
@@ -126,13 +125,13 @@ public class POIXMLPropertiesTextExtract
     * Returns the custom document properties, if
     *  there are any
     */
+   @SuppressWarnings("deprecation")
    public String getCustomPropertiesText() {
-      StringBuffer text = new StringBuffer();
+      StringBuilder text = new StringBuilder();
       
org.openxmlformats.schemas.officeDocument.x2006.customProperties.CTProperties
       props = 
getDocument().getProperties().getCustomProperties().getUnderlyingProperties();
 
-      List<CTProperty> properties = props.getPropertyList();
-      for(CTProperty property : properties) {
+       for(CTProperty property : props.getPropertyArray()) {
          String val = "(not implemented!)";
 
          if (property.isSetLpwstr()) {

Modified: 
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/openxml4j/opc/PackageRelationshipCollection.java
URL: 
http://svn.apache.org/viewvc/poi/branches/xml_signature/src/ooxml/java/org/apache/poi/openxml4j/opc/PackageRelationshipCollection.java?rev=1625828&r1=1625827&r2=1625828&view=diff
==============================================================================
--- 
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/openxml4j/opc/PackageRelationshipCollection.java
 (original)
+++ 
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/openxml4j/opc/PackageRelationshipCollection.java
 Wed Sep 17 21:12:36 2014
@@ -24,9 +24,9 @@ import java.util.TreeMap;
 
 import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
 import org.apache.poi.openxml4j.exceptions.InvalidOperationException;
+import org.apache.poi.util.DocumentHelper;
 import org.apache.poi.util.POILogFactory;
 import org.apache.poi.util.POILogger;
-import org.apache.poi.util.SAXHelper;
 import org.w3c.dom.Attr;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -311,7 +311,7 @@ public final class PackageRelationshipCo
             throws InvalidFormatException {
         try {
             logger.log(POILogger.DEBUG, "Parsing relationship: " + 
relPart.getPartName());
-            Document xmlRelationshipsDoc = 
SAXHelper.readSAXDocument(relPart.getInputStream());
+            Document xmlRelationshipsDoc = 
DocumentHelper.readDocument(relPart.getInputStream());
 
             // Browse default types
             Element root = xmlRelationshipsDoc.getDocumentElement();

Modified: 
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ContentTypeManager.java
URL: 
http://svn.apache.org/viewvc/poi/branches/xml_signature/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ContentTypeManager.java?rev=1625828&r1=1625827&r2=1625828&view=diff
==============================================================================
--- 
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ContentTypeManager.java
 (original)
+++ 
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ContentTypeManager.java
 Wed Sep 17 21:12:36 2014
@@ -33,7 +33,6 @@ import org.apache.poi.openxml4j.opc.Pack
 import org.apache.poi.openxml4j.opc.PackagePartName;
 import org.apache.poi.openxml4j.opc.PackagingURIHelper;
 import org.apache.poi.util.DocumentHelper;
-import org.apache.poi.util.SAXHelper;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.NodeList;
@@ -370,7 +369,7 @@ public abstract class ContentTypeManager
        private void parseContentTypesFile(InputStream in)
                        throws InvalidFormatException {
                try {
-                       Document xmlContentTypetDoc = 
SAXHelper.readSAXDocument(in);
+                       Document xmlContentTypetDoc = 
DocumentHelper.readDocument(in);
 
                        // Default content types
                        NodeList defaultTypes = 
xmlContentTypetDoc.getDocumentElement().getElementsByTagName(DEFAULT_TAG_NAME);

Modified: 
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/unmarshallers/PackagePropertiesUnmarshaller.java
URL: 
http://svn.apache.org/viewvc/poi/branches/xml_signature/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/unmarshallers/PackagePropertiesUnmarshaller.java?rev=1625828&r1=1625827&r2=1625828&view=diff
==============================================================================
--- 
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/unmarshallers/PackagePropertiesUnmarshaller.java
 (original)
+++ 
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/unmarshallers/PackagePropertiesUnmarshaller.java
 Wed Sep 17 21:12:36 2014
@@ -31,7 +31,7 @@ import org.apache.poi.openxml4j.opc.ZipP
 import org.apache.poi.openxml4j.opc.internal.PackagePropertiesPart;
 import org.apache.poi.openxml4j.opc.internal.PartUnmarshaller;
 import org.apache.poi.openxml4j.opc.internal.ZipHelper;
-import org.apache.poi.util.SAXHelper;
+import org.apache.poi.util.DocumentHelper;
 import org.w3c.dom.Attr;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -105,7 +105,7 @@ public final class PackagePropertiesUnma
 
                Document xmlDoc;
                try {
-                       xmlDoc = SAXHelper.readSAXDocument(in);
+                       xmlDoc = DocumentHelper.readDocument(in);
 
                        /* Check OPC compliance */
 

Modified: 
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/poifs/crypt/dsig/SignatureInfo.java
URL: 
http://svn.apache.org/viewvc/poi/branches/xml_signature/src/ooxml/java/org/apache/poi/poifs/crypt/dsig/SignatureInfo.java?rev=1625828&r1=1625827&r2=1625828&view=diff
==============================================================================
--- 
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/poifs/crypt/dsig/SignatureInfo.java
 (original)
+++ 
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/poifs/crypt/dsig/SignatureInfo.java
 Wed Sep 17 21:12:36 2014
@@ -57,9 +57,9 @@ import org.apache.poi.poifs.crypt.HashAl
 import org.apache.poi.poifs.crypt.dsig.services.RelationshipTransformService;
 import org.apache.poi.poifs.crypt.dsig.services.XmlSignatureService;
 import org.apache.poi.poifs.crypt.dsig.spi.DigestInfo;
+import org.apache.poi.util.DocumentHelper;
 import org.apache.poi.util.POILogFactory;
 import org.apache.poi.util.POILogger;
-import org.apache.poi.util.SAXHelper;
 import org.apache.xml.security.Init;
 import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.XmlException;
@@ -127,7 +127,7 @@ public class SignatureInfo {
     throws NoSuchAlgorithmException, IOException, MarshalException, 
ParserConfigurationException, XmlException {
         XmlSignatureService signatureService = 
createSignatureService(hashAlgo, pkg);
 
-        Document document = SAXHelper.getDocumentBuilder().newDocument();
+        Document document = DocumentHelper.createDocument();
         
         // operate
         List<X509Certificate> x509Chain = Collections.singletonList(x509);
@@ -181,7 +181,7 @@ public class SignatureInfo {
             KeyInfoKeySelector keySelector = new KeyInfoKeySelector();
 
             try {
-                Document doc = 
SAXHelper.readSAXDocument(signaturePart.getInputStream());
+                Document doc = 
DocumentHelper.readDocument(signaturePart.getInputStream());
                 // dummy call to createSignatureService to tweak document 
afterwards
                 createSignatureService(HashAlgorithm.sha1, 
pkg).registerIds(doc);
                 

Modified: 
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/util/DocumentHelper.java
URL: 
http://svn.apache.org/viewvc/poi/branches/xml_signature/src/ooxml/java/org/apache/poi/util/DocumentHelper.java?rev=1625828&r1=1625827&r2=1625828&view=diff
==============================================================================
--- 
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/util/DocumentHelper.java
 (original)
+++ 
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/util/DocumentHelper.java
 Wed Sep 17 21:12:36 2014
@@ -17,6 +17,10 @@
 
 package org.apache.poi.util;
 
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Method;
+
 import javax.xml.XMLConstants;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
@@ -25,20 +29,81 @@ import javax.xml.stream.events.Namespace
 
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
+import org.xml.sax.SAXException;
 
-public class DocumentHelper {
+public final class DocumentHelper {
+    private static POILogger logger = 
POILogFactory.getLogger(DocumentHelper.class);
+    
+    private DocumentHelper() {}
 
-    private static final DocumentBuilder newDocumentBuilder;
-    static {
+    /**
+     * Creates a new document builder, with sensible defaults
+     */
+    public static synchronized DocumentBuilder newDocumentBuilder() {
         try {
-            newDocumentBuilder = 
DocumentBuilderFactory.newInstance().newDocumentBuilder();
+            DocumentBuilder documentBuilder = 
documentBuilderFactory.newDocumentBuilder();
+            
documentBuilder.setEntityResolver(SAXHelper.IGNORING_ENTITY_RESOLVER);
+            return documentBuilder;
         } catch (ParserConfigurationException e) {
             throw new IllegalStateException("cannot create a DocumentBuilder", 
e);
         }
     }
 
+    private static final DocumentBuilderFactory documentBuilderFactory = 
DocumentBuilderFactory.newInstance();
+    static {
+        documentBuilderFactory.setNamespaceAware(true);
+        documentBuilderFactory.setValidating(false);
+        trySetSAXFeature(documentBuilderFactory, 
XMLConstants.FEATURE_SECURE_PROCESSING, true);
+        trySetXercesSecurityManager(documentBuilderFactory);
+    }
+
+    private static void trySetSAXFeature(DocumentBuilderFactory 
documentBuilderFactory, String feature, boolean enabled) {
+        try {
+            documentBuilderFactory.setFeature(feature, enabled);
+        } catch (Exception e) {
+            logger.log(POILogger.WARN, "SAX Feature unsupported", feature, e);
+        } catch (AbstractMethodError ame) {
+            logger.log(POILogger.WARN, "Cannot set SAX feature because 
outdated XML parser in classpath", feature, ame);
+        }
+    }
+    
+    private static void trySetXercesSecurityManager(DocumentBuilderFactory 
documentBuilderFactory) {
+        // Try built-in JVM one first, standalone if not
+        for (String securityManagerClassName : new String[] {
+                "com.sun.org.apache.xerces.internal.util.SecurityManager",
+                "org.apache.xerces.util.SecurityManager"
+        }) {
+            try {
+                Object mgr = 
Class.forName(securityManagerClassName).newInstance();
+                Method setLimit = 
mgr.getClass().getMethod("setEntityExpansionLimit", Integer.TYPE);
+                setLimit.invoke(mgr, 4096);
+                
documentBuilderFactory.setAttribute("http://apache.org/xml/properties/security-manager";,
 mgr);
+                // Stop once one can be setup without error
+                return;
+            } catch (Exception e) {
+                logger.log(POILogger.WARN, "SAX Security Manager could not be 
setup", e);
+            }
+        }
+    }
+
+    /**
+     * Parses the given stream via the default (sensible)
+     * DocumentBuilder
+     * @param inp Stream to read the XML data from
+     * @return the parsed Document 
+     */
+    public static Document readDocument(InputStream inp) throws IOException, 
SAXException {
+        return newDocumentBuilder().parse(inp);
+    }
+
+    // must only be used to create empty documents, do not use it for parsing!
+    private static final DocumentBuilder documentBuilderSingleton = 
newDocumentBuilder();
+
+    /**
+     * Creates a new DOM Document
+     */
     public static synchronized Document createDocument() {
-        return newDocumentBuilder.newDocument();
+        return documentBuilderSingleton.newDocument();
     }
 
     /**

Propchange: 
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/util/SAXHelper.java
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Wed Sep 17 21:12:36 2014
@@ -0,0 +1,3 @@
+/poi/branches/excelant/src/ooxml/java/org/apache/poi/util/SAXHelper.java:1069732-1073692
+/poi/branches/gsoc2012/src/ooxml/java/org/apache/poi/util/SAXHelper.java:1341450-1371650
+/poi/trunk/src/ooxml/java/org/apache/poi/util/SAXHelper.java:693591-694881,695264-695420,695621,695649-711764

Modified: 
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xslf/XSLFSlideShow.java
URL: 
http://svn.apache.org/viewvc/poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xslf/XSLFSlideShow.java?rev=1625828&r1=1625827&r2=1625828&view=diff
==============================================================================
--- 
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xslf/XSLFSlideShow.java
 (original)
+++ 
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xslf/XSLFSlideShow.java
 Wed Sep 17 21:12:36 2014
@@ -31,7 +31,20 @@ import org.apache.poi.util.Internal;
 import org.apache.poi.xslf.usermodel.XMLSlideShow;
 import org.apache.poi.xslf.usermodel.XSLFRelation;
 import org.apache.xmlbeans.XmlException;
-import org.openxmlformats.schemas.presentationml.x2006.main.*;
+import org.openxmlformats.schemas.presentationml.x2006.main.CTCommentList;
+import org.openxmlformats.schemas.presentationml.x2006.main.CTNotesSlide;
+import org.openxmlformats.schemas.presentationml.x2006.main.CTPresentation;
+import org.openxmlformats.schemas.presentationml.x2006.main.CTSlide;
+import org.openxmlformats.schemas.presentationml.x2006.main.CTSlideIdList;
+import org.openxmlformats.schemas.presentationml.x2006.main.CTSlideIdListEntry;
+import org.openxmlformats.schemas.presentationml.x2006.main.CTSlideMaster;
+import 
org.openxmlformats.schemas.presentationml.x2006.main.CTSlideMasterIdList;
+import 
org.openxmlformats.schemas.presentationml.x2006.main.CTSlideMasterIdListEntry;
+import org.openxmlformats.schemas.presentationml.x2006.main.CmLstDocument;
+import org.openxmlformats.schemas.presentationml.x2006.main.NotesDocument;
+import 
org.openxmlformats.schemas.presentationml.x2006.main.PresentationDocument;
+import org.openxmlformats.schemas.presentationml.x2006.main.SldDocument;
+import org.openxmlformats.schemas.presentationml.x2006.main.SldMasterDocument;
 
 /**
  * Experimental class to do low level processing of pptx files.
@@ -53,6 +66,7 @@ public class XSLFSlideShow extends POIXM
      */
     private List<PackagePart> embedds;
 
+    @SuppressWarnings("deprecation")
        public XSLFSlideShow(OPCPackage container) throws OpenXML4JException, 
IOException, XmlException {
                super(container);
                
@@ -64,7 +78,7 @@ public class XSLFSlideShow extends POIXM
                        
PresentationDocument.Factory.parse(getCorePart().getInputStream());
                
       embedds = new LinkedList<PackagePart>();
-      for (CTSlideIdListEntry ctSlide : getSlideReferences().getSldIdList()) {
+      for (CTSlideIdListEntry ctSlide : getSlideReferences().getSldIdArray()) {
              PackagePart corePart = getCorePart();
                  PackagePart slidePart = corePart.getRelatedPart(
                        corePart.getRelationship(ctSlide.getId2()));

Modified: 
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xslf/extractor/XSLFPowerPointExtractor.java
URL: 
http://svn.apache.org/viewvc/poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xslf/extractor/XSLFPowerPointExtractor.java?rev=1625828&r1=1625827&r2=1625828&view=diff
==============================================================================
--- 
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xslf/extractor/XSLFPowerPointExtractor.java
 (original)
+++ 
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xslf/extractor/XSLFPowerPointExtractor.java
 Wed Sep 17 21:12:36 2014
@@ -118,6 +118,7 @@ public class XSLFPowerPointExtractor ext
     * @param notesText Should we retrieve text from notes?
     * @param masterText Should we retrieve text from master slides?
     */
+   @SuppressWarnings("deprecation")
    public String getText(boolean slideText, boolean notesText, boolean 
masterText) {
       StringBuffer text = new StringBuffer();
 
@@ -150,7 +151,7 @@ public class XSLFPowerPointExtractor ext
 
                // If the slide has comments, do those too
                if (comments != null) {
-                  for (CTComment comment : 
comments.getCTCommentsList().getCmList()) {
+                  for (CTComment comment : 
comments.getCTCommentsList().getCmArray()) {
                      // Do the author if we can
                      if (commentAuthors != null) {
                         CTCommentAuthor author = 
commentAuthors.getAuthorById(comment.getAuthorId());

Modified: 
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xslf/model/geom/CustomGeometry.java
URL: 
http://svn.apache.org/viewvc/poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xslf/model/geom/CustomGeometry.java?rev=1625828&r1=1625827&r2=1625828&view=diff
==============================================================================
--- 
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xslf/model/geom/CustomGeometry.java
 (original)
+++ 
poi/branches/xml_signature/src/ooxml/java/org/apache/poi/xslf/model/geom/CustomGeometry.java
 Wed Sep 17 21:12:36 2014
@@ -19,12 +19,17 @@
 
 package org.apache.poi.xslf.model.geom;
 
-import org.openxmlformats.schemas.drawingml.x2006.main.*;
-
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 
+import org.openxmlformats.schemas.drawingml.x2006.main.CTCustomGeometry2D;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTGeomGuide;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTGeomGuideList;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTGeomRect;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTPath2D;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTPath2DList;
+
 /**
  * Definition of a custom geometric shape
  *
@@ -36,19 +41,20 @@ public class CustomGeometry implements I
     List<Path> paths = new ArrayList<Path>();
     Path textBounds;
 
+    @SuppressWarnings("deprecation")
     public CustomGeometry(CTCustomGeometry2D geom) {
         CTGeomGuideList avLst = geom.getAvLst();
-        if(avLst != null) for(CTGeomGuide gd : avLst.getGdList()){
+        if(avLst != null) for(CTGeomGuide gd : avLst.getGdArray()){
             adjusts.add(new AdjustValue(gd));
         }
 
         CTGeomGuideList gdLst = geom.getGdLst();
-        if(gdLst != null) for(CTGeomGuide gd : gdLst.getGdList()){
+        if(gdLst != null) for(CTGeomGuide gd : gdLst.getGdArray()){
             guides.add(new Guide(gd));
         }
 
         CTPath2DList pathLst = geom.getPathLst();
-        if(pathLst != null) for(CTPath2D spPath : pathLst.getPathList()){
+        if(pathLst != null) for(CTPath2D spPath : pathLst.getPathArray()){
             paths.add(new Path(spPath));
         }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to