Program: 23995
Project: 23995
Buggy source:
public void load(String rootDir,ImplementationGuideDefn igd,List<ValidationMessage> issues,Set<String> loadedIgs) throws Exception {
  logger.log("String_Node_Str" + igd.getName(),LogMessageType.Process);
  String myRoot=Utilities.path(rootDir,"String_Node_Str",igd.getCode());
  CSFile file=new CSFile(Utilities.path(rootDir,igd.getSource()));
  ImplementationGuide ig=(ImplementationGuide)new XmlParser().parse(new FileInputStream(file));
  if (!ig.getUrl().startsWith("String_Node_Str"))   throw new Exception("String_Node_Str");
  if (!ig.getUrl().equals("String_Node_Str" + ig.getId()))   throw new Exception("String_Node_Str");
  if (!ig.hasName())   throw new Exception("String_Node_Str");
  ig.setDateElement(new DateTimeType(genDate));
  igd.setName(ig.getName());
  igd.setIg(ig);
  Map<String,Resource> resources=new HashMap<String,Resource>();
  for (  ImplementationGuideDependencyComponent d : ig.getDependency()) {
    if (d.getType() != GuideDependencyType.REFERENCE)     throw new Exception("String_Node_Str" + ig.getName() + "String_Node_Str"+ d.getType().toCode());
    if (!loadedIgs.contains(d.getUri()))     throw new Exception("String_Node_Str" + ig.getName() + "String_Node_Str"+ d.getUri());
  }
  loadedIgs.add(ig.getUrl());
  for (  UriType bin : ig.getBinary()) {
    if (!new File(Utilities.path(myRoot,bin.getValue())).exists())     throw new Exception("String_Node_Str" + ig.getName() + "String_Node_Str"+ bin.getValue());
    igd.getImageList().add(bin.getValue());
  }
  processPage(ig.getPage(),igd);
  List<Example> exr=new ArrayList<Example>();
  for (  ImplementationGuidePackageComponent p : ig.getPackage()) {
    if (!p.hasName())     throw new Exception("String_Node_Str" + ig.getName());
    for (    ImplementationGuidePackageResourceComponent r : p.getResource()) {
      if (!r.hasSource())       throw new Exception("String_Node_Str" + p.getName() + "String_Node_Str"+ ig.getName());
      CSFile fn=new CSFile(Utilities.path(myRoot,r.getSourceUriType().getValue()));
      if (!fn.exists())       throw new Exception("String_Node_Str" + r.getSourceUriType().getValue() + "String_Node_Str"+ p.getName()+ "String_Node_Str"+ ig.getName()+ "String_Node_Str"+ fn.getAbsolutePath());
      String id=Utilities.changeFileExt(fn.getName(),"String_Node_Str");
      boolean isExample=r.getExample();
      ResourceType rt=null;
      try {
        rt=new XmlParser().parse(new FileInputStream(fn)).getResourceType();
      }
 catch (      Exception e) {
        rt=null;
        isExample=true;
      }
      if (isExample) {
        if (!r.hasName())         throw new Exception("String_Node_Str" + p.getName() + "String_Node_Str"+ ig.getName());
        Example example=new Example(r.getName(),id,r.getDescription(),fn,false,ExampleType.XmlFile,false);
        example.setIg(igd.getCode());
        if (r.hasExampleFor()) {
          example.setExampleFor(r.getExampleFor().getReference());
          example.setRegistered(true);
          exr.add(example);
        }
        igd.getExamples().add(example);
        r.setUserData(ToolResourceUtilities.NAME_RES_EXAMPLE,example);
        r.setSource(new UriType(example.getId() + "String_Node_Str"));
      }
 else       if (rt == ResourceType.ValueSet) {
        ValueSet vs=(ValueSet)new XmlParser().parse(new FileInputStream(fn));
        if (id.startsWith("String_Node_Str"))         id=id.substring(9);
        vs.setId(id);
        vs.setUrl("String_Node_Str" + id);
        vs.setUserData(ToolResourceUtilities.NAME_RES_IG,igd);
        vs.setUserData("String_Node_Str",igd.getPath() + "String_Node_Str" + id+ "String_Node_Str");
        vs.setUserData("String_Node_Str","String_Node_Str" + id);
        vs.setUserData("String_Node_Str",committee);
        new CodeSystemConvertor(codeSystems).convert(new XmlParser(),vs,fn.getAbsolutePath());
        igd.getValueSets().add(vs);
        if (!r.hasName())         r.setName(vs.getName());
        if (!r.hasDescription())         r.setDescription(vs.getDescription());
        r.setUserData(ToolResourceUtilities.RES_ACTUAL_RESOURCE,vs);
        r.setSource(new UriType(fn.getName()));
      }
 else       if (rt == ResourceType.StructureDefinition) {
        StructureDefinition sd;
        sd=(StructureDefinition)new XmlParser().parse(new CSFileInputStream(fn));
        new ProfileUtilities(context,null,pkp).setIds(sd,sd.getId());
        if (sd.getKind() == StructureDefinitionKind.LOGICAL) {
          fn=new CSFile(Utilities.path(myRoot,r.getSourceUriType().asStringValue()));
          LogicalModel lm=new LogicalModel(sd);
          lm.setSource(fn.getAbsolutePath());
          lm.setId(sd.getId());
          igd.getLogicalModels().add(lm);
        }
 else         if ("String_Node_Str".equals(sd.getBaseType())) {
          sd.setId(tail(sd.getUrl()));
          sd.setUserData(ToolResourceUtilities.NAME_RES_IG,igd.getCode());
          ToolResourceUtilities.updateUsage(sd,igd.getCode());
          this.context.seeExtensionDefinition("String_Node_Str",sd);
        }
 else {
          Profile pr=new Profile(igd.getCode());
          pr.setSource(fn.getAbsolutePath());
          pr.setTitle(sd.getName());
          if (!sd.hasId())           sd.setId(tail(sd.getUrl()));
          sd.setUrl("String_Node_Str" + sd.getId());
          pr.forceMetadata("String_Node_Str",sd.getId() + "String_Node_Str");
          pr.setSourceType(ConformancePackageSourceType.SturctureDefinition);
          ConstraintStructure cs=new ConstraintStructure(sd,igd);
          pr.getProfiles().add(cs);
          igd.getProfiles().add(pr);
        }
      }
 else       if (rt == ResourceType.Bundle) {
        Dictionary d=new Dictionary(id,r.getName(),igd.getCode(),fn.getAbsolutePath(),igd);
        igd.getDictionaries().add(d);
      }
 else       throw new Error("String_Node_Str" + rt.toString());
    }
    for (    Extension ex : p.getExtension()) {
      if (ex.getUrl().equals(ToolResourceUtilities.EXT_PROFILE_SPREADSHEET)) {
        String s=((UriType)ex.getValue()).getValue();
        File fn=new File(Utilities.path(myRoot,s));
        if (!fn.exists())         throw new Exception("String_Node_Str" + s + "String_Node_Str"+ p.getName()+ "String_Node_Str"+ ig.getName()+ "String_Node_Str");
        Profile pr=new Profile(igd.getCode());
        ex.setUserData(ToolResourceUtilities.NAME_RES_PROFILE,pr);
        pr.setSource(fn.getAbsolutePath());
        pr.setSourceType(ConformancePackageSourceType.Spreadsheet);
        SpreadsheetParser sparser=new SpreadsheetParser(pr.getCategory(),new CSFileInputStream(pr.getSource()),Utilities.noString(pr.getId()) ? pr.getSource() : pr.getId(),igd,rootDir,logger,registry,context.getVersion(),context,genDate,false,igd.getExtensions(),pkp,false,committee,mappings,profileIds,codeSystems);
        sparser.getBindings().putAll(commonBindings);
        sparser.setFolder(Utilities.getDirectoryForFile(pr.getSource()));
        sparser.parseConformancePackage(pr,null,Utilities.getDirectoryForFile(pr.getSource()),pr.getCategory(),issues);
        igd.getProfiles().add(pr);
        for (        BindingSpecification bs : sparser.getBindings().values()) {
          if (!commonBindings.containsValue(bs) && bs.getValueSet() != null) {
            ValueSet vs=bs.getValueSet();
            String path=vs.getUserString("String_Node_Str");
            path=path.substring(path.lastIndexOf("String_Node_Str") + 1);
            ig.getPackage().get(0).addResource().setName(vs.getName()).setDescription(vs.getDescription()).setSource(new UriType(path)).setUserData(ToolResourceUtilities.RES_ACTUAL_RESOURCE,vs);
          }
        }
        for (        ValueSet vs : sparser.getValuesets())         p.addResource().setExample(false).setName(vs.getName()).setDescription(vs.getDescription()).setSource(new UriType("String_Node_Str" + vs.getId() + "String_Node_Str")).setUserData(ToolResourceUtilities.RES_ACTUAL_RESOURCE,vs);
        for (        StructureDefinition exd : pr.getExtensions())         p.addResource().setExample(false).setName(exd.getName()).setDescription(exd.getDescription()).setSource(new UriType("String_Node_Str" + exd.getId().toLowerCase() + "String_Node_Str")).setUserData(ToolResourceUtilities.RES_ACTUAL_RESOURCE,exd);
        for (        ConstraintStructure cs : pr.getProfiles()) {
          cs.setResourceInfo(p.addResource());
          cs.getResourceInfo().setExample(false).setName(cs.getDefn().getName()).setDescription(cs.getDefn().getDefinition()).setSource(new UriType(cs.getId().toLowerCase() + "String_Node_Str"));
        }
      }
      if (ex.getUrl().equals(ToolResourceUtilities.EXT_LOGICAL_SPREADSHEET)) {
        File fn=new CSFile(Utilities.path(myRoot,((UriType)ex.getValue()).getValue()));
        String s=fn.getName();
        if (s.endsWith("String_Node_Str"))         s=s.substring(0,s.length() - 16);
        String id=igd.getCode() + "String_Node_Str" + s;
        SpreadsheetParser sparser=new SpreadsheetParser(igd.getCode(),new CSFileInputStream(fn),id,igd,rootDir,logger,registry,context.getVersion(),context,genDate,false,igd.getExtensions(),pkp,false,committee,mappings,profileIds,codeSystems);
        sparser.getBindings().putAll(commonBindings);
        sparser.setFolder(Utilities.getDirectoryForFile(fn.getAbsolutePath()));
        LogicalModel lm=sparser.parseLogicalModel();
        lm.setId(id);
        lm.setSource(fn.getAbsolutePath());
        lm.getResource().setName(lm.getId());
        igd.getLogicalModels().add(lm);
      }
    }
    ToolingExtensions.removeExtension(p,ToolResourceUtilities.EXT_PROFILE_SPREADSHEET);
    ToolingExtensions.removeExtension(p,ToolResourceUtilities.EXT_LOGICAL_SPREADSHEET);
  }
  for (  Example ex : exr) {
    Profile tp=null;
    for (    Profile pr : igd.getProfiles()) {
      if (("String_Node_Str" + pr.getId()).equals(ex.getExampleFor())) {
        tp=pr;
        break;
      }
 else       for (      ConstraintStructure cc : pr.getProfiles()) {
        if (("String_Node_Str" + cc.getId()).equals(ex.getExampleFor())) {
          tp=pr;
          break;
        }
      }
    }
    if (tp != null)     tp.getExamples().add(ex);
 else     throw new Exception("String_Node_Str" + ex.getExampleFor());
  }
  igd.numberPages();
}

