Uploaded image for project: 'Tika'
  1. Tika
  2. TIKA-1732

TikaException "Failed to close temporary resources" with AutoDetectParser on Windows

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Not A Problem
    • Affects Version/s: 1.10
    • Fix Version/s: None
    • Component/s: core
    • Labels:
      None
    • Environment:

      Windows 8.1 Pro, Java 1.8.0_45

    • Flags:
      Important

      Description

      When running the very basic example on https://tika.apache.org/1.7/examples.html
      The following exception is thrown:
      Exception in thread "main" org.apache.tika.exception.TikaException: Failed to close temporary resources
      at org.apache.tika.io.TemporaryResources.dispose(TemporaryResources.java:152)
      at org.apache.tika.parser.AutoDetectParser.parse(AutoDetectParser.java:127)
      at org.apache.tika.parser.AutoDetectParser.parse(AutoDetectParser.java:136)
      at com.joliciel.test.tika.TikaStructureTest.main(TikaStructureTest.java:17)
      Caused by: java.io.IOException: Could not delete temporary file C:\Users\Assaf\AppData\Local\Temp\apache-tika-1485913318469340881.tmp
      at org.apache.tika.io.TemporaryResources$1.close(TemporaryResources.java:70)
      at org.apache.tika.io.TemporaryResources.close(TemporaryResources.java:121)
      at org.apache.tika.io.TemporaryResources.dispose(TemporaryResources.java:150)
      ... 3 more

      The code is:
      import java.io.InputStream;
      import org.apache.tika.metadata.Metadata;
      import org.apache.tika.parser.AutoDetectParser;
      import org.apache.tika.sax.BodyContentHandler;

      public class TikaTest {
      public static void main(String[] args) throws Exception {
      InputStream stream = TikaTest.class.getResourceAsStream("test.docx");
      BodyContentHandler handler = new BodyContentHandler();

      AutoDetectParser parser = new AutoDetectParser();
      Metadata metadata = new Metadata();
      try

      { parser.parse(stream, handler, metadata); System.out.println(handler.toString()); }

      finally

      { stream.close(); }

      }

      }

      The file analysed is a Microsoft Word 2013 DOCX.

        Attachments

        1. test.docx
          13 kB
          Assaf Urieli

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              assaf.urieli Assaf Urieli
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: