Better to remove the if/then and the null check and always call  addMapReduceJobState(node.getJob(), jobClient); here and below. The method then first checks for null and delegates to  addMapReduceJobState(node.getJob()); as necessary.