Fixed version (ground truth):
public void load(String rootDir,ImplementationGuideDefn igd,List<ValidationMessage> issues,Set<String> loadedIgs) throws Exception {
  logger.log("String_Node_Str" + igd.getName(),LogMessageType.Process);
  String myRoot=Utilities.path(rootDir,"String_Node_Str",igd.getCode());
  CSFile file=new CSFile(Utilities.path(rootDir,igd.getSource()));
  ImplementationGuide ig=(ImplementationGuide)new XmlParser().parse(new FileInputStream(file));
  if (!ig.getUrl().startsWith("String_Node_Str"))   throw new Exception("String_Node_Str");
  if (!ig.getUrl().equals("String_Node_Str" + ig.getId()))   throw new Exception("String_Node_Str");
  if (!ig.hasName())   throw new Exception("String_Node_Str");
  ig.setDateElement(new DateTimeType(genDate));
  igd.setName(ig.getName());
  igd.setIg(ig);
  Map<String,Resource> resources=new HashMap<String,Resource>();
  for (  ImplementationGuideDependencyComponent d : ig.getDependency()) {
    if (d.getType() != GuideDependencyType.REFERENCE)     throw new Exception("String_Node_Str" + ig.getName() + "String_Node_Str"+ d.getType().toCode());
    if (!loadedIgs.contains(d.getUri()))     throw new Exception("String_Node_Str" + ig.getName() + "String_Node_Str"+ d.getUri());
  }
  loadedIgs.add(ig.getUrl());
  for (  UriType bin : ig.getBinary()) {
    if (!new File(Utilities.path(myRoot,bin.getValue())).exists())     throw new Exception("String_Node_Str" + ig.getName() + "String_Node_Str"+ bin.getValue());
    igd.getImageList().add(bin.getValue());
  }
  processPage(ig.getPage(),igd);
  List<Example> exr=new ArrayList<Example>();
  for (  ImplementationGuidePackageComponent p : ig.getPackage()) {
    if (!p.hasName())     throw new Exception("String_Node_Str" + ig.getName());
    for (    ImplementationGuidePackageResourceComponent r : p.getResource()) {
      if (!r.hasSource())       throw new Exception("String_Node_Str" + p.getName() + "String_Node_Str"+ ig.getName());
      CSFile fn=new CSFile(Utilities.path(myRoot,r.getSourceUriType().getValue()));
      if (!fn.exists())       throw new Exception("String_Node_Str" + r.getSourceUriType().getValue() + "String_Node_Str"+ p.getName()+ "String_Node_Str"+ ig.getName()+ "String_Node_Str"+ fn.getAbsolutePath());
      String id=Utilities.changeFileExt(fn.getName(),"String_Node_Str");
      boolean isExample=r.getExample();
      ResourceType rt=null;
      try {
        rt=new XmlParser().parse(new FileInputStream(fn)).getResourceType();
      }
 catch (      Exception e) {
        rt=null;
        isExample=true;
      }
      if (isExample) {
        if (!r.hasName())         throw new Exception("String_Node_Str" + p.getName() + "String_Node_Str"+ ig.getName());
        Example example=new Example(r.getName(),id,r.getDescription(),fn,false,ExampleType.XmlFile,false);
        example.setIg(igd.getCode());
        if (r.hasExampleFor()) {
          example.setExampleFor(r.getExampleFor().getReference());
          example.setRegistered(true);
          exr.add(example);
        }
        igd.getExamples().add(example);
        r.setUserData(ToolResourceUtilities.NAME_RES_EXAMPLE,example);
        r.setSource(new UriType(example.getId() + "String_Node_Str"));
      }
 else       if (rt == ResourceType.ValueSet) {
        ValueSet vs=(ValueSet)new XmlParser().parse(new FileInputStream(fn));
        if (id.startsWith("String_Node_Str"))         id=id.substring(9);
        vs.setId(id);
        vs.setUrl("String_Node_Str" + id);
        vs.setUserData(ToolResourceUtilities.NAME_RES_IG,igd);
        vs.setUserData("String_Node_Str",igd.getPath() + "String_Node_Str" + id+ "String_Node_Str");
        vs.setUserData("String_Node_Str","String_Node_Str" + id);
        vs.setUserData("String_Node_Str",committee);
        new CodeSystemConvertor(codeSystems).convert(new XmlParser(),vs,fn.getAbsolutePath());
        igd.getValueSets().add(vs);
        if (!r.hasName())         r.setName(vs.getName());
        if (!r.hasDescription())         r.setDescription(vs.getDescription());
        r.setUserData(ToolResourceUtilities.RES_ACTUAL_RESOURCE,vs);
        r.setSource(new UriType(fn.getName()));
      }
 else       if (rt == ResourceType.StructureDefinition) {
        StructureDefinition sd;
        sd=(StructureDefinition)new XmlParser().parse(new CSFileInputStream(fn));
        new ProfileUtilities(context,null,pkp).setIds(sd,sd.getId());
        if (sd.getKind() == StructureDefinitionKind.LOGICAL) {
          fn=new CSFile(Utilities.path(myRoot,r.getSourceUriType().asStringValue()));
          LogicalModel lm=new LogicalModel(sd);
          lm.setSource(fn.getAbsolutePath());
          lm.setId(sd.getId());
          igd.getLogicalModels().add(lm);
        }
 else         if ("String_Node_Str".equals(sd.getBaseType())) {
          sd.setId(tail(sd.getUrl()));
          sd.setUserData(ToolResourceUtilities.NAME_RES_IG,igd.getCode());
          ToolResourceUtilities.updateUsage(sd,igd.getCode());
          this.context.seeExtensionDefinition("String_Node_Str",sd);
        }
 else {
          Profile pr=new Profile(igd.getCode());
          pr.setSource(fn.getAbsolutePath());
          pr.setTitle(sd.getName());
          if (!sd.hasId())           sd.setId(tail(sd.getUrl()));
          pr.forceMetadata("String_Node_Str",sd.getId() + "String_Node_Str");
          pr.setSourceType(ConformancePackageSourceType.SturctureDefinition);
          ConstraintStructure cs=new ConstraintStructure(sd,igd);
          pr.getProfiles().add(cs);
          igd.getProfiles().add(pr);
        }
      }
 else       if (rt == ResourceType.Bundle) {
        Dictionary d=new Dictionary(id,r.getName(),igd.getCode(),fn.getAbsolutePath(),igd);
        igd.getDictionaries().add(d);
      }
 else       logger.log("String_Node_Str" + rt.toString(),LogMessageType.Process);
    }
    for (    Extension ex : p.getExtension()) {
      if (ex.getUrl().equals(ToolResourceUtilities.EXT_PROFILE_SPREADSHEET)) {
        String s=((UriType)ex.getValue()).getValue();
        File fn=new File(Utilities.path(myRoot,s));
        if (!fn.exists())         throw new Exception("String_Node_Str" + s + "String_Node_Str"+ p.getName()+ "String_Node_Str"+ ig.getName()+ "String_Node_Str");
        Profile pr=new Profile(igd.getCode());
        ex.setUserData(ToolResourceUtilities.NAME_RES_PROFILE,pr);
        pr.setSource(fn.getAbsolutePath());
        pr.setSourceType(ConformancePackageSourceType.Spreadsheet);
        SpreadsheetParser sparser=new SpreadsheetParser(pr.getCategory(),new CSFileInputStream(pr.getSource()),Utilities.noString(pr.getId()) ? pr.getSource() : pr.getId(),igd,rootDir,logger,registry,context.getVersion(),context,genDate,false,igd.getExtensions(),pkp,false,committee,mappings,profileIds,codeSystems);
        sparser.getBindings().putAll(commonBindings);
        sparser.setFolder(Utilities.getDirectoryForFile(pr.getSource()));
        sparser.parseConformancePackage(pr,null,Utilities.getDirectoryForFile(pr.getSource()),pr.getCategory(),issues);
        igd.getProfiles().add(pr);
        for (        BindingSpecification bs : sparser.getBindings().values()) {
          if (!commonBindings.containsValue(bs) && bs.getValueSet() != null) {
            ValueSet vs=bs.getValueSet();
            String path=vs.getUserString("String_Node_Str");
            path=path.substring(path.lastIndexOf("String_Node_Str") + 1);
            ig.getPackage().get(0).addResource().setName(vs.getName()).setDescription(vs.getDescription()).setSource(new UriType(path)).setUserData(ToolResourceUtilities.RES_ACTUAL_RESOURCE,vs);
          }
        }
        for (        ValueSet vs : sparser.getValuesets())         p.addResource().setExample(false).setName(vs.getName()).setDescription(vs.getDescription()).setSource(new UriType("String_Node_Str" + vs.getId() + "String_Node_Str")).setUserData(ToolResourceUtilities.RES_ACTUAL_RESOURCE,vs);
        for (        StructureDefinition exd : pr.getExtensions())         p.addResource().setExample(false).setName(exd.getName()).setDescription(exd.getDescription()).setSource(new UriType("String_Node_Str" + exd.getId().toLowerCase() + "String_Node_Str")).setUserData(ToolResourceUtilities.RES_ACTUAL_RESOURCE,exd);
        for (        ConstraintStructure cs : pr.getProfiles()) {
          cs.setResourceInfo(p.addResource());
          cs.getResourceInfo().setExample(false).setName(cs.getDefn().getName()).setDescription(cs.getDefn().getDefinition()).setSource(new UriType(cs.getId().toLowerCase() + "String_Node_Str"));
        }
      }
      if (ex.getUrl().equals(ToolResourceUtilities.EXT_LOGICAL_SPREADSHEET)) {
        File fn=new CSFile(Utilities.path(myRoot,((UriType)ex.getValue()).getValue()));
        String s=fn.getName();
        if (s.endsWith("String_Node_Str"))         s=s.substring(0,s.length() - 16);
        String id=igd.getCode() + "String_Node_Str" + s;
        SpreadsheetParser sparser=new SpreadsheetParser(igd.getCode(),new CSFileInputStream(fn),id,igd,rootDir,logger,registry,context.getVersion(),context,genDate,false,igd.getExtensions(),pkp,false,committee,mappings,profileIds,codeSystems);
        sparser.getBindings().putAll(commonBindings);
        sparser.setFolder(Utilities.getDirectoryForFile(fn.getAbsolutePath()));
        LogicalModel lm=sparser.parseLogicalModel();
        lm.setId(id);
        lm.setSource(fn.getAbsolutePath());
        lm.getResource().setName(lm.getId());
        igd.getLogicalModels().add(lm);
      }
    }
    ToolingExtensions.removeExtension(p,ToolResourceUtilities.EXT_PROFILE_SPREADSHEET);
    ToolingExtensions.removeExtension(p,ToolResourceUtilities.EXT_LOGICAL_SPREADSHEET);
  }
  for (  Example ex : exr) {
    Profile tp=null;
    for (    Profile pr : igd.getProfiles()) {
      if (("String_Node_Str" + pr.getId()).equals(ex.getExampleFor())) {
        tp=pr;
        break;
      }
 else       for (      ConstraintStructure cc : pr.getProfiles()) {
        if (("String_Node_Str" + cc.getId()).equals(ex.getExampleFor())) {
          tp=pr;
          break;
        }
      }
    }
    if (tp != null)     tp.getExamples().add(ex);
 else     throw new Exception("String_Node_Str" + ex.getExampleFor());
  }
  igd.numberPages();
}