Buggy code:
protected TaskHeartbeatHandler createTaskHeartbeatHandler ( AppContext context , Configuration conf ) { } protected ContainerHeartbeatHandler createContainerHeartbeatHandler ( AppContext context , Configuration conf ) { } protected ContainerLauncherRouter createContainerLauncherRouter ( Configuration conf , String [ ] containerLauncherClasses , boolean isLocal ) throws UnknownHostException { } public ApplicationId getAppID ( ) { } public ApplicationAttemptId getAttemptID ( ) { } public int getStartCount ( ) { } public AppContext getContext ( ) { } public Dispatcher getDispatcher ( ) { } public ContainerLauncherRouter getContainerLauncherRouter ( ) { } public TaskAttemptListener getTaskAttemptListener ( ) { } public ContainerId getAppContainerId ( ) { } public String getAppNMHost ( ) { } public int getAppNMPort ( ) { } public int getAppNMHttpPort ( ) { } public int getRpcPort ( ) { } public DAGAppMasterState getState ( ) { } private void addDiagnostic ( String diag ) { } public List < String > getDiagnostics ( ) { } public float getProgress ( ) { } private synchronized void setStateOnDAGCompletion ( ) { } public void shutdownTezAM ( ) throws TezException { } void logDAGKillRequestEvent ( TezDAGID dagId , boolean isSessionStopped ) throws IOException { } public String submitDAGToAppMaster ( DAGPlan dagPlan , Map < String , LocalResource > additionalResources ) throws TezException { } @ SuppressWarnings ( "unchecked" ) public void tryKillDAG ( DAG dag ) throws TezException { } private Map < String , LocalResource > getAdditionalLocalResourceDiff ( DAG dag , Map < String , LocalResource > additionalResources ) throws TezException { } private boolean isSameFile ( DAG dag , final String fileName , final LocalResource oldLr , final LocalResource newLr ) throws TezException { } private static Path findLocalFileForResource ( String fileName ) { } private static URI getLocalResourceUri ( LocalResource input ) { } private List < URL > processAdditionalResources ( Map < String , LocalResource > lrDiff ) throws TezException { } private class RunningAppContext implements AppContext { private DAG dag ; private final Configuration conf ; private final ClusterInfo clusterInfo = new ClusterInfo ( ) ; private final ReentrantReadWriteLock rwLock = new ReentrantReadWriteLock ( ) ; private final Lock rLock = rwLock . readLock ( ) ; private final Lock wLock = rwLock . writeLock ( ) ; private final EventHandler eventHandler ; public RunningAppContext ( Configuration config ) { } @ Override public DAGAppMaster getAppMaster ( ) { } @ Override public Configuration getAMConf ( ) { } @ Override public ApplicationAttemptId getApplicationAttemptId ( ) { } @ Override public ApplicationId getApplicationID ( ) { } @ Override public String getApplicationName ( ) { } @ Override public long getStartTime ( ) { } @ Override public DAG getCurrentDAG ( ) { } @ Override public ListeningExecutorService getExecService ( ) { } @ Override public Set < String > getAllDAGIDs ( ) { } @ Override public EventHandler getEventHandler ( ) { } @ Override public String getUser ( ) { } @ Override public Clock getClock ( ) { } @ Override public ClusterInfo getClusterInfo ( ) { } @ Override public AMContainerMap getAllContainers ( ) { } @ Override public AMNodeTracker getNodeTracker ( ) { } @ Override public TaskSchedulerEventHandler getTaskScheduler ( ) { } @ Override public boolean isSession ( ) { } @ Override public boolean isLocal ( ) { } @ Override public DAGAppMasterState getAMState ( ) { } @ Override public HistoryEventHandler getHistoryHandler ( ) { } @ Override public Path getCurrentRecoveryDir ( ) { } @ Override public boolean isRecoveryEnabled ( ) { } @ Override public ACLManager getAMACLManager ( ) { } @ Override public String [ ] getLogDirs ( ) { } @ Override public String [ ] getLocalDirs ( ) { } @ Override public String getAMUser ( ) { } @ Override public boolean isAMInCompletionState ( ) { } @ Override public Credentials getAppCredentials ( ) { } @ Override public Integer getTaskCommunicatorIdentifier ( String name ) { } @ Override public Integer getTaskScheduerIdentifier ( String name ) { } @ Override public Integer getContainerLauncherIdentifier ( String name ) { <START_BUG> return taskCommunicators . get ( name ) ; <END_BUG> } @ Override public Map < ApplicationAccessType , String > getApplicationACLs ( ) { } @ Override public TezDAGID getCurrentDAGID ( ) { } @ Override public void setDAG ( DAG dag ) { } @ Override public long getCumulativeCPUTime ( ) { } @ Override public long getCumulativeGCTime ( ) { } } private static class ServiceWithDependency implements ServiceStateChangeListener { ServiceWithDependency ( Service service ) { } Service service ; List < Service > dependencies = new ArrayList < Service > ( ) ; AtomicInteger dependenciesStarted = new AtomicInteger ( 0 ) ; volatile boolean canStart = false ; volatile boolean dependenciesFailed = false ; @ Override public void stateChanged ( Service dependency ) { } void start ( ) throws InterruptedException { } } private static class ServiceThread extends Thread { final DAGAppMaster . ServiceWithDependency serviceWithDependency ; Throwable error = null ; public ServiceThread ( DAGAppMaster . ServiceWithDependency serviceWithDependency ) { } public void run ( ) { } } void startServices ( ) { } void initServices ( Configuration conf ) { } void stopServices ( ) { } private RecoveredDAGData recoverDAG ( ) throws IOException , TezException { } @ Override public synchronized void serviceStart ( ) throws Exception { } private void initiateStop ( ) { } @ Override public void serviceStop ( ) throws Exception { } private class DagEventDispatcher implements EventHandler < DAGEvent > { @ SuppressWarnings ( "unchecked" ) @ Override public void handle ( DAGEvent event ) { } } private class TaskEventDispatcher implements EventHandler < TaskEvent > { @ SuppressWarnings ( "unchecked" ) @ Override public void handle ( TaskEvent event ) { } } private class SpeculatorEventHandler implements EventHandler < SpeculatorEvent > { @ Override public void handle ( SpeculatorEvent event ) { } }

Fix:
return containerLaunchers . get ( name ) ;