[jira] [Commented] (TIKA-3141) LINUX - Tika shouldn't throw an exception for an empty TIKA_CONFIG environment variable value

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[jira] [Commented] (TIKA-3141) LINUX - Tika shouldn't throw an exception for an empty TIKA_CONFIG environment variable value

Hudson (Jira)

    [ https://issues.apache.org/jira/browse/TIKA-3141?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17167998#comment-17167998 ]

Keith Bennett commented on TIKA-3141:

I agree that this should be handled, if it's not a prohibitively large effort to implement. IMO the correct behavior would be to use the default location.

In addition to the use of:
export TIKA_CONFIG=""{noformat}
 mentioned, this would enable a temporary use of the default config using the environment variable _without_ `export`:

TIKA_CONFIG="" [tika command] 
As I understand it, using unset would require re-setting the value after the single command. This would be unwieldy since it would be necessary to save the original value of the variable before the `unset`ting in order to restore it after the unset. And, in any case, as previously mentioned, the expected behavior of setting the variable to the empty string is to disable the override.


> LINUX - Tika shouldn't throw an exception for an empty TIKA_CONFIG environment variable value
> ---------------------------------------------------------------------------------------------
>                 Key: TIKA-3141
>                 URL: https://issues.apache.org/jira/browse/TIKA-3141
>             Project: Tika
>          Issue Type: Bug
>          Components: config
>    Affects Versions: 1.20
>         Environment: Any Linux distro.  I'm running the bash shell.  Not sure about other platforms.
>            Reporter: Josh Burchard
>            Priority: Trivial
>   Original Estimate: 24h
>  Remaining Estimate: 24h
> On my Linux box I configure Tika using the TIKA_CONFIG environment variable to point the Tika server at my config.xml file.   Sometimes, however, I want to clear this variable to use the default config and I noticed that Tika will throw an exception and abort if I do the following:
> export TIKA_CONFIG=''
> Seems like a case that should be handled just by ignoring the empty value (i.e., there's no config to be used so go with the default)  or at the most, log a warning that the variable was detected but it's value is empty, but still carry on using the default config.
> {{Exception in thread "main" java.lang.RuntimeException: Unable to access default configuration}}
>  \{{ at org.apache.tika.config.TikaConfig.getDefaultConfig(TikaConfig.java:410)}}
>  \{{ at org.apache.tika.Tika.<init>(Tika.java:116)}}
>  \{{ at org.apache.tika.server.TikaServerCli.main(TikaServerCli.java:125)}}
>  {{*Caused by: org.apache.tika.exception.TikaException: Specified Tika configuration not found:*}}
>  \{{ at org.apache.tika.config.TikaConfig.getConfigInputStream(TikaConfig.java:317)}}
>  \{{ at org.apache.tika.config.TikaConfig.<init>(TikaConfig.java:254)}}
>  \{{ at org.apache.tika.config.TikaConfig.getDefaultConfig(TikaConfig.java:405)}}

This message was sent by Atlassian Jira