[jboss-jira] [JBoss JIRA] (JBVFS-185) Switch to 'mkdirs'

Tomaz Cerar (JIRA) jira-events at lists.jboss.org
Mon Sep 2 05:37:04 EDT 2013


     [ https://issues.jboss.org/browse/JBVFS-185?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tomaz Cerar resolved JBVFS-185.
-------------------------------

    Fix Version/s: 3.2.0.Beta2
       Resolution: Done

    
> Switch to 'mkdirs' 
> -------------------
>
>                 Key: JBVFS-185
>                 URL: https://issues.jboss.org/browse/JBVFS-185
>             Project: JBoss VFS
>          Issue Type: Feature Request
>      Security Level: Public(Everyone can see) 
>            Reporter: Bartosz Baranowski
>            Assignee: Bartosz Baranowski
>             Fix For: 3.2.0.Beta2
>
>
> TempFileProvider has:
> {code}
>     static {
>         String configTmpDir = System.getProperty(JBOSS_TMP_DIR_PROPERTY);
>         if (configTmpDir == null)
>             configTmpDir = System.getProperty(JVM_TMP_DIR_PROPERTY);
>         try {
>             TMP_ROOT = new File(configTmpDir, "vfs");
>             TMP_ROOT.mkdirs();
>         }
>         catch (Exception e) {
>             throw new RuntimeException("Can't set up temp file provider", e);
>         }
>     }
> {code}
> This does its job fine when VM starts, but if something removes the directory, ie. as part of cleanup, provider stops, since createTempDir:
> {code}
>     private static File createTempDir(String prefix, String suffix, File root) throws IOException {
>         for (int i = 0; i < RETRIES; i++) {
>             final File f = new File(root, createTempName(prefix, suffix));
>             if (f.mkdir())
>                 return f;
>         }
>         throw new IOException(
>                 String.format("Could not create directory for root '%s' (prefix '%s', suffix '%s') after %d attempts",
>                         root,
>                         prefix,
>                         suffix,
>                         RETRIES));
>     }
> {code}
> So either the static init is removed and performed for each provider( in constructor or better, in some kind of init() meethod ) or createTempDir calls File.mkdirs()

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jboss-jira mailing list