Просмотр исходного кода

fix mkdirs bug in data-service war

Jason Rivard 4 лет назад
Родитель
Сommit
a12c2ab121
1 измененных файлов с 9 добавлено и 0 удалено
  1. 9 0
      data-service/src/main/java/password/pwm/receiver/Storage.java

+ 9 - 0
data-service/src/main/java/password/pwm/receiver/Storage.java

@@ -216,6 +216,15 @@ public class Storage
 
 
     static void mkdirs( final File file ) throws IOException
     static void mkdirs( final File file ) throws IOException
     {
     {
+        if ( file.exists() )
+        {
+            if ( file.isDirectory() )
+            {
+                return;
+            }
+            throw new IOException( "path already exists as file: " + file.getAbsolutePath() );
+        }
+
         if ( !file.mkdirs() )
         if ( !file.mkdirs() )
         {
         {
             throw new IOException( "unable to create path " + file.getAbsolutePath() );
             throw new IOException( "unable to create path " + file.getAbsolutePath() );