Program: 4598
Project: 4598
Buggy source:
private void processNotification(AppMetadataStore appMetadataStore,Notification notification,byte[] messageIdBytes) throws Exception {
  Map<String,String> properties=notification.getProperties();
  String programRun=properties.get(ProgramOptionConstants.PROGRAM_RUN_ID);
  String programStatus=properties.get(ProgramOptionConstants.PROGRAM_STATUS);
  if (programRun == null || programStatus == null) {
    LOG.warn("String_Node_Str",notification);
    return;
  }
  ProgramRunStatus programRunStatus;
  try {
    programRunStatus=ProgramRunStatus.valueOf(programStatus);
  }
 catch (  IllegalArgumentException e) {
    LOG.warn("String_Node_Str",programStatus,programRun,notification);
    return;
  }
  ProgramRunId programRunId=GSON.fromJson(programRun,ProgramRunId.class);
  ProgramId programId=programRunId.getParent();
  ApplicationMeta meta=appMetadataStore.getApplication(programRunId.getNamespace(),programRunId.getApplication(),programRunId.getVersion());
  if (meta == null) {
    LOG.warn("String_Node_Str",programRunId,notification);
    return;
  }
  if (getProgramSpecFromApp(meta.getSpec(),programRunId) == null) {
    LOG.warn("String_Node_Str",programRunId,notification);
    return;
  }
  LOG.trace("String_Node_Str",notification);
  String runId=programRunId.getRun();
  String twillRunId=notification.getProperties().get(ProgramOptionConstants.TWILL_RUN_ID);
  long endTimeSecs=getTimeSeconds(notification.getProperties(),ProgramOptionConstants.END_TIME);
  ProgramRunStatus recordedStatus;
switch (programRunStatus) {
case STARTING:
    long startTimeSecs=getTimeSeconds(notification.getProperties(),ProgramOptionConstants.START_TIME);
  String userArgumentsString=properties.get(ProgramOptionConstants.USER_OVERRIDES);
String systemArgumentsString=properties.get(ProgramOptionConstants.SYSTEM_OVERRIDES);
if (userArgumentsString == null || systemArgumentsString == null) {
LOG.warn("String_Node_Str",programRunId,(userArgumentsString == null) ? "String_Node_Str" : "String_Node_Str",notification);
return;
}
if (startTimeSecs == -1) {
LOG.warn("String_Node_Str",programRunId,notification);
return;
}
Map<String,String> userArguments=GSON.fromJson(userArgumentsString,STRING_STRING_MAP);
Map<String,String> systemArguments=GSON.fromJson(systemArgumentsString,STRING_STRING_MAP);
recordedStatus=appMetadataStore.recordProgramStart(programId,runId,startTimeSecs,twillRunId,userArguments,systemArguments,messageIdBytes);
break;
case RUNNING:
long logicalStartTimeSecs=getTimeSeconds(notification.getProperties(),ProgramOptionConstants.LOGICAL_START_TIME);
if (logicalStartTimeSecs == -1) {
LOG.warn("String_Node_Str",programRunId,ProgramOptionConstants.LOGICAL_START_TIME,notification);
return;
}
recordedStatus=appMetadataStore.recordProgramRunning(programId,runId,logicalStartTimeSecs,twillRunId,messageIdBytes);
break;
case SUSPENDED:
recordedStatus=appMetadataStore.recordProgramSuspend(programId,runId,messageIdBytes);
break;
case RESUMING:
recordedStatus=appMetadataStore.recordProgramResumed(programId,runId,messageIdBytes);
break;
case COMPLETED:
case KILLED:
if (endTimeSecs == -1) {
LOG.warn("String_Node_Str",programRunId,notification);
return;
}
recordedStatus=appMetadataStore.recordProgramStop(programId,runId,endTimeSecs,programRunStatus,null,messageIdBytes);
break;
case FAILED:
if (endTimeSecs == -1) {
LOG.warn("String_Node_Str",programRunId,notification);
return;
}
BasicThrowable cause=decodeBasicThrowable(properties.get(ProgramOptionConstants.PROGRAM_ERROR));
recordedStatus=appMetadataStore.recordProgramStop(programId,runId,endTimeSecs,programRunStatus,cause,messageIdBytes);
break;
default :
LOG.error("String_Node_Str",programRunStatus,programRunId,notification);
return;
}
if (recordedStatus != null) {
publishRecordedStatus(programRunId,recordedStatus);
}
}

