Program: 86053
Project: 86053
Buggy source:
private void generateInstanceStream(PartUsageLink usageLink,double tx,double ty,double tz,double rx,double ry,double rz,List<Integer> filteredPath,List<Integer> instanceIds) throws JAXBException, IOException {
  PartMaster pm=usageLink.getComponent();
  PartRevision partR=pm.getLastRevision();
  PartIteration partI=partR.getLastIteration();
  String partIterationId=new StringBuilder().append(pm.getNumber()).append("String_Node_Str").append(partR.getVersion()).append("String_Node_Str").append(partI.getIteration()).toString();
  List<GeometryDTO> files=new ArrayList<GeometryDTO>();
  List<InstanceAttributeDTO> attributes=new ArrayList<InstanceAttributeDTO>();
  for (  Geometry geometry : partI.getGeometries()) {
    files.add(mapper.map(geometry,GeometryDTO.class));
  }
  for (  InstanceAttribute attr : partI.getInstanceAttributes().values()) {
    attributes.add(mapper.map(attr,InstanceAttributeDTO.class));
  }
  for (  CADInstance instance : usageLink.getCadInstances()) {
    double atx=tx + getRelativeTxAfterParentRotation(rx,ry,rz,instance.getTx(),instance.getTy(),instance.getTz());
    double aty=ty + getRelativeTyAfterParentRotation(rx,ry,rz,instance.getTx(),instance.getTy(),instance.getTz());
    double atz=tz + getRelativeTzAfterParentRotation(rx,ry,rz,instance.getTx(),instance.getTy(),instance.getTz());
    double arx=rx + instance.getRx();
    double ary=ry + instance.getRy();
    double arz=rz + instance.getRz();
    instanceIds.add(instance.getId());
    String id=StringUtils.join(instanceIds.toArray(),"String_Node_Str");
    if (!partI.isAssembly() && partI.getGeometries().size() > 0 && filteredPath.isEmpty()) {
      if (getAddComma())       getEntityStream().write(getComma());
      getMarshaller().marshallToJSON(new InstanceDTO(id,partIterationId,atx,aty,atz,arx,ary,arz,files,attributes),getEntityStream());
      setAddComma(true);
    }
 else {
      for (      PartUsageLink component : partI.getComponents()) {
        ArrayList<Integer> copyInstanceIds=new ArrayList<Integer>(instanceIds);
        if (filteredPath.isEmpty()) {
          generateInstanceStream(component,atx,aty,atz,arx,ary,arz,filteredPath,copyInstanceIds);
        }
 else         if (component.getId() == filteredPath.get(0)) {
          ArrayList<Integer> copyWithoutCurrentId=new ArrayList<Integer>(filteredPath);
          copyWithoutCurrentId.remove(0);
          generateInstanceStream(component,atx,aty,atz,arx,ary,arz,copyWithoutCurrentId,copyInstanceIds);
        }
      }
    }
  }
}

Fixed version (ground truth):
private void generateInstanceStream(PartUsageLink usageLink,double tx,double ty,double tz,double rx,double ry,double rz,List<Integer> filteredPath,List<Integer> instanceIds) throws JAXBException, IOException {
  PartMaster pm=usageLink.getComponent();
  PartRevision partR=pm.getLastRevision();
  PartIteration partI=partR.getLastIteration();
  String partIterationId=new StringBuilder().append(pm.getNumber()).append("String_Node_Str").append(partR.getVersion()).append("String_Node_Str").append(partI.getIteration()).toString();
  List<GeometryDTO> files=new ArrayList<GeometryDTO>();
  List<InstanceAttributeDTO> attributes=new ArrayList<InstanceAttributeDTO>();
  for (  Geometry geometry : partI.getGeometries()) {
    files.add(mapper.map(geometry,GeometryDTO.class));
  }
  for (  InstanceAttribute attr : partI.getInstanceAttributes().values()) {
    attributes.add(mapper.map(attr,InstanceAttributeDTO.class));
  }
  for (  CADInstance instance : usageLink.getCadInstances()) {
    ArrayList<Integer> copyInstanceIds=new ArrayList<Integer>(instanceIds);
    if (instance.getId() != -1)     copyInstanceIds.add(instance.getId());
    double atx=tx + getRelativeTxAfterParentRotation(rx,ry,rz,instance.getTx(),instance.getTy(),instance.getTz());
    double aty=ty + getRelativeTyAfterParentRotation(rx,ry,rz,instance.getTx(),instance.getTy(),instance.getTz());
    double atz=tz + getRelativeTzAfterParentRotation(rx,ry,rz,instance.getTx(),instance.getTy(),instance.getTz());
    double arx=rx + instance.getRx();
    double ary=ry + instance.getRy();
    double arz=rz + instance.getRz();
    String id=StringUtils.join(copyInstanceIds.toArray(),"String_Node_Str");
    if (!partI.isAssembly() && partI.getGeometries().size() > 0 && filteredPath.isEmpty()) {
      if (getAddComma())       getEntityStream().write(getComma());
      getMarshaller().marshallToJSON(new InstanceDTO(id,partIterationId,atx,aty,atz,arx,ary,arz,files,attributes),getEntityStream());
      setAddComma(true);
    }
 else {
      for (      PartUsageLink component : partI.getComponents()) {
        ArrayList<Integer> copyInstanceIds2=new ArrayList<Integer>(copyInstanceIds);
        if (filteredPath.isEmpty()) {
          generateInstanceStream(component,atx,aty,atz,arx,ary,arz,filteredPath,copyInstanceIds2);
        }
 else         if (component.getId() == filteredPath.get(0)) {
          ArrayList<Integer> copyWithoutCurrentId=new ArrayList<Integer>(filteredPath);
          copyWithoutCurrentId.remove(0);
          generateInstanceStream(component,atx,aty,atz,arx,ary,arz,copyWithoutCurrentId,copyInstanceIds2);
        }
      }
    }
  }
}