Uploaded image for project: 'Undertow'
  1. Undertow
  2. UNDERTOW-1468

MultipartFile.transferTo throws FileAlreadyExistsException

XMLWordPrintable

      tmpFile = Files.createTempFile("foo.", ".upload").toFile()
      file.transferTo(tmpFile)
      

      io.undertow.server.handlers.form.FormData, from line 255

              public void write(Path target) throws IOException {
                  if (file != null) {
                      try {
                          Files.move(file, target);
                      } catch (IOException e) {
                          Files.copy(getInputStream(), target);
                      }
                  } else {
                      Files.copy(getInputStream(), target);
                  }
              }
      

      Both Files.move & Files.copy throw FileAlreadyExistsException if the target file exists but cannot be replaced because the REPLACE_EXISTING option is not specified.

              rhn-cservice-bbaranow Bartosz Baranowski
              saga_xu 许怀远 许怀远 (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: