Program: 16464
Project: 16464
Buggy source:
private static int testVersion(String ecodVersion) throws IOException {
  EcodDatabase ecod=EcodFactory.getEcodDatabase(ecodVersion);
  AtomCache cache=new AtomCache();
  cache.setObsoleteBehavior(ObsoleteBehavior.FETCH_OBSOLETE);
  List<EcodDomain> domains=ecod.getAllDomains();
  int errors=0;
  for (  EcodDomain d : domains) {
    Atom[] ca1;
    Structure struct;
    try {
      struct=cache.getStructure(d.getPdbId());
      ca1=StructureTools.getRepresentativeAtomArray(struct);
    }
 catch (    IOException e) {
      logger.error("String_Node_Str" + d.getDomainId(),e);
      errors++;
      continue;
    }
catch (    StructureException e) {
      logger.error("String_Node_Str" + d.getDomainId(),e);
      errors++;
      continue;
    }
    String rangeStr=d.getRange();
    AtomPositionMap map=new AtomPositionMap(ca1);
    List<? extends ResidueRange> ranges;
    try {
      ranges=ResidueRange.parseMultiple(rangeStr);
    }
 catch (    Exception e) {
      logger.error("String_Node_Str" + d.getPdbId() + "String_Node_Str"+ d.getRange(),e);
      errors++;
      continue;
    }
    boolean clean=true;
    for (    ResidueRange r : ranges) {
      if (r == null) {
        clean=false;
      }
    }
    if (!clean) {
      logger.error("String_Node_Str",d.getPdbId(),d.getRange());
      errors++;
      continue;
    }
    for (    ResidueRange range : ranges) {
      try {
        Integer start=map.getPosition(range.getStart());
        if (start == null) {
          Group g=struct.getChainByPDB(range.getStart().getChainId()).getGroupByPDB(range.getStart());
          if (g != null) {
            logger.warn("String_Node_Str" + d.getDomainId() + "String_Node_Str"+ range);
            clean=false;
          }
 else {
            logger.error("String_Node_Str" + d.getDomainId() + "String_Node_Str"+ range.toString());
            clean=false;
          }
        }
      }
 catch (      Exception e) {
        logger.error("String_Node_Str" + d.getDomainId() + "String_Node_Str"+ range.toString(),e);
        clean=false;
      }
      try {
        Integer end=map.getPosition(range.getEnd());
        if (end == null) {
          Group g=null;
          try {
            g=struct.getChainByPDB(range.getEnd().getChainId()).getGroupByPDB(range.getEnd());
          }
 catch (          StructureException e) {
          }
          if (g != null) {
            logger.warn("String_Node_Str" + d.getDomainId() + "String_Node_Str"+ range);
            clean=false;
          }
 else {
            logger.error("String_Node_Str" + d.getDomainId() + "String_Node_Str"+ range.toString());
            clean=false;
          }
        }
      }
 catch (      Exception e) {
        logger.error("String_Node_Str" + d.getDomainId() + "String_Node_Str"+ range.toString(),e);
        clean=false;
      }
    }
    try {
      ranges=ResidueRangeAndLength.parseMultiple(rangeStr,map);
    }
 catch (    Exception e) {
      logger.error("String_Node_Str" + d.getPdbId() + "String_Node_Str"+ d.getRange(),e);
      errors++;
      continue;
    }
    clean=true;
    for (    ResidueRange r : ranges) {
      if (r == null) {
        clean=false;
      }
    }
    if (!clean) {
      logger.error("String_Node_Str",d.getPdbId(),d.getRange());
      errors++;
      continue;
    }
    String pdbRangeStr=String.format("String_Node_Str",d.getPdbId(),d.getRange());
    try {
      cache.getStructure(pdbRangeStr);
    }
 catch (    Exception e) {
      logger.error("String_Node_Str" + pdbRangeStr,e);
      errors++;
      continue;
    }
    logger.info("String_Node_Str" + d.getDomainId());
  }
  return errors;
}

