You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ki...@apache.org on 2018/08/31 00:25:51 UTC

svn commit: r1839709 [1/7] - in /poi: site/src/documentation/content/xdocs/components/poifs/ trunk/src/examples/src/org/apache/poi/hpsf/examples/ trunk/src/java/org/apache/poi/ trunk/src/java/org/apache/poi/extractor/ trunk/src/java/org/apache/poi/hpsf...

Author: kiwiwings
Date: Fri Aug 31 00:25:50 2018
New Revision: 1839709

URL: http://svn.apache.org/viewvc?rev=1839709&view=rev
Log:
#62649 - Remove OPOIFS* / rename NPOIFS* to POIFS*

Added:
    poi/trunk/src/java/org/apache/poi/poifs/filesystem/DocumentInputStream.java
      - copied, changed from r1839708, poi/trunk/src/java/org/apache/poi/poifs/filesystem/NDocumentInputStream.java
    poi/trunk/src/java/org/apache/poi/poifs/filesystem/DocumentOutputStream.java
      - copied, changed from r1839708, poi/trunk/src/java/org/apache/poi/poifs/filesystem/NDocumentOutputStream.java
    poi/trunk/src/java/org/apache/poi/poifs/filesystem/POIFSDocument.java
      - copied, changed from r1839708, poi/trunk/src/java/org/apache/poi/poifs/filesystem/NPOIFSDocument.java
    poi/trunk/src/java/org/apache/poi/poifs/filesystem/POIFSFileSystem.java
      - copied, changed from r1839708, poi/trunk/src/java/org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java
    poi/trunk/src/java/org/apache/poi/poifs/filesystem/POIFSMiniStore.java
      - copied, changed from r1839708, poi/trunk/src/java/org/apache/poi/poifs/filesystem/NPOIFSMiniStore.java
    poi/trunk/src/java/org/apache/poi/poifs/filesystem/POIFSStream.java
      - copied, changed from r1839708, poi/trunk/src/java/org/apache/poi/poifs/filesystem/NPOIFSStream.java
    poi/trunk/src/java/org/apache/poi/poifs/property/PropertyTable.java
      - copied, changed from r1839708, poi/trunk/src/java/org/apache/poi/poifs/property/NPropertyTable.java
    poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestPOIFSMiniStore.java
      - copied, changed from r1839708, poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestNPOIFSMiniStore.java
    poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestPOIFSStream.java
      - copied, changed from r1839708, poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestNPOIFSStream.java
Removed:
    poi/trunk/src/java/org/apache/poi/poifs/filesystem/NDocumentInputStream.java
    poi/trunk/src/java/org/apache/poi/poifs/filesystem/NDocumentOutputStream.java
    poi/trunk/src/java/org/apache/poi/poifs/filesystem/NPOIFSDocument.java
    poi/trunk/src/java/org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java
    poi/trunk/src/java/org/apache/poi/poifs/filesystem/NPOIFSMiniStore.java
    poi/trunk/src/java/org/apache/poi/poifs/filesystem/NPOIFSStream.java
    poi/trunk/src/java/org/apache/poi/poifs/property/NPropertyTable.java
    poi/trunk/src/java/org/apache/poi/poifs/property/PropertyTableBase.java
    poi/trunk/src/java/org/apache/poi/poifs/storage/BigBlock.java
    poi/trunk/src/java/org/apache/poi/poifs/storage/BlockAllocationTableReader.java
    poi/trunk/src/java/org/apache/poi/poifs/storage/BlockAllocationTableWriter.java
    poi/trunk/src/java/org/apache/poi/poifs/storage/BlockList.java
    poi/trunk/src/java/org/apache/poi/poifs/storage/BlockListImpl.java
    poi/trunk/src/java/org/apache/poi/poifs/storage/DataInputBlock.java
    poi/trunk/src/java/org/apache/poi/poifs/storage/DocumentBlock.java
    poi/trunk/src/java/org/apache/poi/poifs/storage/HeaderBlockWriter.java
    poi/trunk/src/java/org/apache/poi/poifs/storage/ListManagedBlock.java
    poi/trunk/src/java/org/apache/poi/poifs/storage/PropertyBlock.java
    poi/trunk/src/java/org/apache/poi/poifs/storage/RawDataBlock.java
    poi/trunk/src/java/org/apache/poi/poifs/storage/RawDataBlockList.java
    poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestNPOIFSFileSystem.java
    poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestNPOIFSMiniStore.java
    poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestNPOIFSStream.java
    poi/trunk/src/testcases/org/apache/poi/poifs/storage/LocalRawDataBlockList.java
    poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestBlockAllocationTableReader.java
    poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestBlockAllocationTableWriter.java
    poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestBlockListImpl.java
    poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestDocumentBlock.java
    poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestHeaderBlockWriting.java
    poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestPropertyBlock.java
    poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestRawDataBlock.java
    poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestRawDataBlockList.java
Modified:
    poi/site/src/documentation/content/xdocs/components/poifs/how-to.xml
    poi/trunk/src/examples/src/org/apache/poi/hpsf/examples/ModifyDocumentSummaryInformation.java
    poi/trunk/src/java/org/apache/poi/POIDocument.java
    poi/trunk/src/java/org/apache/poi/POIReadOnlyDocument.java
    poi/trunk/src/java/org/apache/poi/extractor/OLE2ExtractorFactory.java
    poi/trunk/src/java/org/apache/poi/hpsf/HPSFPropertiesOnlyDocument.java
    poi/trunk/src/java/org/apache/poi/hpsf/extractor/HPSFPropertiesExtractor.java
    poi/trunk/src/java/org/apache/poi/hssf/dev/BiffViewer.java
    poi/trunk/src/java/org/apache/poi/hssf/dev/EFBiffViewer.java
    poi/trunk/src/java/org/apache/poi/hssf/dev/FormulaViewer.java
    poi/trunk/src/java/org/apache/poi/hssf/dev/RecordLister.java
    poi/trunk/src/java/org/apache/poi/hssf/extractor/OldExcelExtractor.java
    poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java
    poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbookFactory.java
    poi/trunk/src/java/org/apache/poi/poifs/crypt/ChunkedCipherOutputStream.java
    poi/trunk/src/java/org/apache/poi/poifs/crypt/Decryptor.java
    poi/trunk/src/java/org/apache/poi/poifs/crypt/EncryptionInfo.java
    poi/trunk/src/java/org/apache/poi/poifs/crypt/Encryptor.java
    poi/trunk/src/java/org/apache/poi/poifs/crypt/cryptoapi/CryptoAPIEncryptor.java
    poi/trunk/src/java/org/apache/poi/poifs/crypt/xor/XOREncryptor.java
    poi/trunk/src/java/org/apache/poi/poifs/dev/POIFSDump.java
    poi/trunk/src/java/org/apache/poi/poifs/dev/POIFSLister.java
    poi/trunk/src/java/org/apache/poi/poifs/dev/POIFSViewer.java
    poi/trunk/src/java/org/apache/poi/poifs/eventfilesystem/POIFSReader.java
    poi/trunk/src/java/org/apache/poi/poifs/filesystem/DirectoryNode.java
    poi/trunk/src/java/org/apache/poi/poifs/filesystem/DocumentFactoryHelper.java
    poi/trunk/src/java/org/apache/poi/poifs/filesystem/DocumentNode.java
    poi/trunk/src/java/org/apache/poi/poifs/filesystem/EntryUtils.java
    poi/trunk/src/java/org/apache/poi/poifs/macros/VBAMacroReader.java
    poi/trunk/src/java/org/apache/poi/poifs/property/DocumentProperty.java
    poi/trunk/src/java/org/apache/poi/poifs/property/PropertyFactory.java
    poi/trunk/src/java/org/apache/poi/poifs/storage/BATBlock.java
    poi/trunk/src/java/org/apache/poi/poifs/storage/HeaderBlock.java
    poi/trunk/src/java/org/apache/poi/sl/usermodel/SlideShowFactory.java
    poi/trunk/src/java/org/apache/poi/ss/usermodel/WorkbookFactory.java
    poi/trunk/src/java/org/apache/poi/util/DrawingDump.java
    poi/trunk/src/ooxml/java/org/apache/poi/ooxml/extractor/ExtractorFactory.java
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestDecryptor.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestEncryptor.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFSlideShowFactory.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/TestXWPFBugs.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hdgf/HDGFDiagram.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hdgf/dev/VSDDumper.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hdgf/extractor/VisioTextExtractor.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hpbf/HPBFDocument.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hpbf/dev/HPBFDumper.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hpbf/dev/PLCDumper.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hpbf/extractor/PublisherTextExtractor.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/PPTXMLDump.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/SlideShowDumper.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/extractor/PowerPointExtractor.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/extractor/QuickButCruddyTextExtractor.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/CurrentUserAtom.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShow.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShowFactory.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShowImpl.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/MAPIMessage.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/dev/HSMFDump.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/extractor/OutlookTextExtactor.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/parsers/POIFSChunkParser.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/HWPFDocument.java
    poi/trunk/src/scratchpad/testcases/org/apache/poi/TestPOIDocumentScratchpad.java
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hpbf/extractor/TestPublisherTextExtractor.java
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestExtractor.java
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestDocumentEncryption.java
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestRichTextRun.java
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hsmf/TestFixedSizedProperties.java
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hsmf/extractor/TestOutlookTextExtractor.java
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hsmf/parsers/TestPOIFSChunkParser.java
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/extractor/TestWordExtractor.java
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/extractor/TestWordExtractorBugs.java
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestBugs.java
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestHWPFWrite.java
    poi/trunk/src/testcases/org/apache/poi/TestPOIDocumentMain.java
    poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestHPSFBugs.java
    poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestReadAllFiles.java
    poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestWrite.java
    poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestWriteWellKnown.java
    poi/trunk/src/testcases/org/apache/poi/hpsf/extractor/TestHPSFPropertiesExtractor.java
    poi/trunk/src/testcases/org/apache/poi/hssf/dev/TestBiffViewer.java
    poi/trunk/src/testcases/org/apache/poi/hssf/extractor/TestOldExcelExtractor.java
    poi/trunk/src/testcases/org/apache/poi/hssf/model/TestRVA.java
    poi/trunk/src/testcases/org/apache/poi/hssf/record/chart/TestChartTitleFormatRecord.java
    poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
    poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java
    poi/trunk/src/testcases/org/apache/poi/poifs/crypt/TestXorEncryption.java
    poi/trunk/src/testcases/org/apache/poi/poifs/dev/TestPOIFSDump.java
    poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/AllPOIFSFileSystemTests.java
    poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestDocument.java
    poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestDocumentInputStream.java
    poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestDocumentOutputStream.java
    poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestEntryUtils.java
    poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestFileSystemBugs.java
    poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestOle10Native.java
    poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestPOIFSFileSystem.java
    poi/trunk/src/testcases/org/apache/poi/poifs/macros/TestVBAMacroReader.java
    poi/trunk/src/testcases/org/apache/poi/poifs/property/TestPropertyFactory.java
    poi/trunk/src/testcases/org/apache/poi/poifs/property/TestPropertyTable.java
    poi/trunk/src/testcases/org/apache/poi/poifs/storage/AllPOIFSStorageTests.java
    poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestBATBlock.java
    poi/trunk/src/testcases/org/apache/poi/sl/usermodel/BaseTestSlideShowFactory.java

