Skip to content

Commit fff053c

Browse files
committed
Avoid ClassCastException when casting to EvaluationResult
Add a type check before casting the evaluation result to EvaluationResult in JavaObjectValueEditor to prevent a potential ClassCastException when other evaluation engines return different result types. Fixes : #910
1 parent e12e710 commit fff053c

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/JavaObjectValueEditor.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2004, 2019 IBM Corporation and others.
2+
* Copyright (c) 2004, 2026 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -167,12 +167,13 @@ private IValue evaluate(String stringValue, IVariable variable) throws DebugExce
167167
IEvaluationListener listener= new IEvaluationListener() {
168168
@Override
169169
public void evaluationComplete(IEvaluationResult result) {
170-
var convertedResult = convert((EvaluationResult) result, variable, thread);
171-
172-
synchronized (JavaObjectValueEditor.this) {
173-
results[0] = convertedResult;
174-
JavaObjectValueEditor.this.notifyAll();
175-
}
170+
if (result instanceof EvaluationResult evalResult) {
171+
var convertedResult = convert(evalResult, variable, thread);
172+
synchronized (JavaObjectValueEditor.this) {
173+
results[0] = convertedResult;
174+
JavaObjectValueEditor.this.notifyAll();
175+
}
176+
}
176177
}
177178
};
178179
synchronized(this) {

0 commit comments

Comments
 (0)