Details

    • Type: Sub-task
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.11
    • Component/s: core
    • Labels:
    • Flags:
      Patch

      Description

      This will provide support for the new api for users who need it, and provide better information in I/O operations, e.g. detailed exception if file cannot be read.

      • used Path and methods in java.nio.file.Files internally
      • add getPath() method as the counterpart to getFile()
      • modified test to use
      1. TIKA-1744.patch
        14 kB
        Yaniv Kunda
      2. TIKA-1744-2.patch
        2 kB
        Yaniv Kunda

        Issue Links

          Activity

          Hide
          tallison@mitre.org Tim Allison added a comment - - edited

          Thank you, Yaniv Kunda!

          This was part of the earlier discussion here and maybe here.

          Jukka Zitting and Ken Krugler, what would you think of deprecating get(File .. so that we can clean up its exception signature in 2.0 (leave it in in 2.0, but modify it to throw an IOException)...or do we even need to deprecate it...just change the signature in 2.0 and off we go.

          In the current patch, we have

           public static TikaInputStream get(File file, Metadata metadata)
                      throws FileNotFoundException {
          

          which calls new TikaInputStream(File file).

          It would be great if we could do a complete transfer to Path. However, as you found, we can't just change this under the hood:

              public static TikaInputStream get(File file, Metadata metadata)
                      throws FileNotFoundException {
                  return get(Paths.get(file.toURI()), metadata);
              }
          

          because get(Path path throws the more general, well actually more specific (and better!) IOException and its subclasses.

          I'm wondering if we should deprecate get(File file...) throws FNFE so that we can add get(File file...) throws IOException in Tika 2.0 and do a small amount of cleanup?

          Show
          tallison@mitre.org Tim Allison added a comment - - edited Thank you, Yaniv Kunda ! This was part of the earlier discussion here and maybe here . Jukka Zitting and Ken Krugler , what would you think of deprecating get(File .. so that we can clean up its exception signature in 2.0 (leave it in in 2.0, but modify it to throw an IOException)...or do we even need to deprecate it...just change the signature in 2.0 and off we go. In the current patch, we have public static TikaInputStream get(File file, Metadata metadata) throws FileNotFoundException { which calls new TikaInputStream(File file) . It would be great if we could do a complete transfer to Path. However, as you found, we can't just change this under the hood: public static TikaInputStream get(File file, Metadata metadata) throws FileNotFoundException { return get(Paths.get(file.toURI()), metadata); } because get(Path path throws the more general, well actually more specific (and better!) IOException and its subclasses. I'm wondering if we should deprecate get(File file...) throws FNFE so that we can add get(File file...) throws IOException in Tika 2.0 and do a small amount of cleanup?
          Hide
          tallison@mitre.org Tim Allison added a comment -

          r1706056

          Thank you, Yaniv Kunda!

          Show
          tallison@mitre.org Tim Allison added a comment - r1706056 Thank you, Yaniv Kunda !
          Hide
          hudson Hudson added a comment -

          SUCCESS: Integrated in tika-trunk-jdk1.7 #857 (See https://builds.apache.org/job/tika-trunk-jdk1.7/857/)
          TIKA-1744 via Yaniv Kunda – upgrade TikaInputStream to use Path. Thank you, Yaniv. (tallison: http://svn.apache.org/viewvc/tika/trunk/?view=rev&rev=1706056)

          • trunk/tika-core/src/main/java/org/apache/tika/io/TikaInputStream.java
          • trunk/tika-core/src/test/java/org/apache/tika/io/TikaInputStreamTest.java
          Show
          hudson Hudson added a comment - SUCCESS: Integrated in tika-trunk-jdk1.7 #857 (See https://builds.apache.org/job/tika-trunk-jdk1.7/857/ ) TIKA-1744 via Yaniv Kunda – upgrade TikaInputStream to use Path. Thank you, Yaniv. (tallison: http://svn.apache.org/viewvc/tika/trunk/?view=rev&rev=1706056 ) trunk/tika-core/src/main/java/org/apache/tika/io/TikaInputStream.java trunk/tika-core/src/test/java/org/apache/tika/io/TikaInputStreamTest.java
          Hide
          kunda Yaniv Kunda added a comment -

          Additional minor patch:

          • Corrected javadoc links
          • Added @Deprecated annotations to methods where @deprecated javadoc tags were added
          Show
          kunda Yaniv Kunda added a comment - Additional minor patch: Corrected javadoc links Added @Deprecated annotations to methods where @deprecated javadoc tags were added
          Hide
          tallison@mitre.org Tim Allison added a comment -

          Doh! Thank you.

          Show
          tallison@mitre.org Tim Allison added a comment - Doh! Thank you.
          Hide
          tallison@mitre.org Tim Allison added a comment -

          committed r1706249. Thank you!

          Show
          tallison@mitre.org Tim Allison added a comment - committed r1706249. Thank you!
          Hide
          hudson Hudson added a comment -

          SUCCESS: Integrated in tika-trunk-jdk1.7 #863 (See https://builds.apache.org/job/tika-trunk-jdk1.7/863/)
          TIKA-1744 tidying up via Yaniv Kunda (tallison: http://svn.apache.org/viewvc/tika/trunk/?view=rev&rev=1706249)

          • trunk/tika-core/src/main/java/org/apache/tika/io/TikaInputStream.java
          Show
          hudson Hudson added a comment - SUCCESS: Integrated in tika-trunk-jdk1.7 #863 (See https://builds.apache.org/job/tika-trunk-jdk1.7/863/ ) TIKA-1744 tidying up via Yaniv Kunda (tallison: http://svn.apache.org/viewvc/tika/trunk/?view=rev&rev=1706249 ) trunk/tika-core/src/main/java/org/apache/tika/io/TikaInputStream.java

            People

            • Assignee:
              tallison@mitre.org Tim Allison
              Reporter:
              kunda Yaniv Kunda
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development