Program: 89366
Project: 89366
Buggy source:
@Override public Map<String,Object> executeImpl(WebScriptRequest req,Status status,Cache cache){
  Map<String,Object> model=new HashMap<String,Object>();
  Map<String,String> templateVars=req.getServiceMatch().getTemplateVars();
  String refId=templateVars.get(REF_ID);
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str" + String.valueOf(refId));
  }
  Map<QName,AssociationDefinition> currentCustomRefs=rmAdminService.getCustomReferenceDefinitions();
  if (refId != null) {
    QName qn=rmAdminService.getQNameForClientId(refId);
    AssociationDefinition assDef=currentCustomRefs.get(qn);
    if (assDef == null) {
      StringBuilder msg=new StringBuilder();
      msg.append("String_Node_Str").append(refId);
      if (logger.isDebugEnabled()) {
        logger.debug(msg.toString());
      }
      throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND,msg.toString());
    }
    currentCustomRefs=new HashMap<QName,AssociationDefinition>(1);
    currentCustomRefs.put(qn,assDef);
  }
  List<Map<String,String>> listOfReferenceData=new ArrayList<Map<String,String>>();
  for (  Entry<QName,AssociationDefinition> entry : currentCustomRefs.entrySet()) {
    Map<String,String> data=new HashMap<String,String>();
    AssociationDefinition nextValue=entry.getValue();
    CustomReferenceType referenceType=nextValue instanceof ChildAssociationDefinition ? CustomReferenceType.PARENT_CHILD : CustomReferenceType.BIDIRECTIONAL;
    data.put(REFERENCE_TYPE,referenceType.toString());
    String nextTitle=nextValue.getTitle(dictionaryService);
    if (CustomReferenceType.PARENT_CHILD.equals(referenceType)) {
      if (nextTitle != null) {
        String[] sourceAndTarget=rmAdminService.splitSourceTargetId(nextTitle);
        data.put(SOURCE,sourceAndTarget[0]);
        data.put(TARGET,sourceAndTarget[1]);
        data.put(REF_ID,entry.getKey().getLocalName());
      }
    }
 else     if (CustomReferenceType.BIDIRECTIONAL.equals(referenceType)) {
      if (nextTitle != null) {
        data.put(LABEL,nextTitle);
        data.put(REF_ID,entry.getKey().getLocalName());
      }
    }
 else {
      throw new WebScriptException("String_Node_Str" + referenceType);
    }
    listOfReferenceData.add(data);
  }
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str" + listOfReferenceData.size());
  }
  model.put(CUSTOM_REFS,listOfReferenceData);
  return model;
}

Fixed version (ground truth):
@Override public Map<String,Object> executeImpl(WebScriptRequest req,Status status,Cache cache){
  Map<String,Object> model=new HashMap<String,Object>();
  Map<String,String> templateVars=req.getServiceMatch().getTemplateVars();
  String refId=templateVars.get(REF_ID);
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str" + refId);
  }
  Map<QName,AssociationDefinition> currentCustomRefs=rmAdminService.getCustomReferenceDefinitions();
  if (refId != null) {
    QName qn=rmAdminService.getQNameForClientId(refId);
    AssociationDefinition assDef=currentCustomRefs.get(qn);
    if (assDef == null) {
      StringBuilder msg=new StringBuilder();
      msg.append("String_Node_Str").append(refId);
      if (logger.isDebugEnabled()) {
        logger.debug(msg.toString());
      }
      throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND,msg.toString());
    }
    currentCustomRefs=new HashMap<QName,AssociationDefinition>(1);
    currentCustomRefs.put(qn,assDef);
  }
  List<Map<String,String>> listOfReferenceData=new ArrayList<Map<String,String>>();
  for (  Entry<QName,AssociationDefinition> entry : currentCustomRefs.entrySet()) {
    Map<String,String> data=new HashMap<String,String>();
    AssociationDefinition nextValue=entry.getValue();
    CustomReferenceType referenceType=nextValue instanceof ChildAssociationDefinition ? CustomReferenceType.PARENT_CHILD : CustomReferenceType.BIDIRECTIONAL;
    data.put(REFERENCE_TYPE,referenceType.toString());
    String nextTitle=nextValue.getTitle(dictionaryService);
    if (CustomReferenceType.PARENT_CHILD.equals(referenceType)) {
      if (nextTitle != null) {
        String[] sourceAndTarget=rmAdminService.splitSourceTargetId(nextTitle);
        data.put(SOURCE,sourceAndTarget[0]);
        data.put(TARGET,sourceAndTarget[1]);
        data.put(REF_ID,entry.getKey().getLocalName());
      }
    }
 else     if (CustomReferenceType.BIDIRECTIONAL.equals(referenceType)) {
      if (nextTitle != null) {
        data.put(LABEL,nextTitle);
        data.put(REF_ID,entry.getKey().getLocalName());
      }
    }
 else {
      throw new WebScriptException("String_Node_Str" + referenceType);
    }
    listOfReferenceData.add(data);
  }
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str" + listOfReferenceData.size());
  }
  model.put(CUSTOM_REFS,listOfReferenceData);
  return model;
}