[
https://issues.apache.org/jira/browse/TIKA-1744?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14904388#comment-14904388
]
Tim Allison edited comment on TIKA-1744 at 9/23/15 12:06 PM:
-------------------------------------------------------------
Thank you, [~kunda]!
This was part of the earlier discussion
[here|https://issues.apache.org/jira/browse/TIKA-1726?focusedCommentId=14725703&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14725703]
and maybe
[here|https://issues.apache.org/jira/browse/TIKA-1726?focusedCommentId=14901434&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14901434].
[~jukkaz] and [~kkrugler], 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
{noformat}
public static TikaInputStream get(File file, Metadata metadata)
throws FileNotFoundException {
{noformat}
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:
{noformat}
public static TikaInputStream get(File file, Metadata metadata)
throws FileNotFoundException {
return get(Paths.get(file.toURI()), metadata);
}
{noformat}
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?
was (Author: [email protected]):
Thank you, [~kunda]!
I think this was part of the earlier discussion...
In the current patch, we have
{noformat}
public static TikaInputStream get(File file, Metadata metadata)
throws FileNotFoundException {
{noformat}
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:
{noformat}
public static TikaInputStream get(File file, Metadata metadata)
throws FileNotFoundException {
return get(Paths.get(file.toURI()), metadata);
}
{noformat}
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?
> Use java.nio.file.Path in TikaInputStream
> -----------------------------------------
>
> Key: TIKA-1744
> URL: https://issues.apache.org/jira/browse/TIKA-1744
> Project: Tika
> Issue Type: Sub-task
> Components: core
> Reporter: Yaniv Kunda
> Priority: Minor
> Fix For: 1.11
>
> Attachments: TIKA-1744.patch
>
>
> 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
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)