[bug-62176] synchronize temp dir creation
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1826655 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
fd39985247
commit
47fb3691f7
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
@ -85,11 +85,12 @@ public class DefaultTempFileCreationStrategy implements TempFileCreationStrategy
|
|||||||
/**
|
/**
|
||||||
* Attempt to create a directory, including any necessary parent directories.
|
* Attempt to create a directory, including any necessary parent directories.
|
||||||
* Does nothing if directory already exists.
|
* 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
|
* @param directory the directory to create
|
||||||
* @throws IOException if unable to create temporary directory or it is not a directory
|
* @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
|
// create directory if it doesn't exist
|
||||||
final boolean dirExists = (directory.exists() || directory.mkdirs());
|
final boolean dirExists = (directory.exists() || directory.mkdirs());
|
||||||
|
|
||||||
@ -138,4 +139,4 @@ public class DefaultTempFileCreationStrategy implements TempFileCreationStrategy
|
|||||||
// All done
|
// All done
|
||||||
return newDirectory;
|
return newDirectory;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user