nus-yam/ex-repair huggingface dataset:
Program: 878
Project: 878
Buggy source:
public ModuleManager(){
  metadataReader=new ModuleMetadataReader();
  metadataReader.registerExtension(SERVER_SIDE_ONLY_EXT,Boolean.TYPE);
  metadataReader.registerExtension(IS_GAMEPLAY_EXT,Boolean.TYPE);
  metadataReader.registerExtension(DEFAULT_WORLD_GENERATOR_EXT,String.class);
  Module engineModule;
  try (Reader reader=new InputStreamReader(getClass().getResourceAsStream("String_Node_Str"))){
    ModuleMetadata metadata=metadataReader.read(reader);
    engineModule=ClasspathModule.create(metadata,getClass(),Module.class);
  }
 catch (  IOException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
catch (  URISyntaxException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
  registry=new TableModuleRegistry();
  registry.add(engineModule);
  ModulePathScanner scanner=new ModulePathScanner(new ModuleLoader(metadataReader));
  scanner.getModuleLoader().setModuleInfoPath(TerasologyConstants.MODULE_INFO_FILENAME);
  scanner.scan(registry,PathManager.getInstance().getModulePaths());
  setupSandbox();
  loadEnvironment(Sets.newHashSet(engineModule),true);
}

Fixed version (ground truth):
public ModuleManager(){
  metadataReader=new ModuleMetadataReader();
  metadataReader.registerExtension(SERVER_SIDE_ONLY_EXT,Boolean.TYPE);
  metadataReader.registerExtension(IS_GAMEPLAY_EXT,Boolean.TYPE);
  metadataReader.registerExtension(DEFAULT_WORLD_GENERATOR_EXT,String.class);
  Module engineModule;
  try (Reader reader=new InputStreamReader(getClass().getResourceAsStream("String_Node_Str"),TerasologyConstants.CHARSET)){
    ModuleMetadata metadata=metadataReader.read(reader);
    engineModule=ClasspathModule.create(metadata,getClass(),Module.class);
  }
 catch (  IOException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
catch (  URISyntaxException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
  registry=new TableModuleRegistry();
  registry.add(engineModule);
  ModulePathScanner scanner=new ModulePathScanner(new ModuleLoader(metadataReader));
  scanner.getModuleLoader().setModuleInfoPath(TerasologyConstants.MODULE_INFO_FILENAME);
  scanner.scan(registry,PathManager.getInstance().getModulePaths());
  setupSandbox();
  loadEnvironment(Sets.newHashSet(engineModule),true);
}
Program: 879
Project: 879
Buggy source:
private String getPlayerNameFromCharacter(EntityRef character){
  CharacterComponent characterComponent=character.getComponent(CharacterComponent.class);
  if (characterComponent == null) {
    return "String_Node_Str";
  }
  EntityRef controller=characterComponent.controller;
  ClientComponent clientComponent=controller.getComponent(ClientComponent.class);
  if (characterComponent == null) {
    return "String_Node_Str";
  }
  EntityRef clientInfo=clientComponent.clientInfo;
  DisplayNameComponent displayNameComponent=clientInfo.getComponent(DisplayNameComponent.class);
  if (displayNameComponent == null) {
    return "String_Node_Str";
  }
  return displayNameComponent.name;
}

Fixed version (ground truth):
private String getPlayerNameFromCharacter(EntityRef character){
  CharacterComponent characterComponent=character.getComponent(CharacterComponent.class);
  if (characterComponent == null) {
    return "String_Node_Str";
  }
  EntityRef controller=characterComponent.controller;
  ClientComponent clientComponent=controller.getComponent(ClientComponent.class);
  EntityRef clientInfo=clientComponent.clientInfo;
  DisplayNameComponent displayNameComponent=clientInfo.getComponent(DisplayNameComponent.class);
  if (displayNameComponent == null) {
    return "String_Node_Str";
  }
  return displayNameComponent.name;
}
Program: 881
Project: 881
Buggy source:
/** 
 * @return Real time in milliseconds.
 */
long getRealTimeInMs();

Fixed version (ground truth):
/** 
 * There is no variant of this method that returns seconds because the values can become to large to represent the as float with the necessary precision.
 * @return Real time in milliseconds.
 */
long getRealTimeInMs();
Program: 884
Project: 884
Buggy source:
@Override public boolean equals(Object o){
  if (this == o)   return true;
  if (o == null || getClass() != o.getClass())   return false;
  ImmutableBlockLocation that=(ImmutableBlockLocation)o;
  if (x != that.x)   return false;
  if (y != that.y)   return false;
  if (z != that.z)   return false;
  return true;
}

Fixed version (ground truth):
@Override public boolean equals(Object o){
  if (this == o) {
    return true;
  }
  if (o == null || getClass() != o.getClass()) {
    return false;
  }
  ImmutableBlockLocation that=(ImmutableBlockLocation)o;
  if (x != that.x) {
    return false;
  }
  if (y != that.y) {
    return false;
  }
  if (z != that.z) {
    return false;
  }
  return true;
}
Program: 885
Project: 885
Buggy source:
private boolean isSavingNecessary(){
  ChunkProvider chunkProvider=CoreRegistry.get(ChunkProvider.class);
  int unloadedChunkCount=unloadedAndUnsavedChunkMap.size();
  int loadedChunkCount=chunkProvider.getAllChunks().size();
  double totalChunkCount=unloadedChunkCount + loadedChunkCount;
  double percentageUnloaded=100.0 * (unloadedChunkCount / (double)totalChunkCount);
  if (percentageUnloaded >= config.getSystem().getMaxUnloadedChunksPercentageTillSave()) {
    return true;
  }
  long currentTime=System.currentTimeMillis();
  if (nextAutoSave == null) {
    scheduleNextAutoSave();
    return false;
  }
  if (currentTime >= nextAutoSave) {
    return true;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
private boolean isSavingNecessary(){
  ChunkProvider chunkProvider=CoreRegistry.get(ChunkProvider.class);
  int unloadedChunkCount=unloadedAndUnsavedChunkMap.size();
  int loadedChunkCount=chunkProvider.getAllChunks().size();
  double totalChunkCount=unloadedChunkCount + loadedChunkCount;
  double percentageUnloaded=100.0 * unloadedChunkCount / totalChunkCount;
  if (percentageUnloaded >= config.getSystem().getMaxUnloadedChunksPercentageTillSave()) {
    return true;
  }
  long currentTime=System.currentTimeMillis();
  if (nextAutoSave == null) {
    scheduleNextAutoSave();
    return false;
  }
  if (currentTime >= nextAutoSave) {
    return true;
  }
 else {
    return false;
  }
}
Program: 886
Project: 886
Buggy source:
/** 
 * @param unsavedEntities currently loaded persistent entities without owner that have not been saved yet.
 */
private void addGlobalStoreToSaveTransaction(SaveTransactionBuilder saveTransaction,Set<EntityRef> unsavedEntities){
  GlobalStoreSaver globalStoreSaver=new GlobalStoreSaver(entityManager,prefabSerializer);
  for (  StoreMetadata table : storeMetadata.values()) {
    globalStoreSaver.addStoreMetadata(table);
  }
  for (  EntityRef entity : unsavedEntities) {
    globalStoreSaver.store(entity);
  }
  EntityData.GlobalStore globalStore=globalStoreSaver.save();
  saveTransaction.addGlobalStore(globalStore);
}

Fixed version (ground truth):
/** 
 * @param unsavedEntities currently loaded persistent entities without owner that have not been saved yet.
 */
private void addGlobalStoreToSaveTransaction(SaveTransactionBuilder transactionBuilder,Set<EntityRef> unsavedEntities){
  GlobalStoreSaver globalStoreSaver=new GlobalStoreSaver(entityManager,prefabSerializer);
  for (  StoreMetadata table : storeMetadata.values()) {
    globalStoreSaver.addStoreMetadata(table);
  }
  for (  EntityRef entity : unsavedEntities) {
    globalStoreSaver.store(entity);
  }
  EntityData.GlobalStore globalStore=globalStoreSaver.save();
  transactionBuilder.setGlobalStore(globalStore);
}
Program: 888
Project: 888
Buggy source:
public boolean updateBuffer(int buffer){
  stream.readNextInto(dataBuffer);
  if (dataBuffer.limit() == 0) {
    return false;
  }
  AL10.alBufferData(buffer,stream.getChannels() == 1 ? AL10.AL_FORMAT_MONO16 : AL10.AL_FORMAT_STEREO16,dataBuffer,stream.getSamplingRate());
  OpenALException.checkState("String_Node_Str");
  this.lastUpdatedBuffer=buffer;
  return true;
}

Fixed version (ground truth):
public boolean updateBuffer(int buffer){
  stream.readNextInto(dataBuffer);
  if (dataBuffer.limit() == 0) {
    dataBuffer.clear();
    return false;
  }
  int format=stream.getChannels() == 1 ? AL10.AL_FORMAT_MONO16 : AL10.AL_FORMAT_STEREO16;
  AL10.alBufferData(buffer,format,dataBuffer,stream.getSamplingRate());
  OpenALException.checkState("String_Node_Str");
  this.lastUpdatedBuffer=buffer;
  return true;
}
Program: 889
Project: 889
Buggy source:
private Map<Class<? extends WorldFacet>,Border3D> determineBorders(ListMultimap<Class<? extends WorldFacet>,FacetProvider> providerChains){
  Map<Class<? extends WorldFacet>,Border3D> borders=Maps.newHashMap();
  Border3D largestBorder=new Border3D(0,0,0);
  for (  FacetProvider provider : providersList) {
    Requires requirements=provider.getClass().getAnnotation(Requires.class);
    if (requirements != null) {
      for (      Facet requirement : requirements.value()) {
        largestBorder=new Border3D(Math.max(requirement.border().top(),largestBorder.getTop()),Math.max(requirement.border().bottom(),largestBorder.getBottom()),Math.max(requirement.border().sides(),largestBorder.getSides()));
      }
    }
  }
  for (  Class<? extends WorldFacet> type : providerChains.keySet()) {
    borders.put(type,largestBorder);
  }
  return borders;
}

Fixed version (ground truth):
private Map<Class<? extends WorldFacet>,Border3D> determineBorders(ListMultimap<Class<? extends WorldFacet>,FacetProvider> providerChains){
  Map<Class<? extends WorldFacet>,Border3D> borders=Maps.newHashMap();
  for (  Class<? extends WorldFacet> facet : providerChains.keySet()) {
    ensureBorderCalculatedForFacet(facet,providerChains,borders);
  }
  return borders;
}
Program: 890
Project: 890
Buggy source:
public T take() throws InterruptedException {
  final ReentrantLock lock=this.lock;
  lock.lockInterruptibly();
  T result;
  try {
    while ((result=dequeue()) == null)     notEmpty.await();
  }
  finally {
    lock.unlock();
  }
  return result;
}

Fixed version (ground truth):
@Override public T take() throws InterruptedException {
  lock.lockInterruptibly();
  try {
    T result=dequeue();
    while (result == null) {
      notEmpty.await();
      result=dequeue();
    }
    return result;
  }
  finally {
    lock.unlock();
  }
}
Program: 891
Project: 891
Buggy source:
@Override public int size(){
  final ReentrantLock lock=this.lock;
  lock.lock();
  try {
    return elements.size();
  }
  finally {
    lock.unlock();
  }
}

Fixed version (ground truth):
@Override public int size(){
  lock.lock();
  try {
    return elements.size();
  }
  finally {
    lock.unlock();
  }
}
Program: 892
Project: 892
Buggy source:
public T poll(long timeout,TimeUnit unit) throws InterruptedException {
  long nanos=unit.toNanos(timeout);
  final ReentrantLock lock=this.lock;
  lock.lockInterruptibly();
  T result;
  try {
    while ((result=dequeue()) == null && nanos > 0)     nanos=notEmpty.awaitNanos(nanos);
  }
  finally {
    lock.unlock();
  }
  return result;
}

Fixed version (ground truth):
@Override public T poll(long timeout,TimeUnit unit) throws InterruptedException {
  long nanos=unit.toNanos(timeout);
  lock.lockInterruptibly();
  try {
    T result=dequeue();
    while (result == null && nanos > 0) {
      nanos=notEmpty.awaitNanos(nanos);
      result=dequeue();
    }
    return result;
  }
  finally {
    lock.unlock();
  }
}
Program: 893
Project: 893
Buggy source:
public T peek(){
  final ReentrantLock lock=this.lock;
  lock.lock();
  try {
    return elements.size() == 0 ? null : elements.get(0);
  }
  finally {
    lock.unlock();
  }
}

Fixed version (ground truth):
@Override public T peek(){
  lock.lock();
  try {
    return elements.size() == 0 ? null : elements.get(0);
  }
  finally {
    lock.unlock();
  }
}
Program: 894
Project: 894
Buggy source:
private T dequeue(){
  if (elements.size() == 0) {
    return null;
  }
  T smallest=elements.get(0);
  ListIterator<T> iterator=elements.listIterator();
  while (iterator.hasNext()) {
    T next=iterator.next();
    if (comparator.compare(smallest,next) > 0) {
      iterator.set(smallest);
      smallest=next;
    }
  }
  return smallest;
}

Fixed version (ground truth):
private T dequeue(){
  if (elements.size() == 0) {
    return null;
  }
  T smallest=elements.remove(0);
  ListIterator<T> iterator=elements.listIterator();
  while (iterator.hasNext()) {
    T next=iterator.next();
    if (comparator.compare(smallest,next) > 0) {
      iterator.set(smallest);
      smallest=next;
    }
  }
  return smallest;
}
Program: 895
Project: 895
Buggy source:
public T take() throws InterruptedException {
  final ReentrantLock lock=this.lock;
  lock.lockInterruptibly();
  T result;
  try {
    while ((result=dequeue()) == null)     notEmpty.await();
  }
  finally {
    lock.unlock();
  }
  return result;
}

Fixed version (ground truth):
public T take() throws InterruptedException {
  lock.lockInterruptibly();
  T result;
  try {
    while ((result=dequeue()) == null) {
      notEmpty.await();
    }
  }
  finally {
    lock.unlock();
  }
  return result;
}
Program: 896
Project: 896
Buggy source:
@Override public int size(){
  final ReentrantLock lock=this.lock;
  lock.lock();
  try {
    return elements.size();
  }
  finally {
    lock.unlock();
  }
}

Fixed version (ground truth):
@Override public int size(){
  lock.lock();
  try {
    return elements.size();
  }
  finally {
    lock.unlock();
  }
}
Program: 897
Project: 897
Buggy source:
public T poll(long timeout,TimeUnit unit) throws InterruptedException {
  long nanos=unit.toNanos(timeout);
  final ReentrantLock lock=this.lock;
  lock.lockInterruptibly();
  T result;
  try {
    while ((result=dequeue()) == null && nanos > 0)     nanos=notEmpty.awaitNanos(nanos);
  }
  finally {
    lock.unlock();
  }
  return result;
}

Fixed version (ground truth):
public T poll(long timeout,TimeUnit unit) throws InterruptedException {
  long nanos=unit.toNanos(timeout);
  lock.lockInterruptibly();
  T result;
  try {
    while ((result=dequeue()) == null && nanos > 0) {
      nanos=notEmpty.awaitNanos(nanos);
    }
  }
  finally {
    lock.unlock();
  }
  return result;
}
Program: 898
Project: 898
Buggy source:
public T peek(){
  final ReentrantLock lock=this.lock;
  lock.lock();
  try {
    return elements.size() == 0 ? null : elements.get(0);
  }
  finally {
    lock.unlock();
  }
}

Fixed version (ground truth):
public T peek(){
  lock.lock();
  try {
    return elements.size() == 0 ? null : elements.get(0);
  }
  finally {
    lock.unlock();
  }
}
Program: 900
Project: 900
Buggy source:
@Override public void update(float delta){
  super.update(delta);
  if (previewGenerator != null) {
    PreviewSettings newSettings=new PreviewSettings(layerDropdown.getSelection(),TeraMath.floorToInt(zoomSlider.getValue()),seedBinding.get());
    if (currentSettings == null || !currentSettings.equals(newSettings)) {
      Texture tex=createTexture(imageSize,imageSize,newSettings.zoom,newSettings.layer);
      UIImage image=find("String_Node_Str",UIImage.class);
      image.setImage(tex);
      currentSettings=newSettings;
    }
  }
}

Fixed version (ground truth):
@Override public void update(float delta){
  super.update(delta);
  if (previewGenerator != null) {
    PreviewSettings newSettings=new PreviewSettings(layerDropdown.getSelection(),TeraMath.floorToInt(zoomSlider.getValue()),seedBinding.get());
    if (currentSettings == null || !currentSettings.equals(newSettings)) {
      UIImage image=find("String_Node_Str",UIImage.class);
      try {
        Texture tex=createTexture(imageSize,imageSize,newSettings.zoom,newSettings.layer);
        image.setImage(tex);
        image.setVisible(true);
      }
 catch (      Exception ex) {
        image.setVisible(false);
        logger.info("String_Node_Str" + layerDropdown.getSelection());
      }
      currentSettings=newSettings;
    }
  }
}
Program: 901
Project: 901
Buggy source:
@Override public void initialise(){
  WorldGeneratorInfo info=worldGeneratorManager.getWorldGeneratorInfo(config.getWorldGeneration().getDefaultGenerator());
  try {
    WorldGenerator worldGenerator=worldGeneratorManager.createGenerator(info.getUri());
    seedBinding.setWorldGenerator(worldGenerator);
    if (worldGenerator instanceof WorldGenerator2DPreview) {
      previewGenerator=(WorldGenerator2DPreview)worldGenerator;
    }
 else {
      logger.info(info.getUri().toString() + "String_Node_Str");
    }
  }
 catch (  UnresolvedWorldGeneratorException e) {
    logger.error("String_Node_Str" + info.getUri().toString() + "String_Node_Str");
  }
  zoomSlider=find("String_Node_Str",UISlider.class);
  if (zoomSlider != null) {
    zoomSlider.setMinimum(1.0f);
    zoomSlider.setRange(99.f);
    zoomSlider.setIncrement(1.0f);
    zoomSlider.setValue(10f);
    zoomSlider.setPrecision(0);
  }
  UIText seed=find("String_Node_Str",UIText.class);
  if (seed != null) {
    seed.bindText(seedBinding);
  }
  if (previewGenerator != null) {
    layerDropdown=find("String_Node_Str",UIDropdown.class);
    layerDropdown.setOptions(Lists.newArrayList(previewGenerator.getLayers()));
    if (!layerDropdown.getOptions().isEmpty()) {
      layerDropdown.setSelection(layerDropdown.getOptions().get(0));
    }
  }
  WidgetUtil.trySubscribe(this,"String_Node_Str",new ActivateEventListener(){
    @Override public void onActivated(    UIWidget button){
      getManager().popScreen();
    }
  }
);
}

Fixed version (ground truth):
@Override public void initialise(){
  zoomSlider=find("String_Node_Str",UISlider.class);
  if (zoomSlider != null) {
    zoomSlider.setMinimum(1.0f);
    zoomSlider.setRange(99.f);
    zoomSlider.setIncrement(1.0f);
    zoomSlider.setValue(10f);
    zoomSlider.setPrecision(0);
  }
  UIText seed=find("String_Node_Str",UIText.class);
  if (seed != null) {
    seed.bindText(seedBinding);
  }
  layerDropdown=find("String_Node_Str",UIDropdown.class);
  layerDropdown.bindOptions(new ReadOnlyBinding<List<String>>(){
    @Override public List<String> get(){
      if (previewGenerator != null) {
        return Lists.newArrayList(previewGenerator.getLayers());
      }
 else {
        return Lists.newArrayList();
      }
    }
  }
);
  layerDropdown.bindSelection(new Binding<String>(){
    String selection;
    @Override public String get(){
      if (selection == null && layerDropdown.getOptions().size() > 0) {
        selection=layerDropdown.getOptions().get(0);
      }
      return selection;
    }
    @Override public void set(    String value){
      selection=value;
    }
  }
);
  WidgetUtil.trySubscribe(this,"String_Node_Str",new ActivateEventListener(){
    @Override public void onActivated(    UIWidget button){
      getManager().popScreen();
    }
  }
);
}
Program: 902
Project: 902
Buggy source:
public void setObjectPos(Vector3f objectSpacePos){
  this.objectSpacePos=objectSpacePos;
}

Fixed version (ground truth):
public void setObjectPos(Vector3f newObjectSpacePos){
  this.objectSpacePos=newObjectSpacePos;
}
Program: 903
Project: 903
Buggy source:
public void setObjectRotation(Quat4f rotation){
  this.rotation=rotation;
}

Fixed version (ground truth):
public void setObjectRotation(Quat4f newRotation){
  this.rotation=newRotation;
}
Program: 904
Project: 904
Buggy source:
public void setScaleTranslate(Vector3f scale,Vector3f translate){
  this.scale=scale;
  this.translate=translate;
}

Fixed version (ground truth):
public void setScaleTranslate(Vector3f newScale,Vector3f newTranslate){
  this.scale=newScale;
  this.translate=newTranslate;
}
Program: 907
Project: 907
Buggy source:
/** 
 * Reload the specified data. The asset must not be disposed yet!
 */
public final void reload(T data){
  if (!disposed) {
    onReload(data);
  }
 else {
    logger.error("String_Node_Str",getURI());
  }
}

Fixed version (ground truth):
/** 
 * Reload the specified data. The asset must not be disposed yet!
 */
public final void reload(T data){
  if (!disposed) {
    onReload(data);
    if (disposed) {
      logger.error("String_Node_Str",getURI());
    }
  }
 else {
    logger.error("String_Node_Str",getURI());
  }
}
Program: 908
Project: 908
Buggy source:
protected abstract void onReload(T data);

Fixed version (ground truth):
/** 
 * Reload the specified data. The implementation of this method must not call dispose.
 * @param data
 */
protected abstract void onReload(T data);
Program: 909
Project: 909
Buggy source:
@Override public final void dispose(){
  onDispose();
  disposed=true;
  CoreRegistry.get(AssetManager.class).dispose(this);
}

Fixed version (ground truth):
/** 
 * Disposes the asset. Must not be called from onReload.
 */
@Override public final void dispose(){
  onDispose();
  disposed=true;
  CoreRegistry.get(AssetManager.class).dispose(this);
}
Program: 910
Project: 910
Buggy source:
@Override protected void onReload(ShaderData data){
  logger.debug("String_Node_Str",getURI());
  dispose();
  shaderProgramBase=data;
  parameters.clear();
  for (  ShaderParameterMetadata metadata : shaderProgramBase.getParameterMetadata()) {
    parameters.put(metadata.getName(),metadata);
  }
  updateAvailableFeatures();
  recompile();
}

Fixed version (ground truth):
@Override protected void onReload(ShaderData data){
  logger.debug("String_Node_Str",getURI());
  onDispose();
  shaderProgramBase=data;
  parameters.clear();
  for (  ShaderParameterMetadata metadata : shaderProgramBase.getParameterMetadata()) {
    parameters.put(metadata.getName(),metadata);
  }
  updateAvailableFeatures();
  recompile();
}
Program: 913
Project: 913
Buggy source:
@Command(shortDescription="String_Node_Str",runOnServer=true) public String restoreSpeed(EntityRef client){
  ClientComponent clientComp=client.getComponent(ClientComponent.class);
  CharacterMovementComponent move=clientComp.character.getComponent(CharacterMovementComponent.class);
  if (move != null) {
    move.jumpSpeed=10f;
    move.speedMultiplier=1f;
    move.runFactor=1.5f;
    move.stepHeight=0.35f;
    move.slopeFactor=0.6f;
    move.distanceBetweenFootsteps=1f;
    clientComp.character.saveComponent(move);
    return "String_Node_Str";
  }
  return "String_Node_Str";
}

Fixed version (ground truth):
@Command(shortDescription="String_Node_Str",runOnServer=true) public String restoreSpeed(EntityRef client){
  ClientComponent clientComp=client.getComponent(ClientComponent.class);
  Asset<?> asset=Assets.get(new AssetUri("String_Node_Str"));
  CharacterMovementComponent moveDefault=((PojoPrefab)asset).getComponent(CharacterMovementComponent.class);
  CharacterMovementComponent move=clientComp.character.getComponent(CharacterMovementComponent.class);
  if (move != null && moveDefault != null) {
    move.jumpSpeed=moveDefault.jumpSpeed;
    move.speedMultiplier=moveDefault.speedMultiplier;
    move.runFactor=moveDefault.runFactor;
    move.stepHeight=moveDefault.stepHeight;
    move.slopeFactor=moveDefault.slopeFactor;
    move.distanceBetweenFootsteps=moveDefault.distanceBetweenFootsteps;
    clientComp.character.saveComponent(move);
  }
  HealthComponent healthDefault=((PojoPrefab)asset).getComponent(HealthComponent.class);
  HealthComponent health=clientComp.character.getComponent(HealthComponent.class);
  if (health != null && healthDefault != null) {
    health.fallingDamageSpeedThreshold=healthDefault.fallingDamageSpeedThreshold;
    health.horizontalDamageSpeedThreshold=healthDefault.horizontalDamageSpeedThreshold;
    health.excessSpeedDamageMultiplier=healthDefault.excessSpeedDamageMultiplier;
    clientComp.character.saveComponent(health);
  }
  return "String_Node_Str";
}
Program: 914
Project: 914
Buggy source:
@Override public void update(float delta){
  worldProvider.processPropagation();
  PerformanceMonitor.startActivity("String_Node_Str");
  chunkProvider.beginUpdate();
  PerformanceMonitor.endActivity();
  PerformanceMonitor.startActivity("String_Node_Str");
  updateChunksInProximity(false);
  PerformanceMonitor.endActivity();
}

Fixed version (ground truth):
@Override public void update(float delta){
  worldProvider.processPropagation();
  PerformanceMonitor.startActivity("String_Node_Str");
  chunkProvider.completeUpdate();
  chunkProvider.beginUpdate();
  PerformanceMonitor.endActivity();
  PerformanceMonitor.startActivity("String_Node_Str");
  updateChunksInProximity(false);
  PerformanceMonitor.endActivity();
}
Program: 915
Project: 915
Buggy source:
@Before public void setup() throws Exception {
  super.setup();
  BlockManagerImpl blockManager=new BlockManagerImpl(new NullWorldAtlas(),new DefaultBlockFamilyFactoryRegistry());
  CoreRegistry.put(BlockManager.class,blockManager);
  airBlock=BlockManager.getAir();
  solidBlock=new Block();
  solidBlock.setDisplayName("String_Node_Str");
  solidBlock.setUri(new BlockUri("String_Node_Str"));
  solidBlock.setId((byte)1);
  for (  Side side : Side.values()) {
    solidBlock.setFullSide(side,true);
  }
  solidBlock.setTranslucent(false);
  blockManager.addBlockFamily(new SymmetricFamily(solidBlock.getURI(),solidBlock),true);
  fullLight=new Block();
  fullLight.setDisplayName("String_Node_Str");
  fullLight.setUri(new BlockUri("String_Node_Str"));
  fullLight.setId((byte)2);
  fullLight.setLuminance(ChunkConstants.MAX_LIGHT);
  blockManager.addBlockFamily(new SymmetricFamily(fullLight.getURI(),fullLight),true);
}

Fixed version (ground truth):
@Before public void setup() throws Exception {
  super.setup();
  BlockManagerImpl blockManager=new BlockManagerImpl(new NullWorldAtlas(),new DefaultBlockFamilyFactoryRegistry());
  CoreRegistry.put(BlockManager.class,blockManager);
  airBlock=BlockManager.getAir();
  solidBlock=new Block();
  solidBlock.setDisplayName("String_Node_Str");
  solidBlock.setUri(new BlockUri("String_Node_Str"));
  solidBlock.setId((short)1);
  for (  Side side : Side.values()) {
    solidBlock.setFullSide(side,true);
  }
  solidBlock.setTranslucent(false);
  blockManager.addBlockFamily(new SymmetricFamily(solidBlock.getURI(),solidBlock),true);
  fullLight=new Block();
  fullLight.setDisplayName("String_Node_Str");
  fullLight.setUri(new BlockUri("String_Node_Str"));
  fullLight.setId((short)2);
  fullLight.setLuminance(ChunkConstants.MAX_LIGHT);
  blockManager.addBlockFamily(new SymmetricFamily(fullLight.getURI(),fullLight),true);
}
Program: 916
Project: 916
Buggy source:
@Before public void setup() throws Exception {
  super.setup();
  regenRules=new SunlightRegenPropagationRules();
  blockManager=new BlockManagerImpl(new NullWorldAtlas(),Lists.<String>newArrayList(),Maps.<String,Short>newHashMap(),true,new DefaultBlockFamilyFactoryRegistry());
  CoreRegistry.put(BlockManager.class,blockManager);
  solid=new Block();
  solid.setDisplayName("String_Node_Str");
  solid.setUri(new BlockUri("String_Node_Str"));
  solid.setId((byte)5);
  for (  Side side : Side.values()) {
    solid.setFullSide(side,true);
  }
  blockManager.addBlockFamily(new SymmetricFamily(solid.getURI(),solid),true);
  regenWorldView=new SunlightRegenWorldView(provider);
  lightWorldView=new SunlightWorldView(provider);
  lightRules=new SunlightPropagationRules(regenWorldView);
  sunlightPropagator=new StandardBatchPropagator(lightRules,lightWorldView);
  propagator=new SunlightRegenBatchPropagator(regenRules,regenWorldView,sunlightPropagator,lightWorldView);
  air=BlockManager.getAir();
}

Fixed version (ground truth):
@Before public void setup() throws Exception {
  super.setup();
  regenRules=new SunlightRegenPropagationRules();
  blockManager=new BlockManagerImpl(new NullWorldAtlas(),Lists.<String>newArrayList(),Maps.<String,Short>newHashMap(),true,new DefaultBlockFamilyFactoryRegistry());
  CoreRegistry.put(BlockManager.class,blockManager);
  solid=new Block();
  solid.setDisplayName("String_Node_Str");
  solid.setUri(new BlockUri("String_Node_Str"));
  solid.setId((short)5);
  for (  Side side : Side.values()) {
    solid.setFullSide(side,true);
  }
  blockManager.addBlockFamily(new SymmetricFamily(solid.getURI(),solid),true);
  regenWorldView=new SunlightRegenWorldView(provider);
  lightWorldView=new SunlightWorldView(provider);
  lightRules=new SunlightPropagationRules(regenWorldView);
  sunlightPropagator=new StandardBatchPropagator(lightRules,lightWorldView);
  propagator=new SunlightRegenBatchPropagator(regenRules,regenWorldView,sunlightPropagator,lightWorldView);
  air=BlockManager.getAir();
}
Program: 918
Project: 918
Buggy source:
@Before public void setup() throws Exception {
  super.setup();
  regenRules=new SunlightRegenPropagationRules();
  blockManager=new BlockManagerImpl(new NullWorldAtlas(),Lists.<String>newArrayList(),Maps.<String,Short>newHashMap(),true,new DefaultBlockFamilyFactoryRegistry());
  CoreRegistry.put(BlockManager.class,blockManager);
  solid=new Block();
  solid.setDisplayName("String_Node_Str");
  solid.setUri(new BlockUri("String_Node_Str"));
  solid.setId((byte)5);
  for (  Side side : Side.values()) {
    solid.setFullSide(side,true);
  }
  blockManager.addBlockFamily(new SymmetricFamily(solid.getURI(),solid),true);
  Map<Vector3i,Block> blockData=Maps.newHashMap();
  regenWorldView=new StubPropagatorWorldView(ChunkConstants.CHUNK_REGION,blockData);
  lightWorldView=new StubPropagatorWorldView(ChunkConstants.CHUNK_REGION,blockData);
  lightRules=new SunlightPropagationRules(regenWorldView);
  sunlightPropagator=new StandardBatchPropagator(lightRules,lightWorldView);
  propagator=new SunlightRegenBatchPropagator(regenRules,regenWorldView,sunlightPropagator,lightWorldView);
  air=BlockManager.getAir();
}

Fixed version (ground truth):
@Before public void setup() throws Exception {
  super.setup();
  regenRules=new SunlightRegenPropagationRules();
  blockManager=new BlockManagerImpl(new NullWorldAtlas(),Lists.<String>newArrayList(),Maps.<String,Short>newHashMap(),true,new DefaultBlockFamilyFactoryRegistry());
  CoreRegistry.put(BlockManager.class,blockManager);
  solid=new Block();
  solid.setDisplayName("String_Node_Str");
  solid.setUri(new BlockUri("String_Node_Str"));
  solid.setId((short)5);
  for (  Side side : Side.values()) {
    solid.setFullSide(side,true);
  }
  blockManager.addBlockFamily(new SymmetricFamily(solid.getURI(),solid),true);
  Map<Vector3i,Block> blockData=Maps.newHashMap();
  regenWorldView=new StubPropagatorWorldView(ChunkConstants.CHUNK_REGION,blockData);
  lightWorldView=new StubPropagatorWorldView(ChunkConstants.CHUNK_REGION,blockData);
  lightRules=new SunlightPropagationRules(regenWorldView);
  sunlightPropagator=new StandardBatchPropagator(lightRules,lightWorldView);
  propagator=new SunlightRegenBatchPropagator(regenRules,regenWorldView,sunlightPropagator,lightWorldView);
  air=BlockManager.getAir();
}
Program: 919
Project: 919
Buggy source:
@Override public void onChunkReady(Vector3i chunkPos){
  List<NetData.BlockChangeMessage> updateMessages=awaitingChunkReadyUpdates.removeAll(chunkPos);
  for (  NetData.BlockChangeMessage message : updateMessages) {
    WorldProvider worldProvider=CoreRegistry.get(WorldProvider.class);
    Vector3i pos=NetMessageUtil.convert(message.getPos());
    Block newBlock=blockManager.getBlock((byte)message.getNewBlock());
    worldProvider.setBlock(pos,newBlock);
  }
}

Fixed version (ground truth):
@Override public void onChunkReady(Vector3i chunkPos){
  List<NetData.BlockChangeMessage> updateMessages=awaitingChunkReadyUpdates.removeAll(chunkPos);
  for (  NetData.BlockChangeMessage message : updateMessages) {
    WorldProvider worldProvider=CoreRegistry.get(WorldProvider.class);
    Vector3i pos=NetMessageUtil.convert(message.getPos());
    Block newBlock=blockManager.getBlock((short)message.getNewBlock());
    worldProvider.setBlock(pos,newBlock);
  }
}
Program: 920
Project: 920
Buggy source:
private void processBlockChanges(NetData.NetMessage message){
  for (  NetData.BlockChangeMessage blockChange : message.getBlockChangeList()) {
    logger.debug("String_Node_Str",blockManager.getBlock((byte)blockChange.getNewBlock()));
    WorldProvider worldProvider=CoreRegistry.get(WorldProvider.class);
    Vector3i pos=NetMessageUtil.convert(blockChange.getPos());
    if (worldProvider.isBlockRelevant(pos)) {
      Block newBlock=blockManager.getBlock((byte)blockChange.getNewBlock());
      worldProvider.setBlock(pos,newBlock);
    }
 else {
      awaitingChunkReadyUpdates.put(TeraMath.calcChunkPos(pos),blockChange);
    }
  }
}

Fixed version (ground truth):
private void processBlockChanges(NetData.NetMessage message){
  for (  NetData.BlockChangeMessage blockChange : message.getBlockChangeList()) {
    Block newBlock=blockManager.getBlock((short)blockChange.getNewBlock());
    logger.debug("String_Node_Str",newBlock);
    WorldProvider worldProvider=CoreRegistry.get(WorldProvider.class);
    Vector3i pos=NetMessageUtil.convert(blockChange.getPos());
    if (worldProvider.isBlockRelevant(pos)) {
      worldProvider.setBlock(pos,newBlock);
    }
 else {
      awaitingChunkReadyUpdates.put(TeraMath.calcChunkPos(pos),blockChange);
    }
  }
}
Program: 921
Project: 921
Buggy source:
@Override public EntityRef copy(){
  if (exists) {
    entityManager.create(entityManager.copyComponents(this).values());
  }
  return NULL;
}

Fixed version (ground truth):
@Override public EntityRef copy(){
  if (exists) {
    return entityManager.create(entityManager.copyComponents(this).values());
  }
  return NULL;
}
Program: 922
Project: 922
Buggy source:
@Override public void update(float delta){
  super.update(delta);
  int numSlots=InventoryUtils.getSlotCount(getTargetEntity()) - getCellOffset();
  if (numSlots > cells.size() && cells.size() < getMaxCellCount()) {
    for (int i=cells.size(); i < numSlots && i < getMaxCellCount(); ++i) {
      InventoryCell cell=new InventoryCell();
      cell.bindTargetInventory(new ReadOnlyBinding<EntityRef>(){
        @Override public EntityRef get(){
          return getTargetEntity();
        }
      }
);
      cell.bindTargetSlot(new SlotBinding(i));
      cells.add(cell);
    }
  }
}

Fixed version (ground truth):
@Override public void update(float delta){
  super.update(delta);
  int numSlots=InventoryUtils.getSlotCount(getTargetEntity()) - getCellOffset();
  if (numSlots < cells.size()) {
    cells.clear();
  }
  if (numSlots > cells.size() && cells.size() < getMaxCellCount()) {
    for (int i=cells.size(); i < numSlots && i < getMaxCellCount(); ++i) {
      InventoryCell cell=new InventoryCell();
      cell.bindTargetInventory(new ReadOnlyBinding<EntityRef>(){
        @Override public EntityRef get(){
          return getTargetEntity();
        }
      }
);
      cell.bindTargetSlot(new SlotBinding(i));
      cells.add(cell);
    }
  }
}
Program: 925
Project: 925
Buggy source:
@Override public void setWorldSeed(String seed){
  if (seed == null)   return;
  logger.info("String_Node_Str");
  Texture texture=Assets.getTexture("String_Node_Str");
  ByteBuffer[] bb=texture.getData().getBuffers();
  IntBuffer intBuf=bb[0].asIntBuffer();
  int width=texture.getWidth();
  int height=texture.getHeight();
  heightmap=new float[width][height];
  while (intBuf.position() < intBuf.limit()) {
    int pos=intBuf.position();
    int val=intBuf.get();
    heightmap[pos % width][pos / width]=val / (256 * 256 * 256* 12.8f);
  }
  heightmap=shiftArray(rotateArray(heightmap),-50,-100);
}

Fixed version (ground truth):
@Override public void setWorldSeed(String seed){
  if (seed == null) {
    return;
  }
  logger.info("String_Node_Str");
  Texture texture=Assets.getTexture("String_Node_Str");
  ByteBuffer[] bb=texture.getData().getBuffers();
  IntBuffer intBuf=bb[0].asIntBuffer();
  int width=texture.getWidth();
  int height=texture.getHeight();
  heightmap=new float[width][height];
  while (intBuf.position() < intBuf.limit()) {
    int pos=intBuf.position();
    int val=intBuf.get();
    heightmap[pos % width][pos / width]=val / (256 * 256 * 256* 12.8f);
  }
  heightmap=shiftArray(rotateArray(heightmap),-50,-100);
}
Program: 927
Project: 927
Buggy source:
@Override protected Class<?> loadClass(String name,boolean resolve) throws ClassNotFoundException {
  Class<?> clazz=super.loadClass(name,resolve);
  if (clazz.getClassLoader() != this) {
    if (securityManager.checkAccess(clazz)) {
      return clazz;
    }
 else {
      logger.error("String_Node_Str",name);
      return null;
    }
  }
  return clazz;
}

Fixed version (ground truth):
@Override protected Class<?> loadClass(String name,boolean resolve) throws ClassNotFoundException {
  final Class<?> clazz=super.loadClass(name,resolve);
  ClassLoader loadingClassLoader=AccessController.doPrivileged(new PrivilegedAction<ClassLoader>(){
    @Override public ClassLoader run(){
      return clazz.getClassLoader();
    }
  }
);
  if (loadingClassLoader != this) {
    if (securityManager.checkAccess(clazz)) {
      return clazz;
    }
 else {
      logger.error("String_Node_Str",name);
      return null;
    }
  }
  return clazz;
}
Program: 929
Project: 929
Buggy source:
@Override public void dispose(){
}

Fixed version (ground truth):
@Override public void dispose(){
  worldProvider.dispose();
}
Program: 930
Project: 930
Buggy source:
public void enableModuleAndDependencies(Module module){
  for (  DependencyInfo info : module.getModuleInfo().getDependencies()) {
    Module dependency=getLatestModuleVersion(info.getId());
    if (info.getMaxVersion().compareTo(dependency.getVersion()) <= 0) {
      enableModuleAndDependencies(dependency);
    }
  }
  Module oldModule=activeModules.put(module.getId(),module);
  if (!module.equals(oldModule)) {
    if (oldModule != null && oldModule instanceof ExtensionModule) {
      CoreRegistry.get(AssetManager.class).removeAssetSource(module.getModuleSource());
    }
    if (module instanceof ExtensionModule) {
      CoreRegistry.get(AssetManager.class).addAssetSource(module.getModuleSource());
    }
  }
}

Fixed version (ground truth):
public void enableModuleAndDependencies(Module module){
  for (  DependencyInfo info : module.getModuleInfo().getDependencies()) {
    Module dependency=getLatestModuleVersion(info.getId());
    if (info.getMaxVersion().compareTo(dependency.getVersion()) <= 0) {
      enableModuleAndDependencies(dependency);
    }
  }
  enableModule(module);
}
Program: 931
Project: 931
Buggy source:
@Override public void enableModule(Module module){
  Module oldModule=activeModules.put(module.getId(),module);
  if (!module.equals(oldModule)) {
    if (oldModule != null && oldModule instanceof ExtensionModule) {
      CoreRegistry.get(AssetManager.class).removeAssetSource(module.getModuleSource());
    }
    if (module instanceof ExtensionModule) {
      CoreRegistry.get(AssetManager.class).addAssetSource(module.getModuleSource());
    }
  }
}

Fixed version (ground truth):
@Override public void enableModule(Module module){
  Module oldModule=activeModules.put(module.getId(),module);
  if (!module.equals(oldModule)) {
    if (oldModule != null && oldModule instanceof ExtensionModule) {
      CoreRegistry.get(AssetManager.class).removeAssetSource(oldModule.getModuleSource());
    }
    if (module instanceof ExtensionModule) {
      CoreRegistry.get(AssetManager.class).addAssetSource(module.getModuleSource());
    }
  }
}
Program: 932
Project: 932
Buggy source:
/** 
 * @param other
 * @return A new entity with a copy of each of the other entity's components
 */
@Deprecated EntityRef copy(EntityRef other);

Fixed version (ground truth):
/** 
 * @param other
 * @return A new entity with a copy of each of the other entity's components
 * @deprecated Use EntityRef.copy() instead.
 */
@Deprecated EntityRef copy(EntityRef other);
Program: 937
Project: 937
Buggy source:
private void markForPropagation(LitChunk toChunk,int[] depth,int[] startingRegen,int[] adjDepths,int[] adjStartingRegen){
  Vector3i pos=new Vector3i();
  for (int z=0; z < ChunkConstants.SIZE_Z; ++z) {
    for (int x=0; x < ChunkConstants.SIZE_X; ++x) {
      int depthIndex=x + ChunkConstants.SIZE_X * z;
      int start=startingRegen[depthIndex];
      int adjStart=adjStartingRegen[depthIndex];
      if (start - adjStart > 1) {
        int initialDepth=Math.max(ChunkConstants.SUNLIGHT_REGEN_THRESHOLD - start,0);
        int finalDepth=depth[depthIndex];
        int strength=Math.min(start + initialDepth - ChunkConstants.SUNLIGHT_REGEN_THRESHOLD + 1,ChunkConstants.MAX_SUNLIGHT);
        for (int i=initialDepth; i < finalDepth; ++i) {
          sunlightPropagator.propagateFrom(toChunk.chunkToWorldPosition(x,ChunkConstants.SIZE_Y - i - 1,z),(byte)(strength));
          if (strength < ChunkConstants.MAX_SUNLIGHT) {
            strength++;
          }
        }
      }
 else {
        int initialDepth=Math.max(adjDepths[depthIndex],ChunkConstants.SUNLIGHT_REGEN_THRESHOLD - start);
        byte strength=(byte)Math.min(ChunkConstants.MAX_SUNLIGHT,start + initialDepth - ChunkConstants.SUNLIGHT_REGEN_THRESHOLD + 1);
        for (int i=initialDepth; i <= depth[depthIndex]; ++i) {
          sunlightPropagator.propagateFrom(toChunk.chunkToWorldPosition(x,ChunkConstants.SIZE_Y - i - 1,z),strength);
          if (strength < ChunkConstants.MAX_SUNLIGHT) {
            strength++;
          }
          pos.y--;
        }
      }
    }
  }
}

Fixed version (ground truth):
private void markForPropagation(LitChunk toChunk,int[] depth,int[] startingRegen,int[] adjDepths,int[] adjStartingRegen){
  Vector3i pos=new Vector3i();
  for (int z=0; z < ChunkConstants.SIZE_Z; ++z) {
    for (int x=0; x < ChunkConstants.SIZE_X; ++x) {
      int depthIndex=x + ChunkConstants.SIZE_X * z;
      int start=startingRegen[depthIndex];
      int adjStart=adjStartingRegen[depthIndex];
      if (start - adjStart > 1) {
        int initialDepth=Math.max(ChunkConstants.SUNLIGHT_REGEN_THRESHOLD - start,0);
        int finalDepth=depth[depthIndex];
        int strength=Math.min(start + initialDepth - ChunkConstants.SUNLIGHT_REGEN_THRESHOLD + 1,ChunkConstants.MAX_SUNLIGHT);
        for (int i=initialDepth; i <= finalDepth; ++i) {
          sunlightPropagator.propagateFrom(toChunk.chunkToWorldPosition(x,ChunkConstants.SIZE_Y - i - 1,z),(byte)(strength));
          if (strength < ChunkConstants.MAX_SUNLIGHT) {
            strength++;
          }
        }
      }
 else {
        int initialDepth=Math.max(adjDepths[depthIndex],ChunkConstants.SUNLIGHT_REGEN_THRESHOLD - start);
        byte strength=(byte)Math.min(ChunkConstants.MAX_SUNLIGHT,start + initialDepth - ChunkConstants.SUNLIGHT_REGEN_THRESHOLD + 1);
        for (int i=initialDepth; i <= depth[depthIndex]; ++i) {
          sunlightPropagator.propagateFrom(toChunk.chunkToWorldPosition(x,ChunkConstants.SIZE_Y - i - 1,z),strength);
          if (strength < ChunkConstants.MAX_SUNLIGHT) {
            strength++;
          }
          pos.y--;
        }
      }
    }
  }
}
Program: 938
Project: 938
Buggy source:
public static void main(String[] args){
  try {
    boolean isHeadless=false;
    Path homePath=null;
    for (    String arg : args) {
      if (arg.startsWith(HOME_ARG)) {
        homePath=Paths.get(arg.substring(HOME_ARG.length()));
      }
 else       if (arg.equals(LOCAL_ARG)) {
        homePath=Paths.get("String_Node_Str");
      }
 else       if (arg.equals(HEADLESS_ARG)) {
        isHeadless=true;
      }
    }
    if (homePath != null) {
      PathManager.getInstance().useOverrideHomePath(homePath);
    }
 else {
      PathManager.getInstance().useDefaultHomePath();
    }
    Collection<EngineSubsystem> subsystemList;
    if (isHeadless) {
      subsystemList=Lists.newArrayList(new HeadlessGraphics(),new HeadlessTimer(),new HeadlessAudio(),new HeadlessInput());
    }
 else {
      subsystemList=Lists.<EngineSubsystem>newArrayList(new LwjglGraphics(),new LwjglTimer(),new LwjglAudio(),new LwjglInput());
    }
    TerasologyEngine engine=new TerasologyEngine(subsystemList);
    engine.init();
    if (isHeadless) {
      engine.run(new StateHeadlessSetup());
    }
 else {
      engine.run(new StateMainMenu());
    }
    engine.dispose();
  }
 catch (  Throwable t) {
    String text=getNestedMessageText(t);
    JOptionPane.showMessageDialog(null,text,"String_Node_Str",JOptionPane.ERROR_MESSAGE);
  }
  System.exit(0);
}

Fixed version (ground truth):
public static void main(String[] args){
  try {
    boolean isHeadless=false;
    Path homePath=null;
    for (    String arg : args) {
      if (arg.startsWith(HOME_ARG)) {
        homePath=Paths.get(arg.substring(HOME_ARG.length()));
      }
 else       if (arg.equals(LOCAL_ARG)) {
        homePath=Paths.get("String_Node_Str");
      }
 else       if (arg.equals(HEADLESS_ARG)) {
        isHeadless=true;
      }
    }
    if (homePath != null) {
      PathManager.getInstance().useOverrideHomePath(homePath);
    }
 else {
      PathManager.getInstance().useDefaultHomePath();
    }
    Collection<EngineSubsystem> subsystemList;
    if (isHeadless) {
      subsystemList=Lists.newArrayList(new HeadlessGraphics(),new HeadlessTimer(),new HeadlessAudio(),new HeadlessInput());
    }
 else {
      subsystemList=Lists.<EngineSubsystem>newArrayList(new LwjglGraphics(),new LwjglTimer(),new LwjglAudio(),new LwjglInput());
    }
    TerasologyEngine engine=new TerasologyEngine(subsystemList);
    engine.init();
    if (isHeadless) {
      engine.run(new StateHeadlessSetup());
    }
 else {
      engine.run(new StateMainMenu());
    }
    engine.dispose();
  }
 catch (  Throwable t) {
    String text=getNestedMessageText(t);
    JOptionPane.showMessageDialog(null,text,"String_Node_Str",JOptionPane.ERROR_MESSAGE);
  }
}
Program: 939
Project: 939
Buggy source:
private void markForPropagation(ChunkImpl toChunk,int[] depth,int[] startingRegen,int[] adjDepths,int[] adjStartingRegen){
  Vector3i pos=new Vector3i();
  for (int z=0; z < ChunkConstants.SIZE_Z; ++z) {
    for (int x=0; x < ChunkConstants.SIZE_X; ++x) {
      int depthIndex=x + ChunkConstants.SIZE_X * z;
      int start=startingRegen[depthIndex];
      int adjStart=adjStartingRegen[depthIndex];
      if (start - adjStart > 1) {
        int initialDepth=Math.max(ChunkConstants.SUNLIGHT_REGEN_THRESHOLD - start,0);
        int finalDepth=depth[depthIndex];
        int strength=start + initialDepth - ChunkConstants.SUNLIGHT_REGEN_THRESHOLD + 1;
        for (int i=initialDepth; i < finalDepth; ++i) {
          sunlightPropagator.propagateFrom(toChunk.getBlockWorldPos(x,ChunkConstants.SIZE_Y - i - 1,z),(byte)(strength));
          if (strength < ChunkConstants.MAX_SUNLIGHT) {
            strength++;
          }
        }
      }
 else {
        int initialDepth=Math.max(adjDepths[depthIndex],ChunkConstants.SUNLIGHT_REGEN_THRESHOLD - start);
        byte strength=(byte)Math.min(ChunkConstants.MAX_SUNLIGHT,start + initialDepth - ChunkConstants.SUNLIGHT_REGEN_THRESHOLD + 1);
        for (int i=initialDepth; i < depth[depthIndex]; ++i) {
          sunlightPropagator.propagateFrom(toChunk.getBlockWorldPos(x,ChunkConstants.SIZE_Y - i - 1,z),strength);
          if (strength < ChunkConstants.MAX_SUNLIGHT) {
            strength++;
          }
          pos.y--;
        }
      }
    }
  }
}

Fixed version (ground truth):
private void markForPropagation(ChunkImpl toChunk,int[] depth,int[] startingRegen,int[] adjDepths,int[] adjStartingRegen){
  Vector3i pos=new Vector3i();
  for (int z=0; z < ChunkConstants.SIZE_Z; ++z) {
    for (int x=0; x < ChunkConstants.SIZE_X; ++x) {
      int depthIndex=x + ChunkConstants.SIZE_X * z;
      int start=startingRegen[depthIndex];
      int adjStart=adjStartingRegen[depthIndex];
      if (start - adjStart > 1) {
        int initialDepth=Math.max(ChunkConstants.SUNLIGHT_REGEN_THRESHOLD - start,0);
        int finalDepth=depth[depthIndex];
        int strength=Math.min(start + initialDepth - ChunkConstants.SUNLIGHT_REGEN_THRESHOLD + 1,ChunkConstants.MAX_SUNLIGHT);
        for (int i=initialDepth; i < finalDepth; ++i) {
          sunlightPropagator.propagateFrom(toChunk.getBlockWorldPos(x,ChunkConstants.SIZE_Y - i - 1,z),(byte)(strength));
          if (strength < ChunkConstants.MAX_SUNLIGHT) {
            strength++;
          }
        }
      }
 else {
        int initialDepth=Math.max(adjDepths[depthIndex],ChunkConstants.SUNLIGHT_REGEN_THRESHOLD - start);
        byte strength=(byte)Math.min(ChunkConstants.MAX_SUNLIGHT,start + initialDepth - ChunkConstants.SUNLIGHT_REGEN_THRESHOLD + 1);
        for (int i=initialDepth; i < depth[depthIndex]; ++i) {
          sunlightPropagator.propagateFrom(toChunk.getBlockWorldPos(x,ChunkConstants.SIZE_Y - i - 1,z),strength);
          if (strength < ChunkConstants.MAX_SUNLIGHT) {
            strength++;
          }
          pos.y--;
        }
      }
    }
  }
}