Program: 161263
Project: 161263
Buggy source:
private void importObjects(final File dumpFile) throws IOException {
  grsSource.handleObjects(dumpFile,new ObjectHandler(){
    @Override public void handle(    final List<String> lines){
      final String rpslObjectString=LINE_JOINER.join(lines);
      final RpslObjectBase rpslObject;
      try {
        rpslObject=RpslObjectBase.parse(rpslObjectString);
      }
 catch (      RuntimeException e) {
        logger.warn("String_Node_Str",rpslObjectString);
        return;
      }
      handle(rpslObject);
    }
    @Override public void handle(    final RpslObjectBase rpslObjectBase){
      if (rpslObjectBase.getType() == null) {
        logger.debug("String_Node_Str",rpslObjectBase);
        nrIgnored++;
      }
 else {
        final ObjectMessages messages=new ObjectMessages();
        final RpslObject filteredObject=new RpslObject(filterObject(rpslObjectBase));
        final RpslObject rpslObject=sanitizer.sanitize(filteredObject,messages);
        final RpslAttribute typeAttribute=rpslObject.getTypeAttribute();
        typeAttribute.validateSyntax(rpslObject.getType(),messages);
        if (messages.hasErrors()) {
          logger.debug("String_Node_Str",typeAttribute,messages);
          nrIgnored++;
        }
 else         if (resourceData.isMaintainedInRirSpace(rpslObject)) {
          createOrUpdate(rpslObject);
        }
      }
      nrHandled++;
      if (nrHandled % LOG_EVERY_NR_HANDLED == 0) {
        logger.debug("String_Node_Str",nrHandled);
      }
    }
    private RpslObjectBase filterObject(    final RpslObjectBase rpslObject){
      final RpslAttribute sourceAttribute=new RpslAttribute(AttributeType.SOURCE,grsSource.getSource());
      final ObjectTemplate objectTemplate=ObjectTemplate.getTemplate(rpslObject.getType());
      final Set<AttributeType> attributeTypes=objectTemplate.getAllAttributes();
      final List<RpslAttribute> attributes=rpslObject.getAttributes();
      final List<RpslAttribute> newAttributes=Lists.newArrayListWithExpectedSize(attributes.size());
      final Set<AttributeType> newAttributeTypes=Sets.newHashSet();
      for (      final RpslAttribute attribute : attributes) {
        final AttributeType attributeType=attribute.getType();
        if (attributeType == null || !attributeTypes.contains(attributeType)) {
          logger.debug("String_Node_Str",rpslObject.getFormattedKey(),attribute);
          continue;
        }
        newAttributeTypes.add(attributeType);
        if (attributeType.equals(AttributeType.SOURCE)) {
          newAttributes.add(sourceAttribute);
        }
 else {
          newAttributes.add(attribute);
        }
      }
      if (!newAttributeTypes.contains(AttributeType.SOURCE)) {
        newAttributes.add(sourceAttribute);
      }
      return new RpslObjectBase(newAttributes);
    }
    private void createOrUpdate(    final RpslObject importedObject){
      final GrsObjectInfo grsObjectInfo=grsSource.getDao().find(importedObject.getKey().toString(),importedObject.getType());
      if (grsObjectInfo == null) {
        create(importedObject);
      }
 else {
        currentObjectIds.remove(grsObjectInfo.getObjectId());
        if (!grsObjectInfo.getRpslObject().equals(importedObject)) {
          update(importedObject,grsObjectInfo);
        }
      }
    }
    private void create(    final RpslObject importedObject){
      final GrsDao.UpdateResult updateResult=grsSource.getDao().createObject(importedObject);
      if (updateResult.hasMissingReferences()) {
        incompletelyIndexedObjectIds.add(updateResult.getObjectId());
      }
      nrCreated++;
    }
    private void update(    final RpslObject importedObject,    final GrsObjectInfo grsObjectInfo){
      final GrsDao.UpdateResult updateResult=grsSource.getDao().updateObject(grsObjectInfo,importedObject);
      if (updateResult.hasMissingReferences()) {
        incompletelyIndexedObjectIds.add(updateResult.getObjectId());
      }
      nrUpdated++;
    }
  }
);
}

