mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-01 04:33:36 +02:00
Bug 379277: Address FindBugs issues for DSF
Change-Id: I9fb46d009b55830615881b75ae50e3640e047395 Reviewed-on: https://git.eclipse.org/r/5954 Reviewed-by: Pawel Piech <pawel.piech@windriver.com> IP-Clean: Pawel Piech <pawel.piech@windriver.com> Tested-by: Pawel Piech <pawel.piech@windriver.com> Reviewed-by: Marc Khouzam <marc.khouzam@ericsson.com> IP-Clean: Marc Khouzam <marc.khouzam@ericsson.com> Tested-by: Marc Khouzam <marc.khouzam@ericsson.com>
This commit is contained in:
parent
39c85abc38
commit
677449d867
10 changed files with 31 additions and 17 deletions
|
@ -54,13 +54,18 @@ public class EvaluationContextManager implements IWindowListener, IDebugContextL
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if ( fgManager == null ) {
|
if ( fgManager == null ) {
|
||||||
fgManager = new EvaluationContextManager();
|
// FindBugs reported that it is unsafe to set s_resources
|
||||||
|
// before we finish to initialize the object, because of
|
||||||
|
// multi-threading. This is why we use a temporary variable.
|
||||||
|
EvaluationContextManager manager = new EvaluationContextManager();
|
||||||
IWorkbench workbench = PlatformUI.getWorkbench();
|
IWorkbench workbench = PlatformUI.getWorkbench();
|
||||||
IWorkbenchWindow[] windows = workbench.getWorkbenchWindows();
|
IWorkbenchWindow[] windows = workbench.getWorkbenchWindows();
|
||||||
for( int i = 0; i < windows.length; i++ ) {
|
for( int i = 0; i < windows.length; i++ ) {
|
||||||
fgManager.windowOpened( windows[i] );
|
manager.windowOpened( windows[i] );
|
||||||
}
|
}
|
||||||
workbench.addWindowListener( fgManager );
|
workbench.addWindowListener( manager );
|
||||||
|
|
||||||
|
fgManager = manager;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -851,7 +851,7 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
|
||||||
if (positions != null) {
|
if (positions != null) {
|
||||||
positions.removeAll(toRemove);
|
positions.removeAll(toRemove);
|
||||||
}
|
}
|
||||||
if (category != CATEGORY_MODEL) {
|
if (!category.equals(CATEGORY_MODEL)) {
|
||||||
positions = (List<Position>) getDocumentManagedPositions().get(CATEGORY_MODEL);
|
positions = (List<Position>) getDocumentManagedPositions().get(CATEGORY_MODEL);
|
||||||
if (positions != null) {
|
if (positions != null) {
|
||||||
positions.removeAll(toRemove);
|
positions.removeAll(toRemove);
|
||||||
|
|
|
@ -117,7 +117,7 @@ public class REDRun implements CharSequence {
|
||||||
try {
|
try {
|
||||||
return asString();
|
return asString();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
return null;
|
return ""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -788,7 +788,7 @@ public class NumberFormatDetailPane implements IDetailPane2, IAdaptable, IProper
|
||||||
* elements being displayed in this view
|
* elements being displayed in this view
|
||||||
*/
|
*/
|
||||||
protected void setDebugModel(String id) {
|
protected void setDebugModel(String id) {
|
||||||
if (id != fDebugModelIdentifier) {
|
if (!id.equals(fDebugModelIdentifier)) {
|
||||||
fDebugModelIdentifier = id;
|
fDebugModelIdentifier = id;
|
||||||
configureDetailsViewer();
|
configureDetailsViewer();
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,8 +65,9 @@ public class VMHandlerUtils {
|
||||||
IPartService partService = (IPartService)serviceLocator.getService(IPartService.class);
|
IPartService partService = (IPartService)serviceLocator.getService(IPartService.class);
|
||||||
if (partService != null) {
|
if (partService != null) {
|
||||||
part = partService.getActivePart();
|
part = partService.getActivePart();
|
||||||
|
return getVMProviderForPart(part);
|
||||||
}
|
}
|
||||||
return getVMProviderForPart(part);
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -152,7 +152,7 @@ public abstract class AbstractBreakpointVMNode extends AbstractVMNode {
|
||||||
return IModelDelta.EXPAND | IModelDelta.SELECT;
|
return IModelDelta.EXPAND | IModelDelta.SELECT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (event instanceof DebugContextEvent && (((DebugContextEvent)event).getFlags() | DebugContextEvent.ACTIVATED) != 0) {
|
else if (event instanceof DebugContextEvent && (((DebugContextEvent)event).getFlags() & DebugContextEvent.ACTIVATED) != 0) {
|
||||||
int flags = IModelDelta.NO_CHANGE;
|
int flags = IModelDelta.NO_CHANGE;
|
||||||
if ( Boolean.TRUE.equals(getVMProvider().getPresentationContext().getProperty(IBreakpointUIConstants.PROP_BREAKPOINTS_FILTER_SELECTION)) ) {
|
if ( Boolean.TRUE.equals(getVMProvider().getPresentationContext().getProperty(IBreakpointUIConstants.PROP_BREAKPOINTS_FILTER_SELECTION)) ) {
|
||||||
flags |= IModelDelta.CONTENT;
|
flags |= IModelDelta.CONTENT;
|
||||||
|
@ -203,7 +203,7 @@ public abstract class AbstractBreakpointVMNode extends AbstractVMNode {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (event instanceof DebugContextEvent && (((DebugContextEvent)event).getFlags() | DebugContextEvent.ACTIVATED) != 0) {
|
else if (event instanceof DebugContextEvent && (((DebugContextEvent)event).getFlags() & DebugContextEvent.ACTIVATED) != 0) {
|
||||||
if ( Boolean.TRUE.equals(getVMProvider().getPresentationContext().getProperty(IBreakpointUIConstants.PROP_BREAKPOINTS_FILTER_SELECTION)) ) {
|
if ( Boolean.TRUE.equals(getVMProvider().getPresentationContext().getProperty(IBreakpointUIConstants.PROP_BREAKPOINTS_FILTER_SELECTION)) ) {
|
||||||
parent.setFlags(parent.getFlags() | IModelDelta.CONTENT);
|
parent.setFlags(parent.getFlags() | IModelDelta.CONTENT);
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,7 +114,7 @@ abstract class DataCache<V> {
|
||||||
if (!isCanceled()) {
|
if (!isCanceled()) {
|
||||||
fValid = true;
|
fValid = true;
|
||||||
fRm = null;
|
fRm = null;
|
||||||
set(getData(), getStatus());
|
set(super.getData(), super.getStatus());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -729,9 +729,10 @@ public class SyncRegisterDataAccess {
|
||||||
IRegisterGroupDMContext.class);
|
IRegisterGroupDMContext.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dmc != null) {
|
||||||
DsfSession session = DsfSession.getSession(dmc.getSessionId());
|
DsfSession session = DsfSession.getSession(dmc.getSessionId());
|
||||||
|
|
||||||
if (dmc != null && session != null) {
|
if (session != null) {
|
||||||
GetRegisterGroupDataQuery query = new GetRegisterGroupDataQuery(dmc);
|
GetRegisterGroupDataQuery query = new GetRegisterGroupDataQuery(dmc);
|
||||||
session.getExecutor().execute(query);
|
session.getExecutor().execute(query);
|
||||||
|
|
||||||
|
@ -741,6 +742,7 @@ public class SyncRegisterDataAccess {
|
||||||
} catch (ExecutionException e) {
|
} catch (ExecutionException e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -762,9 +764,11 @@ public class SyncRegisterDataAccess {
|
||||||
if (element instanceof IDMVMContext) {
|
if (element instanceof IDMVMContext) {
|
||||||
dmc = DMContexts.getAncestorOfType( ((IDMVMContext) element).getDMContext(), IRegisterDMContext.class );
|
dmc = DMContexts.getAncestorOfType( ((IDMVMContext) element).getDMContext(), IRegisterDMContext.class );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dmc != null) {
|
||||||
DsfSession session = DsfSession.getSession(dmc.getSessionId());
|
DsfSession session = DsfSession.getSession(dmc.getSessionId());
|
||||||
|
|
||||||
if (dmc != null && session != null) {
|
if (session != null) {
|
||||||
GetRegisterDataQuery query = new GetRegisterDataQuery(dmc);
|
GetRegisterDataQuery query = new GetRegisterDataQuery(dmc);
|
||||||
session.getExecutor().execute(query);
|
session.getExecutor().execute(query);
|
||||||
|
|
||||||
|
@ -774,6 +778,7 @@ public class SyncRegisterDataAccess {
|
||||||
} catch (ExecutionException e) {
|
} catch (ExecutionException e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -794,9 +799,11 @@ public class SyncRegisterDataAccess {
|
||||||
if (element instanceof IDMVMContext) {
|
if (element instanceof IDMVMContext) {
|
||||||
dmc = DMContexts.getAncestorOfType( ((IDMVMContext) element).getDMContext(), IBitFieldDMContext.class );
|
dmc = DMContexts.getAncestorOfType( ((IDMVMContext) element).getDMContext(), IBitFieldDMContext.class );
|
||||||
}
|
}
|
||||||
DsfSession session = DsfSession.getSession(dmc.getSessionId());
|
|
||||||
|
|
||||||
if (dmc != null && session != null) {
|
if (dmc != null) {
|
||||||
|
DsfSession session = DsfSession.getSession(dmc.getSessionId());
|
||||||
|
|
||||||
|
if (session != null) {
|
||||||
GetBitFieldQuery query = new GetBitFieldQuery(dmc);
|
GetBitFieldQuery query = new GetBitFieldQuery(dmc);
|
||||||
session.getExecutor().execute(query);
|
session.getExecutor().execute(query);
|
||||||
|
|
||||||
|
@ -806,6 +813,7 @@ public class SyncRegisterDataAccess {
|
||||||
} catch (ExecutionException e) {
|
} catch (ExecutionException e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -169,7 +169,7 @@ abstract public class AbstractDMVMNode extends AbstractVMNode implements IVMNode
|
||||||
if (element instanceof IDMVMContext) {
|
if (element instanceof IDMVMContext) {
|
||||||
// If update element is a DMC, check if session is still alive.
|
// If update element is a DMC, check if session is still alive.
|
||||||
IDMContext dmc = ((IDMVMContext)element).getDMContext();
|
IDMContext dmc = ((IDMVMContext)element).getDMContext();
|
||||||
if (dmc.getSessionId() != getSession().getId() || !DsfSession.isSessionActive(dmc.getSessionId())) {
|
if (!dmc.getSessionId().equals(getSession().getId()) || !DsfSession.isSessionActive(dmc.getSessionId())) {
|
||||||
handleFailedUpdate(update);
|
handleFailedUpdate(update);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -473,9 +473,9 @@ public class DsfSession
|
||||||
if (o1.fListener == o2.fListener) {
|
if (o1.fListener == o2.fListener) {
|
||||||
return 0;
|
return 0;
|
||||||
} if (o1.fListener instanceof IDsfService && !(o2.fListener instanceof IDsfService)) {
|
} if (o1.fListener instanceof IDsfService && !(o2.fListener instanceof IDsfService)) {
|
||||||
return Integer.MIN_VALUE;
|
return -1;
|
||||||
} else if (o2.fListener instanceof IDsfService && !(o1.fListener instanceof IDsfService)) {
|
} else if (o2.fListener instanceof IDsfService && !(o1.fListener instanceof IDsfService)) {
|
||||||
return Integer.MAX_VALUE;
|
return 1;
|
||||||
} else if ( (o1.fListener instanceof IDsfService) && (o2.fListener instanceof IDsfService) ) {
|
} else if ( (o1.fListener instanceof IDsfService) && (o2.fListener instanceof IDsfService) ) {
|
||||||
return ((IDsfService)o1.fListener).getStartupNumber() - ((IDsfService)o2.fListener).getStartupNumber();
|
return ((IDsfService)o1.fListener).getStartupNumber() - ((IDsfService)o2.fListener).getStartupNumber();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue