Program: 48778
Project: 48778
Buggy source:
public static void configureAlarm(Folder rootFolder) throws Exception {
  AlarmManager alarmManager=VcContext.getService().getAlarmManager();
  String SERENGETI_UUID=rootFolder.getName();
  String ALARM_CLEARED_MSG="String_Node_Str";
  EventAlarmExpression raiseExpression=new EventAlarmExpressionImpl();
  raiseExpression.setEventType(new TypeNameImpl("String_Node_Str"));
  raiseExpression.setEventTypeId("String_Node_Str");
  raiseExpression.setStatus(ManagedEntity.Status.yellow);
  EventAlarmExpression clearExpression=new EventAlarmExpressionImpl();
  clearExpression.setEventType(new TypeNameImpl("String_Node_Str"));
  clearExpression.setEventTypeId("String_Node_Str");
  clearExpression.setComparisons(new EventAlarmExpressionImpl.ComparisonImpl[]{new EventAlarmExpressionImpl.ComparisonImpl("String_Node_Str","String_Node_Str",ALARM_CLEARED_MSG)});
  clearExpression.setStatus(ManagedEntity.Status.green);
  OrAlarmExpression or=new OrAlarmExpressionImpl();
  or.setExpression(new AlarmExpression[]{raiseExpression,clearExpression});
  AlarmTriggeringAction alarmAction=new AlarmTriggeringActionImpl();
  alarmAction.setAction(null);
  TransitionSpec tSpec=new AlarmTriggeringActionImpl.TransitionSpecImpl();
  tSpec.setRepeats(false);
  tSpec.setStartState(Status.green);
  tSpec.setFinalState(Status.yellow);
  alarmAction.setTransitionSpecs(new TransitionSpec[]{tSpec});
  alarmAction.setGreen2yellow(true);
  AlarmSpec spec=new AlarmSpecImpl();
  spec.setActionFrequency(0);
  spec.setExpression(or);
  String alarmName="String_Node_Str" + SERENGETI_UUID;
  if (alarmName.length() > 80) {
    alarmName=alarmName.substring(0,80);
  }
  spec.setName(alarmName);
  spec.setSystemName(null);
  spec.setDescription("String_Node_Str");
  spec.setEnabled(true);
  AlarmSetting as=new AlarmSettingImpl();
  as.setReportingFrequency(0);
  as.setToleranceRange(0);
  spec.setSetting(as);
  ManagedObjectReference[] existingAlarms=alarmManager.getAlarm(rootFolder._getRef());
  Alarm existing=null;
  try {
    if (existingAlarms != null) {
      for (      ManagedObjectReference m : existingAlarms) {
        Alarm a=MoUtil.getManagedObject(m);
        if (a.getInfo().getName().equals(alarmName)) {
          existing=a;
          break;
        }
      }
    }
  }
 catch (  NullPointerException e) {
    logger.error("String_Node_Str",e);
  }
  try {
    if (existing != null) {
      existing.reconfigure(spec);
      logger.info("String_Node_Str" + alarmName + "String_Node_Str");
    }
 else {
      ManagedObjectReference alarmMoref=alarmManager.create(rootFolder._getRef(),spec);
      logger.info("String_Node_Str" + alarmMoref.getValue() + "String_Node_Str"+ alarmName);
    }
  }
 catch (  InvalidName e) {
    logger.error("String_Node_Str",e);
  }
catch (  DuplicateName e) {
    logger.error("String_Node_Str",e);
  }
}

Fixed version (ground truth):
public static void configureAlarm(Folder rootFolder) throws Exception {
  AlarmManager alarmManager=VcContext.getService().getAlarmManager();
  String SERENGETI_UUID=rootFolder.getName();
  String ALARM_CLEARED_MSG="String_Node_Str";
  EventAlarmExpression raiseExpression=new EventAlarmExpressionImpl();
  raiseExpression.setEventType(new TypeNameImpl("String_Node_Str"));
  raiseExpression.setEventTypeId("String_Node_Str");
  raiseExpression.setStatus(ManagedEntity.Status.yellow);
  raiseExpression.setObjectType(new TypeNameImpl("String_Node_Str"));
  EventAlarmExpression clearExpression=new EventAlarmExpressionImpl();
  clearExpression.setEventType(new TypeNameImpl("String_Node_Str"));
  clearExpression.setEventTypeId("String_Node_Str");
  clearExpression.setComparisons(new EventAlarmExpressionImpl.ComparisonImpl[]{new EventAlarmExpressionImpl.ComparisonImpl("String_Node_Str","String_Node_Str",ALARM_CLEARED_MSG)});
  clearExpression.setStatus(ManagedEntity.Status.green);
  clearExpression.setObjectType(new TypeNameImpl("String_Node_Str"));
  OrAlarmExpression or=new OrAlarmExpressionImpl();
  or.setExpression(new AlarmExpression[]{raiseExpression,clearExpression});
  AlarmTriggeringAction alarmAction=new AlarmTriggeringActionImpl();
  alarmAction.setAction(null);
  TransitionSpec tSpec=new AlarmTriggeringActionImpl.TransitionSpecImpl();
  tSpec.setRepeats(false);
  tSpec.setStartState(Status.green);
  tSpec.setFinalState(Status.yellow);
  alarmAction.setTransitionSpecs(new TransitionSpec[]{tSpec});
  alarmAction.setGreen2yellow(true);
  AlarmSpec spec=new AlarmSpecImpl();
  spec.setActionFrequency(0);
  spec.setExpression(or);
  String alarmName="String_Node_Str" + SERENGETI_UUID;
  if (alarmName.length() > 80) {
    alarmName=alarmName.substring(0,80);
  }
  spec.setName(alarmName);
  spec.setSystemName(null);
  spec.setDescription("String_Node_Str");
  spec.setEnabled(true);
  AlarmSetting as=new AlarmSettingImpl();
  as.setReportingFrequency(0);
  as.setToleranceRange(0);
  spec.setSetting(as);
  ManagedObjectReference[] existingAlarms=alarmManager.getAlarm(rootFolder._getRef());
  Alarm existing=null;
  try {
    if (existingAlarms != null) {
      for (      ManagedObjectReference m : existingAlarms) {
        Alarm a=MoUtil.getManagedObject(m);
        if (a.getInfo().getName().equals(alarmName)) {
          existing=a;
          break;
        }
      }
    }
  }
 catch (  NullPointerException e) {
    logger.error("String_Node_Str",e);
  }
  try {
    if (existing != null) {
      existing.reconfigure(spec);
      logger.info("String_Node_Str" + alarmName + "String_Node_Str");
    }
 else {
      ManagedObjectReference alarmMoref=alarmManager.create(rootFolder._getRef(),spec);
      logger.info("String_Node_Str" + alarmMoref.getValue() + "String_Node_Str"+ alarmName);
    }
  }
 catch (  InvalidName e) {
    logger.error("String_Node_Str",e);
  }
catch (  DuplicateName e) {
    logger.error("String_Node_Str",e);
  }
}