use of com.sun.jdi.AbsentInformationException in project che by eclipse.
the class Evaluator method getLocalVariable.
public ExpressionValue getLocalVariable(String text) {
ExpressionValue value = null;
try {
StackFrame frame = thread.frame(0);
LocalVariable var = frame.visibleVariableByName(text);
if (var != null) {
value = new LocalValue(thread, var);
}
} catch (IncompatibleThreadStateException | AbsentInformationException | InvalidStackFrameException | NativeMethodException e) {
throw new ExpressionException(e.getMessage(), e);
}
LOG.debug("GET local variable {} {} ", text, value);
return value;
}
use of com.sun.jdi.AbsentInformationException in project enclojure by EricThorsen.
the class CljSourcePath method annotate.
public Object annotate(CallStackFrame csf, String stratumn) {
int lineNumber = csf.getLineNumber(stratumn);
if (lineNumber < 1) {
return null;
}
Operation operation = csf.getCurrentOperation(stratumn);
try {
if (operation != null) {
int startOffset;
int endOffset;
if (operation.getMethodName() != null) {
startOffset = operation.getMethodStartPosition().getOffset();
endOffset = operation.getMethodEndPosition().getOffset();
} else {
startOffset = operation.getStartPosition().getOffset();
endOffset = operation.getEndPosition().getOffset();
}
return EditorContextBridge.getContext().annotate(getURL(convertSlash(csf.getSourcePath(stratumn)), true), startOffset, endOffset, EditorContext.CALL_STACK_FRAME_ANNOTATION_TYPE, debugger);
} else {
return EditorContextBridge.getContext().annotate(getURL(convertSlash(csf.getSourcePath(stratumn)), true), lineNumber, EditorContext.CALL_STACK_FRAME_ANNOTATION_TYPE, debugger);
}
} catch (AbsentInformationException e) {
return EditorContextBridge.getContext().annotate(getURL(convertClassNameToRelativePath(csf.getClassName()), true), lineNumber, EditorContext.CALL_STACK_FRAME_ANNOTATION_TYPE, debugger);
}
}
use of com.sun.jdi.AbsentInformationException in project enclojure by EricThorsen.
the class CljSourcePath method annotate.
public Object annotate(JPDAThread t, String stratumn) {
int lineNumber = t.getLineNumber(stratumn);
if (lineNumber < 1) {
return null;
//AST ast = t.getAST(stratumn);
}
Operation operation = t.getCurrentOperation();
String url;
try {
url = getURL(convertSlash(t.getSourcePath(stratumn)), true);
} catch (AbsentInformationException e) {
url = getURL(convertClassNameToRelativePath(t.getClassName()), true);
}
List operationsAnn = annotateOperations(debugger, url, operation, t.getLastOperations(), lineNumber);
if (operation == null) {
if (operationsAnn.size() == 0) {
return EditorContextBridge.getContext().annotate(url, lineNumber, EditorContext.CURRENT_LINE_ANNOTATION_TYPE, debugger);
} else {
/*
operationsAnn.add(EditorContextBridge.annotate (
url,
lineNumber,
EditorContext.CURRENT_LINE_ANNOTATION_TYPE,
debugger
));
*/
}
}
return operationsAnn;
}
use of com.sun.jdi.AbsentInformationException in project intellij-community by JetBrains.
the class PositionManagerImpl method getPsiFileByLocation.
@Nullable
protected PsiFile getPsiFileByLocation(final Project project, final Location location) {
if (location == null) {
return null;
}
final ReferenceType refType = location.declaringType();
if (refType == null) {
return null;
}
// We should find a class no matter what
// setAlternativeResolveEnabled is turned on here
//if (DumbService.getInstance(project).isDumb()) {
// return null;
//}
final String originalQName = refType.name();
Ref<PsiFile> altSource = new Ref<>();
PsiClass psiClass = findPsiClassByName(originalQName, c -> altSource.set(findAlternativeJreSourceFile(c)));
if (!altSource.isNull()) {
return altSource.get();
}
if (psiClass != null) {
PsiElement element = psiClass.getNavigationElement();
// see IDEA-137167, prefer not compiled elements
if (element instanceof PsiCompiledElement) {
PsiElement fileElement = psiClass.getContainingFile().getNavigationElement();
if (!(fileElement instanceof PsiCompiledElement)) {
element = fileElement;
}
}
return element.getContainingFile();
} else {
// try to search by filename
try {
PsiFile[] files = FilenameIndex.getFilesByName(project, refType.sourceName(), GlobalSearchScope.allScope(project));
for (PsiFile file : files) {
if (file instanceof PsiJavaFile) {
for (PsiClass cls : ((PsiJavaFile) file).getClasses()) {
if (StringUtil.equals(originalQName, cls.getQualifiedName())) {
return file;
}
}
}
}
} catch (AbsentInformationException ignore) {
}
}
return null;
}
use of com.sun.jdi.AbsentInformationException in project intellij-community by JetBrains.
the class ExceptionBreakpoint method getEventMessage.
public String getEventMessage(LocatableEvent event) {
String exceptionName = (getQualifiedName() != null) ? getQualifiedName() : CommonClassNames.JAVA_LANG_THROWABLE;
String threadName = null;
if (event instanceof ExceptionEvent) {
ExceptionEvent exceptionEvent = (ExceptionEvent) event;
try {
exceptionName = exceptionEvent.exception().type().name();
threadName = exceptionEvent.thread().name();
} catch (Exception ignore) {
}
}
final Location location = event.location();
final String locationQName = DebuggerUtilsEx.getLocationMethodQName(location);
String locationFileName;
try {
locationFileName = location.sourceName();
} catch (AbsentInformationException e) {
locationFileName = "";
}
final int locationLine = Math.max(0, location.lineNumber());
if (threadName != null) {
return DebuggerBundle.message("exception.breakpoint.console.message.with.thread.info", exceptionName, threadName, locationQName, locationFileName, locationLine);
} else {
return DebuggerBundle.message("exception.breakpoint.console.message", exceptionName, locationQName, locationFileName, locationLine);
}
}
Aggregations