Uploaded image for project: 'JBoss VFS'
  1. JBoss VFS
  2. JBVFS-185

Switch to 'mkdirs'

    XMLWordPrintable

Details

    • Feature Request
    • Resolution: Done
    • Major
    • 3.2.0.Beta2
    • None
    • None
    • None
    • 0
    • 0% 0%

    Description

      TempFileProvider has:

          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);
              }
          }
      

      This does its job fine when VM starts, but if something removes the directory, ie. as part of cleanup, provider stops, since createTempDir:

          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));
          }
      

      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()

      Attachments

        Issue Links

          Activity

            People

              rhn-cservice-bbaranow Bartosz Baranowski
              rhn-cservice-bbaranow Bartosz Baranowski
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: