Program: 28623
Project: 28623
Buggy source:
public static String getSecurityMechanismString(CSIV2TaggedComponentInfo tCI,CompoundSecMech[] list,String name){
  StringBuffer b=new StringBuffer();
  b.append("String_Node_Str" + name == null ? "String_Node_Str" : name);
  try {
    for (int i=0; list != null && i < list.length; i++) {
      CompoundSecMech m=list[i];
      b.append("String_Node_Str" + i + "String_Node_Str");
      Enumeration<Integer> keys=assocOptions.keys();
      while (keys.hasMoreElements()) {
        Integer j=keys.nextElement();
        if (isSet(m.target_requires,j.intValue())) {
          b.append("String_Node_Str" + assocOptions.get(j));
        }
      }
      TLS_SEC_TRANS ssl=tCI.getSSLInformation(m);
      if (ssl != null) {
        b.append("String_Node_Str");
        keys=assocOptions.keys();
        while (keys.hasMoreElements()) {
          Integer j=keys.nextElement();
          if (isSet(ssl.target_requires,j.intValue())) {
            b.append("String_Node_Str" + assocOptions.get(j));
          }
        }
        b.append("String_Node_Str");
        keys=assocOptions.keys();
        while (keys.hasMoreElements()) {
          Integer j=keys.nextElement();
          if (isSet(ssl.target_supports,j.intValue())) {
            b.append("String_Node_Str" + assocOptions.get(j));
          }
        }
        TransportAddress[] aList=ssl.addresses;
        for (int j=0; j < aList.length; j++) {
          TransportAddress a=aList[j];
          b.append("String_Node_Str" + j + "String_Node_Str"+ a.host_name+ "String_Node_Str"+ a.port);
        }
      }
      AS_ContextSec asContext=m.as_context_mech;
      if (asContext != null) {
        b.append("String_Node_Str");
        keys=assocOptions.keys();
        while (keys.hasMoreElements()) {
          Integer j=keys.nextElement();
          if (isSet(asContext.target_requires,j.intValue())) {
            b.append("String_Node_Str" + assocOptions.get(j));
          }
        }
        b.append("String_Node_Str");
        keys=assocOptions.keys();
        while (keys.hasMoreElements()) {
          Integer j=keys.nextElement();
          if (isSet(asContext.target_supports,j.intValue())) {
            b.append("String_Node_Str" + assocOptions.get(j));
          }
        }
        try {
          if (asContext.client_authentication_mech.length > 0) {
            Oid oid=new Oid(asContext.client_authentication_mech);
            b.append("String_Node_Str" + oid);
          }
 else {
            b.append("String_Node_Str");
          }
        }
 catch (        Exception e) {
          b.append("String_Node_Str" + e.getMessage());
        }
 finally {
          b.append("String_Node_Str" + new String(asContext.target_name));
        }
      }
      SAS_ContextSec sasContext=m.sas_context_mech;
      if (sasContext != null) {
        b.append("String_Node_Str");
        keys=assocOptions.keys();
        while (keys.hasMoreElements()) {
          Integer j=keys.nextElement();
          if (isSet(sasContext.target_requires,j.intValue())) {
            b.append("String_Node_Str" + assocOptions.get(j));
          }
        }
        b.append("String_Node_Str");
        keys=assocOptions.keys();
        while (keys.hasMoreElements()) {
          Integer j=keys.nextElement();
          if (isSet(sasContext.target_supports,j.intValue())) {
            b.append("String_Node_Str" + assocOptions.get(j));
          }
        }
        b.append("String_Node_Str" + Arrays.toString(sasContext.privilege_authorities));
        byte[][] nameTypes=sasContext.supported_naming_mechanisms;
        for (int j=0; j < nameTypes.length; j++) {
          try {
            if (nameTypes[j].length > 0) {
              Oid oid=new Oid(nameTypes[j]);
              b.append("String_Node_Str" + j + "String_Node_Str"+ oid);
            }
 else {
              b.append("String_Node_Str" + j + "String_Node_Str");
            }
          }
 catch (          Exception e) {
            b.append("String_Node_Str" + j + "String_Node_Str"+ e.getMessage());
          }
        }
        b.append("String_Node_Str");
        long map=sasContext.supported_identity_types;
        keys=identityTokenTypes.keys();
        while (keys.hasMoreElements()) {
          Integer j=keys.nextElement();
          if (isSet(sasContext.supported_identity_types,j.intValue())) {
            b.append("String_Node_Str" + identityTokenTypes.get(j));
            map=map - j.intValue();
          }
        }
        if (map > 0) {
          b.append("String_Node_Str" + map);
        }
      }
    }
    b.append("String_Node_Str");
  }
 catch (  Exception e) {
    e.printStackTrace();
    return ("String_Node_Str" + traceIORsProperty);
  }
  return b.toString();
}