Fixed version (ground truth):
private void importObjects(final File dumpFile) throws IOException {
  grsSource.handleObjects(dumpFile,new ObjectHandler(){
    @Override public void handle(    final List<String> lines){
      final String rpslObjectString=LINE_JOINER.join(lines);
      final RpslObjectBase rpslObject;
      try {
        rpslObject=RpslObjectBase.parse(rpslObjectString);
      }
 catch (      RuntimeException e) {
        logger.warn("String_Node_Str",rpslObjectString);
        return;
      }
      handle(rpslObject);
    }
    @Override public void handle(    final RpslObjectBase rpslObjectBase){
      if (rpslObjectBase.getType() == null) {
        logger.debug("String_Node_Str",rpslObjectBase);
        nrIgnored++;
      }
 else {
        final ObjectMessages messages=new ObjectMessages();
        final RpslObject filteredObject=new RpslObject(filterObject(rpslObjectBase));
        final RpslObject rpslObject=sanitizer.sanitize(filteredObject,messages);
        final RpslAttribute typeAttribute=rpslObject.getTypeAttribute();
        typeAttribute.validateSyntax(rpslObject.getType(),messages);
        if (messages.hasErrors()) {
          logger.debug("String_Node_Str",typeAttribute,messages);
          nrIgnored++;
        }
 else         if (resourceData.isMaintainedInRirSpace(rpslObject)) {
          createOrUpdate(rpslObject);
        }
      }
      nrHandled++;
      if (nrHandled % LOG_EVERY_NR_HANDLED == 0) {
        logger.debug("String_Node_Str",nrHandled);
      }
    }
    private RpslObjectBase filterObject(    final RpslObjectBase rpslObject){
      final RpslAttribute sourceAttribute=new RpslAttribute(AttributeType.SOURCE,grsSource.getSource());
      final ObjectTemplate objectTemplate=ObjectTemplate.getTemplate(rpslObject.getType());
      final Set<AttributeType> attributeTypes=objectTemplate.getAllAttributes();
      final List<RpslAttribute> attributes=rpslObject.getAttributes();
      final List<RpslAttribute> newAttributes=Lists.newArrayListWithExpectedSize(attributes.size());
      final Set<AttributeType> newAttributeTypes=Sets.newHashSet();
      for (      final RpslAttribute attribute : attributes) {
        final AttributeType attributeType=attribute.getType();
        if (attributeType == null || !attributeTypes.contains(attributeType)) {
          logger.debug("String_Node_Str",rpslObject.getFormattedKey(),attribute);
          continue;
        }
        newAttributeTypes.add(attributeType);
        if (attributeType.equals(AttributeType.SOURCE)) {
          newAttributes.add(sourceAttribute);
        }
 else {
          newAttributes.add(attribute);
        }
      }
      if (!newAttributeTypes.contains(AttributeType.SOURCE)) {
        newAttributes.add(sourceAttribute);
      }
      return new RpslObjectBase(newAttributes);
    }
    private void createOrUpdate(    final RpslObject importedObject){
      final String pkey=importedObject.getKey().toString();
      final ObjectType type=importedObject.getType();
      final GrsObjectInfo grsObjectInfo=grsSource.getDao().find(pkey,type);
      if (grsObjectInfo == null) {
        if (type == ObjectType.PERSON && grsSource.getDao().find(pkey,ObjectType.ROLE) != null) {
          return;
        }
        if (type == ObjectType.ROLE && grsSource.getDao().find(pkey,ObjectType.PERSON) != null) {
          return;
        }
        create(importedObject);
      }
 else {
        currentObjectIds.remove(grsObjectInfo.getObjectId());
        if (!grsObjectInfo.getRpslObject().equals(importedObject)) {
          update(importedObject,grsObjectInfo);
        }
      }
    }
    private void create(    final RpslObject importedObject){
      final GrsDao.UpdateResult updateResult=grsSource.getDao().createObject(importedObject);
      if (updateResult.hasMissingReferences()) {
        incompletelyIndexedObjectIds.add(updateResult.getObjectId());
      }
      nrCreated++;
    }
    private void update(    final RpslObject importedObject,    final GrsObjectInfo grsObjectInfo){
      final GrsDao.UpdateResult updateResult=grsSource.getDao().updateObject(grsObjectInfo,importedObject);
      if (updateResult.hasMissingReferences()) {
        incompletelyIndexedObjectIds.add(updateResult.getObjectId());
      }
      nrUpdated++;
    }
  }
);
}