Fixed version (ground truth):
private void processNotification(AppMetadataStore appMetadataStore,Notification notification,byte[] messageIdBytes) throws Exception {
  Map<String,String> properties=notification.getProperties();
  String programRun=properties.get(ProgramOptionConstants.PROGRAM_RUN_ID);
  String programStatus=properties.get(ProgramOptionConstants.PROGRAM_STATUS);
  if (programRun == null || programStatus == null) {
    LOG.warn("String_Node_Str",notification);
    return;
  }
  ProgramRunStatus programRunStatus;
  try {
    programRunStatus=ProgramRunStatus.valueOf(programStatus);
  }
 catch (  IllegalArgumentException e) {
    LOG.warn("String_Node_Str",programStatus,programRun,notification);
    return;
  }
  ProgramRunId programRunId=GSON.fromJson(programRun,ProgramRunId.class);
  ProgramId programId=programRunId.getParent();
  LOG.trace("String_Node_Str",notification);
  String runId=programRunId.getRun();
  String twillRunId=notification.getProperties().get(ProgramOptionConstants.TWILL_RUN_ID);
  long endTimeSecs=getTimeSeconds(notification.getProperties(),ProgramOptionConstants.END_TIME);
  ProgramRunStatus recordedStatus;
switch (programRunStatus) {
case STARTING:
    long startTimeSecs=getTimeSeconds(notification.getProperties(),ProgramOptionConstants.START_TIME);
  String userArgumentsString=properties.get(ProgramOptionConstants.USER_OVERRIDES);
String systemArgumentsString=properties.get(ProgramOptionConstants.SYSTEM_OVERRIDES);
if (userArgumentsString == null || systemArgumentsString == null) {
LOG.warn("String_Node_Str",programRunId,(userArgumentsString == null) ? "String_Node_Str" : "String_Node_Str",notification);
return;
}
if (startTimeSecs == -1) {
LOG.warn("String_Node_Str",programRunId,notification);
return;
}
Map<String,String> userArguments=GSON.fromJson(userArgumentsString,STRING_STRING_MAP);
Map<String,String> systemArguments=GSON.fromJson(systemArgumentsString,STRING_STRING_MAP);
recordedStatus=appMetadataStore.recordProgramStart(programId,runId,startTimeSecs,twillRunId,userArguments,systemArguments,messageIdBytes);
break;
case RUNNING:
long logicalStartTimeSecs=getTimeSeconds(notification.getProperties(),ProgramOptionConstants.LOGICAL_START_TIME);
if (logicalStartTimeSecs == -1) {
LOG.warn("String_Node_Str",programRunId,ProgramOptionConstants.LOGICAL_START_TIME,notification);
return;
}
recordedStatus=appMetadataStore.recordProgramRunning(programId,runId,logicalStartTimeSecs,twillRunId,messageIdBytes);
break;
case SUSPENDED:
recordedStatus=appMetadataStore.recordProgramSuspend(programId,runId,messageIdBytes);
break;
case RESUMING:
recordedStatus=appMetadataStore.recordProgramResumed(programId,runId,messageIdBytes);
break;
case COMPLETED:
case KILLED:
if (endTimeSecs == -1) {
LOG.warn("String_Node_Str",programRunId,notification);
return;
}
recordedStatus=appMetadataStore.recordProgramStop(programId,runId,endTimeSecs,programRunStatus,null,messageIdBytes);
break;
case FAILED:
if (endTimeSecs == -1) {
LOG.warn("String_Node_Str",programRunId,notification);
return;
}
BasicThrowable cause=decodeBasicThrowable(properties.get(ProgramOptionConstants.PROGRAM_ERROR));
recordedStatus=appMetadataStore.recordProgramStop(programId,runId,endTimeSecs,programRunStatus,cause,messageIdBytes);
break;
default :
LOG.error("String_Node_Str",programRunStatus,programRunId,notification);
return;
}
if (recordedStatus != null) {
publishRecordedStatus(programRunId,recordedStatus);
}
}