You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tika.apache.org by ta...@apache.org on 2024/05/30 11:39:10 UTC
(tika) branch TIKA-4221-revert created (now ae1eef48d)
This is an automated email from the ASF dual-hosted git repository.
tallison pushed a change to branch TIKA-4221-revert
in repository https://gitbox.apache.org/repos/asf/tika.git
at ae1eef48d TIKA-4221 -- revert workaround
This branch includes the following new commits:
new ae1eef48d TIKA-4221 -- revert workaround
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(tika) 01/01: TIKA-4221 -- revert workaround
Posted by ta...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
tallison pushed a commit to branch TIKA-4221-revert
in repository https://gitbox.apache.org/repos/asf/tika.git
commit ae1eef48d4e1c755c7b6fa8fa8399770f44e07fa
Author: tallison <ta...@apache.org>
AuthorDate: Thu May 30 07:38:51 2024 -0400
TIKA-4221 -- revert workaround
---
.../apache/tika/parser/pkg/CompressorParser.java | 60 ++--------------------
1 file changed, 3 insertions(+), 57 deletions(-)
diff --git a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-pkg-module/src/main/java/org/apache/tika/parser/pkg/CompressorParser.java b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-pkg-module/src/main/java/org/apache/tika/parser/pkg/CompressorParser.java
index 22262ba8e..e5f9767e2 100644
--- a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-pkg-module/src/main/java/org/apache/tika/parser/pkg/CompressorParser.java
+++ b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-pkg-module/src/main/java/org/apache/tika/parser/pkg/CompressorParser.java
@@ -56,7 +56,7 @@ import org.apache.commons.compress.compressors.snappy.FramedSnappyCompressorInpu
import org.apache.commons.compress.compressors.snappy.SnappyCompressorInputStream;
import org.apache.commons.compress.compressors.xz.XZCompressorInputStream;
import org.apache.commons.compress.compressors.z.ZCompressorInputStream;
-import org.apache.commons.io.input.ClosedInputStream;
+import org.apache.commons.io.input.CloseShieldInputStream;
import org.xml.sax.ContentHandler;
import org.xml.sax.SAXException;
@@ -170,10 +170,10 @@ public class CompressorParser implements Parser {
// any associated resources, but the underlying document stream
// should not be closed
if (stream.markSupported()) {
- stream = new TikaCloseShieldInputStream(stream);
+ stream = CloseShieldInputStream.wrap(stream);
} else {
// Ensure that the stream supports the mark feature
- stream = new BufferedInputStream(new TikaCloseShieldInputStream(stream));
+ stream = new BufferedInputStream(CloseShieldInputStream.wrap(stream));
}
CompressorInputStream cis;
@@ -267,58 +267,4 @@ public class CompressorParser implements Parser {
return this.decompressConcatenated;
}
- //TODO -- get rid of this workaround once TIKA-4221/COMPRESS-675 are fixed
- private class TikaCloseShieldInputStream extends InputStream {
-
- private InputStream stream;
- public TikaCloseShieldInputStream(InputStream stream) {
- this.stream = stream;
- }
-
- @Override
- public void close() throws IOException {
- this.stream = ClosedInputStream.INSTANCE;
- }
-
-
- @Override
- public int read(byte[] b) throws IOException {
- return stream.read(b);
- }
-
- @Override
- public int read(byte[] b, int off, int len) throws IOException {
- return stream.read(b, off, len);
- }
-
- @Override
- public long skip(long n) throws IOException {
- return stream.skip(n);
- }
-
- @Override
- public int available() throws IOException {
- return stream.available();
- }
-
- @Override
- public synchronized void mark(int readlimit) {
- stream.mark(readlimit);
- }
-
- @Override
- public synchronized void reset() throws IOException {
- stream.reset();
- }
-
- @Override
- public boolean markSupported() {
- return stream.markSupported();
- }
-
- @Override
- public int read() throws IOException {
- return stream.read();
- }
- }
}