ava.lang.NullPointerException: element cannot be mapped to a null key
	at java.util.Objects.requireNonNull(Objects.java:228)
	at java.util.stream.Collectors.lambda$groupingBy$45(Collectors.java:907)
	at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
	at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374)
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
	at com.intellij.openapi.vcs.changes.ChangesUtil$4.compute(ChangesUtil.java:304)
	at com.intellij.openapi.vcs.changes.ChangesUtil$4.compute(ChangesUtil.java:300)
	at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:895)
	at com.intellij.openapi.vcs.changes.ChangesUtil.processItemsByVcs(ChangesUtil.java:299)
	at com.intellij.openapi.vcs.changes.ChangesUtil.processVirtualFilesByVcs(ChangesUtil.java:324)
	at com.intellij.openapi.vcs.changes.actions.EditAction.editFiles(EditAction.java:55)
	at com.intellij.openapi.vcs.changes.actions.EditAction.editFilesAndShowErrors(EditAction.java:48)
This commit is contained in:
Sergey Ignatov
2016-12-17 18:20:05 +03:00
parent 3f4e4989d0
commit d88724cc7b
@@ -201,13 +201,9 @@ public class ChangesUtil {
public static FilePath getLocalPath(@NotNull Project project, FilePath filePath) {
// check if the file has just been renamed (IDEADEV-15494)
Change change = ApplicationManager.getApplication().runReadAction(new Computable<Change>() {
@Override
@Nullable
public Change compute() {
if (project.isDisposed()) throw new ProcessCanceledException();
return ChangeListManager.getInstance(project).getChange(filePath);
}
Change change = ApplicationManager.getApplication().runReadAction((Computable<Change>)() -> {
if (project.isDisposed()) throw new ProcessCanceledException();
return ChangeListManager.getInstance(project).getChange(filePath);
});
if (change != null) {
ContentRevision beforeRevision = change.getBeforeRevision();
@@ -242,20 +238,17 @@ public class ChangesUtil {
@Nullable
private static VirtualFile getValidParentUnderReadAction(@NotNull FilePath filePath) {
return ApplicationManager.getApplication().runReadAction(new Computable<VirtualFile>() {
@Override
public VirtualFile compute() {
VirtualFile result = null;
FilePath parent = filePath;
LocalFileSystem lfs = LocalFileSystem.getInstance();
return ApplicationManager.getApplication().runReadAction((Computable<VirtualFile>)() -> {
VirtualFile result = null;
FilePath parent = filePath;
LocalFileSystem lfs = LocalFileSystem.getInstance();
while (result == null && parent != null) {
result = lfs.findFileByPath(parent.getPath());
parent = parent.getParentPath();
}
return result;
while (result == null && parent != null) {
result = lfs.findFileByPath(parent.getPath());
parent = parent.getParentPath();
}
return result;
});
}
@@ -297,13 +290,10 @@ public class ChangesUtil {
@NotNull VcsSeparator<T> separator,
@NotNull PerVcsProcessor<T> processor) {
Map<AbstractVcs, List<T>> changesByVcs = ApplicationManager.getApplication().runReadAction(
new NotNullComputable<Map<AbstractVcs, List<T>>>() {
@NotNull
@Override
public Map<AbstractVcs, List<T>> compute() {
return items.stream().collect(groupingBy(separator::getVcsFor));
}
});
(NotNullComputable<Map<AbstractVcs, List<T>>>)() ->
items.stream()
.filter(it -> separator.getVcsFor(it) != null)
.collect(groupingBy(separator::getVcsFor)));
changesByVcs.forEach((vcs, vcsItems) -> {
if (vcs != null) {