Search in sources :

Example 1 with UnexpectedPropertySetTypeException

use of org.apache.poi.hpsf.UnexpectedPropertySetTypeException in project tika by apache.

the class SummaryExtractor method parseSummaryEntryIfExists.

private void parseSummaryEntryIfExists(DirectoryNode root, String entryName) throws IOException, TikaException {
    try {
        DocumentEntry entry = (DocumentEntry) root.getEntry(entryName);
        PropertySet properties = new PropertySet(new DocumentInputStream(entry));
        if (properties.isSummaryInformation()) {
            parse(new SummaryInformation(properties));
        }
        if (properties.isDocumentSummaryInformation()) {
            parse(new DocumentSummaryInformation(properties));
        }
    } catch (FileNotFoundException e) {
    // entry does not exist, just skip it
    } catch (NoPropertySetStreamException e) {
    // no property stream, just skip it
    } catch (UnexpectedPropertySetTypeException e) {
        throw new TikaException("Unexpected HPSF document", e);
    } catch (MarkUnsupportedException e) {
        throw new TikaException("Invalid DocumentInputStream", e);
    } catch (Exception e) {
        LOG.warn("Ignoring unexpected exception while parsing summary entry {}", entryName, e);
    }
}
Also used : TikaException(org.apache.tika.exception.TikaException) SummaryInformation(org.apache.poi.hpsf.SummaryInformation) DocumentSummaryInformation(org.apache.poi.hpsf.DocumentSummaryInformation) DocumentEntry(org.apache.poi.poifs.filesystem.DocumentEntry) FileNotFoundException(java.io.FileNotFoundException) PropertySet(org.apache.poi.hpsf.PropertySet) DocumentSummaryInformation(org.apache.poi.hpsf.DocumentSummaryInformation) NoPropertySetStreamException(org.apache.poi.hpsf.NoPropertySetStreamException) DocumentInputStream(org.apache.poi.poifs.filesystem.DocumentInputStream) UnexpectedPropertySetTypeException(org.apache.poi.hpsf.UnexpectedPropertySetTypeException) MarkUnsupportedException(org.apache.poi.hpsf.MarkUnsupportedException) NoPropertySetStreamException(org.apache.poi.hpsf.NoPropertySetStreamException) UnexpectedPropertySetTypeException(org.apache.poi.hpsf.UnexpectedPropertySetTypeException) TikaException(org.apache.tika.exception.TikaException) MarkUnsupportedException(org.apache.poi.hpsf.MarkUnsupportedException) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException)

Aggregations

FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 DocumentSummaryInformation (org.apache.poi.hpsf.DocumentSummaryInformation)1 MarkUnsupportedException (org.apache.poi.hpsf.MarkUnsupportedException)1 NoPropertySetStreamException (org.apache.poi.hpsf.NoPropertySetStreamException)1 PropertySet (org.apache.poi.hpsf.PropertySet)1 SummaryInformation (org.apache.poi.hpsf.SummaryInformation)1 UnexpectedPropertySetTypeException (org.apache.poi.hpsf.UnexpectedPropertySetTypeException)1 DocumentEntry (org.apache.poi.poifs.filesystem.DocumentEntry)1 DocumentInputStream (org.apache.poi.poifs.filesystem.DocumentInputStream)1 TikaException (org.apache.tika.exception.TikaException)1