Modified: poi/site/src/documentation/content/xdocs/components/poifs/how-to.xml
URL: http://svn.apache.org/viewvc/poi/site/src/documentation/content/xdocs/components/poifs/how-to.xml?rev=1839709&r1=1839708&r2=1839709&view=diff
==============================================================================
--- poi/site/src/documentation/content/xdocs/components/poifs/how-to.xml (original)
+++ poi/site/src/documentation/content/xdocs/components/poifs/how-to.xml Fri Aug 31 00:25:50 2018
@@ -246,7 +246,7 @@ DocumentInputStream stream = new Documen
 	<section><title>Preparation</title>
 	  <p>Before an application can read a file from the file system, the 
        file system needs to be opened and core parts processed. This is done
-       using the <code>org.apache.poi.poifs.filesystem.NPOIFSFileSystem</code> 
+       using the <code>org.apache.poi.poifs.filesystem.POIFSFileSystem</code>
        class. Once the file system has been loaded into memory, the 
        application may need the root directory. The following code fragment 
        will accomplish this preparation stage:</p>

Modified: poi/trunk/src/examples/src/org/apache/poi/hpsf/examples/ModifyDocumentSummaryInformation.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/hpsf/examples/ModifyDocumentSummaryInformation.java?rev=1839709&r1=1839708&r2=1839709&view=diff
==============================================================================
--- poi/trunk/src/examples/src/org/apache/poi/hpsf/examples/ModifyDocumentSummaryInformation.java (original)
+++ poi/trunk/src/examples/src/org/apache/poi/hpsf/examples/ModifyDocumentSummaryInformation.java Fri Aug 31 00:25:50 2018
@@ -26,7 +26,7 @@ import org.apache.poi.hpsf.DocumentSumma
 import org.apache.poi.hpsf.PropertySetFactory;
 import org.apache.poi.hpsf.SummaryInformation;
 import org.apache.poi.poifs.filesystem.DirectoryEntry;
-import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
+import org.apache.poi.poifs.filesystem.POIFSFileSystem;
 
 /**
  * <p>This is a sample application showing how to easily modify properties in
@@ -79,7 +79,7 @@ public class ModifyDocumentSummaryInform
         File summaryFile = new File(args[0]);
 
         /* Open the POI filesystem. */
