mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
EA-47394 (IVFAE diagnostic)
This commit is contained in:
+21
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,6 +20,25 @@ package com.intellij.openapi.vfs;
|
||||
*/
|
||||
public class InvalidVirtualFileAccessException extends RuntimeException {
|
||||
public InvalidVirtualFileAccessException(final VirtualFile file) {
|
||||
super("Accessing invalid virtual file: " + file.getUrl());
|
||||
super(composeMessage(file));
|
||||
}
|
||||
|
||||
private static String composeMessage(VirtualFile file) {
|
||||
String url = file.getUrl();
|
||||
String message = "Accessing invalid virtual file: " + url;
|
||||
|
||||
try {
|
||||
VirtualFile found = VirtualFileManager.getInstance().findFileByUrl(url);
|
||||
message += "; original:" + hashCode(file) + "; found:" + hashCode(found);
|
||||
}
|
||||
catch (Throwable t) {
|
||||
message += "; lookup failed: " + t.getMessage();
|
||||
}
|
||||
|
||||
return message;
|
||||
}
|
||||
|
||||
private static int hashCode(Object o) {
|
||||
return o != null ? o.hashCode() : 0;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user