Fixed version (ground truth):
private static int testVersion(String ecodVersion) throws IOException {
  EcodDatabase ecod=EcodFactory.getEcodDatabase(ecodVersion);
  AtomCache cache=new AtomCache();
  cache.setObsoleteBehavior(ObsoleteBehavior.FETCH_OBSOLETE);
  List<EcodDomain> domains=ecod.getAllDomains();
  int errors=0;
  for (  EcodDomain d : domains) {
    Atom[] ca1;
    Structure struct;
    try {
      struct=cache.getStructure(d.getPdbId());
      ca1=StructureTools.getRepresentativeAtomArray(struct);
    }
 catch (    IOException e) {
      logger.error("String_Node_Str" + d.getDomainId(),e);
      errors++;
      continue;
    }
catch (    StructureException e) {
      logger.error("String_Node_Str" + d.getDomainId(),e);
      errors++;
      continue;
    }
    String rangeStr=d.getRange();
    AtomPositionMap map=new AtomPositionMap(ca1);
    List<? extends ResidueRange> ranges;
    try {
      ranges=ResidueRange.parseMultiple(rangeStr);
    }
 catch (    Exception e) {
      logger.error("String_Node_Str" + d.getPdbId() + "String_Node_Str"+ d.getRange(),e);
      errors++;
      continue;
    }
    boolean clean=true;
    for (    ResidueRange r : ranges) {
      if (r == null) {
        clean=false;
      }
    }
    if (!clean) {
      logger.error("String_Node_Str",d.getPdbId(),d.getRange());
      errors++;
      continue;
    }
    for (    ResidueRange range : ranges) {
      try {
        Integer start=map.getPosition(range.getStart());
        if (start == null) {
          Group g=struct.getChainByPDB(range.getStart().getChainName()).getGroupByPDB(range.getStart());
          if (g != null) {
            logger.warn("String_Node_Str" + d.getDomainId() + "String_Node_Str"+ range);
            clean=false;
          }
 else {
            logger.error("String_Node_Str" + d.getDomainId() + "String_Node_Str"+ range.toString());
            clean=false;
          }
        }
      }
 catch (      Exception e) {
        logger.error("String_Node_Str" + d.getDomainId() + "String_Node_Str"+ range.toString(),e);
        clean=false;
      }
      try {
        Integer end=map.getPosition(range.getEnd());
        if (end == null) {
          Group g=null;
          try {
            g=struct.getChainByPDB(range.getEnd().getChainName()).getGroupByPDB(range.getEnd());
          }
 catch (          StructureException e) {
          }
          if (g != null) {
            logger.warn("String_Node_Str" + d.getDomainId() + "String_Node_Str"+ range);
            clean=false;
          }
 else {
            logger.error("String_Node_Str" + d.getDomainId() + "String_Node_Str"+ range.toString());
            clean=false;
          }
        }
      }
 catch (      Exception e) {
        logger.error("String_Node_Str" + d.getDomainId() + "String_Node_Str"+ range.toString(),e);
        clean=false;
      }
    }
    try {
      ranges=ResidueRangeAndLength.parseMultiple(rangeStr,map);
    }
 catch (    Exception e) {
      logger.error("String_Node_Str" + d.getPdbId() + "String_Node_Str"+ d.getRange(),e);
      errors++;
      continue;
    }
    clean=true;
    for (    ResidueRange r : ranges) {
      if (r == null) {
        clean=false;
      }
    }
    if (!clean) {
      logger.error("String_Node_Str",d.getPdbId(),d.getRange());
      errors++;
      continue;
    }
    String pdbRangeStr=String.format("String_Node_Str",d.getPdbId(),d.getRange());
    try {
      cache.getStructure(pdbRangeStr);
    }
 catch (    Exception e) {
      logger.error("String_Node_Str" + pdbRangeStr,e);
      errors++;
      continue;
    }
    logger.info("String_Node_Str" + d.getDomainId());
  }
  return errors;
}