This is an automated email from the ASF dual-hosted git repository.
fanningpj pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/poi.git
The following commit(s) were added to refs/heads/trunk by this push:
new 540f0e5617 remove deprecated hasOOXMLHeader method (#941)
540f0e5617 is described below
commit 540f0e5617b7d3b5e644bf62d27199728eee9681
Author: PJ Fanning <[email protected]>
AuthorDate: Wed Nov 19 13:58:41 2025 +0100
remove deprecated hasOOXMLHeader method (#941)
---
.../java/org/apache/poi/ooxml/TestDetectAsOOXML.java | 6 +-----
.../poi/poifs/filesystem/DocumentFactoryHelper.java | 19 -------------------
2 files changed, 1 insertion(+), 24 deletions(-)
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.<p>
- *
- * 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;
- }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]