-        try (NPOIFSFileSystem poifs = new NPOIFSFileSystem(summaryFile, false)) {
+        try (POIFSFileSystem poifs = new POIFSFileSystem(summaryFile, false)) {
 
             /* Read the summary information. */
             DirectoryEntry dir = poifs.getRoot();
@@ -128,7 +128,7 @@ public class ModifyDocumentSummaryInform
             /* Insert some custom properties into the container. */
             customProperties.put("Key 1", "Value 1");
             customProperties.put("Schl\u00fcssel 2", "Wert 2");
-            customProperties.put("Sample Number", new Integer(12345));
+            customProperties.put("Sample Number", 12345);
             customProperties.put("Sample Boolean", Boolean.TRUE);
             customProperties.put("Sample Date", new Date());
 

Modified: poi/trunk/src/java/org/apache/poi/POIDocument.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/POIDocument.java?rev=1839709&r1=1839708&r2=1839709&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/POIDocument.java (original)
+++ poi/trunk/src/java/org/apache/poi/POIDocument.java Fri Aug 31 00:25:50 2018
@@ -39,7 +39,6 @@ import org.apache.poi.poifs.crypt.crypto
 import org.apache.poi.poifs.crypt.cryptoapi.CryptoAPIEncryptor;
 import org.apache.poi.poifs.filesystem.DirectoryNode;
 import org.apache.poi.poifs.filesystem.DocumentInputStream;
-import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
 import org.apache.poi.util.IOUtils;
 import org.apache.poi.util.Internal;
@@ -75,14 +74,6 @@ public abstract class POIDocument implem
     }
 
     /**
-     * Constructs from an old-style OPOIFS
-     * 
-     * @param fs the filesystem the document is read from
-     */
-    protected POIDocument(NPOIFSFileSystem fs) {
-       this(fs.getRoot());
-    }
-    /**
      * Constructs from the default POIFS
      * 
      * @param fs the filesystem the document is read from
@@ -203,7 +194,7 @@ public abstract class POIDocument implem
     protected PropertySet getPropertySet(String setName, EncryptionInfo encryptionInfo) throws IOException {
         DirectoryNode dirNode = directory;
         
-        NPOIFSFileSystem encPoifs = null;
+        POIFSFileSystem encPoifs = null;
         String step = "getting";
         try {
             if (encryptionInfo != null && encryptionInfo.isDocPropsEncrypted()) {
@@ -243,7 +234,7 @@ public abstract class POIDocument implem
      *  into the currently open NPOIFSFileSystem
      * 
      * @throws IOException if an error when writing to the open
-     *      {@link NPOIFSFileSystem} occurs
+     *      {@link POIFSFileSystem} occurs
      */
     protected void writeProperties() throws IOException {
         validateInPlaceWritePossible();
@@ -255,9 +246,9 @@ public abstract class POIDocument implem
      * @param outFS the POIFSFileSystem to write the properties into
      * 
      * @throws IOException if an error when writing to the 
-     *      {@link NPOIFSFileSystem} occurs
+     *      {@link POIFSFileSystem} occurs
      */
-    protected void writeProperties(NPOIFSFileSystem outFS) throws IOException {
+    protected void writeProperties(POIFSFileSystem outFS) throws IOException {
         writeProperties(outFS, null);
     }
     /**
@@ -266,13 +257,13 @@ public abstract class POIDocument implem
      * @param writtenEntries a list of POIFS entries to add the property names too
      * 
      * @throws IOException if an error when writing to the 
-     *      {@link NPOIFSFileSystem} occurs
+     *      {@link POIFSFileSystem} occurs
      */
-    protected void writeProperties(NPOIFSFileSystem outFS, List<String> writtenEntries) throws IOException {
+    protected void writeProperties(POIFSFileSystem outFS, List<String> writtenEntries) throws IOException {
         final EncryptionInfo ei = getEncryptionInfo();
         final boolean encryptProps = (ei != null && ei.isDocPropsEncrypted());
-        try (NPOIFSFileSystem tmpFS = new NPOIFSFileSystem()) {
-            final NPOIFSFileSystem fs = (encryptProps) ? tmpFS : outFS;
+        try (POIFSFileSystem tmpFS = new POIFSFileSystem()) {
+            final POIFSFileSystem fs = (encryptProps) ? tmpFS : outFS;
 
             writePropertySet(SummaryInformation.DEFAULT_STREAM_NAME, getSummaryInformation(), fs, writtenEntries);
             writePropertySet(DocumentSummaryInformation.DEFAULT_STREAM_NAME, getDocumentSummaryInformation(), fs, writtenEntries);
@@ -302,7 +293,7 @@ public abstract class POIDocument implem
         }
     }
 
-    private void writePropertySet(String name, PropertySet ps, NPOIFSFileSystem outFS, List<String> writtenEntries)
+    private void writePropertySet(String name, PropertySet ps, POIFSFileSystem outFS, List<String> writtenEntries)
     throws IOException {
         if (ps == null) {
             return;
@@ -320,9 +311,9 @@ public abstract class POIDocument implem
      * @param outFS the NPOIFSFileSystem to write the property into
      * 
      * @throws IOException if an error when writing to the 
-     *      {@link NPOIFSFileSystem} occurs
+     *      {@link POIFSFileSystem} occurs
      */
-    private void writePropertySet(String name, PropertySet set, NPOIFSFileSystem outFS) throws IOException {
+    private void writePropertySet(String name, PropertySet set, POIFSFileSystem outFS) throws IOException {
         try {
             PropertySet mSet = new PropertySet(set);
             ByteArrayOutputStream bOut = new ByteArrayOutputStream();
@@ -411,7 +402,7 @@ public abstract class POIDocument implem
     public abstract void write(OutputStream out) throws IOException;
 
     /**
-     * Closes the underlying {@link NPOIFSFileSystem} from which
+     * Closes the underlying {@link POIFSFileSystem} from which
      *  the document was read, if any. Has no effect on documents
      *  opened from an InputStream, or newly created ones.<p>
      *
@@ -451,7 +442,7 @@ public abstract class POIDocument implem
     @Internal
     protected boolean initDirectory() {
         if (directory == null) {
-            directory = new NPOIFSFileSystem().getRoot(); // NOSONAR
+            directory = new POIFSFileSystem().getRoot(); // NOSONAR
             return true;
         }
         return false;

Modified: poi/trunk/src/java/org/apache/poi/POIReadOnlyDocument.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/POIReadOnlyDocument.java?rev=1839709&r1=1839708&r2=1839709&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/POIReadOnlyDocument.java (original)
+++ poi/trunk/src/java/org/apache/poi/POIReadOnlyDocument.java Fri Aug 31 00:25:50 2018
@@ -20,7 +20,7 @@ import java.io.File;
 import java.io.OutputStream;
 
 import org.apache.poi.poifs.filesystem.DirectoryNode;
-import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
+import org.apache.poi.poifs.filesystem.POIFSFileSystem;
 
 
 /**
@@ -33,7 +33,7 @@ public abstract class POIReadOnlyDocumen
     protected POIReadOnlyDocument(DirectoryNode dir) {
         super(dir);
     }
-    protected POIReadOnlyDocument(NPOIFSFileSystem fs) {
+    protected POIReadOnlyDocument(POIFSFileSystem fs) {
         super(fs);
     }
 

Modified: poi/trunk/src/java/org/apache/poi/extractor/OLE2ExtractorFactory.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/extractor/OLE2ExtractorFactory.java?rev=1839709&r1=1839708&r2=1839709&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/extractor/OLE2ExtractorFactory.java (original)
+++ poi/trunk/src/java/org/apache/poi/extractor/OLE2ExtractorFactory.java Fri Aug 31 00:25:50 2018
@@ -32,7 +32,6 @@ import org.apache.poi.hssf.extractor.Exc
 import org.apache.poi.poifs.filesystem.DirectoryEntry;
 import org.apache.poi.poifs.filesystem.DirectoryNode;
 import org.apache.poi.poifs.filesystem.Entry;
-import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
 import org.apache.poi.util.POILogFactory;
 import org.apache.poi.util.POILogger;
@@ -49,7 +48,7 @@ import org.apache.poi.util.POILogger;
  * <p>Note 3 - rather than using this, for most cases you would be better
  *  off switching to <a href="http://tika.apache.org">Apache Tika</a> instead!</p>
  */
-@SuppressWarnings("WeakerAccess")
+@SuppressWarnings({"WeakerAccess", "JavadocReference"})
 public final class OLE2ExtractorFactory {
     private static final POILogger LOGGER = POILogFactory.getLogger(OLE2ExtractorFactory.class); 
     
@@ -111,10 +110,6 @@ public final class OLE2ExtractorFactory
     public static <T extends POITextExtractor> T createExtractor(POIFSFileSystem fs) throws IOException {
         return (T)createExtractor(fs.getRoot());
     }
-    @SuppressWarnings("unchecked")
-    public static <T extends POITextExtractor> T createExtractor(NPOIFSFileSystem fs) throws IOException {
-        return (T)createExtractor(fs.getRoot());
-    }
 
     @SuppressWarnings("unchecked")
     public static <T extends POITextExtractor> T createExtractor(InputStream input) throws IOException {
@@ -131,7 +126,7 @@ public final class OLE2ExtractorFactory
             }
         } else {
             // Best hope it's OLE2....
-            return createExtractor(new NPOIFSFileSystem(input));
+            return createExtractor(new POIFSFileSystem(input));
         }
     }
 

Modified: poi/trunk/src/java/org/apache/poi/hpsf/HPSFPropertiesOnlyDocument.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hpsf/HPSFPropertiesOnlyDocument.java?rev=1839709&r1=1839708&r2=1839709&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hpsf/HPSFPropertiesOnlyDocument.java (original)
+++ poi/trunk/src/java/org/apache/poi/hpsf/HPSFPropertiesOnlyDocument.java Fri Aug 31 00:25:50 2018
@@ -25,7 +25,6 @@ import java.util.List;
 import org.apache.poi.POIDocument;
 import org.apache.poi.poifs.filesystem.EntryUtils;
 import org.apache.poi.poifs.filesystem.FilteringDirectoryNode;
-import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
 
 /**
@@ -35,9 +34,6 @@ import org.apache.poi.poifs.filesystem.P
  *  without affecting the rest of the file
  */
 public class HPSFPropertiesOnlyDocument extends POIDocument {
-    public HPSFPropertiesOnlyDocument(NPOIFSFileSystem fs) {
-        super(fs.getRoot());
-    }
     public HPSFPropertiesOnlyDocument(POIFSFileSystem fs) {
         super(fs);
     }
@@ -46,7 +42,7 @@ public class HPSFPropertiesOnlyDocument
      * Write out to the currently open file the properties changes, but nothing else
      */
     public void write() throws IOException {
-        NPOIFSFileSystem fs = getDirectory().getFileSystem();
+        POIFSFileSystem fs = getDirectory().getFileSystem();
         
         validateInPlaceWritePossible();        
         writeProperties(fs, null);
@@ -65,13 +61,13 @@ public class HPSFPropertiesOnlyDocument
      * Write out, with any properties changes, but nothing else
      */
     public void write(OutputStream out) throws IOException {
-        try (NPOIFSFileSystem fs = new NPOIFSFileSystem()) {
+        try (POIFSFileSystem fs = new POIFSFileSystem()) {
             write(fs);
             fs.writeFilesystem(out);
         }
     }
     
-    private void write(NPOIFSFileSystem fs) throws IOException {
+    private void write(POIFSFileSystem fs) throws IOException {
         // For tracking what we've written out, so far
         List<String> excepts = new ArrayList<>(2);
 

Modified: poi/trunk/src/java/org/apache/poi/hpsf/extractor/HPSFPropertiesExtractor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hpsf/extractor/HPSFPropertiesExtractor.java?rev=1839709&r1=1839708&r2=1839709&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hpsf/extractor/HPSFPropertiesExtractor.java (original)
+++ poi/trunk/src/java/org/apache/poi/hpsf/extractor/HPSFPropertiesExtractor.java Fri Aug 31 00:25:50 2018
@@ -30,7 +30,6 @@ import org.apache.poi.hpsf.Property;
 import org.apache.poi.hpsf.PropertySet;
 import org.apache.poi.hpsf.SummaryInformation;
 import org.apache.poi.hpsf.wellknown.PropertyIDMap;
-import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
 
 /**
@@ -48,9 +47,6 @@ public class HPSFPropertiesExtractor ext
     public HPSFPropertiesExtractor(POIFSFileSystem fs) {
         super(new HPSFPropertiesOnlyDocument(fs));
     }
-    public HPSFPropertiesExtractor(NPOIFSFileSystem fs) {
-        super(new HPSFPropertiesOnlyDocument(fs));
-    }
 
     public String getDocumentSummaryInformationText() {
         if(document == null) {  // event based extractor does not have a document
@@ -144,7 +140,7 @@ public class HPSFPropertiesExtractor ext
     public static void main(String[] args) throws IOException {
         for (String file : args) {
             try (HPSFPropertiesExtractor ext = new HPSFPropertiesExtractor(
-                    new NPOIFSFileSystem(new File(file)))) {
+                    new POIFSFileSystem(new File(file)))) {
                 System.out.println(ext.getText());
             }
         }

Modified: poi/trunk/src/java/org/apache/poi/hssf/dev/BiffViewer.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/dev/BiffViewer.java?rev=1839709&r1=1839708&r2=1839709&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/dev/BiffViewer.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/dev/BiffViewer.java Fri Aug 31 00:25:50 2018
@@ -19,7 +19,6 @@ package org.apache.poi.hssf.dev;
 
 import java.io.DataInputStream;
 import java.io.File;
-import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
@@ -42,7 +41,7 @@ import org.apache.poi.hssf.record.pivott
 import org.apache.poi.hssf.record.pivottable.ViewFieldsRecord;
 import org.apache.poi.hssf.record.pivottable.ViewSourceRecord;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
-import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
+import org.apache.poi.poifs.filesystem.POIFSFileSystem;
 import org.apache.poi.util.HexDump;
 import org.apache.poi.util.IOUtils;
 import org.apache.poi.util.LittleEndian;
@@ -71,13 +70,10 @@ public final class BiffViewer {
      * @param recListener the record listener to notify about read records
      * @param dumpInterpretedRecords if {@code true}, the read records will be written to the PrintWriter
      *
-     * @return an array of Records created from the InputStream
      * @exception  org.apache.poi.util.RecordFormatException  on error processing the InputStream
      */
-    public static Record[] createRecords(InputStream is, PrintWriter ps, BiffRecordListener recListener, boolean dumpInterpretedRecords)
+    private static void createRecords(InputStream is, PrintWriter ps, BiffRecordListener recListener, boolean dumpInterpretedRecords)
             throws org.apache.poi.util.RecordFormatException {
-        List<Record> temp = new ArrayList<>();
-
         RecordInputStream recStream = new RecordInputStream(is);
         while (true) {
             boolean hasNext;
@@ -101,7 +97,6 @@ public final class BiffViewer {
                 if (record.getSid() == ContinueRecord.sid) {
                     continue;
                 }
-                temp.add(record);
 
                 for (String header : recListener.getRecentHeaders()) {
                     ps.println(header);
@@ -112,9 +107,6 @@ public final class BiffViewer {
             }
             ps.println();
         }
-        Record[] result = new Record[temp.size()];
-        temp.toArray(result);
-        return result;
     }
 
 
@@ -349,19 +341,19 @@ public final class BiffViewer {
             }
             return new CommandArgs(biffhex, noint, out, rawhex, noheader, file);
         }
-        public boolean shouldDumpBiffHex() {
+        boolean shouldDumpBiffHex() {
             return _biffhex;
         }
-        public boolean shouldDumpRecordInterpretations() {
+        boolean shouldDumpRecordInterpretations() {
             return !_noint;
         }
-        public boolean shouldOutputToFile() {
+        boolean shouldOutputToFile() {
             return _out;
         }
-        public boolean shouldOutputRawHexOnly() {
+        boolean shouldOutputRawHexOnly() {
             return _rawhex;
         }
-        public boolean suppressHeader() {
+        boolean suppressHeader() {
             return _noHeader;
         }
         public File getFile() {
@@ -369,7 +361,7 @@ public final class BiffViewer {
         }
     }
     private static final class CommandParseException extends Exception {
-        public CommandParseException(String msg) {
+        CommandParseException(String msg) {
             super(msg);
         }
     }
@@ -410,10 +402,10 @@ public final class BiffViewer {
 			pw = new PrintWriter(new OutputStreamWriter(System.out, Charset.defaultCharset()));
 		}
 
-		NPOIFSFileSystem fs = null;
+		POIFSFileSystem fs = null;
 		InputStream is = null;
         try {
-            fs = new NPOIFSFileSystem(cmdArgs.getFile(), true);
+            fs = new POIFSFileSystem(cmdArgs.getFile(), true);
             is = getPOIFSInputStream(fs);
 
             if (cmdArgs.shouldOutputRawHexOnly()) {
@@ -432,13 +424,12 @@ public final class BiffViewer {
         }
 	}
 
-	protected static InputStream getPOIFSInputStream(NPOIFSFileSystem fs)
-			throws IOException, FileNotFoundException {
+	static InputStream getPOIFSInputStream(POIFSFileSystem fs) throws IOException {
 		String workbookName = HSSFWorkbook.getWorkbookDirEntryName(fs.getRoot());
 		return fs.createDocumentInputStream(workbookName);
 	}
 
-	protected static void runBiffViewer(PrintWriter pw, InputStream is,
+	static void runBiffViewer(PrintWriter pw, InputStream is,
 			boolean dumpInterpretedRecords, boolean dumpHex, boolean zeroAlignHexDump,
 			boolean suppressHeader) {
 		BiffRecordListener recListener = new BiffRecordListener(dumpHex ? pw : null, zeroAlignHexDump, suppressHeader);
@@ -451,7 +442,7 @@ public final class BiffViewer {
 		private List<String> _headers;
 		private final boolean _zeroAlignEachRecord;
 		private final boolean _noHeader;
-		public BiffRecordListener(Writer hexDumpWriter, boolean zeroAlignEachRecord, boolean noHeader) {
+		private BiffRecordListener(Writer hexDumpWriter, boolean zeroAlignEachRecord, boolean noHeader) {
 			_hexDumpWriter = hexDumpWriter;
 			_zeroAlignEachRecord = zeroAlignEachRecord;
 			_noHeader = noHeader;
@@ -477,7 +468,7 @@ public final class BiffViewer {
 				}
 			}
 		}
-		public List<String> getRecentHeaders() {
+		private List<String> getRecentHeaders() {
 		    List<String> result = _headers;
 		    _headers = new ArrayList<>();
 		    return result;
@@ -510,7 +501,7 @@ public final class BiffViewer {
 		private int _currentSize;
 		private boolean _innerHasReachedEOF;
 
-		public BiffDumpingStream(InputStream is, IBiffRecordListener listener) {
+		private BiffDumpingStream(InputStream is, IBiffRecordListener listener) {
 			_is = new DataInputStream(is);
 			_listener = listener;
 			_data = new byte[RecordInputStream.MAX_RECORD_DATA_SIZE + 4];
@@ -601,7 +592,7 @@ public final class BiffViewer {
 	 * @param globalOffset (somewhat arbitrary) used to calculate the addresses printed at the
 	 * start of each line
 	 */
-	static void hexDumpAligned(Writer w, byte[] data, int dumpLen, int globalOffset,
+	private static void hexDumpAligned(Writer w, byte[] data, int dumpLen, int globalOffset,
 			boolean zeroAlignEachRecord) {
 		int baseDataOffset = 0;
 
@@ -712,7 +703,7 @@ public final class BiffViewer {
 		return ib;
 	}
 
-	private static void writeHex(char buf[], int startInBuf, int value, int nDigits) throws IOException {
+	private static void writeHex(char buf[], int startInBuf, int value, int nDigits) {
 		int acc = value;
 		for(int i=nDigits-1; i>=0; i--) {
 			int digit = acc & 0x0F;

Modified: poi/trunk/src/java/org/apache/poi/hssf/dev/EFBiffViewer.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/dev/EFBiffViewer.java?rev=1839709&r1=1839708&r2=1839709&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/dev/EFBiffViewer.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/dev/EFBiffViewer.java Fri Aug 31 00:25:50 2018
@@ -22,10 +22,8 @@ import java.io.IOException;
 import java.io.InputStream;
 
 import org.apache.poi.hssf.eventusermodel.HSSFEventFactory;
-import org.apache.poi.hssf.eventusermodel.HSSFListener;
 import org.apache.poi.hssf.eventusermodel.HSSFRequest;
-import org.apache.poi.hssf.record.Record;
-import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
+import org.apache.poi.poifs.filesystem.POIFSFileSystem;
 
 /**
  *
@@ -38,32 +36,19 @@ public class EFBiffViewer
 
     /** Creates a new instance of EFBiffViewer */
 
-    public EFBiffViewer()
-    {
+    @SuppressWarnings("WeakerAccess")
+    public EFBiffViewer() {
     }
 
     public void run() throws IOException {
-        NPOIFSFileSystem fs   = new NPOIFSFileSystem(new File(file), true);
-        try {
-            InputStream     din   = BiffViewer.getPOIFSInputStream(fs);
-            try {
-                HSSFRequest     req   = new HSSFRequest();
-        
-                req.addListenerForAllRecords(new HSSFListener()
-                {
-                    public void processRecord(Record rec)
-                    {
-                        System.out.println(rec);
-                    }
-                });
-                HSSFEventFactory factory = new HSSFEventFactory();
-        
-                factory.processEvents(req, din);
-            } finally {
-                din.close();
-            }
-        } finally {
-            fs.close();
+        try (POIFSFileSystem fs = new POIFSFileSystem(new File(file), true);
+         InputStream din = BiffViewer.getPOIFSInputStream(fs)) {
+            HSSFRequest req = new HSSFRequest();
+
+            req.addListenerForAllRecords(System.out::println);
+            HSSFEventFactory factory = new HSSFEventFactory();
+
+            factory.processEvents(req, din);
         }
     }
 

Modified: poi/trunk/src/java/org/apache/poi/hssf/dev/FormulaViewer.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/dev/FormulaViewer.java?rev=1839709&r1=1839708&r2=1839709&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/dev/FormulaViewer.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/dev/FormulaViewer.java Fri Aug 31 00:25:50 2018
@@ -26,8 +26,7 @@ import org.apache.poi.hssf.model.HSSFFor
 import org.apache.poi.hssf.record.FormulaRecord;
 import org.apache.poi.hssf.record.Record;
 import org.apache.poi.hssf.record.RecordFactory;
-import org.apache.poi.hssf.usermodel.HSSFWorkbook;
-import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
+import org.apache.poi.poifs.filesystem.POIFSFileSystem;
 import org.apache.poi.ss.formula.ptg.ExpPtg;
 import org.apache.poi.ss.formula.ptg.FuncPtg;
 import org.apache.poi.ss.formula.ptg.Ptg;
@@ -56,7 +55,7 @@ public class FormulaViewer
      * @throws IOException if the file contained errors 
      */
     public void run() throws IOException {
-        NPOIFSFileSystem fs  = new NPOIFSFileSystem(new File(file), true);
+        POIFSFileSystem fs  = new POIFSFileSystem(new File(file), true);
         try {
             InputStream is = BiffViewer.getPOIFSInputStream(fs);
             try {

Modified: poi/trunk/src/java/org/apache/poi/hssf/dev/RecordLister.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/dev/RecordLister.java?rev=1839709&r1=1839708&r2=1839709&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/dev/RecordLister.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/dev/RecordLister.java Fri Aug 31 00:25:50 2018
@@ -25,7 +25,7 @@ import org.apache.poi.hssf.record.Contin
 import org.apache.poi.hssf.record.Record;
 import org.apache.poi.hssf.record.RecordFactory;
 import org.apache.poi.hssf.record.RecordInputStream;
-import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
+import org.apache.poi.poifs.filesystem.POIFSFileSystem;
 
 /**
  * This is a low-level debugging class, which simply prints
@@ -47,45 +47,36 @@ public class RecordLister
     {
     }
 
-    public void run()
-        throws IOException
-    {
-        NPOIFSFileSystem  fs    = new NPOIFSFileSystem(new File(file), true);
-        try {
-            InputStream       din   = BiffViewer.getPOIFSInputStream(fs);
-            try {
-                RecordInputStream rinp  = new RecordInputStream(din);
-        
-                while(rinp.hasNextRecord()) {
-                   int sid  = rinp.getNextSid();
-                   rinp.nextRecord();
-                   
-                   int size = rinp.available();
-                   Class<? extends Record> clz = RecordFactory.getRecordClass(sid);
-                   
-                   System.out.print(
-                         formatSID(sid) +
-                         " - " +
-                         formatSize(size) +
-                         " bytes"
-                   );
-                   if(clz != null) {
-                      System.out.print("  \t");
-                      System.out.print(clz.getName().replace("org.apache.poi.hssf.record.", ""));
-                   }
-                   System.out.println();
-                   
-                   byte[] data = rinp.readRemainder();
-                   if(data.length > 0) {
-                      System.out.print("   ");
-                      System.out.println( formatData(data) );
-                   }
+    public void run() throws IOException {
+        try (POIFSFileSystem fs = new POIFSFileSystem(new File(file), true);
+             InputStream din = BiffViewer.getPOIFSInputStream(fs)) {
+            RecordInputStream rinp = new RecordInputStream(din);
+
+            while (rinp.hasNextRecord()) {
+                int sid = rinp.getNextSid();
+                rinp.nextRecord();
+
+                int size = rinp.available();
+                Class<? extends Record> clz = RecordFactory.getRecordClass(sid);
+
+                System.out.print(
+                        formatSID(sid) +
+                                " - " +
+                                formatSize(size) +
+                                " bytes"
+                );
+                if (clz != null) {
+                    System.out.print("  \t");
+                    System.out.print(clz.getName().replace("org.apache.poi.hssf.record.", ""));
+                }
+                System.out.println();
+
+                byte[] data = rinp.readRemainder();
+                if (data.length > 0) {
+                    System.out.print("   ");
+                    System.out.println(formatData(data));
                 }
-            } finally {
-                din.close();
             }
-        } finally {
-            fs.close();
         }
     }
     
@@ -93,7 +84,7 @@ public class RecordLister
        String hex = Integer.toHexString(sid);
        String dec = Integer.toString(sid);
        
-       StringBuffer s = new StringBuffer();
+       StringBuilder s = new StringBuilder();
        s.append("0x");
        for(int i=hex.length(); i<4; i++) {
           s.append('0');
@@ -113,7 +104,7 @@ public class RecordLister
        String hex = Integer.toHexString(size);
        String dec = Integer.toString(size);
        
-       StringBuffer s = new StringBuffer();
+       StringBuilder s = new StringBuilder();
        for(int i=hex.length(); i<3; i++) {
           s.append('0');
        }
@@ -133,7 +124,7 @@ public class RecordLister
           return "";
        
        // If possible, do first 4 and last 4 bytes
-       StringBuffer s = new StringBuffer();
+       StringBuilder s = new StringBuilder();
        if(data.length > 9) {
           s.append(byteToHex(data[0]));
           s.append(' ');
@@ -155,10 +146,10 @@ public class RecordLister
           s.append(' ');
           s.append(byteToHex(data[data.length-1]));
        } else {
-          for(int i=0; i<data.length; i++) {
-             s.append(byteToHex(data[i]));
-             s.append(' ');
-          }
+           for (byte aData : data) {
+               s.append(byteToHex(aData));
+               s.append(' ');
+           }
        }
        
        return s.toString();

Modified: poi/trunk/src/java/org/apache/poi/hssf/extractor/OldExcelExtractor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/extractor/OldExcelExtractor.java?rev=1839709&r1=1839708&r2=1839709&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/extractor/OldExcelExtractor.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/extractor/OldExcelExtractor.java Fri Aug 31 00:25:50 2018
@@ -74,9 +74,9 @@ public class OldExcelExtractor implement
     }
 
     public OldExcelExtractor(File f) throws IOException {
-        NPOIFSFileSystem poifs = null;
+        POIFSFileSystem poifs = null;
         try {
-            poifs = new NPOIFSFileSystem(f);
+            poifs = new POIFSFileSystem(f);
             open(poifs);
             toClose = poifs;
             return;
@@ -100,7 +100,7 @@ public class OldExcelExtractor implement
         }
     }
 
-    public OldExcelExtractor(NPOIFSFileSystem fs) throws IOException {
+    public OldExcelExtractor(POIFSFileSystem fs) throws IOException {
         open(fs);
     }
 
@@ -114,7 +114,7 @@ public class OldExcelExtractor implement
             : new BufferedInputStream(biffStream, 8);
 
         if (FileMagic.valueOf(bis) == FileMagic.OLE2) {
-            NPOIFSFileSystem poifs = new NPOIFSFileSystem(bis);
+            POIFSFileSystem poifs = new POIFSFileSystem(bis);
             try {
                 open(poifs);
                 toClose = poifs; // Fixed by GR, we should not close it here
@@ -130,7 +130,7 @@ public class OldExcelExtractor implement
         }
     }
 
-    private void open(NPOIFSFileSystem fs) throws IOException {
+    private void open(POIFSFileSystem fs) throws IOException {
         open(fs.getRoot());
     }
 

Modified: poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java?rev=1839709&r1=1839708&r2=1839709&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java Fri Aug 31 00:25:50 2018
@@ -94,10 +94,9 @@ import org.apache.poi.poifs.filesystem.D
 import org.apache.poi.poifs.filesystem.DocumentNode;
 import org.apache.poi.poifs.filesystem.EntryUtils;
 import org.apache.poi.poifs.filesystem.FilteringDirectoryNode;
-import org.apache.poi.poifs.filesystem.NPOIFSDocument;
-import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
-import org.apache.poi.poifs.filesystem.Ole10Native;
+import org.apache.poi.poifs.filesystem.POIFSDocument;
 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
+import org.apache.poi.poifs.filesystem.Ole10Native;
 import org.apache.poi.ss.SpreadsheetVersion;
 import org.apache.poi.ss.formula.FormulaShifter;
 import org.apache.poi.ss.formula.FormulaType;
@@ -129,6 +128,7 @@ import org.apache.poi.util.POILogger;
  * @see org.apache.poi.hssf.model.InternalWorkbook
  * @see org.apache.poi.hssf.usermodel.HSSFSheet
  */
+@SuppressWarnings("WeakerAccess")
 public final class HSSFWorkbook extends POIDocument implements org.apache.poi.ss.usermodel.Workbook {
 
     //arbitrarily selected; may need to increase
@@ -240,19 +240,6 @@ public final class HSSFWorkbook extends
     public HSSFWorkbook(POIFSFileSystem fs) throws IOException {
         this(fs,true);
     }
-    /**
-     * Given a POI POIFSFileSystem object, read in its Workbook along
-     *  with all related nodes, and populate the high and low level models.
-     * <p>This calls {@link #HSSFWorkbook(POIFSFileSystem, boolean)} with
-     *  preserve nodes set to true.
-     *
-     * @see #HSSFWorkbook(POIFSFileSystem, boolean)
-     * @see org.apache.poi.poifs.filesystem.POIFSFileSystem
-     * @exception IOException if the stream cannot be read
-     */
-    public HSSFWorkbook(NPOIFSFileSystem fs) throws IOException {
-        this(fs.getRoot(),true);
-    }
 
     /**
      * Given a POI POIFSFileSystem object, read in its Workbook and populate
@@ -411,7 +398,7 @@ public final class HSSFWorkbook extends
     public HSSFWorkbook(InputStream s, boolean preserveNodes)
             throws IOException
     {
-        this(new NPOIFSFileSystem(s).getRoot(), preserveNodes);
+        this(new POIFSFileSystem(s).getRoot(), preserveNodes);
     }
 
     /**
@@ -1154,11 +1141,7 @@ public final class HSSFWorkbook extends
 
     HSSFName getBuiltInName(byte builtinCode, int sheetIndex) {
       int index = findExistingBuiltinNameRecordIdx(sheetIndex, builtinCode);
-      if (index < 0) {
-        return null;
-      } else {
-        return names.get(index);
-      }
+      return (index < 0) ? null : names.get(index);
     }
 
 
@@ -1244,7 +1227,7 @@ public final class HSSFWorkbook extends
         // So we don't confuse users, give them back
         //  the same object every time, but create
         //  them lazily
-        Integer sIdx = Integer.valueOf(idx);
+        Integer sIdx = idx;
         if(fonts.containsKey(sIdx)) {
             return fonts.get(sIdx);
         }
@@ -1262,7 +1245,7 @@ public final class HSSFWorkbook extends
      * Should only be called after deleting fonts,
      *  and that's not something you should normally do
      */
-    protected void resetFontCache() {
+    void resetFontCache() {
         fonts = new HashMap<>();
     }
 
@@ -1308,7 +1291,7 @@ public final class HSSFWorkbook extends
     }
 
     /**
-     * Closes the underlying {@link NPOIFSFileSystem} from which
+     * Closes the underlying {@link POIFSFileSystem} from which
      *  the Workbook was read, if any.
      *
      * <p>Once this has been called, no further
@@ -1338,7 +1321,7 @@ public final class HSSFWorkbook extends
         // Update the Workbook stream in the file
         DocumentNode workbookNode = (DocumentNode)dir.getEntry(
                 getWorkbookDirEntryName(dir));
-        NPOIFSDocument workbookDoc = new NPOIFSDocument(workbookNode);
+        POIFSDocument workbookDoc = new POIFSDocument(workbookNode);
         workbookDoc.replaceContents(new ByteArrayInputStream(getBytes()));
         
         // Update the properties streams in the file
@@ -1388,14 +1371,14 @@ public final class HSSFWorkbook extends
      */
     @Override
 	public void write(OutputStream stream) throws IOException {
-        try (NPOIFSFileSystem fs = new NPOIFSFileSystem()) {
+        try (POIFSFileSystem fs = new POIFSFileSystem()) {
             write(fs);
             fs.writeFilesystem(stream);
         }
     }
     
     /** Writes the workbook out to a brand new, empty POIFS */
-    private void write(NPOIFSFileSystem fs) throws IOException {
+    private void write(POIFSFileSystem fs) throws IOException {
         // For tracking what we've written out, used if we're
         //  going to be preserving nodes
         List<String> excepts = new ArrayList<>(1);
@@ -1525,7 +1508,7 @@ public final class HSSFWorkbook extends
     }
 
     @SuppressWarnings("resource")
-    protected void encryptBytes(byte buf[]) {
+    void encryptBytes(byte buf[]) {
         EncryptionInfo ei = getEncryptionInfo();
         if (ei == null) {
             return;
@@ -1540,7 +1523,7 @@ public final class HSSFWorkbook extends
             ChunkedCipherOutputStream os = enc.getDataStream(leos, initialOffset);
             int totalBytes = 0;
             while (totalBytes < buf.length) {
-                plain.read(tmp, 0, 4);
+                IOUtils.readFully(plain, tmp, 0, 4);
                 final int sid = LittleEndian.getUShort(tmp, 0);
                 final int len = LittleEndian.getUShort(tmp, 2);
                 boolean isPlain = Biff8DecryptingStream.isNeverEncryptedRecord(sid);
@@ -1836,9 +1819,11 @@ public final class HSSFWorkbook extends
     /**
      * Spits out a list of all the drawing records in the workbook.
      */
-    public void dumpDrawingGroupRecords(boolean fat)
-    {
+    public void dumpDrawingGroupRecords(boolean fat) {
         DrawingGroupRecord r = (DrawingGroupRecord) workbook.findFirstRecordBySid( DrawingGroupRecord.sid );
+        if (r == null) {
+            return;
+        }
         r.decode();
         List<EscherRecord> escherRecords = r.getEscherRecords();
         PrintWriter w = new PrintWriter(new OutputStreamWriter(System.out, Charset.defaultCharset()));
@@ -2007,7 +1992,7 @@ public final class HSSFWorkbook extends
 
     }
 
-    protected static Map<String,ClassID> getOleMap() {
+    static Map<String,ClassID> getOleMap() {
     	Map<String,ClassID> olemap = new HashMap<>();
     	olemap.put("PowerPoint Document", ClassIDPredefined.POWERPOINT_V8.getClassID());
     	for (String str : WORKBOOK_DIR_ENTRY_NAMES) {

Modified: poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbookFactory.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbookFactory.java?rev=1839709&r1=1839708&r2=1839709&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbookFactory.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbookFactory.java Fri Aug 31 00:25:50 2018
@@ -20,7 +20,7 @@ package org.apache.poi.hssf.usermodel;
 import java.io.IOException;
 
 import org.apache.poi.poifs.filesystem.DirectoryNode;
-import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
+import org.apache.poi.poifs.filesystem.POIFSFileSystem;
 import org.apache.poi.ss.usermodel.WorkbookFactory;
 import org.apache.poi.util.Internal;
 
@@ -28,6 +28,7 @@ import org.apache.poi.util.Internal;
  * Helper class which is instantiated by reflection from
  * {@link WorkbookFactory#create(java.io.File)} and similar
  */
+@SuppressWarnings("unused")
 @Internal
 public class HSSFWorkbookFactory extends WorkbookFactory {
     /**
@@ -35,7 +36,7 @@ public class HSSFWorkbookFactory extends
      * Note that in order to properly release resources the
      * Workbook should be closed after use.
      */
-    public static HSSFWorkbook createWorkbook(final NPOIFSFileSystem fs) throws IOException {
+    public static HSSFWorkbook createWorkbook(final POIFSFileSystem fs) throws IOException {
         return new HSSFWorkbook(fs);
     }
 

Modified: poi/trunk/src/java/org/apache/poi/poifs/crypt/ChunkedCipherOutputStream.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/crypt/ChunkedCipherOutputStream.java?rev=1839709&r1=1839708&r2=1839709&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/poifs/crypt/ChunkedCipherOutputStream.java (original)
+++ poi/trunk/src/java/org/apache/poi/poifs/crypt/ChunkedCipherOutputStream.java Fri Aug 31 00:25:50 2018
@@ -285,25 +285,20 @@ public abstract class ChunkedCipherOutpu
         @Override
         public void processPOIFSWriterEvent(POIFSWriterEvent event) {
             try {
-                OutputStream os = event.getStream();
+                try (OutputStream os = event.getStream();
+                     FileInputStream fis = new FileInputStream(fileOut)) {
 
-                // StreamSize (8 bytes): An unsigned integer that specifies the number of bytes used by data
-                // encrypted within the EncryptedData field, not including the size of the StreamSize field.
-                // Note that the actual size of the \EncryptedPackage stream (1) can be larger than this
-                // value, depending on the block size of the chosen encryption algorithm
-                byte buf[] = new byte[LittleEndianConsts.LONG_SIZE];
-                LittleEndian.putLong(buf, 0, pos);
-                os.write(buf);
+                    // StreamSize (8 bytes): An unsigned integer that specifies the number of bytes used by data
+                    // encrypted within the EncryptedData field, not including the size of the StreamSize field.
+                    // Note that the actual size of the \EncryptedPackage stream (1) can be larger than this
+                    // value, depending on the block size of the chosen encryption algorithm
+                    byte buf[] = new byte[LittleEndianConsts.LONG_SIZE];
+                    LittleEndian.putLong(buf, 0, pos);
+                    os.write(buf);
 
-                FileInputStream fis = new FileInputStream(fileOut);
-                try {
                     IOUtils.copy(fis, os);
-                } finally {
-                    fis.close();
                 }
 
-                os.close();
-
                 if (!fileOut.delete()) {
                     LOG.log(POILogger.ERROR, "Can't delete temporary encryption file: "+fileOut);
                 }

Modified: poi/trunk/src/java/org/apache/poi/poifs/crypt/Decryptor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/crypt/Decryptor.java?rev=1839709&r1=1839708&r2=1839709&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/poifs/crypt/Decryptor.java (original)
+++ poi/trunk/src/java/org/apache/poi/poifs/crypt/Decryptor.java Fri Aug 31 00:25:50 2018
@@ -26,7 +26,6 @@ import javax.crypto.spec.SecretKeySpec;
 
 import org.apache.poi.EncryptedDocumentException;
 import org.apache.poi.poifs.filesystem.DirectoryNode;
-import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
 
 public abstract class Decryptor implements Cloneable {
@@ -121,14 +120,10 @@ public abstract class Decryptor implemen
         return d;
     }
 
-    public InputStream getDataStream(NPOIFSFileSystem fs) throws IOException, GeneralSecurityException {
-        return getDataStream(fs.getRoot());
-    }
-
     public InputStream getDataStream(POIFSFileSystem fs) throws IOException, GeneralSecurityException {
         return getDataStream(fs.getRoot());
     }
-    
+
     // for tests
     public byte[] getVerifier() {
         return verifier;

Modified: poi/trunk/src/java/org/apache/poi/poifs/crypt/EncryptionInfo.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/crypt/EncryptionInfo.java?rev=1839709&r1=1839708&r2=1839709&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/poifs/crypt/EncryptionInfo.java (original)
+++ poi/trunk/src/java/org/apache/poi/poifs/crypt/EncryptionInfo.java Fri Aug 31 00:25:50 2018
@@ -26,7 +26,6 @@ import java.io.IOException;
 
 import org.apache.poi.EncryptedDocumentException;
 import org.apache.poi.poifs.filesystem.DirectoryNode;
-import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
 import org.apache.poi.util.BitField;
 import org.apache.poi.util.BitFieldFactory;
@@ -85,13 +84,6 @@ public class EncryptionInfo implements C
     /**
      * Opens for decryption
      */
-    public EncryptionInfo(NPOIFSFileSystem fs) throws IOException {
-       this(fs.getRoot());
-    }
-    
-    /**
-     * Opens for decryption
-     */
     public EncryptionInfo(DirectoryNode dir) throws IOException {
         this(dir.createDocumentInputStream("EncryptionInfo"), null);
     }
@@ -209,7 +201,7 @@ public class EncryptionInfo implements C
      * @throws IllegalAccessException if the builder class can't be loaded
      * @throws InstantiationException if the builder class can't be loaded
      */
-    @SuppressWarnings("WeakerAccess")
+    @SuppressWarnings({"WeakerAccess", "JavadocReference"})
     protected static EncryptionInfoBuilder getBuilder(EncryptionMode encryptionMode)
     throws ClassNotFoundException, IllegalAccessException, InstantiationException {
         ClassLoader cl = EncryptionInfo.class.getClassLoader();

Modified: poi/trunk/src/java/org/apache/poi/poifs/crypt/Encryptor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/crypt/Encryptor.java?rev=1839709&r1=1839708&r2=1839709&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/poifs/crypt/Encryptor.java (original)
+++ poi/trunk/src/java/org/apache/poi/poifs/crypt/Encryptor.java Fri Aug 31 00:25:50 2018
@@ -25,7 +25,6 @@ import javax.crypto.spec.SecretKeySpec;
 
 import org.apache.poi.EncryptedDocumentException;
 import org.apache.poi.poifs.filesystem.DirectoryNode;
-import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
 
 public abstract class Encryptor implements Cloneable {
@@ -51,9 +50,6 @@ public abstract class Encryptor implemen
 	    return info.getEncryptor();
     }
 
-    public OutputStream getDataStream(NPOIFSFileSystem fs) throws IOException, GeneralSecurityException {
-        return getDataStream(fs.getRoot());
-    }
     public OutputStream getDataStream(POIFSFileSystem fs) throws IOException, GeneralSecurityException {
         return getDataStream(fs.getRoot());
     }

Modified: poi/trunk/src/java/org/apache/poi/poifs/crypt/cryptoapi/CryptoAPIEncryptor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/crypt/cryptoapi/CryptoAPIEncryptor.java?rev=1839709&r1=1839708&r2=1839709&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/poifs/crypt/cryptoapi/CryptoAPIEncryptor.java (original)
+++ poi/trunk/src/java/org/apache/poi/poifs/crypt/cryptoapi/CryptoAPIEncryptor.java Fri Aug 31 00:25:50 2018
@@ -34,26 +34,23 @@ import javax.crypto.SecretKey;
 import org.apache.poi.EncryptedDocumentException;
 import org.apache.poi.poifs.crypt.ChunkedCipherOutputStream;
 import org.apache.poi.poifs.crypt.CryptoFunctions;
-import org.apache.poi.poifs.crypt.DataSpaceMapUtils;
 import org.apache.poi.poifs.crypt.EncryptionInfo;
 import org.apache.poi.poifs.crypt.Encryptor;
 import org.apache.poi.poifs.crypt.HashAlgorithm;
 import org.apache.poi.poifs.crypt.cryptoapi.CryptoAPIDecryptor.StreamDescriptorEntry;
-import org.apache.poi.poifs.crypt.standard.EncryptionRecord;
 import org.apache.poi.poifs.filesystem.DirectoryNode;
 import org.apache.poi.poifs.filesystem.DocumentInputStream;
 import org.apache.poi.poifs.filesystem.Entry;
-import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
+import org.apache.poi.poifs.filesystem.POIFSFileSystem;
 import org.apache.poi.util.IOUtils;
 import org.apache.poi.util.LittleEndian;
-import org.apache.poi.util.LittleEndianByteArrayOutputStream;
 import org.apache.poi.util.StringUtil;
 
 public class CryptoAPIEncryptor extends Encryptor implements Cloneable {
     
     private int chunkSize = 512;
     
-    protected CryptoAPIEncryptor() {
+    CryptoAPIEncryptor() {
     }
 
     @Override
@@ -96,7 +93,7 @@ public class CryptoAPIEncryptor extends
      * @param cipher may be null, otherwise the given instance is reset to the new block index
      * @param block the block index, e.g. the persist/slide id (hslf)
      * @return a new cipher object, if cipher was null, otherwise the reinitialized cipher
-     * @throws GeneralSecurityException
+     * @throws GeneralSecurityException when the cipher can't be initialized
      */
     public Cipher initCipherForBlock(Cipher cipher, int block)
     throws GeneralSecurityException {
@@ -104,8 +101,7 @@ public class CryptoAPIEncryptor extends
     }    
 
     @Override
-    public ChunkedCipherOutputStream getDataStream(DirectoryNode dir)
-    throws IOException, GeneralSecurityException {
+    public ChunkedCipherOutputStream getDataStream(DirectoryNode dir) throws IOException {
         throw new IOException("not supported");
     }
     
@@ -122,7 +118,7 @@ public class CryptoAPIEncryptor extends
      * 
      * @see <a href="http://msdn.microsoft.com/en-us/library/dd943321(v=office.12).aspx">2.3.5.4 RC4 CryptoAPI Encrypted Summary Stream</a>
      */
-    public void setSummaryEntries(DirectoryNode dir, String encryptedStream, NPOIFSFileSystem entries)
+    public void setSummaryEntries(DirectoryNode dir, String encryptedStream, POIFSFileSystem entries)
     throws IOException, GeneralSecurityException {
         CryptoAPIDocumentOutputStream bos = new CryptoAPIDocumentOutputStream(this); // NOSONAR
         byte buf[] = new byte[8];
@@ -191,33 +187,15 @@ public class CryptoAPIEncryptor extends
         dir.createDocument(encryptedStream, new ByteArrayInputStream(bos.getBuf(), 0, savedSize));
     }
 
-    protected int getKeySizeInBytes() {
-        return getEncryptionInfo().getHeader().getKeySize() / 8;
-    }
+//    protected int getKeySizeInBytes() {
+//        return getEncryptionInfo().getHeader().getKeySize() / 8;
+//    }
 
     @Override
     public void setChunkSize(int chunkSize) {
         this.chunkSize = chunkSize;
     }
     
-    protected void createEncryptionInfoEntry(DirectoryNode dir) throws IOException {
-        DataSpaceMapUtils.addDefaultDataSpace(dir);
-        final EncryptionInfo info = getEncryptionInfo();
-        final CryptoAPIEncryptionHeader header = (CryptoAPIEncryptionHeader)getEncryptionInfo().getHeader();
-        final CryptoAPIEncryptionVerifier verifier = (CryptoAPIEncryptionVerifier)getEncryptionInfo().getVerifier();
-        EncryptionRecord er = new EncryptionRecord() {
-            @Override
-            public void write(LittleEndianByteArrayOutputStream bos) {
-                bos.writeShort(info.getVersionMajor());
-                bos.writeShort(info.getVersionMinor());
-                header.write(bos);
-                verifier.write(bos);
-            }
-        };
-        DataSpaceMapUtils.createEncryptionEntry(dir, "EncryptionInfo", er);
-    }
-
-
     @Override
     public CryptoAPIEncryptor clone() throws CloneNotSupportedException {
         return (CryptoAPIEncryptor)super.clone();
@@ -239,12 +217,11 @@ public class CryptoAPIEncryptor extends
         }
 
         @Override
-        protected void createEncryptionInfoEntry(DirectoryNode dir, File tmpFile)
-        throws IOException, GeneralSecurityException {
+        protected void createEncryptionInfoEntry(DirectoryNode dir, File tmpFile) {
             throw new EncryptedDocumentException("createEncryptionInfoEntry not supported");
         }
 
-        public CryptoAPICipherOutputStream(OutputStream stream)
+        CryptoAPICipherOutputStream(OutputStream stream)
         throws IOException, GeneralSecurityException {
             super(stream, CryptoAPIEncryptor.this.chunkSize);
         }

Modified: poi/trunk/src/java/org/apache/poi/poifs/crypt/xor/XOREncryptor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/crypt/xor/XOREncryptor.java?rev=1839709&r1=1839708&r2=1839709&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/poifs/crypt/xor/XOREncryptor.java (original)
+++ poi/trunk/src/java/org/apache/poi/poifs/crypt/xor/XOREncryptor.java Fri Aug 31 00:25:50 2018
@@ -26,6 +26,7 @@ import java.util.BitSet;
 import javax.crypto.Cipher;
 import javax.crypto.spec.SecretKeySpec;
 
+import org.apache.poi.EncryptedDocumentException;
 import org.apache.poi.poifs.crypt.ChunkedCipherOutputStream;
 import org.apache.poi.poifs.crypt.CryptoFunctions;
 import org.apache.poi.poifs.crypt.Encryptor;
@@ -79,9 +80,6 @@ public class XOREncryptor extends Encryp
         // chunkSize is irrelevant
     }
 
-    protected void createEncryptionInfoEntry(DirectoryNode dir) throws IOException {
-    }
-
     @Override
     public XOREncryptor clone() throws CloneNotSupportedException {
         return (XOREncryptor)super.clone();
@@ -110,9 +108,8 @@ public class XOREncryptor extends Encryp
         }
 
         @Override
-        protected void createEncryptionInfoEntry(DirectoryNode dir, File tmpFile)
-        throws IOException, GeneralSecurityException {
-            XOREncryptor.this.createEncryptionInfoEntry(dir);
+        protected void createEncryptionInfoEntry(DirectoryNode dir, File tmpFile) {
+            throw new EncryptedDocumentException("createEncryptionInfoEntry not supported");
         }
 
         @Override

Modified: poi/trunk/src/java/org/apache/poi/poifs/dev/POIFSDump.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/dev/POIFSDump.java?rev=1839709&r1=1839708&r2=1839709&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/poifs/dev/POIFSDump.java (original)
+++ poi/trunk/src/java/org/apache/poi/poifs/dev/POIFSDump.java Fri Aug 31 00:25:50 2018
@@ -29,20 +29,21 @@ import org.apache.poi.poifs.filesystem.D
 import org.apache.poi.poifs.filesystem.DocumentInputStream;
 import org.apache.poi.poifs.filesystem.DocumentNode;
 import org.apache.poi.poifs.filesystem.Entry;
-import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
-import org.apache.poi.poifs.filesystem.NPOIFSStream;
-import org.apache.poi.poifs.property.NPropertyTable;
+import org.apache.poi.poifs.filesystem.POIFSFileSystem;
+import org.apache.poi.poifs.filesystem.POIFSStream;
+import org.apache.poi.poifs.property.PropertyTable;
 import org.apache.poi.poifs.storage.HeaderBlock;
 import org.apache.poi.util.IOUtils;
 
 /**
  * Dump internal structure of a OLE2 file into file system
  */
-public class POIFSDump {
-
+public final class POIFSDump {
     //arbitrarily selected; may need to increase
     private static final int MAX_RECORD_LENGTH = 100_000;
 
+    private POIFSDump() {}
+
     public static void main(String[] args) throws IOException {
         if (args.length == 0) {
             System.err.println("Must specify at least one file to dump");
@@ -66,14 +67,8 @@ public class POIFSDump {
             }
 
             System.out.println("Dumping " + filename);
-            FileInputStream is = new FileInputStream(filename);
-            NPOIFSFileSystem fs;
-            try {
-                fs = new NPOIFSFileSystem(is);
-            } finally {
-                is.close();
-            }
-            try {
+            try (FileInputStream is = new FileInputStream(filename);
+                 POIFSFileSystem fs = new POIFSFileSystem(is)) {
                 DirectoryEntry root = fs.getRoot();
                 String filenameWithoutPath = new File(filename).getName();
                 File dumpDir = new File(filenameWithoutPath + "_dump");
@@ -89,7 +84,7 @@ public class POIFSDump {
                     dump(fs, header.getPropertyStart(), "properties", file);
                 }
                 if (dumpMini) {
-                    NPropertyTable props = fs.getPropertyTable();
+                    PropertyTable props = fs.getPropertyTable();
                     int startBlock = props.getRoot().getStartBlock();
                     if (startBlock == POIFSConstants.END_OF_CHAIN) {
                         System.err.println("No Mini Stream in file");
@@ -97,8 +92,6 @@ public class POIFSDump {
                         dump(fs, startBlock, "mini-stream", file);
                     }
                 }
-            } finally {
-                fs.close();
             }
         }
     }
@@ -112,11 +105,8 @@ public class POIFSDump {
                 byte[] bytes = IOUtils.toByteArray(is);
                 is.close();
 
-                OutputStream out = new FileOutputStream(new File(parent, node.getName().trim()));
-                try {
-                	out.write(bytes);
-                } finally {
-                	out.close();
+                try (OutputStream out = new FileOutputStream(new File(parent, node.getName().trim()))) {
+                    out.write(bytes);
                 }
             } else if (entry instanceof DirectoryEntry){
                 DirectoryEntry dir = (DirectoryEntry)entry;
@@ -130,11 +120,10 @@ public class POIFSDump {
             }
         }
     }
-    public static void dump(NPOIFSFileSystem fs, int startBlock, String name, File parent) throws IOException {
+    public static void dump(POIFSFileSystem fs, int startBlock, String name, File parent) throws IOException {
         File file = new File(parent, name);
-        FileOutputStream out = new FileOutputStream(file);
-        try {
-            NPOIFSStream stream = new NPOIFSStream(fs, startBlock);
+        try (FileOutputStream out = new FileOutputStream(file)) {
+            POIFSStream stream = new POIFSStream(fs, startBlock);
 
             byte[] b = IOUtils.safelyAllocate(fs.getBigBlockSize(), MAX_RECORD_LENGTH);
             for (ByteBuffer bb : stream) {
@@ -142,8 +131,6 @@ public class POIFSDump {
                 bb.get(b);
                 out.write(b, 0, len);
             }
-        } finally {
-            out.close();
         }
     }
 }

Modified: poi/trunk/src/java/org/apache/poi/poifs/dev/POIFSLister.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/dev/POIFSLister.java?rev=1839709&r1=1839708&r2=1839709&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/poifs/dev/POIFSLister.java (original)
+++ poi/trunk/src/java/org/apache/poi/poifs/dev/POIFSLister.java Fri Aug 31 00:25:50 2018
@@ -25,7 +25,6 @@ import java.util.Iterator;
 import org.apache.poi.poifs.filesystem.DirectoryNode;
 import org.apache.poi.poifs.filesystem.DocumentNode;
 import org.apache.poi.poifs.filesystem.Entry;
-import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
 
 /**
@@ -47,23 +46,23 @@ public class POIFSLister {
 
       boolean withSizes = false;
       boolean newPOIFS = true;
-      for (int j = 0; j < args.length; j++) {
-         if (args[j].equalsIgnoreCase("-size") || args[j].equalsIgnoreCase("-sizes")) {
+      for (String arg : args) {
+         if (arg.equalsIgnoreCase("-size") || arg.equalsIgnoreCase("-sizes")) {
             withSizes = true;
-         } else if (args[j].equalsIgnoreCase("-old") || args[j].equalsIgnoreCase("-old-poifs")) {
+         } else if (arg.equalsIgnoreCase("-old") || arg.equalsIgnoreCase("-old-poifs")) {
             newPOIFS = false;
          } else {
-            if(newPOIFS) {
-               viewFile(args[j], withSizes);
+            if (newPOIFS) {
+               viewFile(arg, withSizes);
             } else {
-               viewFileOld(args[j], withSizes);
+               viewFileOld(arg, withSizes);
             }
          }
       }
    }
 
    public static void viewFile(final String filename, boolean withSizes) throws IOException {
-      NPOIFSFileSystem fs = new NPOIFSFileSystem(new File(filename));
+      POIFSFileSystem fs = new POIFSFileSystem(new File(filename));
       displayDirectory(fs.getRoot(), "", withSizes);
       fs.close();
    }

Modified: poi/trunk/src/java/org/apache/poi/poifs/dev/POIFSViewer.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/dev/POIFSViewer.java?rev=1839709&r1=1839708&r2=1839709&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/poifs/dev/POIFSViewer.java (original)
+++ poi/trunk/src/java/org/apache/poi/poifs/dev/POIFSViewer.java Fri Aug 31 00:25:50 2018
@@ -23,7 +23,7 @@ import java.io.File;
 import java.io.IOException;
 import java.util.List;
 
-import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
+import org.apache.poi.poifs.filesystem.POIFSFileSystem;
 
 /**
  * A simple viewer for POIFS files
@@ -31,8 +31,9 @@ import org.apache.poi.poifs.filesystem.N
  * @author Marc Johnson (mjohnson at apache dot org)
  */
 
-public class POIFSViewer
-{
+public final class POIFSViewer {
+
+    private POIFSViewer() {}
 
     /**
      * Display the contents of multiple POIFS files
@@ -47,9 +48,8 @@ public class POIFSViewer
         }
         boolean printNames = (args.length > 1);
 
-        for (int j = 0; j < args.length; j++)
-        {
-            viewFile(args[ j ], printNames);
+        for (String arg : args) {
+            viewFile(arg, printNames);
         }
     }
 
@@ -67,7 +67,7 @@ public class POIFSViewer
             System.out.println(flowerbox);
         }
         try {
-            NPOIFSFileSystem fs = new NPOIFSFileSystem(new File(filename));
+            POIFSFileSystem fs = new POIFSFileSystem(new File(filename));
             List<String> strings = POIFSViewEngine.inspectViewable(fs, true, 0, "  ");
             for (String s : strings) {
                 System.out.print(s);
@@ -77,5 +77,4 @@ public class POIFSViewer
             System.out.println(e.getMessage());
         }
     }
-}   // end public class POIFSViewer
-
+}
\ No newline at end of file

Modified: poi/trunk/src/java/org/apache/poi/poifs/eventfilesystem/POIFSReader.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/eventfilesystem/POIFSReader.java?rev=1839709&r1=1839708&r2=1839709&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/poifs/eventfilesystem/POIFSReader.java (original)
+++ poi/trunk/src/java/org/apache/poi/poifs/eventfilesystem/POIFSReader.java Fri Aug 31 00:25:50 2018
@@ -24,12 +24,12 @@ import java.io.IOException;
 import java.io.InputStream;
 
 import org.apache.poi.poifs.filesystem.DocumentInputStream;
-import org.apache.poi.poifs.filesystem.NPOIFSDocument;
-import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
+import org.apache.poi.poifs.filesystem.POIFSDocument;
+import org.apache.poi.poifs.filesystem.POIFSFileSystem;
 import org.apache.poi.poifs.filesystem.POIFSDocumentPath;
 import org.apache.poi.poifs.property.DirectoryProperty;
 import org.apache.poi.poifs.property.DocumentProperty;
-import org.apache.poi.poifs.property.NPropertyTable;
+import org.apache.poi.poifs.property.PropertyTable;
 import org.apache.poi.poifs.property.Property;
 import org.apache.poi.poifs.property.RootProperty;
 import org.apache.poi.util.IOUtils;
@@ -59,7 +59,7 @@ public class POIFSReader
      */
 
     public void read(final InputStream stream) throws IOException {
-        try (NPOIFSFileSystem poifs = new NPOIFSFileSystem(stream)) {
+        try (POIFSFileSystem poifs = new POIFSFileSystem(stream)) {
             read(poifs);
         }
     }
@@ -72,7 +72,7 @@ public class POIFSReader
      * @exception IOException on errors reading, or on invalid data
      */
     public void read(final File poifsFile) throws IOException {
-        try (NPOIFSFileSystem poifs = new NPOIFSFileSystem(poifsFile, true)) {
+        try (POIFSFileSystem poifs = new POIFSFileSystem(poifsFile, true)) {
             read(poifs);
         }
     }
@@ -84,11 +84,11 @@ public class POIFSReader
      *
      * @exception IOException on errors reading, or on invalid data
      */
-    public void read(final NPOIFSFileSystem poifs) throws IOException {
+    public void read(final POIFSFileSystem poifs) throws IOException {
         registryClosed = true;
 
         // get property table from the document
-        NPropertyTable properties = poifs.getPropertyTable();
+        PropertyTable properties = poifs.getPropertyTable();
 
         // process documents
         RootProperty root = properties.getRoot();
@@ -212,7 +212,7 @@ public class POIFSReader
         }
     }
 
-    private void processProperties(final NPOIFSFileSystem poifs, DirectoryProperty dir, final POIFSDocumentPath path) {
+    private void processProperties(final POIFSFileSystem poifs, DirectoryProperty dir, final POIFSDocumentPath path) {
         boolean hasChildren = false;
         for (final Property property : dir) {
             hasChildren = true;
@@ -222,10 +222,10 @@ public class POIFSReader
                 POIFSDocumentPath new_path = new POIFSDocumentPath(path,new String[]{name});
                 processProperties(poifs, (DirectoryProperty) property, new_path);
             } else {
-                NPOIFSDocument document = null;
+                POIFSDocument document = null;
                 for (POIFSReaderListener rl : registry.getListeners(path, name)) {
                     if (document == null) {
-                        document = new NPOIFSDocument((DocumentProperty)property, poifs);
+                        document = new POIFSDocument((DocumentProperty)property, poifs);
                     }
                     try (DocumentInputStream dis = new DocumentInputStream(document)) {
                         POIFSReaderEvent pe = new POIFSReaderEvent(dis, path, name);

Modified: poi/trunk/src/java/org/apache/poi/poifs/filesystem/DirectoryNode.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/filesystem/DirectoryNode.java?rev=1839709&r1=1839708&r2=1839709&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/poifs/filesystem/DirectoryNode.java (original)
+++ poi/trunk/src/java/org/apache/poi/poifs/filesystem/DirectoryNode.java Fri Aug 31 00:25:50 2018
@@ -50,7 +50,7 @@ public class DirectoryNode
     private final ArrayList<Entry> _entries = new ArrayList<>();
 
     // the NPOIFSFileSytem we belong to
-    private final NPOIFSFileSystem  _nfilesystem;
+    private final POIFSFileSystem _nfilesystem;
 
     // the path described by this document
     private final POIFSDocumentPath _path;
@@ -64,7 +64,7 @@ public class DirectoryNode
      * @param parent the parent of this entry
      */
     DirectoryNode(final DirectoryProperty property,
-                  final NPOIFSFileSystem nfilesystem,
+                  final POIFSFileSystem nfilesystem,
                   final DirectoryNode parent)
     {
         super(property, parent);
@@ -114,7 +114,7 @@ public class DirectoryNode
     /**
      * @return the filesystem that this belongs to
      */
-    public NPOIFSFileSystem getFileSystem()
+    public POIFSFileSystem getFileSystem()
     {
         return _nfilesystem;
     }
@@ -125,7 +125,7 @@ public class DirectoryNode
      *  that this belong to, otherwise Null if OPOIFS based
      * @return the filesystem that this belongs to
      */
-    public NPOIFSFileSystem getNFileSystem()
+    public POIFSFileSystem getNFileSystem()
     {
         return _nfilesystem;
     }
@@ -152,7 +152,7 @@ public class DirectoryNode
      *
      * @param document the document to be opened
      *
-     * @return a newly opened DocumentInputStream or NDocumentInputStream
+     * @return a newly opened DocumentInputStream or DocumentInputStream
      *
      * @exception IOException if the document does not exist or the
      *            name is that of a DirectoryEntry
@@ -179,7 +179,7 @@ public class DirectoryNode
      *
      * @exception IOException if the document can't be created
      */
-    DocumentEntry createDocument(final NPOIFSDocument document)
+    DocumentEntry createDocument(final POIFSDocument document)
         throws IOException
     {
         DocumentProperty property = document.getDocumentProperty();
@@ -351,7 +351,7 @@ public class DirectoryNode
                                         final InputStream stream)
         throws IOException
     {
-        return createDocument(new NPOIFSDocument(name, _nfilesystem, stream));
+        return createDocument(new POIFSDocument(name, _nfilesystem, stream));
     }
 
     /**
@@ -370,7 +370,7 @@ public class DirectoryNode
                                         final POIFSWriterListener writer)
         throws IOException
     {
-        return createDocument(new NPOIFSDocument(name, size, _nfilesystem, writer));
+        return createDocument(new POIFSDocument(name, size, _nfilesystem, writer));
     }
 
     /**
@@ -417,7 +417,7 @@ public class DirectoryNode
             return createDocument(name, stream);
         } else {
             DocumentNode existing = (DocumentNode)getEntry(name);
-            NPOIFSDocument nDoc = new NPOIFSDocument(existing);
+            POIFSDocument nDoc = new POIFSDocument(existing);
             nDoc.replaceContents(stream);
             return existing;
         }

Modified: poi/trunk/src/java/org/apache/poi/poifs/filesystem/DocumentFactoryHelper.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/filesystem/DocumentFactoryHelper.java?rev=1839709&r1=1839708&r2=1839709&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/poifs/filesystem/DocumentFactoryHelper.java (original)
+++ poi/trunk/src/java/org/apache/poi/poifs/filesystem/DocumentFactoryHelper.java Fri Aug 31 00:25:50 2018
@@ -33,7 +33,10 @@ import org.apache.poi.util.Removal;
  * SlideShowFactory to combine common code here.
  */
 @Internal
-public class DocumentFactoryHelper {
+public final class DocumentFactoryHelper {
+    private DocumentFactoryHelper() {
+    }
+
     /**
      * Wrap the OLE2 data in the NPOIFSFileSystem into a decrypted stream by using
      * the given password.
@@ -43,7 +46,7 @@ public class DocumentFactoryHelper {
      * @return A stream for reading the decrypted data
      * @throws IOException If an error occurs while decrypting or if the password does not match
      */
-    public static InputStream getDecryptedStream(final NPOIFSFileSystem fs, String password)
+    public static InputStream getDecryptedStream(final POIFSFileSystem fs, String password)
     throws IOException {
         // wrap the stream in a FilterInputStream to close the NPOIFSFileSystem
         // as well when the resulting OPCPackage is closed



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