Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pivotal ID # 186496317: Too Many Open Files #774

Merged
merged 1 commit into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import ebi.ac.uk.io.ext.isEmpty
import ebi.ac.uk.io.ext.notExist
import ebi.ac.uk.io.ext.size
import org.apache.commons.codec.digest.DigestUtils
import org.springframework.core.io.InputStreamSource
import java.io.File
import java.io.InputStream
import java.nio.file.FileAlreadyExistsException
Expand Down Expand Up @@ -44,10 +45,12 @@ object FileUtils {
}

fun copyOrReplaceFile(
source: InputStream,
source: InputStreamSource,
target: File,
permissions: Permissions,
) = FileUtilsHelper.copyFile(source, target.toPath(), permissions)
) {
source.inputStream.use { FileUtilsHelper.copyFile(it, target.toPath(), permissions) }
}

fun getOrCreateFolder(
folder: Path,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ internal fun transferTo(basePath: Path, file: MultipartFile) {
val expectedFilePath = basePath.resolve(file.originalFilename!!)
FileUtils.createParentFolders(expectedFilePath, RWXRWX___)
FileUtils.copyOrReplaceFile(
source = file.inputStream,
source = file,
target = expectedFilePath.toFile(),
permissions = Permissions(RW_RW____, RWXRWX___)
)
Expand Down