Program: 23401
Project: 23401
Buggy source:
private void getChildTypesByName(String type,String name,TypeDetails result) throws PathEngineException, DefinitionException {
  if (Utilities.noString(type))   throw new PathEngineException("String_Node_Str");
  if (type.equals("String_Node_Str"))   return;
  String url=null;
  if (type.contains("String_Node_Str")) {
    url=type.substring(0,type.indexOf("String_Node_Str"));
  }
 else {
    url=type;
  }
  String tail="String_Node_Str";
  StructureDefinition sd=worker.fetchResource(StructureDefinition.class,url);
  if (sd == null)   throw new DefinitionException("String_Node_Str" + type);
  List<StructureDefinition> sdl=new ArrayList<StructureDefinition>();
  ElementDefinitionMatch m=null;
  if (type.contains("String_Node_Str"))   m=getElementDefinition(sd,type.substring(type.indexOf("String_Node_Str") + 1),false);
  if (m != null && hasDataType(m.definition)) {
    if (m.fixedType != null) {
      StructureDefinition dt=worker.fetchResource(StructureDefinition.class,"String_Node_Str" + m.fixedType);
      if (dt == null)       throw new DefinitionException("String_Node_Str" + m.fixedType);
      sdl.add(dt);
    }
 else     for (    TypeRefComponent t : m.definition.getType()) {
      StructureDefinition dt=worker.fetchResource(StructureDefinition.class,"String_Node_Str" + t.getCode());
      if (dt == null)       throw new DefinitionException("String_Node_Str" + t.getCode());
      sdl.add(dt);
    }
  }
 else {
    sdl.add(sd);
    if (type.contains("String_Node_Str")) {
      tail=type.substring(type.indexOf("String_Node_Str") + 1);
      tail=tail.substring(tail.indexOf("String_Node_Str"));
    }
  }
  for (  StructureDefinition sdi : sdl) {
    String path=sdi.getSnapshot().getElement().get(0).getPath() + tail + "String_Node_Str";
    if (name.equals("String_Node_Str")) {
      assert(result.getCollectionStatus() == CollectionStatus.UNORDERED);
      for (      ElementDefinition ed : sdi.getSnapshot().getElement()) {
        if (ed.getPath().startsWith(path))         for (        TypeRefComponent t : ed.getType()) {
          if (t.hasCode() && t.getCodeElement().hasValue()) {
            String tn=null;
            if (t.getCode().equals("String_Node_Str") || t.getCode().equals("String_Node_Str"))             tn=sdi.getType() + "String_Node_Str" + ed.getPath();
 else             tn=t.getCode();
            if (t.getCode().equals("String_Node_Str")) {
              for (              String rn : worker.getResourceNames()) {
                if (!result.hasType(worker,rn)) {
                  getChildTypesByName(result.addType(rn),"String_Node_Str",result);
                }
              }
            }
 else             if (!result.hasType(worker,tn)) {
              getChildTypesByName(result.addType(tn),"String_Node_Str",result);
            }
          }
        }
      }
    }
 else     if (name.equals("String_Node_Str")) {
      assert(result.getCollectionStatus() == CollectionStatus.UNORDERED);
      for (      ElementDefinition ed : sdi.getSnapshot().getElement()) {
        if (ed.getPath().startsWith(path) && !ed.getPath().substring(path.length()).contains("String_Node_Str"))         for (        TypeRefComponent t : ed.getType()) {
          if (t.getCode().equals("String_Node_Str") || t.getCode().equals("String_Node_Str"))           result.addType(sdi.getType() + "String_Node_Str" + ed.getPath());
 else           if (t.getCode().equals("String_Node_Str"))           result.addTypes(worker.getResourceNames());
 else           result.addType(t.getCode());
        }
      }
    }
 else {
      path=sdi.getSnapshot().getElement().get(0).getPath() + tail + "String_Node_Str"+ name;
      ElementDefinitionMatch ed=getElementDefinition(sdi,path,false);
      if (ed != null) {
        if (!Utilities.noString(ed.getFixedType()))         result.addType(ed.getFixedType());
 else         for (        TypeRefComponent t : ed.getDefinition().getType()) {
          if (Utilities.noString(t.getCode()))           break;
          if (t.hasProfile())           result.addType(t.getProfile());
          if (t.getCode().equals("String_Node_Str") || t.getCode().equals("String_Node_Str"))           result.addType(sdi.getUrl() + "String_Node_Str" + path);
 else           if (t.getCode().equals("String_Node_Str"))           result.addTypes(worker.getResourceNames());
 else           result.addType(t.getCode());
        }
      }
    }
  }
}

