This is an automated email from the ASF dual-hosted git repository. tallison pushed a commit to branch branch_1x in repository https://gitbox.apache.org/repos/asf/tika.git
commit 87845dbaded47689f5f26cf94a75b5dad3072da4 Merge: 943355e ed53797 Author: tallison <[email protected]> AuthorDate: Wed Dec 8 12:24:43 2021 -0500 Merge remote-tracking branch 'origin/branch_1x' into branch_1x # Conflicts: # tika-parent/pom.xml # tika-parsers/pom.xml # tika-parsers/src/main/java/org/apache/tika/parser/microsoft/ooxml/OOXMLExtractorFactory.java tika-bundle/pom.xml | 2 +- .../org/apache/tika/detect/XmlRootExtractor.java | 41 +++++++++++++++++++-- .../apache/tika/metadata/OfficeOpenXMLCore.java | 2 +- .../tika/metadata/OfficeOpenXMLExtended.java | 2 +- .../org/apache/tika/mime/MimeDetectionTest.java | 3 ++ .../org/apache/tika/mime/truncated-utf16-xml.xyz | Bin 0 -> 571 bytes tika-dl/pom.xml | 2 +- tika-parent/pom.xml | 12 +++--- tika-parsers/pom.xml | 2 +- .../microsoft/ooxml/OOXMLExtractorFactory.java | 2 +- .../tika/parser/ner/opennlp/ModelGetter.groovy | 37 +++++++++---------- 11 files changed, 69 insertions(+), 36 deletions(-) diff --cc tika-parent/pom.xml index e44185a,8a5d81f..8d0adea --- a/tika-parent/pom.xml +++ b/tika-parent/pom.xml @@@ -19,271 -19,335 +19,271 @@@ under the License. --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.apache</groupId> - <artifactId>apache</artifactId> - <version>17</version> - <relativePath/> - </parent> + <parent> + <groupId>org.apache</groupId> + <artifactId>apache</artifactId> + <version>24</version> + <relativePath /> + </parent> - <groupId>org.apache.tika</groupId> - <artifactId>tika-parent</artifactId> - <version>1.28-SNAPSHOT</version> - <packaging>pom</packaging> + <groupId>org.apache.tika</groupId> + <artifactId>tika-parent</artifactId> + <version>1.28-SNAPSHOT</version> + <packaging>pom</packaging> - <name>Apache Tika parent</name> - <description> - Apache Tika is a toolkit for detecting and extracting metadata and - structured text content from various documents using existing parser - libraries. - </description> - <inceptionYear>2007</inceptionYear> + <name>Apache Tika parent</name> + <description> + Apache Tika is a toolkit for detecting and extracting metadata and + structured text content from various documents using existing parser + libraries. + </description> + <inceptionYear>2007</inceptionYear> - <url>http://tika.apache.org/</url> + <url>http://tika.apache.org/</url> - <issueManagement> - <system>JIRA</system> - <url>https://issues.apache.org/jira/browse/TIKA</url> - </issueManagement> + <issueManagement> + <system>JIRA</system> + <url>https://issues.apache.org/jira/browse/TIKA</url> + </issueManagement> - <mailingLists> - <mailingList> - <name>Development mailing list</name> - <subscribe>[email protected]</subscribe> - <unsubscribe>[email protected]</unsubscribe> - <post>[email protected]</post> - <archive>https://lists.apache.org/[email protected]</archive> - <otherArchives> - <otherArchive>http://mail-archives.apache.org/mod_mbox/tika-dev/</otherArchive> - <otherArchive>http://mail-archives.apache.org/mod_mbox/lucene-tika-dev</otherArchive> - <otherArchive>http://www.mail-archive.com/[email protected]</otherArchive> - <otherArchive>http://www.mail-archive.com/[email protected]/</otherArchive> - <otherArchive>http://www.mail-archive.com/[email protected]/</otherArchive> - <otherArchive>http://www.nabble.com/Apache-Tika---Development-f20913.html</otherArchive> - <otherArchive>http://news.gmane.org/gmane.comp.apache.tika.devel</otherArchive> - <otherArchive>http://tika.markmail.org/</otherArchive> - </otherArchives> - </mailingList> - <mailingList> - <name>Commit mailing list</name> - <subscribe>[email protected]</subscribe> - <unsubscribe>[email protected]</unsubscribe> - <post>[email protected]</post> - <archive>https://lists.apache.org/[email protected]</archive> - <otherArchives> - <otherArchive>http://mail-archives.apache.org/mod_mbox/tika-commits/</otherArchive> - <otherArchive>http://mail-archives.apache.org/mod_mbox/lucene-tika-commits/</otherArchive> - <otherArchive>http://www.mail-archive.com/[email protected]/</otherArchive> - <otherArchive>http://www.mail-archive.com/[email protected]/</otherArchive> - </otherArchives> - </mailingList> - <mailingList> - <name>User mailing list</name> - <subscribe>[email protected]</subscribe> - <unsubscribe>[email protected]</unsubscribe> - <post>[email protected]</post> - <archive>https://lists.apache.org/[email protected]</archive> - <otherArchives> - <otherArchive>http://mail-archives.apache.org/mod_mbox/tika-user/</otherArchive> - <otherArchive>http://mail-archives.apache.org/mod_mbox/lucene-tika-user/</otherArchive> - <otherArchive>http://www.mail-archive.com/[email protected]/</otherArchive> - </otherArchives> - </mailingList> - </mailingLists> + <mailingLists> + <mailingList> + <name>Development mailing list</name> + <subscribe>[email protected]</subscribe> + <unsubscribe>[email protected]</unsubscribe> + <post>[email protected]</post> + <archive>https://lists.apache.org/[email protected]</archive> + <otherArchives> + <otherArchive>http://mail-archives.apache.org/mod_mbox/tika-dev/</otherArchive> + <otherArchive>http://mail-archives.apache.org/mod_mbox/lucene-tika-dev</otherArchive> + <otherArchive>http://www.mail-archive.com/[email protected]</otherArchive> + <otherArchive>http://www.mail-archive.com/[email protected]/</otherArchive> + <otherArchive>http://www.mail-archive.com/[email protected]/</otherArchive> + <otherArchive>http://www.nabble.com/Apache-Tika---Development-f20913.html</otherArchive> + <otherArchive>http://news.gmane.org/gmane.comp.apache.tika.devel</otherArchive> + <otherArchive>http://tika.markmail.org/</otherArchive> + </otherArchives> + </mailingList> + <mailingList> + <name>Commit mailing list</name> + <subscribe>[email protected]</subscribe> + <unsubscribe>[email protected]</unsubscribe> + <post>[email protected]</post> + <archive>https://lists.apache.org/[email protected]</archive> + <otherArchives> + <otherArchive>http://mail-archives.apache.org/mod_mbox/tika-commits/</otherArchive> + <otherArchive>http://mail-archives.apache.org/mod_mbox/lucene-tika-commits/</otherArchive> + <otherArchive>http://www.mail-archive.com/[email protected]/</otherArchive> + <otherArchive>http://www.mail-archive.com/[email protected]/</otherArchive> + </otherArchives> + </mailingList> + <mailingList> + <name>User mailing list</name> + <subscribe>[email protected]</subscribe> + <unsubscribe>[email protected]</unsubscribe> + <post>[email protected]</post> + <archive>https://lists.apache.org/[email protected]</archive> + <otherArchives> + <otherArchive>http://mail-archives.apache.org/mod_mbox/tika-user/</otherArchive> + <otherArchive>http://mail-archives.apache.org/mod_mbox/lucene-tika-user/</otherArchive> + <otherArchive>http://www.mail-archive.com/[email protected]/</otherArchive> + </otherArchives> + </mailingList> + </mailingLists> - <developers> - <developer> - <name>Rida Benjelloun</name> - <id>ridabenjelloun</id> - <email>[email protected]</email> - <roles> - <role>committer</role> - </roles> - </developer> - <developer> - <name>Keith Bennett</name> - <id>kbennett</id> - <roles> - <role>committer</role> - </roles> - </developer> - <developer> - <name>Mark Harwood</name> - <id>mharwood</id> - <roles> - <role>committer</role> - </roles> - </developer> - <developer> - <name>Ken Krugler</name> - <id>kkrugler</id> - <email>[email protected]</email> - <url>http://ken-blog.krugler.org</url> - <organization>Scale Unlimited</organization> - <organizationUrl>http://www.scaleunlimited.com</organizationUrl> - <roles> - <role>committer</role> - </roles> - </developer> - <developer> - <name>Chris A. Mattmann</name> - <id>mattmann</id> - <email>[email protected]</email> - <url>http://people.apache.org/~mattmann/</url> - <organization>NASA Jet Propulsion Laboratory</organization> - <organizationUrl>http://www.jpl.nasa.gov</organizationUrl> - <timezone>-8</timezone> - <properties /> - <roles> - <role>committer</role> - </roles> - </developer> - <developer> - <name>Michael McCandless</name> - <id>mikemccand</id> - <email>[email protected]</email> - <organization>IBM</organization> - <properties /> - <roles> - <role>committer</role> - </roles> - </developer> - <developer> - <name>Dave Meikle</name> - <id>dmeikle</id> - <roles> - <role>committer</role> - </roles> - </developer> - <developer> - <name>Sami Siren</name> - <id>siren</id> - <roles> - <role>committer</role> - </roles> - </developer> - <developer> - <name>Jukka Zitting</name> - <id>jukka</id> - <roles> - <role>committer</role> - </roles> - </developer> - <developer> - <name>Nick Burch</name> - <id>nick</id> - <organization>Alfresco</organization> - <organizationUrl>http://alfresco.com</organizationUrl> - <roles> - <role>committer</role> - </roles> - </developer> - <developer> - <name>Maxim Valyanskiy</name> - <id>maxcom</id> - <organization>Jet Infosystems</organization> - <roles> - <role>committer</role> - </roles> - <timezone>+3</timezone> - </developer> - <developer> - <name>Oleg Tikhonov</name> - <id>oleg</id> - <roles> - <role>committer</role> - </roles> - <timezone>+2</timezone> - </developer> - <developer> - <name>Ray Gauss II</name> - <id>rgauss</id> - <organization>Alfresco</organization> - <organizationUrl>http://alfresco.com</organizationUrl> - <timezone>-5</timezone> - <roles> - <role>committer</role> - </roles> - </developer> - <developer> - <name>Tyler Palsulich</name> - <id>tpalsulich</id> - <timezone>-8</timezone> - <roles> - <role>committer</role> - </roles> - </developer> - <developer> - <name>Tim Allison</name> - <id>tallison</id> - <timezone>-5</timezone> - <roles> - <role>committer</role> - </roles> - </developer> - <developer> - <name>Konstantin Gribov</name> - <id>grossws</id> - <timezone>+3</timezone> - <roles> - <role>committer</role> - </roles> - </developer> - </developers> - <contributors> - <contributor> - <name>Doug Cutting</name> - <roles> - <role>mentor</role> - </roles> - </contributor> - <contributor> - <name>Bertrand Delacretaz</name> - <roles> - <role>mentor</role> - </roles> - </contributor> - <contributor> - <name>Niall Pemberton</name> - <roles> - <role>emeritus</role> - </roles> - </contributor> - </contributors> + <developers> + <developer> + <name>Rida Benjelloun</name> + <id>ridabenjelloun</id> + <email>[email protected]</email> + <roles> + <role>committer</role> + </roles> + </developer> + <developer> + <name>Keith Bennett</name> + <id>kbennett</id> + <roles> + <role>committer</role> + </roles> + </developer> + <developer> + <name>Mark Harwood</name> + <id>mharwood</id> + <roles> + <role>committer</role> + </roles> + </developer> + <developer> + <name>Ken Krugler</name> + <id>kkrugler</id> + <email>[email protected]</email> + <url>http://ken-blog.krugler.org</url> + <organization>Scale Unlimited</organization> + <organizationUrl>http://www.scaleunlimited.com</organizationUrl> + <roles> + <role>committer</role> + </roles> + </developer> + <developer> + <name>Chris A. Mattmann</name> + <id>mattmann</id> + <email>[email protected]</email> + <url>http://people.apache.org/~mattmann/</url> + <organization>NASA Jet Propulsion Laboratory</organization> + <organizationUrl>http://www.jpl.nasa.gov</organizationUrl> + <timezone>-8</timezone> + <properties/> + <roles> + <role>committer</role> + </roles> + </developer> + <developer> + <name>Michael McCandless</name> + <id>mikemccand</id> + <email>[email protected]</email> + <organization>IBM</organization> + <properties/> + <roles> + <role>committer</role> + </roles> + </developer> + <developer> + <name>Dave Meikle</name> + <id>dmeikle</id> + <roles> + <role>committer</role> + </roles> + </developer> + <developer> + <name>Sami Siren</name> + <id>siren</id> + <roles> + <role>committer</role> + </roles> + </developer> + <developer> + <name>Jukka Zitting</name> + <id>jukka</id> + <roles> + <role>committer</role> + </roles> + </developer> + <developer> + <name>Nick Burch</name> + <id>nick</id> + <organization>Alfresco</organization> + <organizationUrl>http://alfresco.com</organizationUrl> + <roles> + <role>committer</role> + </roles> + </developer> + <developer> + <name>Maxim Valyanskiy</name> + <id>maxcom</id> + <organization>Jet Infosystems</organization> + <roles> + <role>committer</role> + </roles> + <timezone>+3</timezone> + </developer> + <developer> + <name>Oleg Tikhonov</name> + <id>oleg</id> + <roles> + <role>committer</role> + </roles> + <timezone>+2</timezone> + </developer> + <developer> + <name>Ray Gauss II</name> + <id>rgauss</id> + <organization>Alfresco</organization> + <organizationUrl>http://alfresco.com</organizationUrl> + <timezone>-5</timezone> + <roles> + <role>committer</role> + </roles> + </developer> + <developer> + <name>Tyler Palsulich</name> + <id>tpalsulich</id> + <timezone>-8</timezone> + <roles> + <role>committer</role> + </roles> + </developer> + <developer> + <name>Tim Allison</name> + <id>tallison</id> + <timezone>-5</timezone> + <roles> + <role>committer</role> + </roles> + </developer> + <developer> + <name>Konstantin Gribov</name> + <id>grossws</id> + <timezone>+3</timezone> + <roles> + <role>committer</role> + </roles> + </developer> + </developers> + <contributors> + <contributor> + <name>Doug Cutting</name> + <roles> + <role>mentor</role> + </roles> + </contributor> + <contributor> + <name>Bertrand Delacretaz</name> + <roles> + <role>mentor</role> + </roles> + </contributor> + <contributor> + <name>Niall Pemberton</name> + <roles> + <role>emeritus</role> + </roles> + </contributor> + </contributors> + <properties> + <maven.compiler.source>1.8</maven.compiler.source> + <maven.compiler.target>1.8</maven.compiler.target> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <project.reporting.outputEncoding>${project.build.sourceEncoding}</project.reporting.outputEncoding> + <!-- plugin versions --> + <forbiddenapis.version>3.1</forbiddenapis.version> + <groovy.maven.version>2.1.1</groovy.maven.version> + <maven.antrun.version>1.8</maven.antrun.version> + <maven.assembly.version>3.3.0</maven.assembly.version> + <maven.bundle.version>5.1.1</maven.bundle.version> + <maven.failsafe.version>2.22.2</maven.failsafe.version> + <maven.javadoc.version>3.1.1</maven.javadoc.version> + <maven.scr.version>1.26.4</maven.scr.version> + <maven.surefire.version>3.0.0-M4</maven.surefire.version> + <maven.shade.version>3.2.4</maven.shade.version> + <rat.version>0.13</rat.version> + <!-- NOTE: sync tukaani version with commons-compress in tika-parsers --> + <poi.version>4.1.2</poi.version> + <commons.compress.version>1.21</commons.compress.version> + <commons.io.version>2.11.0</commons.io.version> + <commons.lang3.version>3.12.0</commons.lang3.version> + <gson.version>2.8.9</gson.version> + <guava.version>31.0.1-jre</guava.version> + <osgi.core.version>6.0.0</osgi.core.version> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>biz.aQute</groupId> - <artifactId>bndlib</artifactId> - <version>1.50.0</version> - </dependency> - <dependency> - <groupId>org.apache.felix</groupId> - <artifactId>org.apache.felix.scr.annotations</artifactId> - <version>1.12.0</version> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.13.2</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - <version>${slf4j.version}</version> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - <version>${slf4j.version}</version> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-simple</artifactId> - <version>${slf4j.version}</version> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>jcl-over-slf4j</artifactId> - <version>${slf4j.version}</version> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>jul-to-slf4j</artifactId> - <version>${slf4j.version}</version> - </dependency> - - <dependency> - <groupId>jakarta.annotation</groupId> - <artifactId>jakarta.annotation-api</artifactId> - <version>1.3.5</version> - </dependency> - <dependency> - <groupId>javax.xml.soap</groupId> - <artifactId>javax.xml.soap-api</artifactId> - <version>1.4.0</version> - </dependency> - <dependency> - <groupId>org.jvnet.staxex</groupId> - <artifactId>stax-ex</artifactId> - <version>2.0.1</version> - </dependency> - </dependencies> - </dependencyManagement> - - <properties> - <maven.compiler.source>1.8</maven.compiler.source> - <maven.compiler.target>1.8</maven.compiler.target> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <project.reporting.outputEncoding>${project.build.sourceEncoding}</project.reporting.outputEncoding> - <project.build.outputTimestamp>1</project.build.outputTimestamp> - <!-- plugin versions --> - <forbiddenapis.version>3.1</forbiddenapis.version> - <groovy.maven.version>2.1.1</groovy.maven.version> - <maven.antrun.version>1.8</maven.antrun.version> - <maven.assembly.version>3.3.0</maven.assembly.version> - <maven.bundle.version>5.1.1</maven.bundle.version> - <maven.failsafe.version>2.22.2</maven.failsafe.version> - <maven.javadoc.version>3.1.1</maven.javadoc.version> - <maven.scr.version>1.26.4</maven.scr.version> - <maven.surefire.version>3.0.0-M4</maven.surefire.version> - <maven.shade.version>3.2.4</maven.shade.version> - <rat.version>0.13</rat.version> - <!-- NOTE: sync tukaani version with commons-compress in tika-parsers --> - <poi.version>4.1.2</poi.version> - <commons.compress.version>1.20</commons.compress.version> - <commons.io.version>2.11.0</commons.io.version> - <commons.lang3.version>3.12.0</commons.lang3.version> - <gson.version>2.8.7</gson.version> - <guava.version>30.1.1-jre</guava.version> - <osgi.core.version>6.0.0</osgi.core.version> - <lombok.version>1.18.20</lombok.version> - - <cxf.version>3.4.4</cxf.version> + <cxf.version>3.4.5</cxf.version> <slf4j.version>1.7.30</slf4j.version> <log4j.version>1.2.17</log4j.version> - <jackson.version>2.12.3</jackson.version> + <jackson.version>2.13.0</jackson.version> <!-- when this is next upgraded, see if we can get rid of javax.activation dependency in tika-server. Until then, DO NOT go above 2.x unless you know what you're doing. diff --cc tika-parsers/src/main/java/org/apache/tika/parser/microsoft/ooxml/OOXMLExtractorFactory.java index 1a5eb62,d3ef6b4..63dd79f --- a/tika-parsers/src/main/java/org/apache/tika/parser/microsoft/ooxml/OOXMLExtractorFactory.java +++ b/tika-parsers/src/main/java/org/apache/tika/parser/microsoft/ooxml/OOXMLExtractorFactory.java @@@ -111,28 -111,8 +111,28 @@@ public class OOXMLExtractorFactory new RereadableInputStream(stream, MAX_BUFFER_LENGTH, true, false)) { try { - pkg = OPCPackage.open(rereadableInputStream); + pkg = OPCPackage.open(CloseShieldInputStream.wrap(rereadableInputStream)); - } catch (EOFException|UnsupportedZipFeatureException e) { + } catch (UnsupportedZipFeatureException e) { + if (e.getFeature() != + UnsupportedZipFeatureException.Feature.DATA_DESCRIPTOR) { + throw e; + } + rereadableInputStream.rewind(); + tmpRepairedCopy = File.createTempFile("tika-ooxml-repair-", ""); + ZipSalvager.salvageCopy(rereadableInputStream, tmpRepairedCopy, false); + //if there isn't enough left to be opened as a package + //throw an exception -- we may want to fall back to streaming + //parsing + pkg = OPCPackage.open(tmpRepairedCopy, PackageAccess.READ); + } catch (IOException e) { + if (e instanceof EOFException) { + //keep going + } else if (e instanceof IOException && e.getMessage() != null && + e.getMessage().contains("Truncated")) { + //keep going + } else { + throw e; + } rereadableInputStream.rewind(); tmpRepairedCopy = File.createTempFile("tika-ooxml-repair-", ""); ZipSalvager.salvageCopy(rereadableInputStream, tmpRepairedCopy, false);
