]> source.dussan.org Git - poi.git/commitdiff
[bug-62176] synchronize temp dir creation
authorPJ Fanning <fanningpj@apache.org>
Tue, 13 Mar 2018 15:12:00 +0000 (15:12 +0000)
committerPJ Fanning <fanningpj@apache.org>
Tue, 13 Mar 2018 15:12:00 +0000 (15:12 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1826655 13f79535-47bb-0310-9956-ffa450edef68

gradle/wrapper/gradle-wrapper.jar
src/java/org/apache/poi/util/DefaultTempFileCreationStrategy.java

index feef4e75785b9342f1ed3be2f04e798330bfe58a..4da30c3072196683b064dab5aadd34ddc36f65b1 100644 (file)
Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ
index 6f44752873f0c975d2e1917cc9ab516e2e0ff2d4..f14871daf82aea47a3730426b21b5ba2a7c3b10e 100644 (file)
@@ -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
+}