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

ASF subversion and git services commented on LUCENE-9730:
---------------------------------------------------------

Commit 894d0bbb59392c4e04f3bc6646a5b098e3944985 in lucene-solr's branch 
refs/heads/master from Dawid Weiss
[ https://gitbox.apache.org/repos/asf?p=lucene-solr.git;h=894d0bb ]

LUCENE-9730: cleaned up temp. folder management in hunspell.


> 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-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to