Buggy code:
sessionId = login . getResult ( ) . get ( 0 ) . getString ( "sessionId" ) ; } catch ( CatalogException | IOException e ) { e . printStackTrace ( ) ; exit = true ; } analysisOutputRecorder = new AnalysisOutputRecorder ( catalogManager , sessionId ) ; while ( ! ( exit ) ) { try { Thread . sleep ( sleep ) ; } catch ( InterruptedException e ) { if ( ! ( exit ) ) { e . printStackTrace ( ) ; } } DaemonLoop . logger . info ( "-----<seq2seq4repair_space>WakeUp<seq2seq4repair_space>{}<seq2seq4repair_space>-----" , TimeUtils . getTimeMillis ( ) ) ; DaemonLoop . logger . info ( "-----<seq2seq4repair_space>Pending<seq2seq4repair_space>jobs<seq2seq4repair_space>-----" ) ; try { QueryResult < Job > unfinishedJobs = catalogManager . getUnfinishedJobs ( sessionId ) ; for ( Job job : unfinishedJobs . getResult ( ) ) { String status = null ; try { status = SgeManager . status ( job . getResourceManagerAttributes ( ) . get ( JOB_SCHEDULER_NAME ) . toString ( ) ) ; } catch ( Exception e ) { DaemonLoop . logger . warn ( e . getMessage ( ) ) ; } Job . Status jobStatus = job . getStatus ( ) ; DaemonLoop . logger . info ( ( ( ( ( ( ( ( "job<seq2seq4repair_space>:<seq2seq4repair_space>{id:<seq2seq4repair_space>" + ( job . getId ( ) ) ) + ",<seq2seq4repair_space>status:<seq2seq4repair_space>'" ) + ( job . getStatus ( ) ) ) + "',<seq2seq4repair_space>name:<seq2seq4repair_space>'" ) + ( job . getName ( ) ) ) + "'},<seq2seq4repair_space>sgeStatus<seq2seq4repair_space>:<seq2seq4repair_space>" ) + status ) ) ; if ( status != null ) { switch ( status ) { case SgeManager . FINISHED : if ( ! ( DONE . equals ( job . getStatus ( ) ) ) ) { catalogManager . modifyJob ( job . getId ( ) , new ObjectMap ( "status" , Status . DONE ) , sessionId ) ; jobStatus = Status . DONE ; } break ; case SgeManager . ERROR : case SgeManager . EXECUTION_ERROR : if ( ! ( DONE . equals ( job . getStatus ( ) ) ) ) { ObjectMap parameters = new ObjectMap ( ) ; parameters . put ( "status" , DONE ) ; String error = Job . ERRNO_FINISH_ERROR ; parameters . put ( "error" , error ) ; parameters . put ( "errorDescription" , errorDescriptions . get ( error ) ) ; catalogManager . modifyJob ( job . getId ( ) , parameters , sessionId ) ; jobStatus = Status . DONE ; job . setError ( error ) ; } break ; case SgeManager . QUEUED : if ( ! ( QUEUED . equals ( job . getStatus ( ) ) ) ) { catalogManager . modifyJob ( job . getId ( ) , new ObjectMap ( "status" , Status . QUEUED ) , sessionId ) ; jobStatus = Status . QUEUED ; } break ; case SgeManager . RUNNING : if ( ! ( RUNNING . equals ( job . getStatus ( ) ) ) ) { catalogManager . modifyJob ( job . getId ( ) , new ObjectMap ( "status" , Status . RUNNING ) , sessionId ) ; jobStatus = Status . RUNNING ; } break ; case SgeManager . TRANSFERRED : break ; case SgeManager . UNKNOWN : break ; } } switch ( jobStatus ) { case DONE : analysisOutputRecorder . recordJobOutput ( job ) ; <START_BUG> if ( ( ( job . getError ( ) ) != null ) && ( ! ( job . getError ( ) . isEmpty ( ) ) ) ) { <END_BUG> catalogManager . modifyJob ( job . getId ( ) , new ObjectMap ( "status" , Status . READY ) , sessionId ) ; } else { catalogManager . modifyJob ( job . getId ( ) , new ObjectMap ( "status" , Status . ERROR ) , sessionId ) ; } break ; case PREPARED : AnalysisJobExecuter . execute ( job ) ; catalogManager . modifyJob ( job . getId ( ) , new ObjectMap ( "status" , Status . QUEUED ) , sessionId ) ; break ; case QUEUED : break ; case RUNNING : break ; case ERROR : case READY : break ; } } } catch ( Exception e ) { e . printStackTrace ( ) ; } DaemonLoop . logger . info ( "-----<seq2seq4repair_space>Pending<seq2seq4repair_space>deletions<seq2seq4repair_space>-----" ) ; try { QueryResult < File > files = catalogManager . searchFile ( ( - 1 ) , new org . opencb . datastore . core . QueryOptions ( "status" , File . Status . DELETING ) , sessionId ) ; long currentTimeMillis = System . currentTimeMillis ( ) ; for ( File file : files . getResult ( ) ) { try { long deleteDate = new ObjectMap ( file . getAttributes ( ) ) . getLong ( DELETE_DATE , 0 ) ; if ( ( currentTimeMillis - deleteDate ) > ( ( Long . valueOf ( properties . getProperty ( DaemonLoop . DELETE_DELAY , "30" ) ) ) * 1000 ) ) { QueryResult < Study > studyQueryResult = catalogManager . getStudy ( catalogManager . getStudyIdByFileId ( file . getId ( ) ) , sessionId ) ; Study study = studyQueryResult . getResult ( ) . get ( 0 ) ; DaemonLoop . logger . info ( "Deleting<seq2seq4repair_space>file<seq2seq4repair_space>{}<seq2seq4repair_space>from<seq2seq4repair_space>study<seq2seq4repair_space>{id:<seq2seq4repair_space>{},<seq2seq4repair_space>alias:<seq2seq4repair_space>{}}" , file , study . getId ( ) , study . getAlias ( ) ) ; CatalogIOManager catalogIOManager = catalogManager . getCatalogIOManagerFactory ( ) . get ( study . getUri ( ) ) ; catalogIOManager . deleteFile ( catalogIOManager . getFileUri ( study . getUri ( ) , file . getPath ( ) ) ) ; catalogManager . modifyFile ( file . getId ( ) , new ObjectMap ( "status" , File . Status . DELETED ) , sessionId ) ; } else { DaemonLoop . logger . info ( "Don't<seq2seq4repair_space>delete<seq2seq4repair_space>file<seq2seq4repair_space>{id:<seq2seq4repair_space>{},<seq2seq4repair_space>path:<seq2seq4repair_space>'{}',<seq2seq4repair_space>attributes:<seq2seq4repair_space>{}}}" , file . getId ( ) , file . getPath ( ) , file . getAttributes ( ) ) ; DaemonLoop . logger . info ( "{}"

Fix:
if ( ( ( job . getError ( ) ) == null ) || ( job . getError ( ) . isEmpty ( ) ) ) {