]> source.dussan.org Git - poi.git/commitdiff
Bug47950 -- make stream/directory name lookup in OLE2 case insensitive
authorTim Allison <tallison@apache.org>
Wed, 20 Sep 2023 20:32:59 +0000 (20:32 +0000)
committerTim Allison <tallison@apache.org>
Wed, 20 Sep 2023 20:32:59 +0000 (20:32 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1912438 13f79535-47bb-0310-9956-ffa450edef68

70 files changed:
poi-examples/src/main/java/org/apache/poi/examples/hpsf/CopyCompare.java
poi-examples/src/main/java/org/apache/poi/examples/hpsf/WriteAuthorAndTitle.java
poi-integration/src/test/java/org/apache/poi/stress/HPSFFileHandler.java
poi-integration/src/test/java/org/apache/poi/stress/POIXMLDocumentHandler.java
poi-ooxml/src/main/java/org/apache/poi/ooxml/extractor/POIXMLExtractorFactory.java
poi-ooxml/src/test/java/org/apache/poi/poifs/crypt/tests/TestEncryptor.java
poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFBugs.java
poi-scratchpad/src/main/java/org/apache/poi/extractor/ole2/OLE2ScratchpadExtractorFactory.java
poi-scratchpad/src/main/java/org/apache/poi/hpbf/dev/HPBFDumper.java
poi-scratchpad/src/main/java/org/apache/poi/hpbf/model/HPBFPart.java
poi-scratchpad/src/main/java/org/apache/poi/hslf/dev/PPTXMLDump.java
poi-scratchpad/src/main/java/org/apache/poi/hslf/record/CurrentUserAtom.java
poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFSlideShow.java
poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFSlideShowImpl.java
poi-scratchpad/src/main/java/org/apache/poi/hwpf/HWPFDocument.java
poi-scratchpad/src/main/java/org/apache/poi/hwpf/HWPFDocumentCore.java
poi-scratchpad/src/main/java/org/apache/poi/hwpf/converter/WordToTextConverter.java
poi-scratchpad/src/main/java/org/apache/poi/hwpf/usermodel/ObjectPoolImpl.java
poi-scratchpad/src/test/java/org/apache/poi/hslf/TestReWrite.java
poi-scratchpad/src/test/java/org/apache/poi/hslf/extractor/TestExtractor.java
poi-scratchpad/src/test/java/org/apache/poi/hslf/model/TestTextRunReWrite.java
poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestCurrentUserAtom.java
poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestExOleObjStg.java
poi-scratchpad/src/test/java/org/apache/poi/hsmf/parsers/TestPOIFSChunkParser.java
poi-scratchpad/src/test/java/org/apache/poi/hwpf/HWPFDocFixture.java
poi-scratchpad/src/test/java/org/apache/poi/hwpf/extractor/TestWordExtractor.java
poi/src/main/java/org/apache/poi/POIDocument.java
poi/src/main/java/org/apache/poi/extractor/ExtractorFactory.java
poi/src/main/java/org/apache/poi/extractor/MainExtractorFactory.java
poi/src/main/java/org/apache/poi/hpsf/PropertySet.java
poi/src/main/java/org/apache/poi/hssf/eventusermodel/HSSFEventFactory.java
poi/src/main/java/org/apache/poi/hssf/extractor/OldExcelExtractor.java
poi/src/main/java/org/apache/poi/hssf/model/InternalWorkbook.java
poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFObjectData.java
poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFPatriarch.java
poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java
poi/src/main/java/org/apache/poi/poifs/crypt/DataSpaceMapUtils.java
poi/src/main/java/org/apache/poi/poifs/crypt/cryptoapi/CryptoAPIDecryptor.java
poi/src/main/java/org/apache/poi/poifs/filesystem/DirectoryEntry.java
poi/src/main/java/org/apache/poi/poifs/filesystem/DirectoryNode.java
poi/src/main/java/org/apache/poi/poifs/filesystem/DocumentFactoryHelper.java
poi/src/main/java/org/apache/poi/poifs/filesystem/FilteringDirectoryNode.java
poi/src/main/java/org/apache/poi/poifs/filesystem/Ole10Native.java
poi/src/main/java/org/apache/poi/poifs/macros/VBAMacroReader.java
poi/src/main/java/org/apache/poi/sl/usermodel/ObjectShape.java
poi/src/main/java/org/apache/poi/sl/usermodel/SlideShowFactory.java
poi/src/main/java/org/apache/poi/ss/extractor/EmbeddedExtractor.java
poi/src/main/java/org/apache/poi/ss/usermodel/WorkbookFactory.java
poi/src/test/java/org/apache/poi/hpsf/basic/TestReadAllFiles.java
poi/src/test/java/org/apache/poi/hpsf/basic/TestWrite.java
poi/src/test/java/org/apache/poi/hpsf/basic/TestWriteWellKnown.java
poi/src/test/java/org/apache/poi/hssf/extractor/TestExcelExtractor.java
poi/src/test/java/org/apache/poi/hssf/usermodel/TestBugs.java
poi/src/test/java/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java
poi/src/test/java/org/apache/poi/hssf/usermodel/TestNonStandardWorkbookStreamNames.java
poi/src/test/java/org/apache/poi/hssf/usermodel/TestPOIFSProperties.java
poi/src/test/java/org/apache/poi/poifs/filesystem/ReaderWriter.java
poi/src/test/java/org/apache/poi/poifs/filesystem/TestDirectoryNode.java
poi/src/test/java/org/apache/poi/poifs/filesystem/TestDocument.java
poi/src/test/java/org/apache/poi/poifs/filesystem/TestDocumentInputStream.java
poi/src/test/java/org/apache/poi/poifs/filesystem/TestEmptyDocument.java
poi/src/test/java/org/apache/poi/poifs/filesystem/TestEntryUtils.java
poi/src/test/java/org/apache/poi/poifs/filesystem/TestFilteringDirectoryNode.java
poi/src/test/java/org/apache/poi/poifs/filesystem/TestPOIFSFileSystem.java
poi/src/test/java/org/apache/poi/poifs/filesystem/TestPOIFSMiniStore.java
poi/src/test/java/org/apache/poi/poifs/filesystem/TestPOIFSStream.java
poi/src/test/java/org/apache/poi/poifs/filesystem/TestPropertySorter.java
test-data/document/47950_lower.doc [new file with mode: 0644]
test-data/document/47950_normal.doc [new file with mode: 0644]
test-data/document/47950_upper.doc [new file with mode: 0644]

index 010504140ceeefb2ad199b6f8dd5fb5c753abb41..fef6ae5aefc4f46407a10edb0de54733e52d87e1 100644 (file)
@@ -174,8 +174,8 @@ public final class CopyCompare {
 
                 for (int i=0; i<path.length(); i++) {
                     String subDir = path.getComponent(i);
-                    if (de.hasEntry(subDir)) {
-                        de = (DirectoryEntry)de.getEntry(subDir);
+                    if (de.hasEntryCaseInsensitive(subDir)) {
+                        de = (DirectoryEntry)de.getEntryCaseInsensitive(subDir);
                     } else {
                         de = de.createDirectory(subDir);
                         if (i == path.length()-1) {
index 71f4d8aa935fe940dbf676cb68c8964ba400bcd4..c731b0ac898a76c885c80fea652a757c10432274 100644 (file)
@@ -158,7 +158,7 @@ public final class WriteAuthorAndTitle {
 
                 for (int i=0; i<path.length(); i++) {
                     String subDir = path.getComponent(i);
-                    de = (de.hasEntry(subDir)) ? (DirectoryEntry)de.getEntry(subDir) : de.createDirectory(subDir);
+                    de = (de.hasEntryCaseInsensitive(subDir)) ? (DirectoryEntry)de.getEntryCaseInsensitive(subDir) : de.createDirectory(subDir);
                 }
 
                 de.createDocument(event.getName(), is);
index 705bed2e53dd01aaecbebb17b0739748b8b6e5de..9edd92306fef52696ad0e49f3529cd8f7239df0f 100644 (file)
@@ -101,7 +101,7 @@ public class HPSFFileHandler extends POIFSFileHandler {
 
     private static boolean hasPropertyStream(POIFSFileSystem poifs, String streamName) throws IOException {
         DirectoryNode root = poifs.getRoot();
-        if (!root.hasEntry(streamName)) {
+        if (!root.hasEntryCaseInsensitive(streamName)) {
             return false;
         }
         try (DocumentInputStream dis = root.createDocumentInputStream(streamName)) {
index 88b269b68750818f13a297a36ffa97d5267094f3..6dd78b1a6a13f7dbfdc6dc7ca3c97b5d872a265c 100644 (file)
@@ -40,7 +40,7 @@ public final class POIXMLDocumentHandler {
     protected static boolean isEncrypted(InputStream stream) throws IOException {
         if (FileMagic.valueOf(stream) == FileMagic.OLE2) {
             try (POIFSFileSystem poifs = new POIFSFileSystem(stream)) {
-                if (poifs.getRoot().hasEntry(Decryptor.DEFAULT_POIFS_ENTRY)) {
+                if (poifs.getRoot().hasEntryCaseInsensitive(Decryptor.DEFAULT_POIFS_ENTRY)) {
                     return true;
                 }
             }
index a648f26d9f3d97ed55498cc7e83e70cb0f4dab2e..e1981e9f60f0c5b79a5b54fe94586013e3e1b8ab 100644 (file)
@@ -282,13 +282,13 @@ public final class POIXMLExtractorFactory implements ExtractorProvider {
     @Override
     public POITextExtractor create(DirectoryNode poifsDir, String password) throws IOException {
         // First, check for plain OOXML package
-        if (poifsDir.hasEntry(OOXML_PACKAGE)) {
+        if (poifsDir.hasEntryCaseInsensitive(OOXML_PACKAGE)) {
             try (InputStream is = poifsDir.createDocumentInputStream(OOXML_PACKAGE)) {
                 return create(is, password);
             }
         }
 
-        if (poifsDir.hasEntry(Decryptor.DEFAULT_POIFS_ENTRY)) {
+        if (poifsDir.hasEntryCaseInsensitive(Decryptor.DEFAULT_POIFS_ENTRY)) {
             EncryptionInfo ei = new EncryptionInfo(poifsDir);
             Decryptor dec = ei.getDecryptor();
             try {
index f531631e38faf5be07902c6dc72ce32dd6747077..57855faf2e8f13b2998487826366e0b7da8f0bda 100644 (file)
@@ -171,7 +171,7 @@ class TestEncryptor {
             assertEquals(decPackLenExpected, payloadExpected.length);
 
             final DirectoryNode root = nfs.getRoot();
-            final DocumentEntry entry = (DocumentEntry)root.getEntry(Decryptor.DEFAULT_POIFS_ENTRY);
+            final DocumentEntry entry = (DocumentEntry)root.getEntryCaseInsensitive(Decryptor.DEFAULT_POIFS_ENTRY);
             try (InputStream is = root.createDocumentInputStream(entry)) {
                 // ignore padding block
                 encPackExpected = IOUtils.toByteArray(is, entry.getSize()-16);
@@ -225,7 +225,7 @@ class TestEncryptor {
             decPackLenActual = decActual.getLength();
 
             final DirectoryNode root = nfs.getRoot();
-            final DocumentEntry entry = (DocumentEntry)root.getEntry(Decryptor.DEFAULT_POIFS_ENTRY);
+            final DocumentEntry entry = (DocumentEntry)root.getEntryCaseInsensitive(Decryptor.DEFAULT_POIFS_ENTRY);
             try (InputStream is = root.createDocumentInputStream(entry)) {
                 // ignore padding block
                 encPackActual = IOUtils.toByteArray(is, entry.getSize()-16);
index 700196e53c118978866296f030158c9459f07a95..37013d73bec8d9e862236bfca48ee6e3f002579b 100644 (file)
@@ -3460,13 +3460,13 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
 
             // Will be OOXML wrapped in OLE2, not directly SpreadSheet
             POIFSFileSystem fs = new POIFSFileSystem(data.getInputStream());
-            assertTrue(fs.getRoot().hasEntry(OOXML_PACKAGE));
-            assertFalse(fs.getRoot().hasEntry("Workbook"));
+            assertTrue(fs.getRoot().hasEntryCaseInsensitive(OOXML_PACKAGE));
+            assertFalse(fs.getRoot().hasEntryCaseInsensitive("Workbook"));
 
 
             // Can fetch Package to get OOXML
             DirectoryNode root = fs.getRoot();
-            DocumentEntry docEntry = (DocumentEntry) root.getEntry(OOXML_PACKAGE);
+            DocumentEntry docEntry = (DocumentEntry) root.getEntryCaseInsensitive(OOXML_PACKAGE);
             try (DocumentInputStream dis = new DocumentInputStream(docEntry);
                  OPCPackage pkg = OPCPackage.open(dis);
                  XSSFWorkbook wb = new XSSFWorkbook(pkg)) {
@@ -3921,4 +3921,4 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
             }
         }
     }
-}
\ No newline at end of file
+}
index 64c2c6fce04e69385fb8f28fdb1ab2f248ccf3ab..5bd8783294377270c7dca36aedde7a14d60d63e4 100644 (file)
@@ -108,7 +108,7 @@ public class OLE2ScratchpadExtractorFactory implements ExtractorProvider {
         final String oldPW = Biff8EncryptionKey.getCurrentUserPassword();
         try {
             Biff8EncryptionKey.setCurrentUserPassword(password);
-            if (poifsDir.hasEntry("WordDocument")) {
+            if (poifsDir.hasEntryCaseInsensitive("WordDocument")) {
                 // Old or new style word document?
                 try {
                     return new WordExtractor(poifsDir);
@@ -117,20 +117,20 @@ public class OLE2ScratchpadExtractorFactory implements ExtractorProvider {
                 }
             }
 
-            if (poifsDir.hasEntry(HSLFSlideShow.POWERPOINT_DOCUMENT) || poifsDir.hasEntry(HSLFSlideShow.PP97_DOCUMENT)) {
+            if (poifsDir.hasEntryCaseInsensitive(HSLFSlideShow.POWERPOINT_DOCUMENT) || poifsDir.hasEntryCaseInsensitive(HSLFSlideShow.PP97_DOCUMENT)) {
                 return new SlideShowExtractor<>((HSLFSlideShow)SlideShowFactory.create(poifsDir));
             }
 
-            if (poifsDir.hasEntry("VisioDocument")) {
+            if (poifsDir.hasEntryCaseInsensitive("VisioDocument")) {
                 return new VisioTextExtractor(poifsDir);
             }
 
-            if (poifsDir.hasEntry("Quill")) {
+            if (poifsDir.hasEntryCaseInsensitive("Quill")) {
                 return new PublisherTextExtractor(poifsDir);
             }
 
             for (String entryName : OUTLOOK_ENTRY_NAMES) {
-                if (poifsDir.hasEntry(entryName)) {
+                if (poifsDir.hasEntryCaseInsensitive(entryName)) {
                     return new OutlookTextExtractor(poifsDir);
                 }
             }
@@ -168,7 +168,7 @@ public class OLE2ScratchpadExtractorFactory implements ExtractorProvider {
         } else if (ext instanceof WordExtractor) {
             // These are in ObjectPool -> _... under the root
             try {
-                DirectoryEntry op = (DirectoryEntry) root.getEntry("ObjectPool");
+                DirectoryEntry op = (DirectoryEntry) root.getEntryCaseInsensitive("ObjectPool");
                 StreamSupport.stream(op.spliterator(), false)
                     .filter(entry -> entry.getName().startsWith("_"))
                     .forEach(dirs::add);
index 4fccf48565ae66351d3761325be762eef9c31cd8..5154df98496b9c6f63a644ab592986fe86e2132d 100644 (file)
@@ -103,7 +103,7 @@ public final class HPBFDumper {
      */
     public void dumpEscher() throws IOException {
         DirectoryNode escherDir = (DirectoryNode)
-            fs.getRoot().getEntry("Escher");
+            fs.getRoot().getEntryCaseInsensitive("Escher");
 
         dumpEscherStm(escherDir);
         dumpEscherDelayStm(escherDir);
@@ -343,9 +343,9 @@ public final class HPBFDumper {
 
     public void dumpQuill() throws IOException {
         DirectoryNode quillDir = (DirectoryNode)
-            fs.getRoot().getEntry("Quill");
+            fs.getRoot().getEntryCaseInsensitive("Quill");
         DirectoryNode quillSubDir = (DirectoryNode)
-            quillDir.getEntry("QuillSub");
+            quillDir.getEntryCaseInsensitive("QuillSub");
 
         dump001CompObj(quillSubDir);
         dumpCONTENTSraw(quillSubDir);
index c3d44099de12bff32ebb8012773e5fc11918ba00..8016e9b7184449b6d47f9cece4212e68e39a50d1 100644 (file)
@@ -44,7 +44,7 @@ public abstract class HPBFPart {
         DirectoryNode dir = getDir(baseDir, path);
         String name = path[path.length-1];
 
-        if (!dir.hasEntry(name)) {
+        if (!dir.hasEntryCaseInsensitive(name)) {
             throw new IllegalArgumentException("File invalid - failed to find document entry '" + name + "'");
         }
 
@@ -78,7 +78,7 @@ public abstract class HPBFPart {
         DirectoryNode dir = baseDir;
         for(int i=0; i<path.length-1; i++) {
             try {
-                dir = (DirectoryNode)dir.getEntry(path[i]);
+                dir = (DirectoryNode)dir.getEntryCaseInsensitive(path[i]);
             } catch(FileNotFoundException e) {
                 dir.createDirectory(path[i]);
             }
index f6b523fcc3a124cfd980e9f84b742dc833a5349a..fff6523b85c63703ce35c9e0f6a656e711f28e71 100644 (file)
@@ -63,7 +63,7 @@ public final class PPTXMLDump {
     private static byte[] readEntry(POIFSFileSystem fs, String entry)
     throws IOException {
         DirectoryNode dn = fs.getRoot();
-        if (!dn.hasEntry(entry)) {
+        if (!dn.hasEntryCaseInsensitive(entry)) {
             return null;
         }
         try (InputStream is = dn.createDocumentInputStream(entry);
index 3bdcee13b98d3deb817e5dde41a8d0e8092acaf5..8f6cdd9aa20a5f8436aae5060566914d74742bcc 100644 (file)
@@ -140,7 +140,7 @@ public class CurrentUserAtom {
         // See how long it is. If it's under 28 bytes long, we can't
         //  read it
         if(_contents.length < 28) {
-            boolean isPP95 = dir.hasEntry(PP95_DOCUMENT);
+            boolean isPP95 = dir.hasEntryCaseInsensitive(PP95_DOCUMENT);
             // PPT95 has 4 byte size, then data
             if (!isPP95 && _contents.length >= 4) {
                 int size = LittleEndian.getInt(_contents);
index 8fd7a1d40a4d5a334697702a4aaed7b730dd8120..9b0d96cdfb3ca59546cf20ce25a50e89e3628b30 100644 (file)
@@ -1047,7 +1047,7 @@ public final class HSLFSlideShow extends POIDocument implements SlideShow<HSLFSh
             Map<String,ClassID> olemap = getOleMap();
             ClassID classID = null;
             for (Map.Entry<String,ClassID> entry : olemap.entrySet()) {
-                if (root.hasEntry(entry.getKey())) {
+                if (root.hasEntryCaseInsensitive(entry.getKey())) {
                     classID = entry.getValue();
                     break;
                 }
index 9f55214ee55b5a864d7387942ea7a931fd45e2ad..53bf44300b205a45594887c3f51fd6d2ec8a81ee 100644 (file)
@@ -197,10 +197,10 @@ public final class HSLFSlideShowImpl extends POIDocument implements Closeable {
 
     private static DirectoryNode handleDualStorage(DirectoryNode dir) throws IOException {
         // when there's a dual storage entry, use it, as the outer document can't be read quite probably ...
-        if (!dir.hasEntry(PP97_DOCUMENT)) {
+        if (!dir.hasEntryCaseInsensitive(PP97_DOCUMENT)) {
             return dir;
         }
-        return (DirectoryNode) dir.getEntry(PP97_DOCUMENT);
+        return (DirectoryNode) dir.getEntryCaseInsensitive(PP97_DOCUMENT);
     }
 
     /**
@@ -226,12 +226,12 @@ public final class HSLFSlideShowImpl extends POIDocument implements Closeable {
     private void readPowerPointStream() throws IOException {
         final DirectoryNode dir = getDirectory();
 
-        if (!dir.hasEntry(POWERPOINT_DOCUMENT) && dir.hasEntry(PP95_DOCUMENT)) {
+        if (!dir.hasEntryCaseInsensitive(POWERPOINT_DOCUMENT) && dir.hasEntryCaseInsensitive(PP95_DOCUMENT)) {
             throw new OldPowerPointFormatException("You seem to have supplied a PowerPoint95 file, which isn't supported");
         }
 
         // Get the main document stream
-        final Entry entry = dir.getEntry(POWERPOINT_DOCUMENT);
+        final Entry entry = dir.getEntryCaseInsensitive(POWERPOINT_DOCUMENT);
         if (!(entry instanceof DocumentEntry)) {
             throw new IllegalArgumentException("Had unexpected type of entry for name: " + POWERPOINT_DOCUMENT + ": " + entry.getClass());
         }
@@ -399,12 +399,12 @@ public final class HSLFSlideShowImpl extends POIDocument implements Closeable {
     private void readPictures() throws IOException {
 
         // if the presentation doesn't contain pictures, will use an empty collection instead
-        if (!getDirectory().hasEntry("Pictures")) {
+        if (!getDirectory().hasEntryCaseInsensitive("Pictures")) {
             _pictures = new ArrayList<>();
             return;
         }
 
-        final Entry en = getDirectory().getEntry("Pictures");
+        final Entry en = getDirectory().getEntryCaseInsensitive("Pictures");
         if (!(en instanceof DocumentEntry)) {
             throw new IllegalArgumentException("Had unexpected type of entry for name: Pictures: " + en.getClass());
         }
index 53c37ffe8fba88b2a003ef2ec0116724df748cf2..12577ea186268c295191372e3e84f82b1b59a387 100644 (file)
@@ -261,7 +261,7 @@ public final class HWPFDocument extends HWPFDocumentCore {
         String name = (_fib.getFibBase().isFWhichTblStm()) ? STREAM_TABLE_1 : STREAM_TABLE_0;
 
         // Grab the table stream.
-        if (!directory.hasEntry(name)) {
+        if (!directory.hasEntryCaseInsensitive(name)) {
             throw new IllegalStateException("Table Stream '" + name + "' wasn't found - Either the document is corrupt, or is Word95 (or earlier)");
         }
 
@@ -271,7 +271,7 @@ public final class HWPFDocument extends HWPFDocumentCore {
         _fib.fillVariableFields(_mainStream, _tableStream);
 
         // read in the data stream.
-        _dataStream = directory.hasEntry(STREAM_DATA) ? getDocumentEntryBytes(STREAM_DATA, 0, Integer.MAX_VALUE) : new byte[0];
+        _dataStream = directory.hasEntryCaseInsensitive(STREAM_DATA) ? getDocumentEntryBytes(STREAM_DATA, 0, Integer.MAX_VALUE) : new byte[0];
 
         // Get the cp of the start of text in the main stream
         // The latest spec doc says this is always zero!
@@ -1033,4 +1033,4 @@ public final class HWPFDocument extends HWPFDocumentCore {
         Range r = new Range(start, start + length, this);
         r.delete();
     }
-}
\ No newline at end of file
+}
index 22bf28eab730bf24cf82b9099b3c1b23b9b04ab5..86f9956824e2829ef943070635c397a9c07132f5 100644 (file)
@@ -185,8 +185,8 @@ public abstract class HWPFDocumentCore extends POIDocument {
         _fib = new FileInformationBlock(_mainStream);
 
         DirectoryEntry objectPoolEntry = null;
-        if (directory.hasEntry(STREAM_OBJECT_POOL)) {
-            final Entry entry = directory.getEntry(STREAM_OBJECT_POOL);
+        if (directory.hasEntryCaseInsensitive(STREAM_OBJECT_POOL)) {
+            final Entry entry = directory.getEntryCaseInsensitive(STREAM_OBJECT_POOL);
             if (!(entry instanceof DirectoryEntry)) {
                 throw new IllegalArgumentException("Had unexpected type of entry for name: " + STREAM_OBJECT_POOL + ": " + entry.getClass());
             }
@@ -341,7 +341,7 @@ public abstract class HWPFDocumentCore extends POIDocument {
      */
     protected byte[] getDocumentEntryBytes(String name, int encryptionOffset, final int len) throws IOException {
         DirectoryNode dir = getDirectory();
-        final Entry entry = dir.getEntry(name);
+        final Entry entry = dir.getEntryCaseInsensitive(name);
         if (!(entry instanceof DocumentEntry)) {
             throw new IllegalArgumentException("Had unexpected type of entry for name: " + name + ": " + entry);
         }
@@ -368,4 +368,4 @@ public abstract class HWPFDocumentCore extends POIDocument {
         }
         return new SequenceInputStream(new ByteArrayInputStream(plain), cis);
     }
-}
\ No newline at end of file
+}
index 915abe819a0061ac28f61f1f7468417a91e6ec5e..58f529a3c9141f0fc9d5618f67fd6f96ddde7a96 100644 (file)
@@ -332,7 +332,7 @@ public class WordToTextConverter extends AbstractWordConverter {
          * even if there is no ExtractorFactory in classpath, still support
          * included Word's objects
          */
-        if ( directoryNode.hasEntry( "WordDocument" ) )
+        if ( directoryNode.hasEntryCaseInsensitive( "WordDocument" ) )
         {
             String text = WordToTextConverter.getText( (DirectoryNode) entry );
             block.appendChild( textDocumentFacade
index c672134ec431f59171a299fad4826d862b7c31b3..644814d340929a3e682ba607454ff8c487cd0f55 100644 (file)
@@ -42,7 +42,7 @@ public class ObjectPoolImpl implements ObjectsPool
 
         try
         {
-            return _objectPool.getEntry( objId );
+            return _objectPool.getEntryCaseInsensitive( objId );
         }
         catch ( FileNotFoundException exc )
         {
index 48e2666aa147920d328d900368837d150ff34e52..0606c289507c414f56090dc36c5560c015731c0a 100644 (file)
@@ -92,20 +92,20 @@ public final class TestReWrite {
             assertSlideShowWritesOutTheSame(hssC, pfsC);
 
             // Currently has a Macros stream
-            assertNotNull(pfsC.getRoot().getEntry("Macros"));
+            assertNotNull(pfsC.getRoot().getEntryCaseInsensitive("Macros"));
 
             // Write out normally, will loose the macro stream
             UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
             hssC.write(baos);
             try (POIFSFileSystem pfsNew = new POIFSFileSystem(baos.toInputStream())) {
-                assertFalse(pfsNew.getRoot().hasEntry("Macros"));
+                assertFalse(pfsNew.getRoot().hasEntryCaseInsensitive("Macros"));
             }
 
             // But if we write out with nodes preserved, will be there
             baos.reset();
             hssC.write(baos, true);
             try (POIFSFileSystem pfsNew = new POIFSFileSystem(baos.toInputStream())) {
-                assertTrue(pfsNew.getRoot().hasEntry("Macros"));
+                assertTrue(pfsNew.getRoot().hasEntryCaseInsensitive("Macros"));
             }
         }
     }
@@ -145,8 +145,8 @@ public final class TestReWrite {
 
     private void assertSame(POIFSFileSystem origPFS, POIFSFileSystem newPFS) throws IOException {
         // Check that the "PowerPoint Document" sections have the same size
-        DocumentEntry oProps = (DocumentEntry) origPFS.getRoot().getEntry(POWERPOINT_DOCUMENT);
-        DocumentEntry nProps = (DocumentEntry) newPFS.getRoot().getEntry(POWERPOINT_DOCUMENT);
+        DocumentEntry oProps = (DocumentEntry) origPFS.getRoot().getEntryCaseInsensitive(POWERPOINT_DOCUMENT);
+        DocumentEntry nProps = (DocumentEntry) newPFS.getRoot().getEntryCaseInsensitive(POWERPOINT_DOCUMENT);
         assertEquals(oProps.getSize(), nProps.getSize());
 
 
index 6b8a08ff2df8da8eb1444d73e8ef469b4efa14db..4d70257650e872800dbab17f95ad32f471245c8d 100644 (file)
@@ -185,8 +185,8 @@ public final class TestExtractor {
             };
 
             for (int i=0; i<TEST_SET.length; i+=2) {
-                DirectoryNode dir = (DirectoryNode)root.getEntry(TEST_SET[i]);
-                assertTrue(dir.hasEntry(HSLFSlideShow.POWERPOINT_DOCUMENT));
+                DirectoryNode dir = (DirectoryNode)root.getEntryCaseInsensitive(TEST_SET[i]);
+                assertTrue(dir.hasEntryCaseInsensitive(HSLFSlideShow.POWERPOINT_DOCUMENT));
 
                 try (final SlideShow<?,?> ppt = SlideShowFactory.create(dir);
                      final SlideShowExtractor<?,?> ppe = new SlideShowExtractor<>(ppt)) {
index b38ae3ba51381d4f6071bffa0ce46e0383aba7c5..658e2df37077a7b4afa4f48df77db3462856d3c5 100644 (file)
@@ -79,8 +79,8 @@ public final class TestTextRunReWrite {
                 // Check that the "PowerPoint Document" sections have the same size
                 DirectoryNode oDir = ppt1.getSlideShowImpl().getDirectory();
 
-                DocumentEntry oProps = (DocumentEntry) oDir.getEntry(HSLFSlideShow.POWERPOINT_DOCUMENT);
-                DocumentEntry nProps = (DocumentEntry) npfs.getRoot().getEntry(HSLFSlideShow.POWERPOINT_DOCUMENT);
+                DocumentEntry oProps = (DocumentEntry) oDir.getEntryCaseInsensitive(HSLFSlideShow.POWERPOINT_DOCUMENT);
+                DocumentEntry nProps = (DocumentEntry) npfs.getRoot().getEntryCaseInsensitive(HSLFSlideShow.POWERPOINT_DOCUMENT);
                 assertEquals(oProps.getSize(), nProps.getSize());
 
                 // Check that they contain the same data
@@ -130,8 +130,8 @@ public final class TestTextRunReWrite {
                 // Check that the "PowerPoint Document" sections have the same size
                 DirectoryNode oDir = ppt1.getSlideShowImpl().getDirectory();
 
-                DocumentEntry oProps = (DocumentEntry) oDir.getEntry(HSLFSlideShow.POWERPOINT_DOCUMENT);
-                DocumentEntry nProps = (DocumentEntry) npfs.getRoot().getEntry(HSLFSlideShow.POWERPOINT_DOCUMENT);
+                DocumentEntry oProps = (DocumentEntry) oDir.getEntryCaseInsensitive(HSLFSlideShow.POWERPOINT_DOCUMENT);
+                DocumentEntry nProps = (DocumentEntry) npfs.getRoot().getEntryCaseInsensitive(HSLFSlideShow.POWERPOINT_DOCUMENT);
                 assertEquals(oProps.getSize(), nProps.getSize());
 
                 // Check that they contain the same data
index a1ee955fd36704b74679905ffd57801add94e297..780e36500aeae5492ce1f9fe99bf4724c6b87748 100644 (file)
@@ -76,7 +76,7 @@ public final class TestCurrentUserAtom {
         // Get raw contents from a known file
         byte[] contents;
         try (POIFSFileSystem fs = new POIFSFileSystem(_slTests.getFile(normalFile))) {
-            DocumentEntry docProps = (DocumentEntry) fs.getRoot().getEntry("Current User");
+            DocumentEntry docProps = (DocumentEntry) fs.getRoot().getEntryCaseInsensitive("Current User");
             contents = new byte[docProps.getSize()];
             try (InputStream in = fs.getRoot().createDocumentInputStream("Current User")) {
                 in.read(contents);
index 46d607e72974aed554966fafe309fdac16e6bb3e..8563bf7c5eaed35175aed2b97bce6d2fb1479e91 100644 (file)
@@ -62,7 +62,7 @@ public final class TestExOleObjStg {
         assertEquals(len, oledata.length);
 
         try (POIFSFileSystem fs = new POIFSFileSystem(record.getData())) {
-            DocumentEntry doc = (DocumentEntry) fs.getRoot().getEntry("Contents");
+            DocumentEntry doc = (DocumentEntry) fs.getRoot().getEntryCaseInsensitive("Contents");
             assertNotNull(doc);
         }
     }
index f93ff19f0f662d3e29d08bd48f752730fb58f59c..17d58effea9340e5e13b1c6d3dc6d021c3957cdc 100644 (file)
@@ -56,13 +56,13 @@ public final class TestPOIFSChunkParser {
     void testFindsCore() throws IOException, ChunkNotFoundException {
         try (POIFSFileSystem simple = new POIFSFileSystem(samples.getFile("quick.msg"), true)) {
 
-            // Check a few core things are present
-            simple.getRoot().getEntry(
-                    (new StringChunk(MAPIProperty.SUBJECT.id, Types.ASCII_STRING)).getEntryName()
-            );
-            simple.getRoot().getEntry(
-                    (new StringChunk(MAPIProperty.SENDER_NAME.id, Types.ASCII_STRING)).getEntryName()
-            );
+      // Check a few core things are present
+      simple.getRoot().getEntryCaseInsensitive(
+            (new StringChunk(MAPIProperty.SUBJECT.id, Types.ASCII_STRING)).getEntryName()
+      );
+      simple.getRoot().getEntryCaseInsensitive(
+            (new StringChunk(MAPIProperty.SENDER_NAME.id, Types.ASCII_STRING)).getEntryName()
+      );
 
             // Now load the file
             try (MAPIMessage msg = new MAPIMessage(simple)) {
@@ -82,7 +82,7 @@ public final class TestPOIFSChunkParser {
     void testFindsRecips() throws IOException, ChunkNotFoundException {
         try (POIFSFileSystem simple = new POIFSFileSystem(samples.getFile("quick.msg"), true)) {
 
-            simple.getRoot().getEntry("__recip_version1.0_#00000000");
+      simple.getRoot().getEntryCaseInsensitive("__recip_version1.0_#00000000");
 
             ChunkGroup[] groups = POIFSChunkParser.parse(simple.getRoot());
             assertEquals(3, groups.length);
@@ -136,12 +136,12 @@ public final class TestPOIFSChunkParser {
     void testFindsMultipleRecipients() throws IOException, ChunkNotFoundException {
         try (POIFSFileSystem multiple = new POIFSFileSystem(samples.getFile("example_received_unicode.msg"), true)) {
 
-            multiple.getRoot().getEntry("__recip_version1.0_#00000000");
-            multiple.getRoot().getEntry("__recip_version1.0_#00000001");
-            multiple.getRoot().getEntry("__recip_version1.0_#00000002");
-            multiple.getRoot().getEntry("__recip_version1.0_#00000003");
-            multiple.getRoot().getEntry("__recip_version1.0_#00000004");
-            multiple.getRoot().getEntry("__recip_version1.0_#00000005");
+      multiple.getRoot().getEntryCaseInsensitive("__recip_version1.0_#00000000");
+      multiple.getRoot().getEntryCaseInsensitive("__recip_version1.0_#00000001");
+      multiple.getRoot().getEntryCaseInsensitive("__recip_version1.0_#00000002");
+      multiple.getRoot().getEntryCaseInsensitive("__recip_version1.0_#00000003");
+      multiple.getRoot().getEntryCaseInsensitive("__recip_version1.0_#00000004");
+      multiple.getRoot().getEntryCaseInsensitive("__recip_version1.0_#00000005");
 
             ChunkGroup[] groups = POIFSChunkParser.parse(multiple.getRoot());
             assertEquals(9, groups.length);
@@ -228,7 +228,7 @@ public final class TestPOIFSChunkParser {
     void testFindsNameId() throws IOException {
         try (POIFSFileSystem simple = new POIFSFileSystem(samples.getFile("quick.msg"), true)) {
 
-            simple.getRoot().getEntry("__nameid_version1.0");
+      simple.getRoot().getEntryCaseInsensitive("__nameid_version1.0");
 
             ChunkGroup[] groups = POIFSChunkParser.parse(simple.getRoot());
             assertEquals(3, groups.length);
@@ -253,10 +253,11 @@ public final class TestPOIFSChunkParser {
                 POIFSFileSystem without = new POIFSFileSystem(samples.getFile("quick.msg"), true)) {
             AttachmentChunks attachment;
 
-            // Check raw details on the one with
-            with.getRoot().getEntry("__attach_version1.0_#00000000");
-            with.getRoot().getEntry("__attach_version1.0_#00000001");
-            POIFSChunkParser.parse(with.getRoot());
+
+      // Check raw details on the one with
+      with.getRoot().getEntryCaseInsensitive("__attach_version1.0_#00000000");
+      with.getRoot().getEntryCaseInsensitive("__attach_version1.0_#00000001");
+      POIFSChunkParser.parse(with.getRoot());
 
             ChunkGroup[] groups = POIFSChunkParser.parse(with.getRoot());
             assertEquals(5, groups.length);
@@ -276,9 +277,10 @@ public final class TestPOIFSChunkParser {
             assertEquals("pj1.txt", attachment.getAttachLongFileName().toString());
             assertEquals(89, attachment.getAttachData().getValue().length);
 
-            // Check raw details on one without
-            assertFalse(without.getRoot().hasEntry("__attach_version1.0_#00000000"));
-            assertFalse(without.getRoot().hasEntry("__attach_version1.0_#00000001"));
+
+      // Check raw details on one without
+      assertFalse(without.getRoot().hasEntryCaseInsensitive("__attach_version1.0_#00000000"));
+      assertFalse(without.getRoot().hasEntryCaseInsensitive("__attach_version1.0_#00000001"));
 
             // One with, from the top
             try (MAPIMessage msgWith = new MAPIMessage(with)) {
index ea2a93cc12531741642ae9fa55ec512adb32e69b..54052acc581318a18aba518f33a6f129951a6985 100644 (file)
@@ -44,7 +44,7 @@ public final class HWPFDocFixture
               POIDataSamples.getDocumentInstance().openResourceAsStream(_testFile));
 
       DocumentEntry documentProps =
-        (DocumentEntry) filesystem.getRoot().getEntry("WordDocument");
+        (DocumentEntry) filesystem.getRoot().getEntryCaseInsensitive("WordDocument");
       _mainStream = new byte[documentProps.getSize()];
       filesystem.createDocumentInputStream("WordDocument").read(_mainStream);
 
@@ -59,7 +59,7 @@ public final class HWPFDocFixture
 
       // read in the table stream.
       DocumentEntry tableProps =
-        (DocumentEntry) filesystem.getRoot().getEntry(name);
+        (DocumentEntry) filesystem.getRoot().getEntryCaseInsensitive(name);
       _tableStream = new byte[tableProps.getSize()];
       filesystem.createDocumentInputStream(name).read(_tableStream);
 
index 4ef67c44c8c80fd461b8f8f95f544b2e35953605..a53fefd7fe9aa0938d8838c6d9cbe88ef44bbf6e 100644 (file)
@@ -142,15 +142,15 @@ public final class TestWordExtractor {
         POIFSFileSystem fs = new POIFSFileSystem(is);
         is.close();
 
-        DirectoryNode dirA = (DirectoryNode) fs.getRoot().getEntry("MBD0000A3B7");
-        DirectoryNode dirB = (DirectoryNode) fs.getRoot().getEntry("MBD0000A3B2");
+        DirectoryNode dirA = (DirectoryNode) fs.getRoot().getEntryCaseInsensitive("MBD0000A3B7");
+        DirectoryNode dirB = (DirectoryNode) fs.getRoot().getEntryCaseInsensitive("MBD0000A3B2");
 
         // Should have WordDocument and 1Table
-        assertNotNull(dirA.getEntry("1Table"));
-        assertNotNull(dirA.getEntry("WordDocument"));
+        assertNotNull(dirA.getEntryCaseInsensitive("1Table"));
+        assertNotNull(dirA.getEntryCaseInsensitive("WordDocument"));
 
-        assertNotNull(dirB.getEntry("1Table"));
-        assertNotNull(dirB.getEntry("WordDocument"));
+        assertNotNull(dirB.getEntryCaseInsensitive("1Table"));
+        assertNotNull(dirB.getEntryCaseInsensitive("WordDocument"));
 
         // Check each in turn
         HWPFDocument docA = new HWPFDocument(dirA);
@@ -402,6 +402,18 @@ public final class TestWordExtractor {
         }
     }
 
+    @Test
+    public void testCaseInsensitiveOLENames() throws Exception {
+        //test files are from Ross Johnson on TIKA-4091
+        for (String n : new String[]{"normal", "lower", "upper"}) {
+            try (InputStream is = docTests.openResourceAsStream("47950_" + n + ".doc");
+                 POIFSFileSystem fs = new POIFSFileSystem(is);
+                 WordExtractor wExt = new WordExtractor(fs)) {
+                assertContains(wExt.getText(), "This is a sample Word document");
+            }
+        }
+    }
+
     @Test
     void testCapitalized() throws Exception {
         try (WordExtractor wExt = openExtractor("capitalized.doc")) {
index c7e4536b3bd3494591c3bbf1187992de510bdd30..ab312bccd3298a53b9a568d2787a8d7d7a3ee1e9 100644 (file)
@@ -222,7 +222,7 @@ public abstract class POIDocument implements Closeable {
             if (encryptionInfo != null && encryptionInfo.isDocPropsEncrypted()) {
                 step = "getting encrypted";
                 String encryptedStream = getEncryptedPropertyStreamName();
-                if (!dirNode.hasEntry(encryptedStream)) {
+                if (!dirNode.hasEntryCaseInsensitive(encryptedStream)) {
                     throw new EncryptedDocumentException("can't find encrypted property stream '"+encryptedStream+"'");
                 }
                 CryptoAPIDecryptor dec = (CryptoAPIDecryptor)encryptionInfo.getDecryptor();
@@ -231,13 +231,13 @@ public abstract class POIDocument implements Closeable {
             }
 
             //directory can be null when creating new documents
-            if (dirNode == null || !dirNode.hasEntry(setName)) {
+            if (dirNode == null || !dirNode.hasEntryCaseInsensitive(setName)) {
                 return null;
             }
 
             // Find the entry, and get an input stream for it
             step = "getting";
-            try (DocumentInputStream dis = dirNode.createDocumentInputStream(dirNode.getEntry(setName))) {
+            try (DocumentInputStream dis = dirNode.createDocumentInputStream(dirNode.getEntryCaseInsensitive(setName))) {
                 // Create the Property Set
                 step = "creating";
                 return PropertySetFactory.create(dis);
@@ -302,8 +302,8 @@ public abstract class POIDocument implements Closeable {
             writePropertySet(DocumentSummaryInformation.DEFAULT_STREAM_NAME, newDocumentSummaryInformation(), outFS);
 
             // remove summary, if previously available
-            if (outFS.getRoot().hasEntry(SummaryInformation.DEFAULT_STREAM_NAME)) {
-                outFS.getRoot().getEntry(SummaryInformation.DEFAULT_STREAM_NAME).delete();
+            if (outFS.getRoot().hasEntryCaseInsensitive(SummaryInformation.DEFAULT_STREAM_NAME)) {
+                outFS.getRoot().getEntryCaseInsensitive(SummaryInformation.DEFAULT_STREAM_NAME).delete();
             }
             CryptoAPIEncryptor enc = (CryptoAPIEncryptor) encGen;
             try {
index b3c6ef0514374f58689e7f83be39a69a7fdbce57..21e61e572aa944cba0e97a30031421b259ca68ee 100644 (file)
@@ -222,7 +222,7 @@ public final class ExtractorFactory {
 
         POIFSFileSystem poifs = new POIFSFileSystem(is);
         DirectoryNode root = poifs.getRoot();
-        boolean isOOXML = root.hasEntry(DEFAULT_POIFS_ENTRY) || root.hasEntry(OOXML_PACKAGE);
+        boolean isOOXML = root.hasEntryCaseInsensitive(DEFAULT_POIFS_ENTRY) || root.hasEntryCaseInsensitive(OOXML_PACKAGE);
 
         return wp(isOOXML ? FileMagic.OOXML : fm, w -> w.create(root, password));
     }
@@ -267,7 +267,7 @@ public final class ExtractorFactory {
         try {
             poifs = new POIFSFileSystem(file, true);
             DirectoryNode root = poifs.getRoot();
-            boolean isOOXML = root.hasEntry(DEFAULT_POIFS_ENTRY) || root.hasEntry(OOXML_PACKAGE);
+            boolean isOOXML = root.hasEntryCaseInsensitive(DEFAULT_POIFS_ENTRY) || root.hasEntryCaseInsensitive(OOXML_PACKAGE);
             return wp(isOOXML ? FileMagic.OOXML : fm, w -> w.create(root, password));
         } catch (IOException | RuntimeException e) {
             IOUtils.closeQuietly(poifs);
@@ -313,7 +313,7 @@ public final class ExtractorFactory {
      */
     public static POITextExtractor createExtractor(final DirectoryNode root, String password) throws IOException {
         // Encrypted OOXML files go inside OLE2 containers, is this one?
-        if (root.hasEntry(DEFAULT_POIFS_ENTRY) || root.hasEntry(OOXML_PACKAGE)) {
+        if (root.hasEntryCaseInsensitive(DEFAULT_POIFS_ENTRY) || root.hasEntryCaseInsensitive(OOXML_PACKAGE)) {
             return wp(FileMagic.OOXML, w -> w.create(root, password));
         } else {
             return wp(FileMagic.OLE2, w ->  w.create(root, password));
index 89815bfd9eaa4ed16ef27000e1a2444f6bd6ca75..eba21972d9fc89627000acdb23e316ca6241ee3f 100644 (file)
@@ -17,7 +17,7 @@
 
 package org.apache.poi.extractor;
 
-import static org.apache.poi.hssf.model.InternalWorkbook.WORKBOOK_DIR_ENTRY_NAMES;
+import static org.apache.poi.hssf.model.InternalWorkbook.WORKBOOK_DIR_ENTRY_NAMES_CASE_INSENSITIVE;
 
 import java.io.File;
 import java.io.IOException;
@@ -59,16 +59,17 @@ public class MainExtractorFactory implements ExtractorProvider {
         try {
             Biff8EncryptionKey.setCurrentUserPassword(password);
 
+            if (poifsDir.hasEntry(InternalWorkbook.OLD_WORKBOOK_DIR_ENTRY_NAME)) {
+                return new OldExcelExtractor(poifsDir);
+            }
+
             // Look for certain entries in the stream, to figure it out from
-            for (String workbookName : WORKBOOK_DIR_ENTRY_NAMES) {
-                if (poifsDir.hasEntry(workbookName)) {
+            for (String workbookName : WORKBOOK_DIR_ENTRY_NAMES_CASE_INSENSITIVE) {
+                if (poifsDir.hasEntryCaseInsensitive(workbookName)) {
                     return ExtractorFactory.getPreferEventExtractor() ? new EventBasedExcelExtractor(poifsDir) : new ExcelExtractor(poifsDir);
                 }
             }
 
-            if (poifsDir.hasEntry(InternalWorkbook.OLD_WORKBOOK_DIR_ENTRY_NAME)) {
-                return new OldExcelExtractor(poifsDir);
-            }
         } finally {
             Biff8EncryptionKey.setCurrentUserPassword(oldPW);
         }
index 5bd4cd6b443cc86fe336878027c3172af4e83505..39d259d14ad9761938e7c9a358ff397c73ef8bba 100644 (file)
@@ -575,8 +575,8 @@ public class PropertySet {
     public void write(final DirectoryEntry dir, final String name)
     throws WritingNotSupportedException, IOException {
         /* If there is already an entry with the same name, remove it. */
-        if (dir.hasEntry(name)) {
-            final Entry e = dir.getEntry(name);
+        if (dir.hasEntryCaseInsensitive(name)) {
+            final Entry e = dir.getEntryCaseInsensitive(name);
             e.delete();
         }
 
index dafa88c1cd934d931985da60680caa2bc9e6cfdc..309c3a5e8f72a81c925af2a2cd2f041e93b067f9 100644 (file)
@@ -24,6 +24,9 @@ import java.util.Set;
 import org.apache.poi.hssf.record.*;
 import org.apache.poi.poifs.filesystem.DirectoryNode;
 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
+
+import static org.apache.poi.hssf.model.InternalWorkbook.BOOK;
+import static org.apache.poi.hssf.model.InternalWorkbook.WORKBOOK;
 import static org.apache.poi.hssf.model.InternalWorkbook.WORKBOOK_DIR_ENTRY_NAMES;
 
 /**
@@ -64,13 +67,12 @@ public class HSSFEventFactory {
     public void processWorkbookEvents(HSSFRequest req, DirectoryNode dir) throws IOException {
         // some old documents have "WORKBOOK" or "BOOK"
         String name = null;
-        Set<String> entryNames = dir.getEntryNames();
-        for (String potentialName : WORKBOOK_DIR_ENTRY_NAMES) {
-            if (entryNames.contains(potentialName)) {
-                name = potentialName;
-                break;
-            }
+        if (dir.hasEntry(WORKBOOK)) {
+            name = WORKBOOK;
+        } else if (dir.hasEntry(BOOK)) {
+            name = BOOK;
         }
+
         // If in doubt, go for the default
         if (name == null) {
             name = WORKBOOK_DIR_ENTRY_NAMES.get(0);
index 80b715a59bf590b546268c02689bd075c8220c9c..1db03f80bcaae7f8200015598fbfeed4ee2e6ae8 100644 (file)
@@ -18,6 +18,7 @@
 package org.apache.poi.hssf.extractor;
 
 import static org.apache.poi.hssf.model.InternalWorkbook.OLD_WORKBOOK_DIR_ENTRY_NAME;
+import static org.apache.poi.hssf.model.InternalWorkbook.WORKBOOK;
 import static org.apache.poi.hssf.model.InternalWorkbook.WORKBOOK_DIR_ENTRY_NAMES;
 
 import java.io.BufferedInputStream;
@@ -150,14 +151,14 @@ public class OldExcelExtractor implements POITextExtractor {
     private void open(DirectoryNode directory) throws IOException {
         DocumentNode book;
         try {
-            Entry entry = directory.getEntry(OLD_WORKBOOK_DIR_ENTRY_NAME);
+            Entry entry = directory.getEntryCaseInsensitive(OLD_WORKBOOK_DIR_ENTRY_NAME);
             if (!(entry instanceof DocumentNode)) {
                 throw new IllegalArgumentException("Did not have an Excel 5/95 Book stream: " + entry);
             }
             book = (DocumentNode) entry;
         } catch (FileNotFoundException | IllegalArgumentException e) {
             // some files have "Workbook" instead
-            Entry entry = directory.getEntry(WORKBOOK_DIR_ENTRY_NAMES.get(0));
+            Entry entry = directory.getEntryCaseInsensitive(WORKBOOK);
             if (!(entry instanceof DocumentNode)) {
                 throw new IllegalArgumentException("Did not have an Excel 5/95 Book stream: " + entry);
             }
index 39ea0530a4df6d00db541cbca7b80378cfe86924..acd3541cf7e240276348de1939727f88683740d8 100644 (file)
@@ -87,7 +87,7 @@ public final class InternalWorkbook {
     /**
      * Normally, the Workbook will be in a POIFS Stream called
      *  "Workbook". However, some weird XLS generators use "WORKBOOK"
-     *  or "BOOK".
+     *  or "BOOK". This includes common case sensitive variations.
      */
     public static final List<String> WORKBOOK_DIR_ENTRY_NAMES = Collections.unmodifiableList(
             Arrays.asList(
@@ -98,6 +98,19 @@ public final class InternalWorkbook {
             )
     );
 
+    /**
+     *     Crystal exports may use this for a regular .xls file. This
+     *     needs to be distinguished case sensitively from {@link #OLD_WORKBOOK_DIR_ENTRY_NAME}.
+     */
+    public static final String BOOK = "BOOK";
+
+    public static final String WORKBOOK = "WORKBOOK";
+
+    public static final List<String> WORKBOOK_DIR_ENTRY_NAMES_CASE_INSENSITIVE =
+            Collections.unmodifiableList(
+                    Arrays.asList(WORKBOOK, BOOK)
+    );
+
     /**
      * Name of older (pre-Excel 97) Workbook streams, which
      *  aren't supported by HSSFWorkbook, only by
index 27ea1deebea14e670177e3bca0ec39538453f8ad..5c1bdee1eff0c67e354056ee1dcd656c017ce48d 100644 (file)
@@ -19,7 +19,6 @@
 package org.apache.poi.hssf.usermodel;
 
 import java.io.IOException;
-import java.util.Iterator;
 
 import org.apache.poi.ddf.*;
 import org.apache.poi.hssf.record.*;
@@ -56,7 +55,7 @@ public final class HSSFObjectData extends HSSFPicture implements ObjectData {
         int streamId = subRecord.getStreamId().intValue();
         String streamName = "MBD" + HexDump.toHex(streamId);
 
-        Entry entry = _root.getEntry(streamName);
+        Entry entry = _root.getEntryCaseInsensitive(streamName);
         if (entry instanceof DirectoryEntry) {
             return (DirectoryEntry) entry;
         }
index 716e215bbc2a0c161938e359d7b9a2cfe836c417..dc64f10f5ec1ba292441c5ef42a6fca5fb5e739f 100644 (file)
@@ -290,7 +290,7 @@ public final class HSSFPatriarch implements HSSFShapeContainer, Drawing<HSSFShap
             if (dn == null) {
                 throw new FileNotFoundException();
             }
-            oleRoot = (DirectoryEntry)dn.getEntry(entryName);
+            oleRoot = (DirectoryEntry)dn.getEntryCaseInsensitive(entryName);
         } catch (FileNotFoundException e) {
             throw new IllegalStateException("trying to add ole shape without actually adding data first - use HSSFWorkbook.addOlePackage first", e);
         }
index 6c4c84b56e29e4b0e2662ce3962efa93f6dd78af..336fc2bc3e43c2c9d82ccc4e69b81192ca3fb6ec 100644 (file)
@@ -18,7 +18,9 @@
 package org.apache.poi.hssf.usermodel;
 
 import static org.apache.logging.log4j.util.Unbox.box;
+import static org.apache.poi.hssf.model.InternalWorkbook.BOOK;
 import static org.apache.poi.hssf.model.InternalWorkbook.OLD_WORKBOOK_DIR_ENTRY_NAME;
+import static org.apache.poi.hssf.model.InternalWorkbook.WORKBOOK;
 import static org.apache.poi.hssf.model.InternalWorkbook.WORKBOOK_DIR_ENTRY_NAMES;
 
 import java.io.BufferedOutputStream;
@@ -285,26 +287,30 @@ public final class HSSFWorkbook extends POIDocument implements Workbook {
     }
 
     public static String getWorkbookDirEntryName(DirectoryNode directory) {
-        for (String wbName : WORKBOOK_DIR_ENTRY_NAMES) {
-            if (directory.hasEntry(wbName)) {
-                return wbName;
-            }
+        if (directory.hasEntryCaseInsensitive(WORKBOOK)) {
+            return WORKBOOK;
         }
 
         // check for an encrypted .xlsx file - they get OLE2 wrapped
-        if (directory.hasEntry(Decryptor.DEFAULT_POIFS_ENTRY)) {
+        if (directory.hasEntryCaseInsensitive(Decryptor.DEFAULT_POIFS_ENTRY)) {
             throw new EncryptedDocumentException("The supplied spreadsheet seems to be an Encrypted .xlsx file. " +
                     "It must be decrypted before use by XSSF, it cannot be used by HSSF");
         }
 
-        // check for previous version of file format
+        // check case-sensitive for previous version of file format
         if (directory.hasEntry(OLD_WORKBOOK_DIR_ENTRY_NAME)) {
             throw new OldExcelFormatException("The supplied spreadsheet seems to be Excel 5.0/7.0 (BIFF5) format. "
                     + "POI only supports BIFF8 format (from Excel versions 97/2000/XP/2003)");
         }
 
+        //check for non-case-sensitive book (e.g. crystal) after ruling out case-sensitive
+        // OldExcelFormatException
+        if (directory.hasEntryCaseInsensitive(BOOK)) {
+            return BOOK;
+        }
+
         // throw more useful exceptions for known wrong file-extensions
-        if (directory.hasEntry("WordDocument")) {
+        if (directory.hasEntryCaseInsensitive("WordDocument")) {
             throw new IllegalArgumentException("The document is really a DOC file");
         }
 
@@ -1350,7 +1356,7 @@ public final class HSSFWorkbook extends POIDocument implements Workbook {
         final DirectoryNode dir = getDirectory();
 
         // Update the Workbook stream in the file
-        DocumentNode workbookNode = (DocumentNode) dir.getEntry(
+        DocumentNode workbookNode = (DocumentNode) dir.getEntryCaseInsensitive(
                 getWorkbookDirEntryName(dir));
         POIFSDocument workbookDoc = new POIFSDocument(workbookNode);
         workbookDoc.replaceContents(UnsynchronizedByteArrayInputStream.builder().setByteArray(getBytes()).get());
@@ -2104,7 +2110,7 @@ public final class HSSFWorkbook extends POIDocument implements Workbook {
         DirectoryNode root = poiData.getRoot();
         Map<String, ClassID> olemap = getOleMap();
         for (Map.Entry<String, ClassID> entry : olemap.entrySet()) {
-            if (root.hasEntry(entry.getKey())) {
+            if (root.hasEntryCaseInsensitive(entry.getKey())) {
                 root.setStorageClsid(entry.getValue());
                 break;
             }
@@ -2129,7 +2135,7 @@ public final class HSSFWorkbook extends POIDocument implements Workbook {
         DirectoryEntry oleDir = null;
         do {
             String storageStr = "MBD" + HexDump.toHex(++storageId);
-            if (!getDirectory().hasEntry(storageStr)) {
+            if (!getDirectory().hasEntryCaseInsensitive(storageStr)) {
                 oleDir = getDirectory().createDirectory(storageStr);
                 oleDir.setStorageClsid(ClassIDPredefined.OLE_V1_PACKAGE.getClassID());
             }
index a9042141211fd73ed791cc86155387b03acf62b1..bcbebd7ed6304a21d7b6c60b864fb98f236ebff5 100644 (file)
@@ -61,8 +61,8 @@ public class DataSpaceMapUtils {
     public static DocumentEntry createEncryptionEntry(DirectoryEntry dir, String path, EncryptionRecord out) throws IOException {
         String[] parts = path.split("/");
         for (int i=0; i<parts.length-1; i++) {
-            dir = dir.hasEntry(parts[i])
-                ? (DirectoryEntry)dir.getEntry(parts[i])
+            dir = dir.hasEntryCaseInsensitive(parts[i])
+                ? (DirectoryEntry)dir.getEntryCaseInsensitive(parts[i])
                 : dir.createDirectory(parts[i]);
         }
 
@@ -72,8 +72,8 @@ public class DataSpaceMapUtils {
         
         String fileName = parts[parts.length-1];
         
-        if (dir.hasEntry(fileName)) {
-            dir.getEntry(fileName).delete();
+        if (dir.hasEntryCaseInsensitive(fileName)) {
+            dir.getEntryCaseInsensitive(fileName).delete();
         }
         
         return dir.createDocument(fileName, bos.getWriteIndex(), event -> {
index 3698c57b7ef931bd6b4a2a32ca58ca3f3a467a53..ed0cf123722dea46f03d2eea7120a6520e9bf28d 100644 (file)
@@ -173,9 +173,9 @@ public class CryptoAPIDecryptor extends Decryptor {
     throws IOException, GeneralSecurityException {
         POIFSFileSystem fsOut = null;
         try (
-            DocumentInputStream dis = root.createDocumentInputStream(root.getEntry(encryptedStream));
-            CryptoAPIDocumentInputStream sbis = new CryptoAPIDocumentInputStream(this, IOUtils.toByteArray(dis));
-            LittleEndianInputStream leis = new LittleEndianInputStream(sbis)
+                DocumentInputStream dis = root.createDocumentInputStream(root.getEntryCaseInsensitive(encryptedStream));
+                CryptoAPIDocumentInputStream sbis = new CryptoAPIDocumentInputStream(this, IOUtils.toByteArray(dis));
+                LittleEndianInputStream leis = new LittleEndianInputStream(sbis)
         ) {
             int streamDescriptorArrayOffset = (int) leis.readUInt();
             /* int streamDescriptorArraySize = (int) */ leis.readUInt();
index 2c99782af9d7c0dd90c216efb146c4e2b192f334..2ede110ec5896e887ab1ff7f17a59af1c97909c2 100644 (file)
@@ -76,14 +76,20 @@ public interface DirectoryEntry extends Entry, Iterable<Entry> {
 
     int getEntryCount();
 
+
     /**
-     * Checks if entry with specified name present
+     * Checks if entry with specified name present, case sensitive
      */
-
     boolean hasEntry( final String name );
 
     /**
-     * get a specified Entry by name
+     * Checks if entry with specified name present, case sensitive
+     */
+
+    boolean hasEntryCaseInsensitive(final String name );
+
+    /**
+     * get a specified Entry by name, case sensitive
      *
      * @param name the name of the Entry to obtain.
      *
@@ -96,6 +102,20 @@ public interface DirectoryEntry extends Entry, Iterable<Entry> {
 
     Entry getEntry(final String name) throws FileNotFoundException;
 
+    /**
+     * get a specified Entry by name, case insensitive
+     *
+     * @param name the name of the Entry to obtain.
+     *
+     * @return the specified Entry, if it is directly contained in
+     *         this DirectoryEntry
+     *
+     * @throws FileNotFoundException if no Entry with the specified
+     *            name exists in this DirectoryEntry
+     */
+
+    Entry getEntryCaseInsensitive(final String name) throws FileNotFoundException;
+
     /**
      * create a new DocumentEntry
      *
index 54fab5f4987b5b2c56ee70476f67aa4bf06465f4..6e7f7508d0794918183d0c3187a8930ea3d4f878 100644 (file)
@@ -23,9 +23,12 @@ import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
 import java.util.Spliterator;
@@ -40,13 +43,16 @@ import org.apache.poi.poifs.property.Property;
  * Simple implementation of DirectoryEntry
  */
 public class DirectoryNode
-    extends EntryNode
-    implements DirectoryEntry, POIFSViewable, Iterable<Entry>
+        extends EntryNode
+        implements DirectoryEntry, POIFSViewable, Iterable<Entry>
 {
 
-    // Map of Entry instances, keyed by their names
+    // Map of Entry instances, keyed by their literal names as stored
     private final Map<String,Entry> _byname = new HashMap<>();
 
+    // Map of Entry instances, keyed by their Uppercased names
+    private final Map<String,Entry> _byUCName = new HashMap<>();
+
     // Our list of entries, kept sorted to preserve order
     private final ArrayList<Entry> _entries = new ArrayList<>();
 
@@ -100,6 +106,7 @@ public class DirectoryNode
             }
             _entries.add(childNode);
             _byname.put(childNode.getName(), childNode);
+            _byUCName.put(childNode.getName().toUpperCase(Locale.ROOT), childNode);
         }
     }
 
@@ -132,9 +139,9 @@ public class DirectoryNode
      */
     public DocumentInputStream createDocumentInputStream(
             final String documentName)
-        throws IOException
+            throws IOException
     {
-        return createDocumentInputStream(getEntry(documentName));
+        return createDocumentInputStream(getEntryCaseInsensitive(documentName));
     }
 
     /**
@@ -149,11 +156,11 @@ public class DirectoryNode
      */
     public DocumentInputStream createDocumentInputStream(
             final Entry document)
-        throws IOException
+            throws IOException
     {
         if (!document.isDocumentEntry()) {
             throw new IOException("Entry '" + document.getName()
-                                  + "' is not a DocumentEntry");
+                    + "' is not a DocumentEntry");
         }
 
         DocumentEntry entry = (DocumentEntry)document;
@@ -170,7 +177,7 @@ public class DirectoryNode
      * @throws IOException if the document can't be created
      */
     DocumentEntry createDocument(final POIFSDocument document)
-        throws IOException
+            throws IOException
     {
         DocumentProperty property = document.getDocumentProperty();
         DocumentNode     rval     = new DocumentNode(property, this);
@@ -180,6 +187,7 @@ public class DirectoryNode
 
         _entries.add(rval);
         _byname.put(property.getName(), rval);
+        _byUCName.put(property.getName().toUpperCase(Locale.ROOT), rval);
         return rval;
     }
 
@@ -194,16 +202,18 @@ public class DirectoryNode
     boolean changeName(final String oldName, final String newName)
     {
         boolean   rval  = false;
-        EntryNode child = ( EntryNode ) _byname.get(oldName);
+        EntryNode child = ( EntryNode ) _byUCName.get(oldName.toUpperCase(Locale.ROOT));
 
         if (child != null)
         {
             rval = (( DirectoryProperty ) getProperty())
-                .changeName(child.getProperty(), newName);
+                    .changeName(child.getProperty(), newName);
             if (rval)
             {
                 _byname.remove(oldName);
                 _byname.put(child.getProperty().getName(), child);
+                _byUCName.remove(oldName.toUpperCase(Locale.ROOT));
+                _byUCName.put(child.getProperty().getName().toUpperCase(Locale.ROOT), child);
             }
         }
         return rval;
@@ -220,13 +230,14 @@ public class DirectoryNode
     boolean deleteEntry(final EntryNode entry)
     {
         boolean rval =
-            (( DirectoryProperty ) getProperty())
-                .deleteChild(entry.getProperty());
+                (( DirectoryProperty ) getProperty())
+                        .deleteChild(entry.getProperty());
 
         if (rval)
         {
             _entries.remove(entry);
             _byname.remove(entry.getName());
+            _byUCName.remove(entry.getName().toUpperCase(Locale.ROOT));
 
             try {
                 _filesystem.remove(entry);
@@ -258,9 +269,9 @@ public class DirectoryNode
     }
 
     /**
-     * get the names of all the Entries contained directly in this
-     * instance (in other words, names of children only; no grandchildren
-     * etc).
+     * get the literal, case-sensitive names of all the Entries contained
+     * directly in this instance (in other words, names of children only;
+     * no grandchildren etc).
      *
      * @return the names of all the entries that may be retrieved with
      *         getEntry(String), which may be empty (if this
@@ -298,14 +309,32 @@ public class DirectoryNode
         return _entries.size();
     }
 
+    /**
+     * Checks for a specific entry in a case-sensitive way.
+     *
+     * @param name
+     * @return whether or not an entry exists for that name (case-sensitive)
+     */
+    @Override
+    public boolean hasEntry(String name )
+    {
+        return name != null && _byname.containsKey(name);
+    }
+
+    /**
+     * Checks for a specific entry in a case-insensitive way.
+     *
+     * @param name
+     * @return whether or not an entry exists for that name (case-insensitive)
+     */
     @Override
-    public boolean hasEntryString name )
+    public boolean hasEntryCaseInsensitive(String name )
     {
-        return name != null && _byname.containsKey( name );
+        return name != null && _byUCName.containsKey(name.toUpperCase(Locale.ROOT));
     }
 
     /**
-     * get a specified Entry by name
+     * get a specified Entry by name, case sensitive
      *
      * @param name the name of the Entry to obtain.
      *
@@ -315,7 +344,6 @@ public class DirectoryNode
      * @throws FileNotFoundException if no Entry with the specified
      *            name exists in this DirectoryEntry
      */
-
     @Override
     public Entry getEntry(final String name) throws FileNotFoundException {
         Entry rval = null;
@@ -340,6 +368,41 @@ public class DirectoryNode
         return rval;
     }
 
+    /**
+     * get a specified Entry by name, case-insensitive
+     *
+     * @param name the name of the Entry to obtain.
+     *
+     * @return the specified Entry, if it is directly contained in
+     *         this DirectoryEntry
+     *
+     * @throws FileNotFoundException if no Entry with the specified
+     *            name exists in this DirectoryEntry
+     */
+    @Override
+    public Entry getEntryCaseInsensitive(final String name) throws FileNotFoundException {
+        Entry rval = null;
+
+        if (name != null) {
+            rval = _byUCName.get(name.toUpperCase(Locale.ROOT));
+        }
+        if (rval == null) {
+            // throw more useful exceptions for known wrong file-extensions
+            if(_byname.containsKey("Workbook")) {
+                throw new IllegalArgumentException("The document is really a XLS file");
+            } else if(_byname.containsKey("PowerPoint Document")) {
+                throw new IllegalArgumentException("The document is really a PPT file");
+            } else if(_byname.containsKey("VisioDocument")) {
+                throw new IllegalArgumentException("The document is really a VSD file");
+            }
+
+            // either a null name was given, or there is no such name
+            throw new FileNotFoundException("no such entry: \"" + name
+                    + "\", had: " + _byUCName.keySet());
+        }
+        return rval;
+    }
+
     /**
      * create a new DocumentEntry
      *
@@ -355,7 +418,7 @@ public class DirectoryNode
     @Override
     public DocumentEntry createDocument(final String name,
                                         final InputStream stream)
-        throws IOException
+            throws IOException
     {
         return createDocument(new POIFSDocument(name, _filesystem, stream));
     }
@@ -375,7 +438,7 @@ public class DirectoryNode
     @Override
     public DocumentEntry createDocument(final String name, final int size,
                                         final POIFSWriterListener writer)
-        throws IOException
+            throws IOException
     {
         return createDocument(new POIFSDocument(name, size, _filesystem, writer));
     }
@@ -392,16 +455,17 @@ public class DirectoryNode
 
     @Override
     public DirectoryEntry createDirectory(final String name)
-        throws IOException
+            throws IOException
     {
         DirectoryProperty property = new DirectoryProperty(name);
 
         DirectoryNode rval = new DirectoryNode(property, _filesystem, this);
-       _filesystem.addDirectory(property);
+        _filesystem.addDirectory(property);
 
         (( DirectoryProperty ) getProperty()).addChild(property);
         _entries.add(rval);
         _byname.put(name, rval);
+        _byUCName.put(name.toUpperCase(Locale.ROOT), rval);
         return rval;
     }
 
@@ -419,12 +483,12 @@ public class DirectoryNode
     @SuppressWarnings("WeakerAccess")
     public DocumentEntry createOrUpdateDocument(final String name,
                                                 final InputStream stream)
-        throws IOException
+            throws IOException
     {
-        if (! hasEntry(name)) {
+        if (! hasEntryCaseInsensitive(name)) {
             return createDocument(name, stream);
         } else {
-            DocumentNode existing = (DocumentNode)getEntry(name);
+            DocumentNode existing = (DocumentNode) getEntryCaseInsensitive(name);
             POIFSDocument nDoc = new POIFSDocument(existing);
             nDoc.replaceContents(stream);
             return existing;
index 088b54928368fbdce4b4b60fecc83d74b19c1c76..6b9b749362b56c3bff867013331fe02117606948 100644 (file)
@@ -73,7 +73,7 @@ public final class DocumentFactoryHelper {
     public static InputStream getDecryptedStream(final DirectoryNode root, String password)
     throws IOException {
         // first check if the node contains an plain package
-        if (root.hasEntry(OOXML_PACKAGE)) {
+        if (root.hasEntryCaseInsensitive(OOXML_PACKAGE)) {
             return root.createDocumentInputStream(OOXML_PACKAGE);
         }
 
index 9b3c0150b072f6d5cafe3bd0589c14d5fbc07c3b..f9410c0264cf59e0768a9f77c449db5b16db6bc3 100644 (file)
@@ -129,7 +129,7 @@ public class FilteringDirectoryNode implements DirectoryEntry
    public int getEntryCount() {
       int size = directory.getEntryCount();
       for (String excl : excludes) {
-         if (directory.hasEntry(excl)) {
+         if (directory.hasEntryCaseInsensitive(excl)) {
             size--;
          }
       }
@@ -160,6 +160,15 @@ public class FilteringDirectoryNode implements DirectoryEntry
       return directory.hasEntry(name);
    }
 
+   @Override
+   public boolean hasEntryCaseInsensitive(String name) {
+      if (excludes.contains(name)) {
+         return false;
+      }
+      return directory.hasEntryCaseInsensitive(name);
+   }
+
+
    @Override
    public Entry getEntry(String name) throws FileNotFoundException {
       if (excludes.contains(name)) {
@@ -169,6 +178,17 @@ public class FilteringDirectoryNode implements DirectoryEntry
       Entry entry = directory.getEntry(name);
       return wrapEntry(entry);
    }
+
+   @Override
+   public Entry getEntryCaseInsensitive(String name) throws FileNotFoundException {
+      if (excludes.contains(name)) {
+         throw new FileNotFoundException(name);
+      }
+
+      Entry entry = directory.getEntryCaseInsensitive(name);
+      return wrapEntry(entry);
+   }
+
    private Entry wrapEntry(Entry entry) {
       String name = entry.getName();
       if (childExcludes.containsKey(name) && entry instanceof DirectoryEntry) {
@@ -258,4 +278,4 @@ public class FilteringDirectoryNode implements DirectoryEntry
          throw new UnsupportedOperationException("Remove not supported");
       }
    }
-}
\ No newline at end of file
+}
index 90fbc2433e820f2e6f528477a3fae0adee787cad..fef85f82db2e98f6ceed8a657a2cccd182875aa0 100644 (file)
@@ -133,7 +133,7 @@ public class Ole10Native {
      * @throws Ole10NativeException on invalid or unexcepted data format
      */
     public static Ole10Native createFromEmbeddedOleObject(DirectoryNode directory) throws IOException, Ole10NativeException {
-        DocumentEntry nativeEntry = (DocumentEntry) directory.getEntry(OLE10_NATIVE);
+        DocumentEntry nativeEntry = (DocumentEntry) directory.getEntryCaseInsensitive(OLE10_NATIVE);
         try (DocumentInputStream dis = directory.createDocumentInputStream(nativeEntry)) {
             byte[] data = IOUtils.toByteArray(dis, nativeEntry.getSize(), MAX_RECORD_LENGTH);
             return new Ole10Native(data, 0);
@@ -253,7 +253,7 @@ public class Ole10Native {
      * OlePresXXX, but it seems, that they aren't necessary
      */
     public static void createOleMarkerEntry(final DirectoryEntry parent) throws IOException {
-        if (!parent.hasEntry(OLE_MARKER_NAME)) {
+        if (!parent.hasEntryCaseInsensitive(OLE_MARKER_NAME)) {
             parent.createDocument(OLE_MARKER_NAME, UnsynchronizedByteArrayInputStream.builder().setByteArray(OLE_MARKER_BYTES).get());
         }
     }
index 944c05bbd1d2199d42221bf55122025e6596748e..5d5081a8f2d1b37fb43bc83de97e875dc0c678e2 100644 (file)
@@ -325,7 +325,7 @@ public class VBAMacroReader implements Closeable {
         //process the dirstream first -- "dir" is case insensitive
         for (String entryName : macroDir.getEntryNames()) {
             if ("dir".equalsIgnoreCase(entryName)) {
-                processDirStream(macroDir.getEntry(entryName), modules);
+                processDirStream(macroDir.getEntryCaseInsensitive(entryName), modules);
                 break;
             }
         }
index 8f6bd803e40bedaa0e63da2c4681093b7a09752c..8fad23ee9e041e58ee051a2e28e9bab05823935a 100644 (file)
@@ -113,7 +113,7 @@ public interface ObjectShape<
                     final DirectoryNode root = poifs.getRoot();
                     String entryName = null;
                     for (String n : names) {
-                        if (root.hasEntry(n)) {
+                        if (root.hasEntryCaseInsensitive(n)) {
                             entryName = n;
                             break;
                         }
index cb4c81ca7781d29e49d2a624537606f436653a2f..b0aa16a89bc8f37e10eff0e003bd4a500c67eb25 100644 (file)
@@ -126,7 +126,7 @@ public final class SlideShowFactory {
      */
     public static SlideShow<?,?> create(final DirectoryNode root, String password) throws IOException {
         // Encrypted OOXML files go inside OLE2 containers, is this one?
-        if (root.hasEntry(Decryptor.DEFAULT_POIFS_ENTRY) || root.hasEntry(OOXML_PACKAGE)) {
+        if (root.hasEntryCaseInsensitive(Decryptor.DEFAULT_POIFS_ENTRY) || root.hasEntryCaseInsensitive(OOXML_PACKAGE)) {
             return wp(FileMagic.OOXML, w -> w.create(root, password));
         } else {
             return wp(FileMagic.OLE2, w ->  w.create(root, password));
@@ -200,7 +200,7 @@ public final class SlideShowFactory {
 
         POIFSFileSystem poifs = new POIFSFileSystem(is);
         DirectoryNode root = poifs.getRoot();
-        boolean isOOXML = root.hasEntry(DEFAULT_POIFS_ENTRY) || root.hasEntry(OOXML_PACKAGE);
+        boolean isOOXML = root.hasEntryCaseInsensitive(DEFAULT_POIFS_ENTRY) || root.hasEntryCaseInsensitive(OOXML_PACKAGE);
 
         return wp(isOOXML ? FileMagic.OOXML : fm, w -> w.create(poifs.getRoot(), password));
     }
@@ -274,7 +274,7 @@ public final class SlideShowFactory {
             final boolean ooxmlEnc;
             try (POIFSFileSystem fs = new POIFSFileSystem(file, true)) {
                 DirectoryNode root = fs.getRoot();
-                ooxmlEnc = root.hasEntry(Decryptor.DEFAULT_POIFS_ENTRY) || root.hasEntry(OOXML_PACKAGE);
+                ooxmlEnc = root.hasEntryCaseInsensitive(Decryptor.DEFAULT_POIFS_ENTRY) || root.hasEntryCaseInsensitive(OOXML_PACKAGE);
             }
             return wp(ooxmlEnc ? FileMagic.OOXML : fm, w -> w.create(file, password, readOnly));
         } else {
index 31c6632c07bc5b17198dacd5279e4a581855aedb..b0b3cbd990d7e769231a4c996f87675d9e35ad25 100644 (file)
@@ -213,7 +213,7 @@ public class EmbeddedExtractor implements Iterable<EmbeddedExtractor> {
         @Override
         public boolean canExtract(DirectoryNode dn) {
             ClassID clsId = dn.getStorageClsid();
-            return (ClassIDPredefined.PDF.equals(clsId) || dn.hasEntry("CONTENTS"));
+            return (ClassIDPredefined.PDF.equals(clsId) || dn.hasEntryCaseInsensitive("CONTENTS"));
         }
 
         @Override
@@ -273,7 +273,7 @@ public class EmbeddedExtractor implements Iterable<EmbeddedExtractor> {
     static class OOXMLExtractor extends EmbeddedExtractor {
         @Override
         public boolean canExtract(DirectoryNode dn) {
-            return dn.hasEntry("package");
+            return dn.hasEntryCaseInsensitive("package");
         }
 
         @Override
@@ -312,14 +312,14 @@ public class EmbeddedExtractor implements Iterable<EmbeddedExtractor> {
             ClassIDPredefined clsId = ClassIDPredefined.lookup(dn.getStorageClsid());
             return (ClassIDPredefined.EXCEL_V7 == clsId
                 || ClassIDPredefined.EXCEL_V8 == clsId
-                || dn.hasEntry("Workbook") /*...*/);
+                || dn.hasEntryCaseInsensitive("Workbook") /*...*/);
         }
 
         protected boolean canExtractWord(DirectoryNode dn) {
             ClassIDPredefined clsId = ClassIDPredefined.lookup(dn.getStorageClsid());
             return (ClassIDPredefined.WORD_V7 == clsId
                 || ClassIDPredefined.WORD_V8 == clsId
-                || dn.hasEntry("WordDocument"));
+                || dn.hasEntryCaseInsensitive("WordDocument"));
         }
 
         @Override
index 707c045babe3e0402d44c54d799cae36e0645446..34ac9afd3c8d1e010fb5cd3368758bda7f50340a 100644 (file)
@@ -150,7 +150,7 @@ public final class WorkbookFactory {
      */
     public static Workbook create(final DirectoryNode root, String password) throws IOException {
         // Encrypted OOXML files go inside OLE2 containers, is this one?
-        if (root.hasEntry(DEFAULT_POIFS_ENTRY) || root.hasEntry(OOXML_PACKAGE)) {
+        if (root.hasEntryCaseInsensitive(DEFAULT_POIFS_ENTRY) || root.hasEntryCaseInsensitive(OOXML_PACKAGE)) {
             return wp(FileMagic.OOXML, w -> w.create(root, password));
         } else {
             return wp(FileMagic.OLE2, w ->  w.create(root, password));
@@ -230,7 +230,7 @@ public final class WorkbookFactory {
 
         POIFSFileSystem poifs = new POIFSFileSystem(is);
         DirectoryNode root = poifs.getRoot();
-        boolean isOOXML = root.hasEntry(DEFAULT_POIFS_ENTRY) || root.hasEntry(OOXML_PACKAGE);
+        boolean isOOXML = root.hasEntryCaseInsensitive(DEFAULT_POIFS_ENTRY) || root.hasEntryCaseInsensitive(OOXML_PACKAGE);
 
         return wp(isOOXML ? FileMagic.OOXML : fm, w -> w.create(root, password));
     }
@@ -313,7 +313,7 @@ public final class WorkbookFactory {
             final boolean ooxmlEnc;
             try (POIFSFileSystem fs = new POIFSFileSystem(file, true)) {
                 DirectoryNode root = fs.getRoot();
-                ooxmlEnc = root.hasEntry(DEFAULT_POIFS_ENTRY) || root.hasEntry(OOXML_PACKAGE);
+                ooxmlEnc = root.hasEntryCaseInsensitive(DEFAULT_POIFS_ENTRY) || root.hasEntryCaseInsensitive(OOXML_PACKAGE);
             }
             return wp(ooxmlEnc ? FileMagic.OOXML : fm, w -> w.create(file, password, readOnly));
         } else {
index 395aab02cfa04903788985f9812d9685b8e89e80..cf13fd04745dfdf7a4f860d106110a33ba549830 100644 (file)
@@ -154,7 +154,7 @@ class TestReadAllFiles {
              * If there is a document summry information stream, read it from
              * the POI filesystem.
              */
-            if (dir.hasEntry(DocumentSummaryInformation.DEFAULT_STREAM_NAME)) {
+            if (dir.hasEntryCaseInsensitive(DocumentSummaryInformation.DEFAULT_STREAM_NAME)) {
                 final DocumentSummaryInformation dsi = TestWriteWellKnown.getDocumentSummaryInformation(poifs);
                 assertNotNull(dsi);
 
index 48b8b594ecb93928440491bc6a5cc11691724311..442bcde58f7e916c343b0f6a94bd3565d79f9280 100644 (file)
@@ -447,8 +447,8 @@ class TestWrite {
             DirectoryEntry root = fs.getRoot();
 
             // Read the properties in there
-            DocumentNode sinfDoc = (DocumentNode) root.getEntry(SummaryInformation.DEFAULT_STREAM_NAME);
-            DocumentNode dinfDoc = (DocumentNode) root.getEntry(DocumentSummaryInformation.DEFAULT_STREAM_NAME);
+            DocumentNode sinfDoc = (DocumentNode) root.getEntryCaseInsensitive(SummaryInformation.DEFAULT_STREAM_NAME);
+            DocumentNode dinfDoc = (DocumentNode) root.getEntryCaseInsensitive(DocumentSummaryInformation.DEFAULT_STREAM_NAME);
 
             InputStream sinfStream = new DocumentInputStream(sinfDoc);
             SummaryInformation sinf = (SummaryInformation) PropertySetFactory.create(sinfStream);
@@ -479,8 +479,8 @@ class TestWrite {
 
 
             // Check it didn't get changed
-            sinfDoc = (DocumentNode) root.getEntry(SummaryInformation.DEFAULT_STREAM_NAME);
-            dinfDoc = (DocumentNode) root.getEntry(DocumentSummaryInformation.DEFAULT_STREAM_NAME);
+            sinfDoc = (DocumentNode) root.getEntryCaseInsensitive(SummaryInformation.DEFAULT_STREAM_NAME);
+            dinfDoc = (DocumentNode) root.getEntryCaseInsensitive(DocumentSummaryInformation.DEFAULT_STREAM_NAME);
 
             InputStream sinfStream2 = new DocumentInputStream(sinfDoc);
             sinf = (SummaryInformation) PropertySetFactory.create(sinfStream2);
@@ -503,8 +503,8 @@ class TestWrite {
             DirectoryEntry root = fs.getRoot();
 
             // Read the properties in once more
-            DocumentNode sinfDoc = (DocumentNode)root.getEntry(SummaryInformation.DEFAULT_STREAM_NAME);
-            DocumentNode dinfDoc = (DocumentNode)root.getEntry(DocumentSummaryInformation.DEFAULT_STREAM_NAME);
+            DocumentNode sinfDoc = (DocumentNode)root.getEntryCaseInsensitive(SummaryInformation.DEFAULT_STREAM_NAME);
+            DocumentNode dinfDoc = (DocumentNode)root.getEntryCaseInsensitive(DocumentSummaryInformation.DEFAULT_STREAM_NAME);
 
             InputStream sinfStream3 = new DocumentInputStream(sinfDoc);
             SummaryInformation sinf = (SummaryInformation)PropertySetFactory.create(sinfStream3);
@@ -533,8 +533,8 @@ class TestWrite {
 
 
             // Check that the filesystem can give us back the same bytes
-            sinfDoc = (DocumentNode)root.getEntry(SummaryInformation.DEFAULT_STREAM_NAME);
-            dinfDoc = (DocumentNode)root.getEntry(DocumentSummaryInformation.DEFAULT_STREAM_NAME);
+            sinfDoc = (DocumentNode)root.getEntryCaseInsensitive(SummaryInformation.DEFAULT_STREAM_NAME);
+            dinfDoc = (DocumentNode)root.getEntryCaseInsensitive(DocumentSummaryInformation.DEFAULT_STREAM_NAME);
 
             InputStream sinfStream4 = new DocumentInputStream(sinfDoc);
             byte[] sinfData = IOUtils.toByteArray(sinfStream4);
@@ -581,13 +581,13 @@ class TestWrite {
 
 
             // Read them back in again
-            sinfDoc = (DocumentNode)root.getEntry(SummaryInformation.DEFAULT_STREAM_NAME);
+            sinfDoc = (DocumentNode)root.getEntryCaseInsensitive(SummaryInformation.DEFAULT_STREAM_NAME);
             InputStream sinfStream6 = new DocumentInputStream(sinfDoc);
             sinf = (SummaryInformation)PropertySetFactory.create(sinfStream6);
             sinfStream6.close();
             assertEquals(131077, sinf.getOSVersion());
 
-            dinfDoc = (DocumentNode)root.getEntry(DocumentSummaryInformation.DEFAULT_STREAM_NAME);
+            dinfDoc = (DocumentNode)root.getEntryCaseInsensitive(DocumentSummaryInformation.DEFAULT_STREAM_NAME);
             InputStream dinfStream6 = new DocumentInputStream(dinfDoc);
             dinf = (DocumentSummaryInformation)PropertySetFactory.create(dinfStream6);
             dinfStream6.close();
@@ -609,13 +609,13 @@ class TestWrite {
             DirectoryEntry root = fs.getRoot();
 
             // Re-check on load
-            DocumentNode sinfDoc = (DocumentNode) root.getEntry(SummaryInformation.DEFAULT_STREAM_NAME);
+            DocumentNode sinfDoc = (DocumentNode) root.getEntryCaseInsensitive(SummaryInformation.DEFAULT_STREAM_NAME);
             InputStream sinfStream7 = new DocumentInputStream(sinfDoc);
             SummaryInformation sinf = (SummaryInformation) PropertySetFactory.create(sinfStream7);
             sinfStream7.close();
             assertEquals(131077, sinf.getOSVersion());
 
-            DocumentNode dinfDoc = (DocumentNode) root.getEntry(DocumentSummaryInformation.DEFAULT_STREAM_NAME);
+            DocumentNode dinfDoc = (DocumentNode) root.getEntryCaseInsensitive(DocumentSummaryInformation.DEFAULT_STREAM_NAME);
             InputStream dinfStream7 = new DocumentInputStream(dinfDoc);
             DocumentSummaryInformation dinf = (DocumentSummaryInformation) PropertySetFactory.create(dinfStream7);
             dinfStream7.close();
index 06cf09cf3f8afaec36ddfd756bf1530f78faed6d..7a296522c7708718ca95aeb9a145e598ffad1c4c 100644 (file)
@@ -494,7 +494,7 @@ class TestWriteWellKnown {
 
     static DocumentSummaryInformation getDocumentSummaryInformation(POIFSFileSystem poifs)
     throws IOException, NoPropertySetStreamException, UnexpectedPropertySetTypeException {
-        if (!poifs.getRoot().hasEntry(DocumentSummaryInformation.DEFAULT_STREAM_NAME)) {
+        if (!poifs.getRoot().hasEntryCaseInsensitive(DocumentSummaryInformation.DEFAULT_STREAM_NAME)) {
             return null;
         }
 
index 497bd20843cb98156d02e6aff39ede462047ce5a..495ceb9837deceef05d67a5646dec926d3b62429 100644 (file)
@@ -252,9 +252,9 @@ final class TestExcelExtractor {
         try {
             fs = new POIFSFileSystem(POIDataSamples.getDocumentInstance().getFile("word_with_embeded.doc"));
 
-            DirectoryNode objPool = (DirectoryNode) fs.getRoot().getEntry("ObjectPool");
-            DirectoryNode dirA = (DirectoryNode) objPool.getEntry("_1269427460");
-            DirectoryNode dirB = (DirectoryNode) objPool.getEntry("_1269427461");
+            DirectoryNode objPool = (DirectoryNode) fs.getRoot().getEntryCaseInsensitive("ObjectPool");
+            DirectoryNode dirA = (DirectoryNode) objPool.getEntryCaseInsensitive("_1269427460");
+            DirectoryNode dirB = (DirectoryNode) objPool.getEntryCaseInsensitive("_1269427461");
 
             wbA = new HSSFWorkbook(dirA, fs, true);
             exA = new ExcelExtractor(wbA);
@@ -287,8 +287,8 @@ final class TestExcelExtractor {
         try {
             fs = new POIFSFileSystem(ssSamples.getFile("excel_with_embeded.xls"));
 
-            DirectoryNode dirA = (DirectoryNode) fs.getRoot().getEntry("MBD0000A3B5");
-            DirectoryNode dirB = (DirectoryNode) fs.getRoot().getEntry("MBD0000A3B4");
+            DirectoryNode dirA = (DirectoryNode) fs.getRoot().getEntryCaseInsensitive("MBD0000A3B5");
+            DirectoryNode dirB = (DirectoryNode) fs.getRoot().getEntryCaseInsensitive("MBD0000A3B4");
 
             wbA = new HSSFWorkbook(dirA, fs, true);
             wbB = new HSSFWorkbook(dirB, fs, true);
index b836e3269ce80cc3641f33abd46762ee6f26e3cf..b9d5fcb3caa1ec4e7173b4e1dbe63d0d2920018c 100644 (file)
@@ -2451,7 +2451,7 @@ final class TestBugs extends BaseTestBugzillaIssues {
         try (POIFSFileSystem poifs = new POIFSFileSystem(HSSFTestDataSamples.openSampleFileStream("61300.xls"))) {
 
             DocumentEntry entry =
-                    (DocumentEntry) poifs.getRoot().getEntry(SummaryInformation.DEFAULT_STREAM_NAME);
+                    (DocumentEntry) poifs.getRoot().getEntryCaseInsensitive(SummaryInformation.DEFAULT_STREAM_NAME);
 
             RuntimeException ex = assertThrows(
                 RuntimeException.class,
index eb87441cd3928e32b2f66d4d6771998d7115e6c2..94f3c4fa7803396cffb1a990fb194ab29811ea64 100644 (file)
@@ -644,7 +644,7 @@ public final class TestHSSFWorkbook extends BaseTestWorkbook {
                             DirectoryEntry dir = embeddedObject.getDirectory();
                             if (dir instanceof DirectoryNode) {
                                 DirectoryNode dNode = (DirectoryNode) dir;
-                                if (dNode.hasEntry("WordDocument")) {
+                                if (dNode.hasEntryCaseInsensitive("WordDocument")) {
                                     found = true;
                                     break;
                                 }
index 3434d7b581dac12980ff3ac08399b15eb31002ce..e44195afcd6910ca94d3e5f8db7a744875780f0d 100644 (file)
@@ -121,14 +121,13 @@ final class TestNonStandardWorkbookStreamNames {
         wb.close();
 
         DirectoryNode root = wb2.getDirectory();
-
         // Check that we have the new entries
         assertTrue(root.hasEntry("Workbook"));
         assertFalse(root.hasEntry("BOOK"));
         assertFalse(root.hasEntry("WORKBOOK"));
 
         // As we preserved, should also have a few other streams
-        assertTrue(root.hasEntry(SummaryInformation.DEFAULT_STREAM_NAME));
+        assertTrue(root.hasEntryCaseInsensitive(SummaryInformation.DEFAULT_STREAM_NAME));
         wb2.close();
     }
 }
index 2bc2da0a1c972a690e6d8f74959c173c8bceb1c0..4faf1647314efe3996ef1427f9c05be2e5bcb4ad 100644 (file)
@@ -89,7 +89,7 @@ class TestPOIFSProperties {
 
         summary1.setTitle(title);
         //write the modified property back to POIFS
-        fs.getRoot().getEntry(SummaryInformation.DEFAULT_STREAM_NAME).delete();
+        fs.getRoot().getEntryCaseInsensitive(SummaryInformation.DEFAULT_STREAM_NAME).delete();
         fs.createDocument(summary1.toInputStream(), SummaryInformation.DEFAULT_STREAM_NAME);
 
         // check that the information was added successfully to the filesystem object
index 195682ae753af751797f410a6d5643e9350671fa..0c57856df0d49ae3166262d4c0d0a91ccfc3e048 100644 (file)
@@ -106,7 +106,7 @@ public final class ReaderWriter implements POIFSReaderListener, POIFSWriterListe
 
                 try
                 {
-                    nextEntry = entry.getEntry(componentName);
+                    nextEntry = entry.getEntryCaseInsensitive(componentName);
                 }
                 catch (FileNotFoundException ignored)
                 {
index 1a81dc5a5867cbb473156f86fdd4e42fe4e841d4..15342a245d8bd621b50462a9a21b6c82f6db03a5 100644 (file)
@@ -73,7 +73,7 @@ final class TestDirectoryNode {
             assertEquals(0, node.getEntryCount());
 
             // verify behavior of getEntry
-            assertThrows(FileNotFoundException.class, () -> node.getEntry("foo"));
+            assertThrows(FileNotFoundException.class, () -> node.getEntryCaseInsensitive("foo"));
 
             // verify behavior of isDirectoryEntry
             assertTrue(node.isDirectoryEntry());
@@ -124,11 +124,11 @@ final class TestDirectoryNode {
             assertEquals(2, node.getEntryCount());
 
             // verify behavior of getEntry
-            DirectoryNode child1 = (DirectoryNode) node.getEntry("child1");
+            DirectoryNode child1 = (DirectoryNode) node.getEntryCaseInsensitive("child1");
 
-            child1.getEntry("child3");
-            node.getEntry("child2");
-            assertThrows(FileNotFoundException.class, () -> node.getEntry("child3"));
+            child1.getEntryCaseInsensitive("child3");
+            node.getEntryCaseInsensitive("child2");
+            assertThrows(FileNotFoundException.class, () -> node.getEntryCaseInsensitive("child3"));
 
             // verify behavior of isDirectoryEntry
             assertTrue(node.isDirectoryEntry());
index 94bc700be31f724d77cee023639e65ac5e27cdf4..59c6d168ba9450bad971dde045587e3bd558539c 100644 (file)
@@ -101,8 +101,8 @@ class TestDocument {
         POIFSFileSystem poifs = document.getFileSystem();
         String name = "test" + input.length;
         DirectoryNode root = poifs.getRoot();
-        if (root.hasEntry(name)) {
-            root.deleteEntry((EntryNode)root.getEntry(name));
+        if (root.hasEntryCaseInsensitive(name)) {
+            root.deleteEntry((EntryNode)root.getEntryCaseInsensitive(name));
         }
         return ((DocumentNode)root
             .createDocument(name, new ByteArrayInputStream(input)))
index c0d4de13534789915247ddf25a6551680df70c22..c083a2c3e4bbbc75150f911d07e5b3a2f3e3edfe 100644 (file)
@@ -381,22 +381,22 @@ final class TestDocumentInputStream {
             // Check inside
             DirectoryNode root = poifs.getRoot();
             // Top Level
-            Entry top = root.getEntry("Contents");
+            Entry top = root.getEntryCaseInsensitive("Contents");
             assertTrue(top.isDocumentEntry());
             stream = root.createDocumentInputStream(top);
             assertNotEquals(-1, stream.read());
 
             // One Level Down
-            DirectoryNode escher = (DirectoryNode) root.getEntry("Escher");
-            Entry one = escher.getEntry("EscherStm");
+            DirectoryNode escher = (DirectoryNode) root.getEntryCaseInsensitive("Escher");
+            Entry one = escher.getEntryCaseInsensitive("EscherStm");
             assertTrue(one.isDocumentEntry());
             stream = escher.createDocumentInputStream(one);
             assertNotEquals(-1, stream.read());
 
             // Two Levels Down
-            DirectoryNode quill = (DirectoryNode) root.getEntry("Quill");
-            DirectoryNode quillSub = (DirectoryNode) quill.getEntry("QuillSub");
-            Entry two = quillSub.getEntry("CONTENTS");
+            DirectoryNode quill = (DirectoryNode) root.getEntryCaseInsensitive("Quill");
+            DirectoryNode quillSub = (DirectoryNode) quill.getEntryCaseInsensitive("QuillSub");
+            Entry two = quillSub.getEntryCaseInsensitive("CONTENTS");
             assertTrue(two.isDocumentEntry());
             stream = quillSub.createDocumentInputStream(two);
             assertNotEquals(-1, stream.read());
index f60ce5bc3bf72d723d0c73da997a8d3bafc98bf5..9507b13a7deadc8313f33d6030e67ac78bd44d19 100644 (file)
@@ -101,13 +101,13 @@ final class TestEmptyDocument {
 
         // This line caused the error.
         try (POIFSFileSystem fs = new POIFSFileSystem(out.toInputStream())) {
-            DocumentEntry entry = (DocumentEntry) fs.getRoot().getEntry("Empty");
+            DocumentEntry entry = (DocumentEntry) fs.getRoot().getEntryCaseInsensitive("Empty");
             assertEquals(0, entry.getSize(), "Expected zero size");
             byte[] actualReadbackData;
             actualReadbackData = IOUtils.toByteArray(new DocumentInputStream(entry));
             assertEquals(0, actualReadbackData.length, "Expected zero read from stream");
 
-            entry = (DocumentEntry) fs.getRoot().getEntry("NotEmpty");
+            entry = (DocumentEntry) fs.getRoot().getEntryCaseInsensitive("NotEmpty");
             actualReadbackData = IOUtils.toByteArray(new DocumentInputStream(entry));
             assertEquals(testData.length, entry.getSize(), "Expected size was wrong");
             assertArrayEquals(testData, actualReadbackData, "Expected same data read from stream");
index 16fa1fd2404ec207a8b54192840767b87db25913..9dfec6f27640940843caa8a2b98c1e12280d72a2 100644 (file)
@@ -53,18 +53,18 @@ class TestEntryUtils {
        EntryUtils.copyNodeRecursively(entryR, fsD.getRoot());
 
        assertEquals(1, fsD.getRoot().getEntryCount());
-       assertNotNull(fsD.getRoot().getEntry("EntryRoot"));
+       assertNotNull(fsD.getRoot().getEntryCaseInsensitive("EntryRoot"));
 
        EntryUtils.copyNodeRecursively(entryA1, fsD.getRoot());
        assertEquals(2, fsD.getRoot().getEntryCount());
-       assertNotNull(fsD.getRoot().getEntry("EntryRoot"));
-       assertNotNull(fsD.getRoot().getEntry("EntryA1"));
+       assertNotNull(fsD.getRoot().getEntryCaseInsensitive("EntryRoot"));
+       assertNotNull(fsD.getRoot().getEntryCaseInsensitive("EntryA1"));
 
        EntryUtils.copyNodeRecursively(entryA2, fsD.getRoot());
        assertEquals(3, fsD.getRoot().getEntryCount());
-       assertNotNull(fsD.getRoot().getEntry("EntryRoot"));
-       assertNotNull(fsD.getRoot().getEntry("EntryA1"));
-       assertNotNull(fsD.getRoot().getEntry("EntryA2"));
+       assertNotNull(fsD.getRoot().getEntryCaseInsensitive("EntryRoot"));
+       assertNotNull(fsD.getRoot().getEntryCaseInsensitive("EntryA1"));
+       assertNotNull(fsD.getRoot().getEntryCaseInsensitive("EntryA2"));
 
        fsD.close();
 
@@ -74,15 +74,15 @@ class TestEntryUtils {
 
        EntryUtils.copyNodeRecursively(dirB, fsD.getRoot());
        assertEquals(1, fsD.getRoot().getEntryCount());
-       assertNotNull(fsD.getRoot().getEntry("DirB"));
-       assertEquals(0, ((DirectoryEntry)fsD.getRoot().getEntry("DirB")).getEntryCount());
+       assertNotNull(fsD.getRoot().getEntryCaseInsensitive("DirB"));
+       assertEquals(0, ((DirectoryEntry)fsD.getRoot().getEntryCaseInsensitive("DirB")).getEntryCount());
 
        EntryUtils.copyNodeRecursively(dirA, fsD.getRoot());
        assertEquals(2, fsD.getRoot().getEntryCount());
-       assertNotNull(fsD.getRoot().getEntry("DirB"));
-       assertEquals(0, ((DirectoryEntry)fsD.getRoot().getEntry("DirB")).getEntryCount());
-       assertNotNull(fsD.getRoot().getEntry("DirA"));
-       assertEquals(2, ((DirectoryEntry)fsD.getRoot().getEntry("DirA")).getEntryCount());
+       assertNotNull(fsD.getRoot().getEntryCaseInsensitive("DirB"));
+       assertEquals(0, ((DirectoryEntry)fsD.getRoot().getEntryCaseInsensitive("DirB")).getEntryCount());
+       assertNotNull(fsD.getRoot().getEntryCaseInsensitive("DirA"));
+       assertEquals(2, ((DirectoryEntry)fsD.getRoot().getEntryCaseInsensitive("DirA")).getEntryCount());
        fsD.close();
 
        // Copy the whole lot
@@ -91,11 +91,11 @@ class TestEntryUtils {
 
        EntryUtils.copyNodes(fs, fsD, new ArrayList<>());
        assertEquals(3, fsD.getRoot().getEntryCount());
-       assertNotNull(fsD.getRoot().getEntry(dirA.getName()));
-       assertNotNull(fsD.getRoot().getEntry(dirB.getName()));
-       assertNotNull(fsD.getRoot().getEntry(entryR.getName()));
-       assertEquals(0, ((DirectoryEntry)fsD.getRoot().getEntry("DirB")).getEntryCount());
-       assertEquals(2, ((DirectoryEntry)fsD.getRoot().getEntry("DirA")).getEntryCount());
+       assertNotNull(fsD.getRoot().getEntryCaseInsensitive(dirA.getName()));
+       assertNotNull(fsD.getRoot().getEntryCaseInsensitive(dirB.getName()));
+       assertNotNull(fsD.getRoot().getEntryCaseInsensitive(entryR.getName()));
+       assertEquals(0, ((DirectoryEntry)fsD.getRoot().getEntryCaseInsensitive("DirB")).getEntryCount());
+       assertEquals(2, ((DirectoryEntry)fsD.getRoot().getEntryCaseInsensitive("DirA")).getEntryCount());
        fsD.close();
        fs.close();
     }
@@ -131,11 +131,11 @@ class TestEntryUtils {
              try (InputStream tmpI = tmpO.toInputStream();
                   POIFSFileSystem nfs = new POIFSFileSystem(tmpI)) {
 
-                DirectoryEntry dN1 = (DirectoryEntry) nfs.getRoot().getEntry("DirA");
-                DirectoryEntry dN2 = (DirectoryEntry) nfs.getRoot().getEntry("DirB");
-                DocumentEntry eNA1 = (DocumentEntry) dN1.getEntry(entryA1.getName());
-                DocumentEntry eNA2 = (DocumentEntry) dN1.getEntry(entryA2.getName());
-                DocumentEntry eNB1 = (DocumentEntry) dN2.getEntry(entryB1.getName());
+                DirectoryEntry dN1 = (DirectoryEntry) nfs.getRoot().getEntryCaseInsensitive("DirA");
+                DirectoryEntry dN2 = (DirectoryEntry) nfs.getRoot().getEntryCaseInsensitive("DirB");
+                DocumentEntry eNA1 = (DocumentEntry) dN1.getEntryCaseInsensitive(entryA1.getName());
+                DocumentEntry eNA2 = (DocumentEntry) dN1.getEntryCaseInsensitive(entryA2.getName());
+                DocumentEntry eNB1 = (DocumentEntry) dN2.getEntryCaseInsensitive(entryB1.getName());
 
                 assertFalse(EntryUtils.areDocumentsIdentical(eNA1, eNA2));
                 assertTrue(EntryUtils.areDocumentsIdentical(eNA1, eNB1));
index ae28e00d36c5fc36c505564c10e52fff364994df..39bbfa2a4012640de4d16928654c6fdf46d0edb7 100644 (file)
@@ -63,16 +63,16 @@ final class TestFilteringDirectoryNode {
     void testNoFiltering() throws Exception {
         FilteringDirectoryNode d = new FilteringDirectoryNode(fs.getRoot(), new HashSet<>());
         assertEquals(3, d.getEntryCount());
-        assertEquals(dirA.getName(), d.getEntry(dirA.getName()).getName());
+        assertEquals(dirA.getName(), d.getEntryCaseInsensitive(dirA.getName()).getName());
 
-        assertTrue(d.getEntry(dirA.getName()).isDirectoryEntry());
-        assertFalse(d.getEntry(dirA.getName()).isDocumentEntry());
+        assertTrue(d.getEntryCaseInsensitive(dirA.getName()).isDirectoryEntry());
+        assertFalse(d.getEntryCaseInsensitive(dirA.getName()).isDocumentEntry());
 
-        assertTrue(d.getEntry(dirB.getName()).isDirectoryEntry());
-        assertFalse(d.getEntry(dirB.getName()).isDocumentEntry());
+        assertTrue(d.getEntryCaseInsensitive(dirB.getName()).isDirectoryEntry());
+        assertFalse(d.getEntryCaseInsensitive(dirB.getName()).isDocumentEntry());
 
-        assertFalse(d.getEntry(eRoot.getName()).isDirectoryEntry());
-        assertTrue(d.getEntry(eRoot.getName()).isDocumentEntry());
+        assertFalse(d.getEntryCaseInsensitive(eRoot.getName()).isDirectoryEntry());
+        assertTrue(d.getEntryCaseInsensitive(eRoot.getName()).isDocumentEntry());
 
         Iterator<Entry> i = d.getEntries();
         assertEquals(dirA, i.next());
@@ -93,13 +93,13 @@ final class TestFilteringDirectoryNode {
         FilteringDirectoryNode d1 = new FilteringDirectoryNode(fs.getRoot(), excl);
 
         assertEquals(2, d1.getEntryCount());
-        assertTrue(d1.hasEntry(dirA.getName()));
-        assertTrue(d1.hasEntry(dirB.getName()));
-        assertFalse(d1.hasEntry(eRoot.getName()));
+        assertTrue(d1.hasEntryCaseInsensitive(dirA.getName()));
+        assertTrue(d1.hasEntryCaseInsensitive(dirB.getName()));
+        assertFalse(d1.hasEntryCaseInsensitive(eRoot.getName()));
 
-        assertEquals(dirA, d1.getEntry(dirA.getName()));
-        assertEquals(dirB, d1.getEntry(dirB.getName()));
-        assertThrows(FileNotFoundException.class, () -> d1.getEntry(eRoot.getName()));
+        assertEquals(dirA, d1.getEntryCaseInsensitive(dirA.getName()));
+        assertEquals(dirB, d1.getEntryCaseInsensitive(dirB.getName()));
+        assertThrows(FileNotFoundException.class, () -> d1.getEntryCaseInsensitive(eRoot.getName()));
 
         Iterator<Entry> i = d1.getEntries();
         assertEquals(dirA, i.next());
@@ -117,12 +117,12 @@ final class TestFilteringDirectoryNode {
         FilteringDirectoryNode d2 = new FilteringDirectoryNode(fs.getRoot(), excl);
 
         assertEquals(1, d2.getEntryCount());
-        assertFalse(d2.hasEntry(dirA.getName()));
-        assertTrue(d2.hasEntry(dirB.getName()));
-        assertFalse(d2.hasEntry(eRoot.getName()));
-        assertThrows(FileNotFoundException.class, () -> d2.getEntry(dirA.getName()), "Should be filtered");
-        assertEquals(dirB, d2.getEntry(dirB.getName()));
-        assertThrows(FileNotFoundException.class, () -> d2.getEntry(eRoot.getName()), "Should be filtered");
+        assertFalse(d2.hasEntryCaseInsensitive(dirA.getName()));
+        assertTrue(d2.hasEntryCaseInsensitive(dirB.getName()));
+        assertFalse(d2.hasEntryCaseInsensitive(eRoot.getName()));
+        assertThrows(FileNotFoundException.class, () -> d2.getEntryCaseInsensitive(dirA.getName()), "Should be filtered");
+        assertEquals(dirB, d2.getEntryCaseInsensitive(dirB.getName()));
+        assertThrows(FileNotFoundException.class, () -> d2.getEntryCaseInsensitive(eRoot.getName()), "Should be filtered");
 
         i = d2.getEntries();
         assertEquals(dirB, i.next());
@@ -137,12 +137,12 @@ final class TestFilteringDirectoryNode {
         FilteringDirectoryNode d3 = new FilteringDirectoryNode(fs.getRoot(), excl);
 
         assertEquals(0, d3.getEntryCount());
-        assertFalse(d3.hasEntry(dirA.getName()));
-        assertFalse(d3.hasEntry(dirB.getName()));
-        assertFalse(d3.hasEntry(eRoot.getName()));
-        assertThrows(FileNotFoundException.class, () -> d3.getEntry(dirA.getName()), "Should be filtered");
-        assertThrows(FileNotFoundException.class, () -> d3.getEntry(dirB.getName()), "Should be filtered");
-        assertThrows(FileNotFoundException.class, () -> d3.getEntry(eRoot.getName()), "Should be filtered");
+        assertFalse(d3.hasEntryCaseInsensitive(dirA.getName()));
+        assertFalse(d3.hasEntryCaseInsensitive(dirB.getName()));
+        assertFalse(d3.hasEntryCaseInsensitive(eRoot.getName()));
+        assertThrows(FileNotFoundException.class, () -> d3.getEntryCaseInsensitive(dirA.getName()), "Should be filtered");
+        assertThrows(FileNotFoundException.class, () -> d3.getEntryCaseInsensitive(dirB.getName()), "Should be filtered");
+        assertThrows(FileNotFoundException.class, () -> d3.getEntryCaseInsensitive(eRoot.getName()), "Should be filtered");
 
         i = d3.getEntries();
         assertThrows(NoSuchElementException.class, i::next, "Should throw NoSuchElementException when depleted");
@@ -161,24 +161,24 @@ final class TestFilteringDirectoryNode {
 
         // Check main
         assertEquals(2, d.getEntryCount());
-        assertTrue(d.hasEntry(dirA.getName()));
-        assertTrue(d.hasEntry(dirB.getName()));
-        assertFalse(d.hasEntry(eRoot.getName()));
+        assertTrue(d.hasEntryCaseInsensitive(dirA.getName()));
+        assertTrue(d.hasEntryCaseInsensitive(dirB.getName()));
+        assertFalse(d.hasEntryCaseInsensitive(eRoot.getName()));
 
         // Check filtering down
-        assertTrue(d.getEntry(dirA.getName()) instanceof FilteringDirectoryNode);
-        assertFalse(d.getEntry(dirB.getName()) instanceof FilteringDirectoryNode);
+        assertTrue(d.getEntryCaseInsensitive(dirA.getName()) instanceof FilteringDirectoryNode);
+        assertFalse(d.getEntryCaseInsensitive(dirB.getName()) instanceof FilteringDirectoryNode);
 
-        DirectoryEntry fdA = (DirectoryEntry) d.getEntry(dirA.getName());
-        assertFalse(fdA.hasEntry(eA.getName()));
-        assertTrue(fdA.hasEntry(dirAA.getName()));
+        DirectoryEntry fdA = (DirectoryEntry) d.getEntryCaseInsensitive(dirA.getName());
+        assertFalse(fdA.hasEntryCaseInsensitive(eA.getName()));
+        assertTrue(fdA.hasEntryCaseInsensitive(dirAA.getName()));
 
-        DirectoryEntry fdAA = (DirectoryEntry) fdA.getEntry(dirAA.getName());
-        assertTrue(fdAA.hasEntry(eAA.getName()));
+        DirectoryEntry fdAA = (DirectoryEntry) fdA.getEntryCaseInsensitive(dirAA.getName());
+        assertTrue(fdAA.hasEntryCaseInsensitive(eAA.getName()));
     }
 
     @Test
     void testNullDirectory() {
         assertThrows(IllegalArgumentException.class, () -> new FilteringDirectoryNode(null, null));
     }
-}
\ No newline at end of file
+}
index 10e7759a06442a85a1066b4266d6627e26147f52..a4c421a2a748e716942a292d84fcaeae672dc990 100644 (file)
@@ -214,7 +214,7 @@ final class TestPOIFSFileSystem {
 
        DirectoryNode root = fs.getRoot();
        assertEquals(1, root.getEntryCount());
-       DocumentNode big = (DocumentNode)root.getEntry("BIG");
+       DocumentNode big = (DocumentNode)root.getEntryCaseInsensitive("BIG");
        assertEquals(hugeStream.length, big.getSize());
     }
 
index fcc1e4bcf1ed87801697089041f39b9b8ef0c77b..8d24e9f87b6cfdba31a3e14b304e04aae3cff294 100644 (file)
@@ -390,7 +390,7 @@ final class TestPOIFSMiniStore {
         assertEquals(POIFSConstants.UNUSED_BLOCK, ministore.getNextBlock(2));
 
         // Check the data is unchanged and the right length
-        entry = (DocumentEntry) fs.getRoot().getEntry("mini");
+        entry = (DocumentEntry) fs.getRoot().getEntryCaseInsensitive("mini");
         assertEquals(data.length, entry.getSize());
         byte[] rdata = new byte[data.length];
         dis = new DocumentInputStream(entry);
@@ -398,7 +398,7 @@ final class TestPOIFSMiniStore {
         assertArrayEquals(data, rdata);
         dis.close();
 
-        entry = (DocumentEntry) fs.getRoot().getEntry("mini2");
+        entry = (DocumentEntry) fs.getRoot().getEntryCaseInsensitive("mini2");
         assertEquals(data.length, entry.getSize());
         rdata = new byte[data.length];
         dis = new DocumentInputStream(entry);
index 4efcc809835e848b493de3e60bcae5a67b1953da..7f25ca751dac38dd65c02cc39bcd7b3f015cda1c 100644 (file)
@@ -960,7 +960,7 @@ final class TestPOIFSStream {
             assertEquals(POIFSConstants.END_OF_CHAIN, bat.getValueAt(10));
             assertEquals(POIFSConstants.UNUSED_BLOCK, bat.getValueAt(11));
 
-            DocumentEntry normal = (DocumentEntry) fs1.getRoot().getEntry("Normal");
+            DocumentEntry normal = (DocumentEntry) fs1.getRoot().getEntryCaseInsensitive("Normal");
             assertEquals(4106, normal.getSize());
             assertEquals(4106, ((DocumentNode) normal).getProperty().getSize());
 
@@ -988,7 +988,7 @@ final class TestPOIFSStream {
             assertEquals(POIFSConstants.UNUSED_BLOCK, bat.getValueAt(10));
             assertEquals(POIFSConstants.UNUSED_BLOCK, bat.getValueAt(11));
 
-            normal = (DocumentEntry) fs1.getRoot().getEntry("Normal");
+            normal = (DocumentEntry) fs1.getRoot().getEntryCaseInsensitive("Normal");
             assertEquals(4096, normal.getSize());
             assertEquals(4096, ((DocumentNode) normal).getProperty().getSize());
 
@@ -1011,13 +1011,13 @@ final class TestPOIFSStream {
                 assertEquals(POIFSConstants.UNUSED_BLOCK, bat.getValueAt(10));
                 assertEquals(POIFSConstants.UNUSED_BLOCK, bat.getValueAt(11));
 
-                normal = (DocumentEntry) fs2.getRoot().getEntry("Normal");
+                normal = (DocumentEntry) fs2.getRoot().getEntryCaseInsensitive("Normal");
                 assertEquals(4096, normal.getSize());
                 assertEquals(4096, ((DocumentNode) normal).getProperty().getSize());
 
 
                 // Make longer, take 1 block at the end
-                normal = (DocumentEntry) fs2.getRoot().getEntry("Normal");
+                normal = (DocumentEntry) fs2.getRoot().getEntryCaseInsensitive("Normal");
                 try (DocumentOutputStream nout = new DocumentOutputStream(normal)) {
                     nout.write(main4106);
                 }
@@ -1036,14 +1036,14 @@ final class TestPOIFSStream {
                 assertEquals(POIFSConstants.UNUSED_BLOCK, bat.getValueAt(11));
                 assertEquals(POIFSConstants.UNUSED_BLOCK, bat.getValueAt(12));
 
-                normal = (DocumentEntry) fs2.getRoot().getEntry("Normal");
+                normal = (DocumentEntry) fs2.getRoot().getEntryCaseInsensitive("Normal");
                 assertEquals(4106, normal.getSize());
                 assertEquals(4106, ((DocumentNode) normal).getProperty().getSize());
 
 
                 // Make it small, will trigger the SBAT stream and free lots up
                 byte[] mini = new byte[]{42, 0, 1, 2, 3, 4, 42};
-                normal = (DocumentEntry) fs2.getRoot().getEntry("Normal");
+                normal = (DocumentEntry) fs2.getRoot().getEntryCaseInsensitive("Normal");
                 try (DocumentOutputStream nout = new DocumentOutputStream(normal)) {
                     nout.write(mini);
                 }
@@ -1062,7 +1062,7 @@ final class TestPOIFSStream {
                 assertEquals(POIFSConstants.UNUSED_BLOCK, bat.getValueAt(11));
                 assertEquals(POIFSConstants.UNUSED_BLOCK, bat.getValueAt(12));
 
-                normal = (DocumentEntry) fs2.getRoot().getEntry("Normal");
+                normal = (DocumentEntry) fs2.getRoot().getEntryCaseInsensitive("Normal");
                 assertEquals(7, normal.getSize());
                 assertEquals(7, ((DocumentNode) normal).getProperty().getSize());
 
@@ -1088,7 +1088,7 @@ final class TestPOIFSStream {
                 assertEquals(POIFSConstants.UNUSED_BLOCK, bat.getValueAt(12));
                 assertEquals(POIFSConstants.UNUSED_BLOCK, bat.getValueAt(13));
 
-                normal = (DocumentEntry) fs2.getRoot().getEntry("Normal");
+                normal = (DocumentEntry) fs2.getRoot().getEntryCaseInsensitive("Normal");
                 assertEquals(4096, normal.getSize());
                 assertEquals(4096, ((DocumentNode) normal).getProperty().getSize());
 
@@ -1112,7 +1112,7 @@ final class TestPOIFSStream {
                     assertEquals(POIFSConstants.UNUSED_BLOCK, bat.getValueAt(12));
                     assertEquals(POIFSConstants.UNUSED_BLOCK, bat.getValueAt(13));
 
-                    normal = (DocumentEntry) fs3.getRoot().getEntry("Normal");
+                    normal = (DocumentEntry) fs3.getRoot().getEntryCaseInsensitive("Normal");
                     assertEquals(4096, normal.getSize());
                     assertEquals(4096, ((DocumentNode) normal).getProperty().getSize());
                 }
@@ -1639,11 +1639,11 @@ final class TestPOIFSStream {
             assertEquals(5, root.getEntryCount());
 
             // Check by the names
-            Entry thumbnail = root.getEntry("Thumbnail");
-            Entry dsi = root.getEntry("\u0005DocumentSummaryInformation");
-            Entry si = root.getEntry("\u0005SummaryInformation");
-            Entry image = root.getEntry("Image");
-            Entry tags = root.getEntry("Tags");
+            Entry thumbnail = root.getEntryCaseInsensitive("Thumbnail");
+            Entry dsi = root.getEntryCaseInsensitive("\u0005DocumentSummaryInformation");
+            Entry si = root.getEntryCaseInsensitive("\u0005SummaryInformation");
+            Entry image = root.getEntryCaseInsensitive("Image");
+            Entry tags = root.getEntryCaseInsensitive("Tags");
 
             assertFalse(thumbnail.isDirectoryEntry());
             assertFalse(dsi.isDirectoryEntry());
@@ -1675,7 +1675,7 @@ final class TestPOIFSStream {
     throws IOException, NoPropertySetStreamException {
         try (POIFSFileSystem fs = opener.apply(file)) {
             DirectoryEntry root = fs.getRoot();
-            Entry si = root.getEntry("\u0005SummaryInformation");
+            Entry si = root.getEntryCaseInsensitive("\u0005SummaryInformation");
 
             assertTrue(si.isDocumentEntry());
             DocumentNode doc = (DocumentNode) si;
@@ -1697,7 +1697,7 @@ final class TestPOIFSStream {
 
 
             // Try the other summary information
-            si = root.getEntry("\u0005DocumentSummaryInformation");
+            si = root.getEntryCaseInsensitive("\u0005DocumentSummaryInformation");
             assertTrue(si.isDocumentEntry());
             doc = (DocumentNode) si;
             assertContentsMatches(null, doc);
@@ -1745,11 +1745,11 @@ final class TestPOIFSStream {
 
                 // Check the contents of them - parse the summary block and check
                 sinf = (SummaryInformation) PropertySetFactory.create(new DocumentInputStream(
-                    (DocumentEntry) root.getEntry(SummaryInformation.DEFAULT_STREAM_NAME)));
+                    (DocumentEntry) root.getEntryCaseInsensitive(SummaryInformation.DEFAULT_STREAM_NAME)));
                 assertEquals(131333, sinf.getOSVersion());
 
                 dinf = (DocumentSummaryInformation) PropertySetFactory.create(new DocumentInputStream(
-                    (DocumentEntry) root.getEntry(DocumentSummaryInformation.DEFAULT_STREAM_NAME)));
+                    (DocumentEntry) root.getEntryCaseInsensitive(DocumentSummaryInformation.DEFAULT_STREAM_NAME)));
                 assertEquals(131333, dinf.getOSVersion());
 
 
@@ -1765,7 +1765,7 @@ final class TestPOIFSStream {
                 try (POIFSFileSystem fs3 = writeOutAndReadBack(fs2)) {
 
                     root = fs3.getRoot();
-                    testDir = (DirectoryEntry) root.getEntry("Testing 123");
+                    testDir = (DirectoryEntry) root.getEntryCaseInsensitive("Testing 123");
                     assertEquals(6, root.getEntryCount());
                     assertThat(root.getEntryNames(), hasItem("Thumbnail"));
                     assertThat(root.getEntryNames(), hasItem("Image"));
@@ -1777,21 +1777,21 @@ final class TestPOIFSStream {
 
                     // Check old and new are there
                     sinf = (SummaryInformation) PropertySetFactory.create(new DocumentInputStream(
-                        (DocumentEntry) root.getEntry(SummaryInformation.DEFAULT_STREAM_NAME)));
+                        (DocumentEntry) root.getEntryCaseInsensitive(SummaryInformation.DEFAULT_STREAM_NAME)));
                     assertEquals(131333, sinf.getOSVersion());
 
                     dinf = (DocumentSummaryInformation) PropertySetFactory.create(new DocumentInputStream(
-                        (DocumentEntry) root.getEntry(DocumentSummaryInformation.DEFAULT_STREAM_NAME)));
+                        (DocumentEntry) root.getEntryCaseInsensitive(DocumentSummaryInformation.DEFAULT_STREAM_NAME)));
                     assertEquals(131333, dinf.getOSVersion());
 
-                    assertContentsMatches(mini, (DocumentEntry) testDir.getEntry("Mini"));
+                    assertContentsMatches(mini, (DocumentEntry) testDir.getEntryCaseInsensitive("Mini"));
 
 
                     // Write out and read once more, just to be sure
                     try (POIFSFileSystem fs4 = writeOutAndReadBack(fs3)) {
 
                         root = fs4.getRoot();
-                        testDir = (DirectoryEntry) root.getEntry("Testing 123");
+                        testDir = (DirectoryEntry) root.getEntryCaseInsensitive("Testing 123");
                         assertEquals(6, root.getEntryCount());
                         assertThat(root.getEntryNames(), hasItem("Thumbnail"));
                         assertThat(root.getEntryNames(), hasItem("Image"));
@@ -1801,14 +1801,14 @@ final class TestPOIFSStream {
                         assertThat(root.getEntryNames(), hasItem("\u0005SummaryInformation"));
 
                         sinf = (SummaryInformation) PropertySetFactory.create(new DocumentInputStream(
-                            (DocumentEntry) root.getEntry(SummaryInformation.DEFAULT_STREAM_NAME)));
+                            (DocumentEntry) root.getEntryCaseInsensitive(SummaryInformation.DEFAULT_STREAM_NAME)));
                         assertEquals(131333, sinf.getOSVersion());
 
                         dinf = (DocumentSummaryInformation) PropertySetFactory.create(new DocumentInputStream(
-                            (DocumentEntry) root.getEntry(DocumentSummaryInformation.DEFAULT_STREAM_NAME)));
+                            (DocumentEntry) root.getEntryCaseInsensitive(DocumentSummaryInformation.DEFAULT_STREAM_NAME)));
                         assertEquals(131333, dinf.getOSVersion());
 
-                        assertContentsMatches(mini, (DocumentEntry) testDir.getEntry("Mini"));
+                        assertContentsMatches(mini, (DocumentEntry) testDir.getEntryCaseInsensitive("Mini"));
 
 
                         // Add a full stream, delete a full stream
@@ -1817,7 +1817,7 @@ final class TestPOIFSStream {
                         main4096[4095] = -11;
                         testDir.createDocument("Normal4096", new ByteArrayInputStream(main4096));
 
-                        root.getEntry("Tags").delete();
+                        root.getEntryCaseInsensitive("Tags").delete();
 
 
                         // Write out, re-load
@@ -1825,7 +1825,7 @@ final class TestPOIFSStream {
 
                             // Check it's all there
                             root = fs5.getRoot();
-                            testDir = (DirectoryEntry) root.getEntry("Testing 123");
+                            testDir = (DirectoryEntry) root.getEntryCaseInsensitive("Testing 123");
                             assertEquals(5, root.getEntryCount());
                             assertThat(root.getEntryNames(), hasItem("Thumbnail"));
                             assertThat(root.getEntryNames(), hasItem("Image"));
@@ -1836,19 +1836,19 @@ final class TestPOIFSStream {
 
                             // Check old and new are there
                             sinf = (SummaryInformation) PropertySetFactory.create(new DocumentInputStream(
-                                (DocumentEntry) root.getEntry(SummaryInformation.DEFAULT_STREAM_NAME)));
+                                (DocumentEntry) root.getEntryCaseInsensitive(SummaryInformation.DEFAULT_STREAM_NAME)));
                             assertEquals(131333, sinf.getOSVersion());
 
                             dinf = (DocumentSummaryInformation) PropertySetFactory.create(new DocumentInputStream(
-                                (DocumentEntry) root.getEntry(DocumentSummaryInformation.DEFAULT_STREAM_NAME)));
+                                (DocumentEntry) root.getEntryCaseInsensitive(DocumentSummaryInformation.DEFAULT_STREAM_NAME)));
                             assertEquals(131333, dinf.getOSVersion());
 
-                            assertContentsMatches(mini, (DocumentEntry) testDir.getEntry("Mini"));
-                            assertContentsMatches(main4096, (DocumentEntry) testDir.getEntry("Normal4096"));
+                            assertContentsMatches(mini, (DocumentEntry) testDir.getEntryCaseInsensitive("Mini"));
+                            assertContentsMatches(main4096, (DocumentEntry) testDir.getEntryCaseInsensitive("Normal4096"));
 
 
                             // Delete a directory, and add one more
-                            testDir.getEntry("Testing 456").delete();
+                            testDir.getEntryCaseInsensitive("Testing 456").delete();
                             testDir.createDirectory("Testing ABC");
 
 
@@ -1857,7 +1857,7 @@ final class TestPOIFSStream {
 
                                 // Check
                                 root = fs6.getRoot();
-                                testDir = (DirectoryEntry) root.getEntry("Testing 123");
+                                testDir = (DirectoryEntry) root.getEntryCaseInsensitive("Testing 123");
 
                                 assertEquals(5, root.getEntryCount());
                                 assertThat(root.getEntryNames(), hasItem("Thumbnail"));
@@ -1881,7 +1881,7 @@ final class TestPOIFSStream {
                                 try (POIFSFileSystem fs7 = writeOutAndReadBack(fs6)) {
 
                                     root = fs7.getRoot();
-                                    testDir = (DirectoryEntry) root.getEntry("Testing 123");
+                                    testDir = (DirectoryEntry) root.getEntryCaseInsensitive("Testing 123");
 
                                     assertEquals(5, root.getEntryCount());
                                     assertThat(root.getEntryNames(), hasItem("Thumbnail"));
@@ -1897,13 +1897,13 @@ final class TestPOIFSStream {
                                     assertThat(testDir.getEntryNames(), hasItem("Testing 789"));
                                     assertThat(testDir.getEntryNames(), hasItem("Testing ABC"));
 
-                                    assertContentsMatches(mini, (DocumentEntry) testDir.getEntry("Mini"));
-                                    assertContentsMatches(mini2, (DocumentEntry) testDir.getEntry("Mini2"));
-                                    assertContentsMatches(main4096, (DocumentEntry) testDir.getEntry("Normal4096"));
+                                    assertContentsMatches(mini, (DocumentEntry) testDir.getEntryCaseInsensitive("Mini"));
+                                    assertContentsMatches(mini2, (DocumentEntry) testDir.getEntryCaseInsensitive("Mini2"));
+                                    assertContentsMatches(main4096, (DocumentEntry) testDir.getEntryCaseInsensitive("Normal4096"));
 
 
                                     // Delete a mini stream, add one more
-                                    testDir.getEntry("Mini").delete();
+                                    testDir.getEntryCaseInsensitive("Mini").delete();
 
                                     byte[] mini3 = new byte[]{42, 0, 42, 0, 42, 0, 42};
                                     testDir.createDocument("Mini3", new ByteArrayInputStream(mini3));
@@ -1913,7 +1913,7 @@ final class TestPOIFSStream {
                                     try (POIFSFileSystem fs8 = writeOutAndReadBack(fs7)) {
 
                                         root = fs8.getRoot();
-                                        testDir = (DirectoryEntry) root.getEntry("Testing 123");
+                                        testDir = (DirectoryEntry) root.getEntryCaseInsensitive("Testing 123");
 
                                         assertEquals(5, root.getEntryCount());
                                         assertThat(root.getEntryNames(), hasItem("Thumbnail"));
@@ -1929,19 +1929,19 @@ final class TestPOIFSStream {
                                         assertThat(testDir.getEntryNames(), hasItem("Testing 789"));
                                         assertThat(testDir.getEntryNames(), hasItem("Testing ABC"));
 
-                                        assertContentsMatches(mini2, (DocumentEntry) testDir.getEntry("Mini2"));
-                                        assertContentsMatches(mini3, (DocumentEntry) testDir.getEntry("Mini3"));
-                                        assertContentsMatches(main4096, (DocumentEntry) testDir.getEntry("Normal4096"));
+                                        assertContentsMatches(mini2, (DocumentEntry) testDir.getEntryCaseInsensitive("Mini2"));
+                                        assertContentsMatches(mini3, (DocumentEntry) testDir.getEntryCaseInsensitive("Mini3"));
+                                        assertContentsMatches(main4096, (DocumentEntry) testDir.getEntryCaseInsensitive("Normal4096"));
 
 
                                         // Change some existing streams
-                                        POIFSDocument mini2Doc = new POIFSDocument((DocumentNode) testDir.getEntry("Mini2"));
+                                        POIFSDocument mini2Doc = new POIFSDocument((DocumentNode) testDir.getEntryCaseInsensitive("Mini2"));
                                         mini2Doc.replaceContents(new ByteArrayInputStream(mini));
 
                                         byte[] main4106 = new byte[4106];
                                         main4106[0] = 41;
                                         main4106[4105] = 42;
-                                        POIFSDocument mainDoc = new POIFSDocument((DocumentNode) testDir.getEntry("Normal4096"));
+                                        POIFSDocument mainDoc = new POIFSDocument((DocumentNode) testDir.getEntryCaseInsensitive("Normal4096"));
                                         mainDoc.replaceContents(new ByteArrayInputStream(main4106));
 
 
@@ -1949,7 +1949,7 @@ final class TestPOIFSStream {
                                         try (POIFSFileSystem fs9 = writeOutAndReadBack(fs8)) {
 
                                             root = fs9.getRoot();
-                                            testDir = (DirectoryEntry) root.getEntry("Testing 123");
+                                            testDir = (DirectoryEntry) root.getEntryCaseInsensitive("Testing 123");
 
                                             assertEquals(5, root.getEntryCount());
                                             assertThat(root.getEntryNames(), hasItem("Thumbnail"));
@@ -1965,9 +1965,9 @@ final class TestPOIFSStream {
                                             assertThat(testDir.getEntryNames(), hasItem("Testing 789"));
                                             assertThat(testDir.getEntryNames(), hasItem("Testing ABC"));
 
-                                            assertContentsMatches(mini, (DocumentEntry) testDir.getEntry("Mini2"));
-                                            assertContentsMatches(mini3, (DocumentEntry) testDir.getEntry("Mini3"));
-                                            assertContentsMatches(main4106, (DocumentEntry) testDir.getEntry("Normal4096"));
+                                            assertContentsMatches(mini, (DocumentEntry) testDir.getEntryCaseInsensitive("Mini2"));
+                                            assertContentsMatches(mini3, (DocumentEntry) testDir.getEntryCaseInsensitive("Mini3"));
+                                            assertContentsMatches(main4106, (DocumentEntry) testDir.getEntryCaseInsensitive("Normal4096"));
                                         }
                                     }
                                 }
@@ -2165,16 +2165,16 @@ final class TestPOIFSStream {
 
                 // Check some data
                 assertEquals(1, fs5.getRoot().getEntryCount());
-                testDir = (DirectoryEntry) fs5.getRoot().getEntry("Test Directory");
+                testDir = (DirectoryEntry) fs5.getRoot().getEntryCaseInsensitive("Test Directory");
                 assertEquals(3, testDir.getEntryCount());
 
-                DocumentEntry miniDoc = (DocumentEntry) testDir.getEntry("Mini");
+                DocumentEntry miniDoc = (DocumentEntry) testDir.getEntryCaseInsensitive("Mini");
                 assertContentsMatches(mini, miniDoc);
 
-                DocumentEntry normDoc = (DocumentEntry) testDir.getEntry("Normal4096");
+                DocumentEntry normDoc = (DocumentEntry) testDir.getEntryCaseInsensitive("Normal4096");
                 assertContentsMatches(main4096, normDoc);
 
-                normDoc = (DocumentEntry) testDir.getEntry("Normal5124");
+                normDoc = (DocumentEntry) testDir.getEntryCaseInsensitive("Normal5124");
                 assertContentsMatches(main5124, normDoc);
 
 
@@ -2278,10 +2278,10 @@ final class TestPOIFSStream {
 
 
             // Check that we can read the right data pre-write
-            DocumentEntry miniDoc = (DocumentEntry) testDir.getEntry("Mini");
+            DocumentEntry miniDoc = (DocumentEntry) testDir.getEntryCaseInsensitive("Mini");
             assertContentsMatches(mini, miniDoc);
 
-            DocumentEntry normDoc = (DocumentEntry) testDir.getEntry("Normal4096");
+            DocumentEntry normDoc = (DocumentEntry) testDir.getEntryCaseInsensitive("Normal4096");
             assertContentsMatches(main4096, normDoc);
 
 
@@ -2319,16 +2319,16 @@ final class TestPOIFSStream {
                 DirectoryEntry fsRoot = fs2.getRoot();
                 assertEquals(1, fsRoot.getEntryCount());
 
-                parentDir = (DirectoryEntry) fsRoot.getEntry("Parent Directory");
+                parentDir = (DirectoryEntry) fsRoot.getEntryCaseInsensitive("Parent Directory");
                 assertEquals(1, parentDir.getEntryCount());
 
-                testDir = (DirectoryEntry) parentDir.getEntry("Test Directory");
+                testDir = (DirectoryEntry) parentDir.getEntryCaseInsensitive("Test Directory");
                 assertEquals(2, testDir.getEntryCount());
 
-                miniDoc = (DocumentEntry) testDir.getEntry("Mini");
+                miniDoc = (DocumentEntry) testDir.getEntryCaseInsensitive("Mini");
                 assertContentsMatches(mini, miniDoc);
 
-                normDoc = (DocumentEntry) testDir.getEntry("Normal4096");
+                normDoc = (DocumentEntry) testDir.getEntryCaseInsensitive("Normal4096");
                 assertContentsMatches(main4096, normDoc);
 
 
@@ -2347,19 +2347,19 @@ final class TestPOIFSStream {
                     fsRoot = fs3.getRoot();
                     assertEquals(1, fsRoot.getEntryCount());
 
-                    parentDir = (DirectoryEntry) fsRoot.getEntry("Parent Directory");
+                    parentDir = (DirectoryEntry) fsRoot.getEntryCaseInsensitive("Parent Directory");
                     assertEquals(1, parentDir.getEntryCount());
 
-                    testDir = (DirectoryEntry) parentDir.getEntry("Test Directory");
+                    testDir = (DirectoryEntry) parentDir.getEntryCaseInsensitive("Test Directory");
                     assertEquals(4, testDir.getEntryCount());
 
-                    miniDoc = (DocumentEntry) testDir.getEntry("Mini");
+                    miniDoc = (DocumentEntry) testDir.getEntryCaseInsensitive("Mini");
                     assertContentsMatches(mini, miniDoc);
 
-                    miniDoc = (DocumentEntry) testDir.getEntry("Mini2");
+                    miniDoc = (DocumentEntry) testDir.getEntryCaseInsensitive("Mini2");
                     assertContentsMatches(mini2, miniDoc);
 
-                    normDoc = (DocumentEntry) testDir.getEntry("Normal4106");
+                    normDoc = (DocumentEntry) testDir.getEntryCaseInsensitive("Normal4106");
                     assertContentsMatches(main4106, normDoc);
                 }
             }
@@ -2372,15 +2372,15 @@ final class TestPOIFSStream {
             DirectoryNode testDir = fs.getRoot();
             assertEquals(3, testDir.getEntryCount());
 
-            DocumentEntry entry = (DocumentEntry) testDir.getEntry("test-zero-1");
+            DocumentEntry entry = (DocumentEntry) testDir.getEntryCaseInsensitive("test-zero-1");
             assertNotNull(entry);
             assertEquals(0, entry.getSize());
 
-            entry = (DocumentEntry) testDir.getEntry("test-zero-2");
+            entry = (DocumentEntry) testDir.getEntryCaseInsensitive("test-zero-2");
             assertNotNull(entry);
             assertEquals(0, entry.getSize());
 
-            entry = (DocumentEntry) testDir.getEntry("test-zero-3");
+            entry = (DocumentEntry) testDir.getEntryCaseInsensitive("test-zero-3");
             assertNotNull(entry);
             assertEquals(0, entry.getSize());
 
@@ -2419,19 +2419,19 @@ final class TestPOIFSStream {
             testDir.createDocument("empty-3", new ByteArrayInputStream(empty));
 
             // Check
-            miniDoc = (DocumentEntry) testDir.getEntry("Mini2");
+            miniDoc = (DocumentEntry) testDir.getEntryCaseInsensitive("Mini2");
             assertContentsMatches(mini2, miniDoc);
 
-            normDoc = (DocumentEntry) testDir.getEntry("Normal4106");
+            normDoc = (DocumentEntry) testDir.getEntryCaseInsensitive("Normal4106");
             assertContentsMatches(main4106, normDoc);
 
-            emptyDoc = (DocumentEntry) testDir.getEntry("empty-1");
+            emptyDoc = (DocumentEntry) testDir.getEntryCaseInsensitive("empty-1");
             assertContentsMatches(empty, emptyDoc);
 
-            emptyDoc = (DocumentEntry) testDir.getEntry("empty-2");
+            emptyDoc = (DocumentEntry) testDir.getEntryCaseInsensitive("empty-2");
             assertContentsMatches(empty, emptyDoc);
 
-            emptyDoc = (DocumentEntry) testDir.getEntry("empty-3");
+            emptyDoc = (DocumentEntry) testDir.getEntryCaseInsensitive("empty-3");
             assertContentsMatches(empty, emptyDoc);
 
             // Look at the properties entry, and check the empty ones
@@ -2469,19 +2469,19 @@ final class TestPOIFSStream {
             try (POIFSFileSystem fs2 = writeOutAndReadBack(fs1)) {
                 testDir = fs2.getRoot();
 
-                miniDoc = (DocumentEntry) testDir.getEntry("Mini2");
+                miniDoc = (DocumentEntry) testDir.getEntryCaseInsensitive("Mini2");
                 assertContentsMatches(mini2, miniDoc);
 
-                normDoc = (DocumentEntry) testDir.getEntry("Normal4106");
+                normDoc = (DocumentEntry) testDir.getEntryCaseInsensitive("Normal4106");
                 assertContentsMatches(main4106, normDoc);
 
-                emptyDoc = (DocumentEntry) testDir.getEntry("empty-1");
+                emptyDoc = (DocumentEntry) testDir.getEntryCaseInsensitive("empty-1");
                 assertContentsMatches(empty, emptyDoc);
 
-                emptyDoc = (DocumentEntry) testDir.getEntry("empty-2");
+                emptyDoc = (DocumentEntry) testDir.getEntryCaseInsensitive("empty-2");
                 assertContentsMatches(empty, emptyDoc);
 
-                emptyDoc = (DocumentEntry) testDir.getEntry("empty-3");
+                emptyDoc = (DocumentEntry) testDir.getEntryCaseInsensitive("empty-3");
                 assertContentsMatches(empty, emptyDoc);
 
                 // Check that a mini-stream was assigned, with one block used
@@ -2528,7 +2528,7 @@ final class TestPOIFSStream {
             assertEquals(5, src.getRoot().getEntryCount());
 
             // Grab the VBA project root
-            DirectoryEntry vbaProj = (DirectoryEntry) src.getRoot().getEntry("_VBA_PROJECT_CUR");
+            DirectoryEntry vbaProj = (DirectoryEntry) src.getRoot().getEntryCaseInsensitive("_VBA_PROJECT_CUR");
             assertEquals(3, vbaProj.getEntryCount());
             // Can't delete yet, has stuff
             assertFalse(vbaProj.delete());
@@ -2550,7 +2550,7 @@ final class TestPOIFSStream {
         DirectoryEntry dir = (DirectoryEntry) entry;
         String[] names = dir.getEntryNames().toArray(new String[dir.getEntryCount()]);
         for (String name : names) {
-            Entry ce = dir.getEntry(name);
+            Entry ce = dir.getEntryCaseInsensitive(name);
             _recursiveDeletee(ce);
         }
         assertTrue(dir.delete());
@@ -2602,7 +2602,7 @@ final class TestPOIFSStream {
         // Extend it past the 2gb mark
         try (POIFSFileSystem fs = new POIFSFileSystem(big, false)) {
             for (int i = 0; i < 19; i++) {
-                entry = (DocumentEntry) fs.getRoot().getEntry("Entry" + i);
+                entry = (DocumentEntry) fs.getRoot().getEntryCaseInsensitive("Entry" + i);
                 assertNotNull(entry);
                 assertEquals(s100mb, entry.getSize());
             }
@@ -2614,11 +2614,11 @@ final class TestPOIFSStream {
         // Check it still works
         try (POIFSFileSystem fs = new POIFSFileSystem(big, false)) {
             for (int i = 0; i < 19; i++) {
-                entry = (DocumentEntry) fs.getRoot().getEntry("Entry" + i);
+                entry = (DocumentEntry) fs.getRoot().getEntryCaseInsensitive("Entry" + i);
                 assertNotNull(entry);
                 assertEquals(s100mb, entry.getSize());
             }
-            entry = (DocumentEntry) fs.getRoot().getEntry("Bigger");
+            entry = (DocumentEntry) fs.getRoot().getEntryCaseInsensitive("Bigger");
             assertNotNull(entry);
             assertEquals(s512mb, entry.getSize());
         }
@@ -2637,7 +2637,7 @@ final class TestPOIFSStream {
         // Read it
         try (POIFSFileSystem fs = new POIFSFileSystem(big, false)) {
             for (int i = 0; i < 4; i++) {
-                entry = (DocumentEntry) fs.getRoot().getEntry("Entry" + i);
+                entry = (DocumentEntry) fs.getRoot().getEntryCaseInsensitive("Entry" + i);
                 assertNotNull(entry);
                 assertEquals(s512mb, entry.getSize());
             }
@@ -2650,7 +2650,7 @@ final class TestPOIFSStream {
         // Check it worked
         try (POIFSFileSystem fs = new POIFSFileSystem(big, false)) {
             for (int i = 0; i < 5; i++) {
-                entry = (DocumentEntry) fs.getRoot().getEntry("Entry" + i);
+                entry = (DocumentEntry) fs.getRoot().getEntryCaseInsensitive("Entry" + i);
                 assertNotNull(entry);
                 assertEquals(s512mb, entry.getSize());
             }
index 7c674b5b6925cc025fb4ad2ea83c8a7ebe7b2faf..4b12050ba256dad96435d2ea9e591aa59204e4cd 100644 (file)
@@ -116,9 +116,9 @@ final class TestPropertySorter {
         String VBA = "VBA";
 
         DirectoryEntry root = fs.getRoot();
-        DirectoryEntry vba_project = (DirectoryEntry)root.getEntry(_VBA_PROJECT_CUR);
+        DirectoryEntry vba_project = (DirectoryEntry)root.getEntryCaseInsensitive(_VBA_PROJECT_CUR);
 
-        DirectoryNode vba = (DirectoryNode)vba_project.getEntry(VBA);
+        DirectoryNode vba = (DirectoryNode)vba_project.getEntryCaseInsensitive(VBA);
         DirectoryProperty  p = (DirectoryProperty)vba.getProperty();
 
         List<Property> lst = new ArrayList<>();
diff --git a/test-data/document/47950_lower.doc b/test-data/document/47950_lower.doc
new file mode 100644 (file)
index 0000000..f9f2c6e
Binary files /dev/null and b/test-data/document/47950_lower.doc differ
diff --git a/test-data/document/47950_normal.doc b/test-data/document/47950_normal.doc
new file mode 100644 (file)
index 0000000..e79a621
Binary files /dev/null and b/test-data/document/47950_normal.doc differ
diff --git a/test-data/document/47950_upper.doc b/test-data/document/47950_upper.doc
new file mode 100644 (file)
index 0000000..b09ec38
Binary files /dev/null and b/test-data/document/47950_upper.doc differ