Program: 23324
Project: 23324
Buggy source:
private void analyseTarget(String ruleId,TransformContext context,VariablesForProfiling vars,StructureMap map,StructureMapGroupRuleTargetComponent tgt,String tv,TargetWriter tw,List<StructureDefinition> profiles,String sliceName) throws Exception {
  VariableForProfiling var=null;
  if (tgt.hasContext()) {
    var=vars.get(VariableMode.OUTPUT,tgt.getContext());
    if (var == null)     throw new Exception("String_Node_Str" + ruleId + "String_Node_Str"+ tgt.getContext());
    if (!tgt.hasElement())     throw new Exception("String_Node_Str" + ruleId + "String_Node_Str");
  }
  TypeDetails type=null;
  if (tgt.hasTransform()) {
    type=analyseTransform(context,map,tgt,var,vars);
  }
 else   type=new TypeDetails(CollectionStatus.SINGLETON,var.property.baseProperty.getChild(tgt.getElement(),tgt.getElement()).getType(tgt.getElement()));
  if (tgt.getTransform() == StructureMapTransform.CREATE) {
    String s=getParamString(vars,tgt.getParameter().get(0));
    if (worker.getResourceNames().contains(s))     tw.newResource(tgt.getVariable(),s);
  }
 else {
    boolean mapsSrc=false;
    for (    StructureMapGroupRuleTargetParameterComponent p : tgt.getParameter()) {
      Type pr=p.getValue();
      if (pr instanceof IdType && ((IdType)pr).asStringValue().equals(tv))       mapsSrc=true;
    }
    if (mapsSrc) {
      if (var == null)       throw new Error("String_Node_Str" + ruleId + "String_Node_Str");
      tw.valueAssignment(tgt.getContext(),var.property.getPath() + "String_Node_Str" + tgt.getElement()+ getTransformSuffix(tgt.getTransform()));
    }
 else     if (tgt.hasContext()) {
      if (isSignificantElement(var.property,tgt.getElement())) {
        String td=describeTransform(tgt);
        if (td != null)         tw.keyAssignment(tgt.getContext(),var.property.getPath() + "String_Node_Str" + tgt.getElement()+ "String_Node_Str"+ td);
      }
    }
  }
  Type fixed=generateFixedValue(tgt);
  PropertyWithType prop=updateProfile(var,tgt.getElement(),type,map,profiles,sliceName,fixed,tgt);
  if (tgt.hasVariable())   if (tgt.hasElement())   vars.add(VariableMode.OUTPUT,tgt.getVariable(),prop);
 else   vars.add(VariableMode.OUTPUT,tgt.getVariable(),prop);
}

Fixed version (ground truth):
private void analyseTarget(String ruleId,TransformContext context,VariablesForProfiling vars,StructureMap map,StructureMapGroupRuleTargetComponent tgt,String tv,TargetWriter tw,List<StructureDefinition> profiles,String sliceName) throws Exception {
  VariableForProfiling var=null;
  if (tgt.hasContext()) {
    var=vars.get(VariableMode.OUTPUT,tgt.getContext());
    if (var == null)     throw new Exception("String_Node_Str" + ruleId + "String_Node_Str"+ tgt.getContext());
    if (!tgt.hasElement())     throw new Exception("String_Node_Str" + ruleId + "String_Node_Str");
  }
  TypeDetails type=null;
  if (tgt.hasTransform()) {
    type=analyseTransform(context,map,tgt,var,vars);
  }
 else {
    Property vp=var.property.baseProperty.getChild(tgt.getElement(),tgt.getElement());
    if (vp == null)     throw new Exception("String_Node_Str" + tgt.getElement() + "String_Node_Str"+ var.property.path);
    type=new TypeDetails(CollectionStatus.SINGLETON,vp.getType(tgt.getElement()));
  }
  if (tgt.getTransform() == StructureMapTransform.CREATE) {
    String s=getParamString(vars,tgt.getParameter().get(0));
    if (worker.getResourceNames().contains(s))     tw.newResource(tgt.getVariable(),s);
  }
 else {
    boolean mapsSrc=false;
    for (    StructureMapGroupRuleTargetParameterComponent p : tgt.getParameter()) {
      Type pr=p.getValue();
      if (pr instanceof IdType && ((IdType)pr).asStringValue().equals(tv))       mapsSrc=true;
    }
    if (mapsSrc) {
      if (var == null)       throw new Error("String_Node_Str" + ruleId + "String_Node_Str");
      tw.valueAssignment(tgt.getContext(),var.property.getPath() + "String_Node_Str" + tgt.getElement()+ getTransformSuffix(tgt.getTransform()));
    }
 else     if (tgt.hasContext()) {
      if (isSignificantElement(var.property,tgt.getElement())) {
        String td=describeTransform(tgt);
        if (td != null)         tw.keyAssignment(tgt.getContext(),var.property.getPath() + "String_Node_Str" + tgt.getElement()+ "String_Node_Str"+ td);
      }
    }
  }
  Type fixed=generateFixedValue(tgt);
  PropertyWithType prop=updateProfile(var,tgt.getElement(),type,map,profiles,sliceName,fixed,tgt);
  if (tgt.hasVariable())   if (tgt.hasElement())   vars.add(VariableMode.OUTPUT,tgt.getVariable(),prop);
 else   vars.add(VariableMode.OUTPUT,tgt.getVariable(),prop);
}