Program: 89315
Project: 89315
Buggy source:
public ScriptConstraintValue[] getValues(){
  Map<String,List<String>> details=rmCaveatconfigService.getListDetails(info.getName());
  if (details == null) {
    details=new HashMap<String,List<String>>();
  }
  Map<String,List<String>> pivot=PivotUtil.getPivot(details);
  Set<String> values=pivot.keySet();
  ArrayList<ScriptConstraintValue> constraints=new ArrayList<ScriptConstraintValue>(pivot.size());
  for (  String value : values) {
    ScriptConstraintValue constraint=new ScriptConstraintValue();
    constraint.setValueName(value);
    constraint.setValueTitle(value);
    List<String> authorities=pivot.get(value);
    List<ScriptAuthority> sauth=new ArrayList<ScriptAuthority>();
    for (    String authority : authorities) {
      ScriptAuthority a=new ScriptAuthority();
      a.setAuthorityName(authority);
      String displayName=authorityService.getAuthorityDisplayName(authority);
      if (StringUtils.isNotBlank(displayName)) {
        a.setAuthorityTitle(displayName);
      }
 else {
        a.setAuthorityTitle(authority);
      }
      sauth.add(a);
    }
    constraint.setAuthorities(sauth);
    constraints.add(constraint);
  }
  for (  String value : info.getAllowedValues()) {
    if (!values.contains(value)) {
      ScriptConstraintValue constraint=new ScriptConstraintValue();
      constraint.setValueName(value);
      constraint.setValueTitle(value);
      List<ScriptAuthority> sauth=new ArrayList<ScriptAuthority>();
      constraint.setAuthorities(sauth);
      constraints.add(constraint);
    }
  }
  ScriptConstraintValue[] retVal=constraints.toArray(new ScriptConstraintValue[constraints.size()]);
  return retVal;
}

Fixed version (ground truth):
public ScriptConstraintValue[] getValues(){
  Map<String,List<String>> details=rmCaveatconfigService.getListDetails(info.getName());
  if (details == null) {
    details=new HashMap<String,List<String>>();
  }
  Map<String,List<String>> pivot=PivotUtil.getPivot(details);
  Set<String> values=pivot.keySet();
  ArrayList<ScriptConstraintValue> constraints=new ArrayList<ScriptConstraintValue>(pivot.size());
  for (  String value : values) {
    ScriptConstraintValue constraint=new ScriptConstraintValue();
    constraint.setValueName(value);
    constraint.setValueTitle(value);
    List<String> authorities=pivot.get(value);
    List<ScriptAuthority> sauth=new ArrayList<ScriptAuthority>();
    for (    String authority : authorities) {
      ScriptAuthority a=new ScriptAuthority();
      a.setAuthorityName(authority);
      String displayName=authorityService.getAuthorityDisplayName(authority);
      if (StringUtils.isNotBlank(displayName)) {
        a.setAuthorityTitle(displayName);
      }
 else {
        a.setAuthorityTitle(authority);
      }
      sauth.add(a);
    }
    constraint.setAuthorities(sauth);
    constraints.add(constraint);
  }
  for (  String value : info.getAllowedValues()) {
    if (!values.contains(value)) {
      ScriptConstraintValue constraint=new ScriptConstraintValue();
      constraint.setValueName(value);
      constraint.setValueTitle(value);
      List<ScriptAuthority> sauth=new ArrayList<ScriptAuthority>();
      constraint.setAuthorities(sauth);
      constraints.add(constraint);
    }
  }
  return constraints.toArray(new ScriptConstraintValue[constraints.size()]);
}