Fixed version (ground truth):
public static String getSecurityMechanismString(CSIV2TaggedComponentInfo tCI,CompoundSecMech[] list,String name){
  StringBuffer b=new StringBuffer();
  b.append("String_Node_Str" + name);
  try {
    for (int i=0; list != null && i < list.length; i++) {
      CompoundSecMech m=list[i];
      b.append("String_Node_Str" + i + "String_Node_Str");
      Enumeration<Integer> keys=assocOptions.keys();
      while (keys.hasMoreElements()) {
        Integer j=keys.nextElement();
        if (isSet(m.target_requires,j.intValue())) {
          b.append("String_Node_Str" + assocOptions.get(j));
        }
      }
      TLS_SEC_TRANS ssl=tCI.getSSLInformation(m);
      if (ssl != null) {
        b.append("String_Node_Str");
        keys=assocOptions.keys();
        while (keys.hasMoreElements()) {
          Integer j=keys.nextElement();
          if (isSet(ssl.target_requires,j.intValue())) {
            b.append("String_Node_Str" + assocOptions.get(j));
          }
        }
        b.append("String_Node_Str");
        keys=assocOptions.keys();
        while (keys.hasMoreElements()) {
          Integer j=keys.nextElement();
          if (isSet(ssl.target_supports,j.intValue())) {
            b.append("String_Node_Str" + assocOptions.get(j));
          }
        }
        TransportAddress[] aList=ssl.addresses;
        for (int j=0; j < aList.length; j++) {
          TransportAddress a=aList[j];
          b.append("String_Node_Str" + j + "String_Node_Str"+ a.host_name+ "String_Node_Str"+ a.port);
        }
      }
      AS_ContextSec asContext=m.as_context_mech;
      if (asContext != null) {
        b.append("String_Node_Str");
        keys=assocOptions.keys();
        while (keys.hasMoreElements()) {
          Integer j=keys.nextElement();
          if (isSet(asContext.target_requires,j.intValue())) {
            b.append("String_Node_Str" + assocOptions.get(j));
          }
        }
        b.append("String_Node_Str");
        keys=assocOptions.keys();
        while (keys.hasMoreElements()) {
          Integer j=keys.nextElement();
          if (isSet(asContext.target_supports,j.intValue())) {
            b.append("String_Node_Str" + assocOptions.get(j));
          }
        }
        try {
          if (asContext.client_authentication_mech.length > 0) {
            Oid oid=new Oid(asContext.client_authentication_mech);
            b.append("String_Node_Str" + oid);
          }
 else {
            b.append("String_Node_Str");
          }
        }
 catch (        Exception e) {
          b.append("String_Node_Str" + e.getMessage());
        }
 finally {
          b.append("String_Node_Str" + new String(asContext.target_name));
        }
      }
      SAS_ContextSec sasContext=m.sas_context_mech;
      if (sasContext != null) {
        b.append("String_Node_Str");
        keys=assocOptions.keys();
        while (keys.hasMoreElements()) {
          Integer j=keys.nextElement();
          if (isSet(sasContext.target_requires,j.intValue())) {
            b.append("String_Node_Str" + assocOptions.get(j));
          }
        }
        b.append("String_Node_Str");
        keys=assocOptions.keys();
        while (keys.hasMoreElements()) {
          Integer j=keys.nextElement();
          if (isSet(sasContext.target_supports,j.intValue())) {
            b.append("String_Node_Str" + assocOptions.get(j));
          }
        }
        b.append("String_Node_Str" + Arrays.toString(sasContext.privilege_authorities));
        byte[][] nameTypes=sasContext.supported_naming_mechanisms;
        for (int j=0; j < nameTypes.length; j++) {
          try {
            if (nameTypes[j].length > 0) {
              Oid oid=new Oid(nameTypes[j]);
              b.append("String_Node_Str" + j + "String_Node_Str"+ oid);
            }
 else {
              b.append("String_Node_Str" + j + "String_Node_Str");
            }
          }
 catch (          Exception e) {
            b.append("String_Node_Str" + j + "String_Node_Str"+ e.getMessage());
          }
        }
        b.append("String_Node_Str");
        long map=sasContext.supported_identity_types;
        keys=identityTokenTypes.keys();
        while (keys.hasMoreElements()) {
          Integer j=keys.nextElement();
          if (isSet(sasContext.supported_identity_types,j.intValue())) {
            b.append("String_Node_Str" + identityTokenTypes.get(j));
            map=map - j.intValue();
          }
        }
        if (map > 0) {
          b.append("String_Node_Str" + map);
        }
      }
    }
    b.append("String_Node_Str");
  }
 catch (  Exception e) {
    e.printStackTrace();
    return ("String_Node_Str" + traceIORsProperty);
  }
  return b.toString();
}