Skip to content

Commit 29bc65f

Browse files
committed
Breakpoint.ensureMarker() not MT safe and should provide more info
- made Breakpoint.fMarker volatile so Breakpoint.ensureMarker() always see the last state - changed error message to indicate what was the real problem - not set or not existing marker. Fixes #1717
1 parent fbae6a1 commit 29bc65f

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

debug/org.eclipse.debug.core/META-INF/MANIFEST.MF

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
22
Bundle-ManifestVersion: 2
33
Bundle-Name: %pluginName
44
Bundle-SymbolicName: org.eclipse.debug.core; singleton:=true
5-
Bundle-Version: 3.22.0.qualifier
5+
Bundle-Version: 3.22.100.qualifier
66
Bundle-Activator: org.eclipse.debug.core.DebugPlugin
77
Bundle-Vendor: %providerName
88
Bundle-Localization: plugin

debug/org.eclipse.debug.core/core/org/eclipse/debug/core/model/Breakpoint.java

+10-5
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import org.eclipse.debug.core.IBreakpointManager;
3333
import org.eclipse.debug.internal.core.BreakpointManager;
3434
import org.eclipse.debug.internal.core.DebugCoreMessages;
35+
import org.eclipse.osgi.util.NLS;
3536

3637
/**
3738
* Abstract implementation of a breakpoint. This class is
@@ -58,15 +59,14 @@ public Breakpoint() {
5859
/**
5960
* Underlying marker.
6061
*/
61-
private IMarker fMarker= null;
62+
private volatile IMarker fMarker;
6263

6364
/**
6465
* @see IBreakpoint#setMarker(IMarker)
6566
*/
6667
@Override
6768
public void setMarker(IMarker marker) throws CoreException {
6869
fMarker= marker;
69-
7070
}
7171

7272
/**
@@ -292,10 +292,15 @@ protected void setAttributes(final Map<String, ? extends Object> attributes) thr
292292
* this breakpoint or the associated marker does not exist
293293
*/
294294
protected IMarker ensureMarker() throws DebugException {
295+
String message = null;
295296
IMarker m = getMarker();
296-
if (m == null || !m.exists()) {
297-
throw new DebugException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugException.REQUEST_FAILED,
298-
DebugCoreMessages.Breakpoint_no_associated_marker, null));
297+
if (m == null) {
298+
message = DebugCoreMessages.Breakpoint_no_associated_marker;
299+
} else if (!m.exists()) {
300+
message = NLS.bind(DebugCoreMessages.Breakpoint_marker_does_not_exist, m.toString());
301+
}
302+
if (message != null) {
303+
throw new DebugException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugException.REQUEST_FAILED, message, null));
299304
}
300305
return m;
301306
}

debug/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreMessages.java

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public class DebugCoreMessages extends NLS {
2121
private static final String BUNDLE_NAME = "org.eclipse.debug.internal.core.DebugCoreMessages";//$NON-NLS-1$
2222

2323
public static String Breakpoint_no_associated_marker;
24+
public static String Breakpoint_marker_does_not_exist;
2425
public static String BreakpointManager_Missing_breakpoint_definition;
2526
public static String BreakpointManager_Missing_model_identifier;
2627
public static String DebugEvent_illegal_detail;

debug/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreMessages.properties

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
###############################################################################
1616

1717
Breakpoint_no_associated_marker=Breakpoint does not have an associated marker.
18+
Breakpoint_marker_does_not_exist=Breakpoint marker does not exist: {0}
1819
BreakpointManager_Missing_breakpoint_definition=Missing breakpoint definition for marker type {0}
1920
BreakpointManager_Missing_model_identifier=Breakpoint missing debug model identifier
2021
DebugEvent_illegal_detail=detail is not one of the allowed constants, see IDebugEventConstants

0 commit comments

Comments
 (0)