Fixed version (ground truth):
private void getChildTypesByName(String type,String name,TypeDetails result) throws PathEngineException, DefinitionException {
  if (Utilities.noString(type))   throw new PathEngineException("String_Node_Str");
  if (type.equals("String_Node_Str"))   return;
  String url=null;
  if (type.contains("String_Node_Str")) {
    url=type.substring(0,type.indexOf("String_Node_Str"));
  }
 else {
    url=type;
  }
  String tail="String_Node_Str";
  StructureDefinition sd=worker.fetchResource(StructureDefinition.class,url);
  if (sd == null)   throw new DefinitionException("String_Node_Str" + type);
  List<StructureDefinition> sdl=new ArrayList<StructureDefinition>();
  ElementDefinitionMatch m=null;
  if (type.contains("String_Node_Str"))   m=getElementDefinition(sd,type.substring(type.indexOf("String_Node_Str") + 1),false);
  if (m != null && hasDataType(m.definition)) {
    if (m.fixedType != null) {
      StructureDefinition dt=worker.fetchResource(StructureDefinition.class,"String_Node_Str" + m.fixedType);
      if (dt == null)       throw new DefinitionException("String_Node_Str" + m.fixedType);
      sdl.add(dt);
    }
 else     for (    TypeRefComponent t : m.definition.getType()) {
      StructureDefinition dt=worker.fetchResource(StructureDefinition.class,"String_Node_Str" + t.getCode());
      if (dt == null)       throw new DefinitionException("String_Node_Str" + t.getCode());
      sdl.add(dt);
    }
  }
 else {
    sdl.add(sd);
    if (type.contains("String_Node_Str")) {
      tail=type.substring(type.indexOf("String_Node_Str") + 1);
      tail=tail.substring(tail.indexOf("String_Node_Str"));
    }
  }
  for (  StructureDefinition sdi : sdl) {
    String path=sdi.getSnapshot().getElement().get(0).getPath() + tail + "String_Node_Str";
    if (name.equals("String_Node_Str")) {
      assert(result.getCollectionStatus() == CollectionStatus.UNORDERED);
      for (      ElementDefinition ed : sdi.getSnapshot().getElement()) {
        if (ed.getPath().startsWith(path))         for (        TypeRefComponent t : ed.getType()) {
          if (t.hasCode() && t.getCodeElement().hasValue()) {
            String tn=null;
            if (t.getCode().equals("String_Node_Str") || t.getCode().equals("String_Node_Str"))             tn=sdi.getType() + "String_Node_Str" + ed.getPath();
 else             tn=t.getCode();
            if (t.getCode().equals("String_Node_Str")) {
              for (              String rn : worker.getResourceNames()) {
                if (!result.hasType(worker,rn)) {
                  getChildTypesByName(result.addType(rn),"String_Node_Str",result);
                }
              }
            }
 else             if (!result.hasType(worker,tn)) {
              getChildTypesByName(result.addType(tn),"String_Node_Str",result);
            }
          }
        }
      }
    }
 else     if (name.equals("String_Node_Str")) {
      assert(result.getCollectionStatus() == CollectionStatus.UNORDERED);
      for (      ElementDefinition ed : sdi.getSnapshot().getElement()) {
        if (ed.getPath().startsWith(path) && !ed.getPath().substring(path.length()).contains("String_Node_Str"))         for (        TypeRefComponent t : ed.getType()) {
          if (t.getCode().equals("String_Node_Str") || t.getCode().equals("String_Node_Str"))           result.addType(sdi.getType() + "String_Node_Str" + ed.getPath());
 else           if (t.getCode().equals("String_Node_Str"))           result.addTypes(worker.getResourceNames());
 else           result.addType(t.getCode());
        }
      }
    }
 else {
      path=sdi.getSnapshot().getElement().get(0).getPath() + tail + "String_Node_Str"+ name;
      ElementDefinitionMatch ed=getElementDefinition(sdi,path,false);
      if (ed != null) {
        if (!Utilities.noString(ed.getFixedType()))         result.addType(ed.getFixedType());
 else         for (        TypeRefComponent t : ed.getDefinition().getType()) {
          if (Utilities.noString(t.getCode()))           break;
          if (t.hasProfile() && !t.getCode().equals("String_Node_Str"))           result.addType(t.getProfile());
          if (t.getCode().equals("String_Node_Str") || t.getCode().equals("String_Node_Str"))           result.addType(sdi.getUrl() + "String_Node_Str" + path);
 else           if (t.getCode().equals("String_Node_Str"))           result.addTypes(worker.getResourceNames());
 else           result.addType(t.getCode());
        }
      }
    }
  }
}