Program: 978
Project: 978
Buggy source:
public BlockManagerImpl(WorldAtlas atlas,List<String> registeredBlockFamilies,Map<String,Short> knownBlockMappings,boolean generateNewIds,BlockFamilyFactoryRegistry blockFamilyFactoryRegistry){
  this.generateNewIds=generateNewIds;
  this.moduleManager=CoreRegistry.get(ModuleManager.class);
  blockLoader=new BlockLoader(CoreRegistry.get(AssetManager.class),blockFamilyFactoryRegistry,atlas);
  BlockLoader.LoadBlockDefinitionResults blockDefinitions=blockLoader.loadBlockDefinitions();
  addBlockFamily(getAirFamily(),true);
  for (  BlockFamily family : blockDefinitions.families) {
    addBlockFamily(family,false);
  }
  for (  FreeformFamily freeformFamily : blockDefinitions.shapelessDefinitions) {
    addFreeformBlockFamily(freeformFamily.uri,freeformFamily.categories);
  }
  if (knownBlockMappings.size() >= MAX_ID) {
    nextId=UNKNOWN_ID;
  }
 else   if (knownBlockMappings.size() > 0) {
    nextId=(byte)knownBlockMappings.size();
  }
  for (  String rawFamilyUri : registeredBlockFamilies) {
    BlockUri familyUri=new BlockUri(rawFamilyUri);
    BlockFamily family;
    if (isFreeformFamily(familyUri)) {
      family=blockLoader.loadWithShape(familyUri);
    }
 else {
      family=getAvailableBlockFamily(familyUri);
    }
    if (family != null) {
      for (      Block block : family.getBlocks()) {
        Short id=knownBlockMappings.get(block.getURI().toString());
        if (id != null) {
          block.setId(id);
        }
 else {
          logger.error("String_Node_Str",block.getURI(),family.getURI());
          if (generateNewIds) {
            block.setId(getNextId());
          }
 else {
            block.setId(UNKNOWN_ID);
          }
        }
      }
      registerFamily(family);
    }
 else {
      logger.error("String_Node_Str",rawFamilyUri);
    }
  }
}

Fixed version (ground truth):
public BlockManagerImpl(WorldAtlas atlas,List<String> registeredBlockFamilies,Map<String,Short> knownBlockMappings,boolean generateNewIds,BlockFamilyFactoryRegistry blockFamilyFactoryRegistry){
  this.generateNewIds=generateNewIds;
  this.moduleManager=CoreRegistry.get(ModuleManager.class);
  blockLoader=new BlockLoader(CoreRegistry.get(AssetManager.class),blockFamilyFactoryRegistry,atlas);
  BlockLoader.LoadBlockDefinitionResults blockDefinitions=blockLoader.loadBlockDefinitions();
  addBlockFamily(getAirFamily(),true);
  for (  BlockFamily family : blockDefinitions.families) {
    addBlockFamily(family,false);
  }
  for (  FreeformFamily freeformFamily : blockDefinitions.shapelessDefinitions) {
    addFreeformBlockFamily(freeformFamily.uri,freeformFamily.categories);
  }
  if (knownBlockMappings.size() >= MAX_ID) {
    nextId=UNKNOWN_ID;
  }
 else   if (knownBlockMappings.size() > 0) {
    nextId=(short)knownBlockMappings.size();
  }
  for (  String rawFamilyUri : registeredBlockFamilies) {
    BlockUri familyUri=new BlockUri(rawFamilyUri);
    BlockFamily family;
    if (isFreeformFamily(familyUri)) {
      family=blockLoader.loadWithShape(familyUri);
    }
 else {
      family=getAvailableBlockFamily(familyUri);
    }
    if (family != null) {
      for (      Block block : family.getBlocks()) {
        Short id=knownBlockMappings.get(block.getURI().toString());
        if (id != null) {
          block.setId(id);
        }
 else {
          logger.error("String_Node_Str",block.getURI(),family.getURI());
          if (generateNewIds) {
            block.setId(getNextId());
          }
 else {
            block.setId(UNKNOWN_ID);
          }
        }
      }
      registerFamily(family);
    }
 else {
      logger.error("String_Node_Str",rawFamilyUri);
    }
  }
}