You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "Dawid Weiss (Jira)" <ji...@apache.org> on 2021/02/03 16:53:00 UTC
[jira] [Assigned] (LUCENE-9730) Clean up temporary folder
management in Dictionary
[ https://issues.apache.org/jira/browse/LUCENE-9730?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dawid Weiss reassigned LUCENE-9730:
-----------------------------------
Assignee: Dawid Weiss
> Clean up temporary folder management in Dictionary
> ---------------------------------------------------
>
> Key: LUCENE-9730
> URL: https://issues.apache.org/jira/browse/LUCENE-9730
> Project: Lucene - Core
> Issue Type: Sub-task
> Reporter: Dawid Weiss
> Assignee: Dawid Weiss
> Priority: Major
>
> Reomve setDefaultTempDir, make getDefaultTempDir always evaluate temp dir property (no lazy init as temp. dir can change over time).
> Ideally, just remove the need for temp folder altogether by scanning a given number of lead stream bytes from within a resettable stream.
> {code}
> private static Path DEFAULT_TEMP_DIR;
> /** Used by test framework */
> @SuppressWarnings("unused")
> public static void setDefaultTempDir(Path tempDir) {
> DEFAULT_TEMP_DIR = tempDir;
> }
> /**
> * Returns the default temporary directory. By default, java.io.tmpdir. If not accessible or not
> * available, an IOException is thrown
> */
> static synchronized Path getDefaultTempDir() throws IOException {
> if (DEFAULT_TEMP_DIR == null) {
> // Lazy init
> String tempDirPath = System.getProperty("java.io.tmpdir");
> if (tempDirPath == null) {
> throw new IOException("Java has no temporary folder property (java.io.tmpdir)?");
> }
> Path tempDirectory = Paths.get(tempDirPath);
> if (!Files.isWritable(tempDirectory)) {
> throw new IOException(
> "Java's temporary folder not present or writeable?: " + tempDirectory.toAbsolutePath());
> }
> DEFAULT_TEMP_DIR = tempDirectory;
> }
> return DEFAULT_TEMP_DIR;
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org