mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
diff: EA-73535 - assert: FileManagerImpl.findFile
call isValid() with ReadLock
This commit is contained in:
@@ -76,29 +76,30 @@ public class TwosideBinaryDiffViewer extends TwosideDiffViewer<BinaryEditorHolde
|
||||
|
||||
final VirtualFile file1 = ((FileContent)contents.get(0)).getFile();
|
||||
final VirtualFile file2 = ((FileContent)contents.get(1)).getFile();
|
||||
if (!file1.isValid() || !file2.isValid()) {
|
||||
return applyNotification(DiffNotifications.createError());
|
||||
}
|
||||
|
||||
final boolean equal = ApplicationManager.getApplication().runReadAction(new Computable<Boolean>() {
|
||||
final JComponent notification = ApplicationManager.getApplication().runReadAction(new Computable<JComponent>() {
|
||||
@Override
|
||||
public Boolean compute() {
|
||||
public JComponent compute() {
|
||||
if (!file1.isValid() || !file2.isValid()) {
|
||||
return DiffNotifications.createError();
|
||||
}
|
||||
|
||||
try {
|
||||
// we can't use getInputStream() here because we can't restore BOM marker
|
||||
// (getBom() can return null for binary files, while getInputStream() strips BOM for all files).
|
||||
// It can be made for files from VFS that implements FileSystemInterface though.
|
||||
byte[] bytes1 = file1.contentsToByteArray();
|
||||
byte[] bytes2 = file2.contentsToByteArray();
|
||||
return Arrays.equals(bytes1, bytes2);
|
||||
return Arrays.equals(bytes1, bytes2) ? DiffNotifications.createEqualContents() : null;
|
||||
}
|
||||
catch (IOException e) {
|
||||
LOG.warn(e);
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return applyNotification(equal ? DiffNotifications.createEqualContents(): null);
|
||||
return applyNotification(notification);
|
||||
}
|
||||
catch (ProcessCanceledException e) {
|
||||
throw e;
|
||||
|
||||
Reference in New Issue
Block a user