Upgrade Tika to 1.7

Closes #94.
(cherry picked from commit 0ab38f3)
(cherry picked from commit 96c7bb1)
This commit is contained in:
David Pilato 2015-02-11 16:53:53 +01:00
parent 931be57da9
commit ec59d381b8
2 changed files with 6 additions and 1 deletions

View File

@ -89,8 +89,9 @@
<dependency> <dependency>
<groupId>org.apache.tika</groupId> <groupId>org.apache.tika</groupId>
<artifactId>tika-parsers</artifactId> <artifactId>tika-parsers</artifactId>
<version>1.5</version> <version>1.7</version>
<exclusions> <exclusions>
<!-- Not Apache2 License compatible -->
<exclusion> <exclusion>
<groupId>edu.ucar</groupId> <groupId>edu.ucar</groupId>
<artifactId>netcdf</artifactId> <artifactId>netcdf</artifactId>

View File

@ -455,6 +455,10 @@ public class AttachmentMapper extends AbstractFieldMapper<Object> {
// Set the maximum length of strings returned by the parseToString method, -1 sets no limit // Set the maximum length of strings returned by the parseToString method, -1 sets no limit
parsedContent = tika().parseToString(new BytesStreamInput(content, false), metadata, indexedChars); parsedContent = tika().parseToString(new BytesStreamInput(content, false), metadata, indexedChars);
} catch (Throwable e) { } catch (Throwable e) {
// It could happen that Tika adds a System property `sun.font.fontmanager` which should not happen
// TODO Remove when this will be fixed in Tika. See https://issues.apache.org/jira/browse/TIKA-1548
System.clearProperty("sun.font.fontmanager");
// #18: we could ignore errors when Tika does not parse data // #18: we could ignore errors when Tika does not parse data
if (!ignoreErrors) { if (!ignoreErrors) {
throw new MapperParsingException("Failed to extract [" + indexedChars + "] characters of text for [" + name + "]", e); throw new MapperParsingException("Failed to extract [" + indexedChars + "] characters of text for [" + name + "]", e);