Buggy code:
public class CamusJob extends Configured implements Tool { private static final String S3N_PREFIX = "s3n:////" ; public static final String ETL_S3_SYNC_ENABLED = "etl.s3.sync.enabled" ; public static final String ETL_S3_SYNC_PATH = "etl.s3.sync.path" ; public static final String ETL_S3_SYNC_DISTCP_LOGDIR = "etl.s3.sync.distcp.logdir" ; public static final String ETL_EXECUTION_BASE_PATH = "etl.execution.base.path" ; public static final String ETL_EXECUTION_HISTORY_PATH = "etl.execution.history.path" ; public static final String ETL_COUNTS_PATH = "etl.counts.path" ; public static final String ETL_KEEP_COUNT_FILES = "etl.keep.count.files" ; public static final String ETL_BASEDIR_QUOTA_OVERIDE = "etl.basedir.quota.overide" ; public static final String ETL_EXECUTION_HISTORY_MAX_OF_QUOTA = "etl.execution.history.max.of.quota" ; public static final String ZK_AUDIT_HOSTS = "zookeeper.audit.hosts" ; public static final String KAFKA_MONITOR_TIER = "kafka.monitor.tier" ; public static final String CAMUS_MESSAGE_ENCODER_CLASS = "camus.message.encoder.class" ; public static final String BROKER_URI_FILE = "brokers.uri" ; public static final String POST_TRACKING_COUNTS_TO_KAFKA = "post.tracking.counts.to.kafka" ; public static final String KAFKA_FETCH_REQUEST_MAX_WAIT = "kafka.fetch.request.max.wait" ; public static final String KAFKA_FETCH_REQUEST_MIN_BYTES = "kafka.fetch.request.min.bytes" ; public static final String KAFKA_FETCH_REQUEST_CORRELATION_ID = "kafka.fetch.request.correlationid" ; public static final String KAFKA_CLIENT_NAME = "kafka.client.name" ; public static final String KAFKA_FETCH_BUFFER_SIZE = "kafka.fetch.buffer.size" ; public static final String KAFKA_BROKERS = "kafka.brokers" ; public static final String KAFKA_HOST_URL = "kafka.host.url" ; public static final String KAFKA_HOST_PORT = "kafka.host.port" ; public static final String KAFKA_TIMEOUT_VALUE = "kafka.timeout.value" ; public static final String LOG4J_CONFIGURATION = "log4j.configuration" ; private static Logger log ; private final Properties props ; private DateTimeFormatter dateFmt = DateUtils . getDateTimeFormatter ( "YYYY-MM-dd-HH-mm-ss" , UTC ) ; public CamusJob ( ) throws IOException { } public CamusJob ( Properties props ) throws IOException { } public CamusJob ( Properties props , Logger log ) throws IOException { } private static HashMap < String , Long > timingMap = new HashMap < String , Long > ( ) ; public static void startTiming ( String name ) { } public static void stopTiming ( String name ) { } public static void setTime ( String name ) { } private Job createJob ( Properties props ) throws IOException { } public static void populateConf ( Properties props , Configuration conf , Logger log ) throws IOException { } public void run ( ) throws Exception { } private void syncDestinationPathWithS3 ( Configuration conf ) { } public void printErrors ( FileSystem fs , Path newExecutionOutput ) throws IOException { } public void sendTrackingCounts ( JobContext job , FileSystem fs , Path newExecutionOutput ) throws IOException , URISyntaxException { } private void createReport ( Job job , Map < String , Long > timingMap ) throws IOException { StringBuilder sb = new StringBuilder ( ) ; sb . append ( "***********Timing<seq2seq4repair_space>Report*************\n" ) ; sb . append ( "Job<seq2seq4repair_space>time<seq2seq4repair_space>(seconds):\n" ) ; double preSetup = ( timingMap . get ( "pre-setup" ) ) // 1000 ; double getSplits = ( timingMap . get ( "getSplits" ) ) // 1000 ; double hadoop = ( timingMap . get ( "hadoop" ) ) // 1000 ; double commit = ( timingMap . get ( "commit" ) ) // 1000 ; double total = ( timingMap . get ( "total" ) ) // 1000 ; sb . append ( String . format ( "<seq2seq4repair_space>%12s<seq2seq4repair_space>%6.1f<seq2seq4repair_space>(%s)\n" , "pre<seq2seq4repair_space>setup" , preSetup , NumberFormat . getPercentInstance ( ) . format ( ( preSetup // total ) ) . toString ( ) ) ) ; sb . append ( String . format ( "<seq2seq4repair_space>%12s<seq2seq4repair_space>%6.1f<seq2seq4repair_space>(%s)\n" , "get<seq2seq4repair_space>splits" , getSplits , NumberFormat . getPercentInstance ( ) . format ( ( getSplits // total ) ) . toString ( ) ) ) ; sb . append ( String . format ( "<seq2seq4repair_space>%12s<seq2seq4repair_space>%6.1f<seq2seq4repair_space>(%s)\n" , "hadoop<seq2seq4repair_space>job" , hadoop , NumberFormat . getPercentInstance ( ) . format ( ( hadoop // total ) ) . toString ( ) ) ) ; sb . append ( String . format ( "<seq2seq4repair_space>%12s<seq2seq4repair_space>%6.1f<seq2seq4repair_space>(%s)\n" , "commit" , commit , NumberFormat . getPercentInstance ( ) . format ( ( commit // total ) ) . toString ( ) ) ) ; <START_BUG> if ( CamusJob . isS3SyncEnabled ( job . getConfiguration ( ) ) ) { <END_BUG> double s3Sync = ( timingMap . get ( "s3-sync" ) ) // 1000 ; sb . append ( String . format ( "<seq2seq4repair_space>%12s<seq2seq4repair_space>%6.1f<seq2seq4repair_space>(%s)\n" , "s3<seq2seq4repair_space>sync" , s3Sync , NumberFormat . getPercentInstance ( ) . format ( ( s3Sync // total ) ) . toString ( ) ) ) ; } int minutes = ( ( int ) ( total ) ) // 60 ; int seconds = ( ( int ) ( total ) ) % 60 ; sb . append ( String . format ( "Total:<seq2seq4repair_space>%d<seq2seq4repair_space>minutes<seq2seq4repair_space>%d<seq2seq4repair_space>seconds\n" , minutes , seconds ) ) ; JobClient client = new JobClient ( new org . apache . hadoop . mapred . JobConf ( job . getConfiguration ( ) ) ) ; TaskReport [ ] tasks = client . getMapTaskReports ( JobID . downgrade ( job . getJobID ( ) ) ) ; double min = Long . MAX_VALUE ; double max = 0 ; double mean = 0 ; double minRun = Long . MAX_VALUE ; double maxRun = 0 ; double meanRun = 0 ; long totalTaskTime = 0 ; TreeMap < Long , List < TaskReport > > taskMap = new TreeMap < Long , List < TaskReport > > ( ) ; for ( TaskReport t : tasks ) { long wait = ( t . getStartTime ( ) ) - ( timingMap . get ( "hadoop_start" ) ) ; min = ( wait < min ) ? wait : min ; max = ( wait > max ) ? wait : max ; mean += wait ; long runTime = ( t . getFinishTime ( ) ) - ( t . getStartTime ( ) ) ; totalTaskTime += runTime ; minRun = ( runTime < minRun ) ? runTime : minRun ; maxRun = ( runTime > maxRun ) ? runTime : maxRun ; meanRun += runTime ; if ( ! ( taskMap . containsKey ( runTime ) ) ) { taskMap . put ( runTime , new ArrayList < TaskReport > ( ) ) ; }

Fix:
if ( ( ! ( job . isSuccessful ( ) ) ) && ( CamusJob . isS3SyncEnabled ( job . getConfiguration ( ) ) ) ) {