From 61bd8bf911801998ce97f132ecd38d819b52d6c6 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Tue, 13 Mar 2018 15:12:00 +0000 Subject: [PATCH] [bug-62176] synchronize temp dir creation git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1826655 13f79535-47bb-0310-9956-ffa450edef68 --- gradle/wrapper/gradle-wrapper.jar | Bin 54212 -> 54212 bytes .../util/DefaultTempFileCreationStrategy.java | 5 +++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index feef4e75785b9342f1ed3be2f04e798330bfe58a..4da30c3072196683b064dab5aadd34ddc36f65b1 100644 GIT binary patch delta 24 fcmX@IocYLd<_)ojm~Kqi9Dhhu5J*ohyX*%5li>@b delta 24 fcmX@IocYLd<_)ojn5q&s#~%_E1k#hsF8cuhi75(* diff --git a/src/java/org/apache/poi/util/DefaultTempFileCreationStrategy.java b/src/java/org/apache/poi/util/DefaultTempFileCreationStrategy.java index 6f44752873..f14871daf8 100644 --- a/src/java/org/apache/poi/util/DefaultTempFileCreationStrategy.java +++ b/src/java/org/apache/poi/util/DefaultTempFileCreationStrategy.java @@ -85,11 +85,12 @@ public class DefaultTempFileCreationStrategy implements TempFileCreationStrategy /** * Attempt to create a directory, including any necessary parent directories. * Does nothing if directory already exists. + * The method is synchronized to ensure that multiple threads don't try to create the directory at the same time. * * @param directory the directory to create * @throws IOException if unable to create temporary directory or it is not a directory */ - private void createTempDirectory(File directory) throws IOException { + private synchronized void createTempDirectory(File directory) throws IOException { // create directory if it doesn't exist final boolean dirExists = (directory.exists() || directory.mkdirs()); @@ -138,4 +139,4 @@ public class DefaultTempFileCreationStrategy implements TempFileCreationStrategy // All done return newDirectory; } -} \ No newline at end of file +} -- 2.39.5