diagnostics for EA-40790 - NPE: FileUtil.ensureExists

This commit is contained in:
Dmitry Avdeev
2012-12-25 16:15:13 +04:00
parent 6997ab2471
commit 3b377020d3
2 changed files with 5 additions and 1 deletions
@@ -27,6 +27,7 @@ import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.command.CommandProcessor;
import com.intellij.openapi.components.StorageScheme;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectBundle;
@@ -103,6 +104,7 @@ public class NewProjectUtil {
try {
File projectDir = new File(projectFilePath).getParentFile();
LOG.assertTrue(projectDir != null, "Cannot create project in '" + projectFilePath + "': no parent file exists");
FileUtil.ensureExists(projectDir);
if (StorageScheme.DIRECTORY_BASED == dialog.getStorageScheme()) {
final File ideaDir = new File(projectFilePath, Project.DIRECTORY_STORE_FOLDER);
@@ -245,4 +247,6 @@ public class NewProjectUtil {
}
}
}
private final static Logger LOG = Logger.getInstance(NewProjectUtil.class);
}
@@ -573,7 +573,7 @@ public class FileUtil extends FileUtilRt {
}
}
public static void ensureExists(File dir) throws IOException {
public static void ensureExists(@NotNull File dir) throws IOException {
if (!dir.exists() && !dir.mkdirs()) {
throw new IOException(CommonBundle.message("exception.directory.can.not.create", dir.getPath()));
}