mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Maven: invalid vfs access exception handled in wizard (IDEA-61527) + NPE from getList() in wizard fixed
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.jetbrains.idea.maven.utils;
|
||||
|
||||
import com.intellij.openapi.vfs.InvalidVirtualFileAccessException;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jetbrains.idea.maven.model.MavenConstants;
|
||||
|
||||
@@ -27,18 +28,25 @@ public class FileFinder {
|
||||
List<VirtualFile> result) throws MavenProcessCanceledException {
|
||||
for (VirtualFile f : roots) {
|
||||
indicator.checkCanceled();
|
||||
indicator.setText2(f.getPath());
|
||||
|
||||
if (f.isDirectory()) {
|
||||
if (lookForNested) {
|
||||
f.refresh(false, false);
|
||||
findPomFiles(f.getChildren(), lookForNested, indicator, result);
|
||||
try {
|
||||
indicator.setText2(f.getPath());
|
||||
|
||||
if (f.isDirectory()) {
|
||||
if (lookForNested) {
|
||||
f.refresh(false, false);
|
||||
findPomFiles(f.getChildren(), lookForNested, indicator, result);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (f.getName().equalsIgnoreCase(MavenConstants.POM_XML)) {
|
||||
result.add(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (f.getName().equalsIgnoreCase(MavenConstants.POM_XML)) {
|
||||
result.add(f);
|
||||
}
|
||||
catch (InvalidVirtualFileAccessException e) {
|
||||
// we are accessing VFS without read action here so such exception may occasionally occur
|
||||
MavenLog.LOG.info(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -159,7 +159,7 @@ public class MavenUtil {
|
||||
|
||||
public static boolean isNoBackgroundMode() {
|
||||
return (ApplicationManager.getApplication().isUnitTestMode()
|
||||
|| ApplicationManager.getApplication().isHeadlessEnvironment());
|
||||
|| ApplicationManager.getApplication().isHeadlessEnvironment());
|
||||
}
|
||||
|
||||
public static boolean isInModalContext() {
|
||||
@@ -354,6 +354,8 @@ public class MavenUtil {
|
||||
|
||||
public static void run(Project project, String title, final MavenTask task) throws MavenProcessCanceledException {
|
||||
final Exception[] canceledEx = new Exception[1];
|
||||
final RuntimeException[] runtimeEx = new RuntimeException[1];
|
||||
final Error[] errorEx = new Error[1];
|
||||
|
||||
ProgressManager.getInstance().run(new Task.Modal(project, title, true) {
|
||||
public void run(@NotNull ProgressIndicator i) {
|
||||
@@ -366,10 +368,19 @@ public class MavenUtil {
|
||||
catch (ProcessCanceledException e) {
|
||||
canceledEx[0] = e;
|
||||
}
|
||||
catch (RuntimeException e) {
|
||||
runtimeEx[0] = e;
|
||||
}
|
||||
catch (Error e) {
|
||||
errorEx[0] = e;
|
||||
}
|
||||
}
|
||||
});
|
||||
if (canceledEx[0] instanceof MavenProcessCanceledException) throw (MavenProcessCanceledException)canceledEx[0];
|
||||
if (canceledEx[0] instanceof ProcessCanceledException) throw new MavenProcessCanceledException();
|
||||
|
||||
if (runtimeEx[0] != null) throw runtimeEx[0];
|
||||
if (errorEx[0] != null) throw errorEx[0];
|
||||
}
|
||||
|
||||
public static MavenTaskHandler runInBackground(final Project project,
|
||||
|
||||
@@ -200,15 +200,6 @@ public class MavenProjectBuilder extends ProjectImportBuilder<MavenProject> {
|
||||
}
|
||||
|
||||
public List<MavenProject> getList() {
|
||||
// npe trap: EA-13593
|
||||
MavenLog.LOG.assertTrue(myParamaters != null, "parameters field is null");
|
||||
if (myParamaters.myMavenProjectTree == null) {
|
||||
MavenLog.LOG.assertTrue(false, "tree is null:" +
|
||||
"\n\troot:" + myParamaters.myImportRoot +
|
||||
"\n\nprofiles:" + myParamaters.myProfiles +
|
||||
"\n\tproject:" + myParamaters.myProjectToUpdate);
|
||||
}
|
||||
|
||||
return getParameters().myMavenProjectTree.getRootProjects();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user