Uploaded image for project: 'Felix'
  1. Felix
  2. FELIX-6167

org.apache.commons.io.FileExistsException when installing bundle from web console

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • webconsole-4.3.12
    • None
    • Web Console
    • None

    Description

      I get an org.apache.commons.io.FileExistsException when installing bundle from web console.

      it only happens when there is v1.4 of commons-fileupload bundle present, works with v.1.3.3

      DiskFileItem in v1.4 has code updated for write method which BundleServlet uses for writing temp file.

      FileUtils.moveFile(outputFile, file) call is failing here because it does an exists check on temp file created by BundleServlet.

      // Code snippet from v1.4 DiskFileItem.write

      File outputFile = getStoreLocation();
      if (outputFile != null) {
          // Save the length of the file
          size = outputFile.length();
          /*
           * The uploaded file is being stored on disk
           * in a temporary location so move it to the
           * desired file.
           */
          FileUtils.moveFile(outputFile, file);
      }

      v1.3.3

      File outputFile = getStoreLocation();
      if (outputFile != null) {
          // Save the length of the file
          size = outputFile.length();
          /*
           * The uploaded file is being stored on disk
           * in a temporary location so move it to the
           * desired file.
           */
          if (!outputFile.renameTo(file)) {
              BufferedInputStream in = null;
              BufferedOutputStream out = null;
              try {
                  in = new BufferedInputStream(
                      new FileInputStream(outputFile));
                  out = new BufferedOutputStream(
                          new FileOutputStream(file));
                  IOUtils.copy(in, out);
              }

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              rakeshk15 Rakesh Kumar
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: