Buggy code:
public class Client { private static final Log LOG = LogFactory . getLog ( Client . class ) ; private YarnClient yarnClient ; private String fileName ; public Client ( String [ ] args ) throws Exception { } public boolean run ( ) throws IOException , YarnException { Configuration conf = new YarnConfiguration ( ) ; yarnClient = YarnClient . createYarnClient ( ) ; yarnClient . init ( conf ) ; yarnClient . start ( ) ; YarnClientApplication app = yarnClient . createApplication ( ) ; ApplicationSubmissionContext appContext = app . getApplicationSubmissionContext ( ) ; ApplicationId appId = appContext . getApplicationId ( ) ; appContext . setKeepContainersAcrossApplicationAttempts ( false ) ; appContext . setApplicationName ( jobName ) ; ContainerLaunchContext amContainer = Records . newRecord ( ContainerLaunchContext . class ) ; Resource capability = Records . newRecord ( Resource . class ) ; capability . setMemory ( amMemory ) ; capability . setVirtualCores ( amVCores ) ; appContext . setResource ( capability ) ; Priority pri = Records . newRecord ( Priority . class ) ; pri . setPriority ( amPriority ) ; appContext . setPriority ( pri ) ; appContext . setQueue ( amQueue ) ; appContext . setAMContainerSpec ( amContainer ) ; FileSystem fs = FileSystem . get ( conf ) ; Map < String , LocalResource > localResources = new HashMap < String , LocalResource > ( ) ; Client . LOG . info ( "Copying<seq2seq4repair_space>AppMaster<seq2seq4repair_space>jar<seq2seq4repair_space>from<seq2seq4repair_space>local<seq2seq4repair_space>filesystem<seq2seq4repair_space>and<seq2seq4repair_space>add<seq2seq4repair_space>to<seq2seq4repair_space>local<seq2seq4repair_space>environment" ) ; <START_BUG> addToLocalResources ( fs , "huffmanyarn.jar" , "job.jar" , appId . toString ( ) , localResources , null ) ; <END_BUG> amContainer . setLocalResources ( localResources ) ; Client . LOG . info ( "Set<seq2seq4repair_space>the<seq2seq4repair_space>environment<seq2seq4repair_space>for<seq2seq4repair_space>the<seq2seq4repair_space>application<seq2seq4repair_space>master" ) ; Map < String , String > env = new HashMap < String , String > ( ) ; StringBuilder classPathEnv = new StringBuilder ( CLASSPATH . $$ ( ) ) . append ( CLASS_PATH_SEPARATOR ) . append ( ".//*" ) ; for ( String c : conf . getStrings ( YARN_APPLICATION_CLASSPATH , DEFAULT_YARN_CROSS_PLATFORM_APPLICATION_CLASSPATH ) ) { classPathEnv . append ( CLASS_PATH_SEPARATOR ) ; classPathEnv . append ( c . trim ( ) ) ; } env . put ( "CLASSPATH" , classPathEnv . toString ( ) ) ; amContainer . setEnvironment ( env ) ; Vector < CharSequence > vargs = new Vector < CharSequence > ( 30 ) ; vargs . add ( ( ( JAVA_HOME . $$ ( ) ) + "//bin//java" ) ) ; vargs . add ( ( ( "-Xmx" + ( Defines . amMemory ) ) + "m" ) ) ; vargs . add ( ApplicationMaster . class . getName ( ) ) ; vargs . add ( appId . toString ( ) ) ; vargs . add ( this . fileName ) ; vargs . add ( ( ( "1>" + ( ApplicationConstants . LOG_DIR_EXPANSION_VAR ) ) + "//AppMaster.stdout" ) ) ; vargs . add ( ( ( "2>" + ( ApplicationConstants . LOG_DIR_EXPANSION_VAR ) ) + "//AppMaster.stderr" ) ) ; StringBuilder command = new StringBuilder ( ) ; for ( CharSequence str : vargs ) { command . append ( str ) . append ( "<seq2seq4repair_space>" ) ; } Client . LOG . info ( ( "Completed<seq2seq4repair_space>setting<seq2seq4repair_space>up<seq2seq4repair_space>app<seq2seq4repair_space>master<seq2seq4repair_space>command<seq2seq4repair_space>" + ( command . toString ( ) ) ) ) ; List < String > commands = new ArrayList < String > ( ) ; commands . add ( command . toString ( ) ) ; amContainer . setCommands ( commands ) ; Client . LOG . info ( "Submitting<seq2seq4repair_space>application<seq2seq4repair_space>to<seq2seq4repair_space>ASM" ) ; yarnClient . submitApplication ( appContext ) ; return monitorApplication ( appId ) ; } private boolean monitorApplication ( ApplicationId appId ) throws IOException , YarnException { } private void addToLocalResources ( FileSystem fs , String fileSrcPath , String fileDstPath , String appId , Map < String , LocalResource > localResources , String resources ) throws IOException { } }

Fix:
addToLocalResources ( fs , "huffmanyarnmultithread.jar" , "job.jar" , appId . toString ( ) , localResources , null ) ;