Source:
<code>private synchronized int findNumFrames() { int frameNum = 0; if (DsfSession.getSession(fSessionId) == null) { return 0; } final DsfExecutor executor = DsfSession.getSession(fSessionId) .getExecutor(); final DsfServicesTracker tracker = new DsfServicesTracker( GdbTraceCorePlugin.getBundleContext(), fSessionId); Query<ITraceStatusDMData> selectRecordQuery = new Query<ITraceStatusDMData>() { @Override public void execute( final DataRequestMonitor<ITraceStatusDMData> queryRm) { final IGDBTraceControl traceControl = tracker .getService(IGDBTraceControl.class); final ICommandControlService commandControl = <START> checkNotNull(tracker.getService(ICommandControlService.class)); <END> final ITraceTargetDMContext dmc = (ITraceTargetDMContext) commandControl .getContext(); if (traceControl != null) { traceControl.getTraceStatus(dmc, queryRm); } else { queryRm.done(); } } }; try { executor.execute(selectRecordQuery); ITraceStatusDMData data; if (fIsTimeoutEnabled) { data = selectRecordQuery.get(fTimeout, TimeUnit.MILLISECONDS); } else { data = selectRecordQuery.get(); } frameNum = data.getNumberOfCollectedFrame(); } catch (InterruptedException e) { GdbTraceCorePlugin.logError(INTERRUPTION_EXCEPTION, e); } catch (ExecutionException e) { GdbTraceCorePlugin.logError(GDB_EXCEPTION, e); } catch (RejectedExecutionException e) { GdbTraceCorePlugin.logError(REQUEST_REJECTED_EXCEPTION, e); } catch (TimeoutException e) { GdbTraceCorePlugin.logError(TIMEOUT, e); } finally { tracker.dispose(); } return frameNum; }</code><technical_language>I this needs a null check</technical_language>

Target:
private synchronized int findNumFrames() { int frameNum = 0; if (DsfSession.getSession(fSessionId) == null) { return 0; } final DsfExecutor executor = DsfSession.getSession(fSessionId) .getExecutor(); final DsfServicesTracker tracker = new DsfServicesTracker( GdbTraceCorePlugin.getBundleContext(), fSessionId); Query<ITraceStatusDMData> selectRecordQuery = new Query<ITraceStatusDMData>() { @Override public void execute( final DataRequestMonitor<ITraceStatusDMData> queryRm) { final IGDBTraceControl traceControl = tracker .getService(IGDBTraceControl.class); final ICommandControlService commandControl = tracker.getService(ICommandControlService.class); if (commandControl == null) { queryRm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.INTERNAL_ERROR, "Could not find necessary services", null)); queryRm.done(); return; } final ITraceTargetDMContext dmc = (ITraceTargetDMContext) commandControl .getContext(); if (traceControl != null) { traceControl.getTraceStatus(dmc, queryRm); } else { queryRm.done(); } } }; try { executor.execute(selectRecordQuery); ITraceStatusDMData data; if (fIsTimeoutEnabled) { data = selectRecordQuery.get(fTimeout, TimeUnit.MILLISECONDS); } else { data = selectRecordQuery.get(); } frameNum = data.getNumberOfCollectedFrame(); } catch (InterruptedException e) { GdbTraceCorePlugin.logError(INTERRUPTION_EXCEPTION, e); } catch (ExecutionException e) { GdbTraceCorePlugin.logError(GDB_EXCEPTION, e); } catch (RejectedExecutionException e) { GdbTraceCorePlugin.logError(REQUEST_REJECTED_EXCEPTION, e); } catch (TimeoutException e) { GdbTraceCorePlugin.logError(TIMEOUT, e); } finally { tracker.dispose(); } return frameNum; }