diff --git a/poi-ooxml/src/test/java/org/apache/poi/ooxml/TestDetectAsOOXML.java b/poi-ooxml/src/test/java/org/apache/poi/ooxml/TestDetectAsOOXML.java index 6d3708c139..1255f1da3f 100644 --- a/poi-ooxml/src/test/java/org/apache/poi/ooxml/TestDetectAsOOXML.java +++ b/poi-ooxml/src/test/java/org/apache/poi/ooxml/TestDetectAsOOXML.java @@ -54,10 +54,6 @@ class TestDetectAsOOXML { void testDetectAsPOIFS(String file, FileMagic fm) throws IOException { try (InputStream is = FileMagic.prepareToCheckMagic(openSampleFileStream(file))) { FileMagic act = FileMagic.valueOf(is); - - assertEquals(act == FileMagic.OOXML, DocumentFactoryHelper.hasOOXMLHeader(is), - "OOXML files should be detected, others not"); - assertEquals(fm, act, "file magic failed for " + file); } } @@ -70,7 +66,7 @@ class TestDetectAsOOXML { InputStream is = FileMagic.prepareToCheckMagic(testInput); // detect header - assertFalse(DocumentFactoryHelper.hasOOXMLHeader(is)); + assertFalse(FileMagic.valueOf(is) == FileMagic.OOXML); // check if InputStream is still intact byte[] act = IOUtils.toByteArray(is); diff --git a/poi/src/main/java/org/apache/poi/poifs/filesystem/DocumentFactoryHelper.java b/poi/src/main/java/org/apache/poi/poifs/filesystem/DocumentFactoryHelper.java index 6b9b749362..4ca1e8ee53 100644 --- a/poi/src/main/java/org/apache/poi/poifs/filesystem/DocumentFactoryHelper.java +++ b/poi/src/main/java/org/apache/poi/poifs/filesystem/DocumentFactoryHelper.java @@ -28,7 +28,6 @@ import org.apache.poi.EncryptedDocumentException; import org.apache.poi.poifs.crypt.Decryptor; import org.apache.poi.poifs.crypt.EncryptionInfo; import org.apache.poi.util.Internal; -import org.apache.poi.util.Removal; /** * A small base class for the various factories, e.g. WorkbookFactory, @@ -100,22 +99,4 @@ public final class DocumentFactoryHelper { throw new IOException(e); } } - - /** - * Checks that the supplied InputStream (which MUST - * support mark and reset) has a OOXML (zip) header at the start of it.
- * - * If unsure if your InputStream does support mark / reset, - * use {@link FileMagic#prepareToCheckMagic(InputStream)} to wrap it and make - * sure to always use that, and not the original! - * - * @param inp An InputStream which supports either mark/reset - * - * @deprecated in 3.17-beta2, use {@link FileMagic#valueOf(InputStream)} == FileMagic.OOXML instead - */ - @Deprecated - @Removal(version="4.0") - public static boolean hasOOXMLHeader(InputStream inp) throws IOException { - return FileMagic.valueOf(inp) == FileMagic.OOXML; - } }