nus-yam/ex-repair huggingface dataset:
Program: 96729
Project: 96729
Buggy source:
/** 
 * Disconnects the session with the specified reason. This causes a KickMessage to be sent. When it has been delivered, the channel is closed.
 * @param reason The reason for disconnection.
 * @param overrideKick Whether to skip the kick event.
 */
@Override public void disconnect(String reason,boolean overrideKick){
  if (player != null && !overrideKick) {
    PlayerKickEvent event=EventFactory.onPlayerKick(player,reason);
    if (event.isCancelled()) {
      return;
    }
    reason=event.getReason();
    if (event.getLeaveMessage() != null) {
      this.getServer().broadcastMessage(event.getLeaveMessage());
    }
  }
  if (player != null) {
    GlowServer.logger.info(player.getName() + "String_Node_Str" + reason);
  }
 else {
    GlowServer.logger.info("String_Node_Str" + this.remoteIP + "String_Node_Str"+ this.remotePort+ "String_Node_Str"+ reason);
  }
  this.send(new KickMessage(reason));
  this.statusActive=false;
  this.getServer().getSessionRegistry().remove(this);
  this.dServer.getNetworkHandler().removeSession(this);
}

Fixed version (ground truth):
/** 
 * Disconnects the session with the specified reason. This causes a KickMessage to be sent. When it has been delivered, the channel is closed.
 * @param reason The reason for disconnection.
 * @param overrideKick Whether to skip the kick event.
 */
@Override public void disconnect(String reason,boolean overrideKick){
  if (player != null && !overrideKick) {
    PlayerKickEvent event=EventFactory.onPlayerKick(player,reason);
    if (event.isCancelled()) {
      return;
    }
    reason=event.getReason();
    if (event.getLeaveMessage() != null) {
      this.getServer().broadcastMessage(event.getLeaveMessage());
    }
  }
  if (player != null) {
    GlowServer.logger.info(player.getName() + "String_Node_Str" + reason);
    this.player.remove();
  }
 else {
    GlowServer.logger.info("String_Node_Str" + this.remoteIP + "String_Node_Str"+ this.remotePort+ "String_Node_Str"+ reason);
  }
  this.send(new KickMessage(reason));
  this.statusActive=false;
  this.dServer.getNetworkHandler().removeSession(this);
  this.getServer().getSessionRegistry().remove((GlowSession)this);
  if (this.player != null) {
    this.player.getWorld().getRawPlayers().remove(this.player);
  }
  this.player=null;
}
Program: 96731
Project: 96731
Buggy source:
public synchronized void removeSession(DragonetSession session){
  this.sessions.remove(session);
}

Fixed version (ground truth):
public synchronized void removeSession(DragonetSession session){
  this.sessions.remove(session.getAddress().toString());
}
Program: 96732
Project: 96732
Buggy source:
public ItemTranslator_v0_10_0(){
  for (int i=0; i <= 24; i++) {
    itemMap_PC_to_PE.put(i,i);
  }
  itemMap_PC_to_PE.put(26,26);
  itemMap_PC_to_PE.put(27,27);
  itemMap_PC_to_PE.put(31,31);
  itemMap_PC_to_PE.put(50,50);
}

Fixed version (ground truth):
public ItemTranslator_v0_10_0(){
  for (int i=0; i <= 24; i++) {
    itemMap_PC_to_PE.put(i,i);
  }
}
Program: 96733
Project: 96733
Buggy source:
/** 
 * Translate a PC block/item into PE block/item
 * @param itemPC PC Item ID
 * @return PE Item ID
 */
@Override public int translateToPE(int itemPC){
  if (itemPC >= 8 && itemPC <= 11) {
    return itemPC;
  }
 else {
    return DEFAULT_BLOCK_TO_PE;
  }
}

Fixed version (ground truth):
/** 
 * Translate a PC block/item into PE block/item
 * @param itemPC PC Item ID
 * @return PE Item ID
 */
@Override public int translateToPE(int itemPC){
  if (itemMap_PC_to_PE.containsKey(itemPC)) {
    return itemMap_PC_to_PE.get(itemPC);
  }
 else {
    return DEFAULT_BLOCK_TO_PE;
  }
}
Program: 96736
Project: 96736
Buggy source:
private Path filePath(final String fileName){
  return Paths.get(workspaceDir(),projectName,fileName);
}

Fixed version (ground truth):
private Path filePath(final String fileName){
  return workspacePath().resolve(projectName).resolve(fileName);
}
Program: 96737
Project: 96737
Buggy source:
private void createJavaProjectIfNotExists(final String projectName){
  final Path projectFilePath=Paths.get(workspaceDir(),projectName,"String_Node_Str");
  if (!Files.isRegularFile(projectFilePath,LinkOption.NOFOLLOW_LINKS)) {
    newJavaProject(projectName);
  }
}

Fixed version (ground truth):
private void createJavaProjectIfNotExists(final String projectName){
  final Path projectFilePath=workspacePath().resolve(projectName).resolve("String_Node_Str");
  if (!Files.isRegularFile(projectFilePath,LinkOption.NOFOLLOW_LINKS)) {
    newJavaProject(projectName);
  }
}
Program: 96739
Project: 96739
Buggy source:
@Override public void savePreferences(String name,JSONObject preferences){
  fileWriter.write(JSON.write(preferences),FilePath.getExternalFile(System.getenv("String_Node_Str") + "String_Node_Str" + name),false);
}

Fixed version (ground truth):
@Override public void savePreferences(String name,JSONObject preferences){
  fileWriter.write(JSON.write(preferences),FilePath.getExternalFile(System.getProperty("String_Node_Str") + "String_Node_Str" + name),false);
}
Program: 96740
Project: 96740
Buggy source:
@Override public JSONObject getPreferences(String name){
  try {
    String json=new String(Files.readAllBytes(Paths.get(System.getenv("String_Node_Str"),name)));
    return JSON.parse(json);
  }
 catch (  Exception e) {
    return new JSONObject();
  }
}

Fixed version (ground truth):
@Override public JSONObject getPreferences(String name){
  try {
    String json=new String(Files.readAllBytes(Paths.get(System.getProperty("String_Node_Str"),name)));
    return JSON.parse(json);
  }
 catch (  Exception e) {
    return new JSONObject();
  }
}
Program: 96741
Project: 96741
Buggy source:
@Override public void readToALBuffer(AudioFormat format,DirectBuffer data,UniCallback<ALBuffer> onDecoded){
  if (!isSupported(format))   throw new SilenceException("String_Node_Str" + format);
  if (format == AudioFormat.WAV)   new Thread(() -> {
    WavReader reader=new WavReader(data);
    ALBuffer alBuffer=new ALBuffer();
    alBuffer.uploadData(new AndroidDirectBuffer(reader.data),reader.alFormat,reader.sampleRate);
    TaskManager.runOnUpdate(() -> onDecoded.invoke(alBuffer));
  }
).start();
 else   if (format == AudioFormat.OGG)   new Thread(() -> {
    OggReader reader=new OggReader(data);
    ALBuffer alBuffer=new ALBuffer();
    alBuffer.uploadData(new AndroidDirectBuffer(reader.getData()),reader.getFormat(),reader.getSampleRate());
    TaskManager.runOnUpdate(() -> onDecoded.invoke(alBuffer));
  }
).start();
}

Fixed version (ground truth):
@Override public void readToALBuffer(AudioFormat format,DirectBuffer data,UniCallback<ALBuffer> onDecoded,UniCallback<Throwable> onError){
  try {
    if (!isSupported(format))     throw new SilenceException("String_Node_Str" + format);
    if (format == AudioFormat.WAV)     new Thread(() -> {
      WavReader reader=new WavReader(data);
      ALBuffer alBuffer=new ALBuffer();
      alBuffer.uploadData(new AndroidDirectBuffer(reader.data),reader.alFormat,reader.sampleRate);
      TaskManager.runOnUpdate(() -> onDecoded.invoke(alBuffer));
    }
).start();
 else     if (format == AudioFormat.OGG)     new Thread(() -> {
      OggReader reader=new OggReader(data);
      ALBuffer alBuffer=new ALBuffer();
      alBuffer.uploadData(new AndroidDirectBuffer(reader.getData()),reader.getFormat(),reader.getSampleRate());
      TaskManager.runOnUpdate(() -> onDecoded.invoke(alBuffer));
    }
).start();
  }
 catch (  Throwable e) {
    onError.invoke(e);
  }
}
Program: 96742
Project: 96742
Buggy source:
@Override public void setIcon(FilePath filePath,SimpleCallback success){
}

Fixed version (ground truth):
@Override public void setIcon(FilePath filePath,SimpleCallback success,UniCallback<Throwable> error){
}
Program: 96743
Project: 96743
Buggy source:
@Override public void readTextFile(FilePath file,UniCallback<String> onComplete){
  new Thread(() -> {
    try (InputStream inputStream=((AndroidFilePath)file).getInputStream();BufferedReader bufferedReader=new BufferedReader(new InputStreamReader(inputStream))){
      StringBuilder stringBuilder=new StringBuilder();
      String line=null;
      while ((line=bufferedReader.readLine()) != null)       stringBuilder.append(line).append("String_Node_Str");
      TaskManager.runOnUpdate(() -> onComplete.invoke(stringBuilder.toString()));
    }
 catch (    Exception e) {
      SilenceEngine.log.getRootLogger().error(e);
    }
  }
).start();
}

Fixed version (ground truth):
@Override public void readTextFile(FilePath file,UniCallback<String> onComplete,UniCallback<Throwable> onError){
  new Thread(() -> {
    try (InputStream inputStream=((AndroidFilePath)file).getInputStream();BufferedReader bufferedReader=new BufferedReader(new InputStreamReader(inputStream))){
      StringBuilder stringBuilder=new StringBuilder();
      String line=null;
      while ((line=bufferedReader.readLine()) != null)       stringBuilder.append(line).append("String_Node_Str");
      TaskManager.runOnUpdate(() -> onComplete.invoke(stringBuilder.toString()));
    }
 catch (    Throwable e) {
      onError.invoke(e);
    }
  }
).start();
}
Program: 96744
Project: 96744
Buggy source:
@Override public void readBinaryFile(FilePath file,UniCallback<DirectBuffer> onComplete){
  new Thread(() -> {
    try {
      InputStream inputStream=((AndroidFilePath)file).getInputStream();
      ByteArrayOutputStream outputStream=new ByteArrayOutputStream();
      byte[] buffer=new byte[4096];
      while (true) {
        int n=inputStream.read(buffer);
        if (n < 0)         break;
        outputStream.write(buffer,0,n);
      }
      inputStream.close();
      byte[] bytes=outputStream.toByteArray();
      DirectBuffer directBuffer=new AndroidDirectBuffer(bytes.length);
      for (int i=0; i < bytes.length; i++)       directBuffer.writeByte(i,bytes[i]);
      TaskManager.runOnUpdate(() -> onComplete.invoke(directBuffer));
    }
 catch (    Exception e) {
      SilenceEngine.log.getRootLogger().error(e);
    }
  }
).start();
}

Fixed version (ground truth):
@Override public void readBinaryFile(FilePath file,UniCallback<DirectBuffer> onComplete,UniCallback<Throwable> onError){
  new Thread(() -> {
    try {
      InputStream inputStream=((AndroidFilePath)file).getInputStream();
      ByteArrayOutputStream outputStream=new ByteArrayOutputStream();
      byte[] buffer=new byte[4096];
      while (true) {
        int n=inputStream.read(buffer);
        if (n < 0)         break;
        outputStream.write(buffer,0,n);
      }
      inputStream.close();
      byte[] bytes=outputStream.toByteArray();
      DirectBuffer directBuffer=new AndroidDirectBuffer(bytes.length);
      for (int i=0; i < bytes.length; i++)       directBuffer.writeByte(i,bytes[i]);
      TaskManager.runOnUpdate(() -> onComplete.invoke(directBuffer));
    }
 catch (    Throwable e) {
      onError.invoke(e);
    }
  }
).start();
}
Program: 96745
Project: 96745
Buggy source:
@Override public void readImage(DirectBuffer memory,UniCallback<Image> uniCallback){
  new Thread(() -> {
    Bitmap bitmap=BitmapFactory.decodeStream(new DirectBufferInputStream(memory));
    if (bitmap == null)     throw new SilenceException(new IOException("String_Node_Str"));
    Image image=new Image(bitmap.getWidth(),bitmap.getHeight());
    for (int x=0; x < image.getWidth(); x++)     for (int y=0; y < image.getHeight(); y++) {
      int pixel=bitmap.getPixel(x,y);
      float a=android.graphics.Color.alpha(pixel) / 255f;
      float r=android.graphics.Color.red(pixel) / 255f;
      float g=android.graphics.Color.green(pixel) / 255f;
      float b=android.graphics.Color.blue(pixel) / 255f;
      image.setPixel(x,y,new Color(r,g,b,a));
    }
    bitmap.recycle();
    bitmap=null;
    TaskManager.runOnUpdate(() -> uniCallback.invoke(image));
  }
).start();
}

Fixed version (ground truth):
@Override public void readImage(DirectBuffer memory,UniCallback<Image> uniCallback,UniCallback<Throwable> onError){
  new Thread(() -> {
    try {
      Bitmap bitmap=BitmapFactory.decodeStream(new DirectBufferInputStream(memory));
      if (bitmap == null)       throw new SilenceException(new IOException("String_Node_Str"));
      Image image=new Image(bitmap.getWidth(),bitmap.getHeight());
      for (int x=0; x < image.getWidth(); x++)       for (int y=0; y < image.getHeight(); y++) {
        int pixel=bitmap.getPixel(x,y);
        float a=android.graphics.Color.alpha(pixel) / 255f;
        float r=android.graphics.Color.red(pixel) / 255f;
        float g=android.graphics.Color.green(pixel) / 255f;
        float b=android.graphics.Color.blue(pixel) / 255f;
        image.setPixel(x,y,new Color(r,g,b,a));
      }
      bitmap.recycle();
      bitmap=null;
      TaskManager.runOnUpdate(() -> uniCallback.invoke(image));
    }
 catch (    Throwable e) {
      onError.invoke(e);
    }
  }
).start();
}
Program: 96746
Project: 96746
Buggy source:
@Override public void readToALBuffer(AudioFormat format,DirectBuffer data,UniCallback<ALBuffer> onDecoded){
  if (!isSupported(format))   throw new SilenceException("String_Node_Str" + format + "String_Node_Str");
  AudioDecoder.decodeAudio(((ArrayBufferView)data.nativeBuffer()).buffer(),alBufferID -> onDecoded.invoke(new ALBuffer(alBufferID)),reason -> {
    throw new SilenceException("String_Node_Str" + reason);
  }
);
}

Fixed version (ground truth):
@Override public void readToALBuffer(AudioFormat format,DirectBuffer data,UniCallback<ALBuffer> onDecoded,UniCallback<Throwable> onError){
  try {
    if (!isSupported(format))     throw new SilenceException("String_Node_Str" + format + "String_Node_Str");
    AudioDecoder.decodeAudio(((ArrayBufferView)data.nativeBuffer()).buffer(),alBufferID -> onDecoded.invoke(new ALBuffer(alBufferID)),reason -> {
      throw new SilenceException("String_Node_Str" + reason);
    }
);
  }
 catch (  Throwable e) {
    onError.invoke(e);
  }
}
Program: 96747
Project: 96747
Buggy source:
@Override public void readTextFile(FilePath file,UniCallback<String> onComplete){
  XMLHttpRequest request=XMLHttpRequest.create();
  request.open("String_Node_Str",file.getAbsolutePath());
  request.setResponseType(XMLHttpRequest.ResponseType.Default);
  request.setOnReadyStateChange(xhr -> {
    if (request.getReadyState() == XMLHttpRequest.DONE)     onComplete.invoke(request.getResponseText());
  }
);
  request.send();
}

Fixed version (ground truth):
@Override public void readTextFile(FilePath file,UniCallback<String> onComplete,UniCallback<Throwable> onError){
  XMLHttpRequest request=XMLHttpRequest.create();
  request.open("String_Node_Str",file.getAbsolutePath());
  request.setResponseType(XMLHttpRequest.ResponseType.Default);
  request.setOnReadyStateChange(xhr -> {
    if (request.getReadyState() == XMLHttpRequest.DONE) {
      if (request.getStatus() == 200)       onComplete.invoke(request.getResponseText());
 else       onError.invoke(new SilenceException("String_Node_Str" + request.getStatusText()));
    }
  }
);
  request.send();
}
Program: 96748
Project: 96748
Buggy source:
@Override public void readBinaryFile(FilePath file,UniCallback<DirectBuffer> onComplete){
  XMLHttpRequest request=XMLHttpRequest.create();
  request.open("String_Node_Str",file.getAbsolutePath());
  request.setResponseType(XMLHttpRequest.ResponseType.ArrayBuffer);
  request.setOnReadyStateChange(xhr -> {
    if (request.getReadyState() == XMLHttpRequest.DONE)     onComplete.invoke(new GwtDirectBuffer(request.getResponseArrayBuffer()));
  }
);
  request.send();
}

Fixed version (ground truth):
@Override public void readBinaryFile(FilePath file,UniCallback<DirectBuffer> onComplete,UniCallback<Throwable> onError){
  XMLHttpRequest request=XMLHttpRequest.create();
  request.open("String_Node_Str",file.getAbsolutePath());
  request.setResponseType(XMLHttpRequest.ResponseType.ArrayBuffer);
  request.setOnReadyStateChange(xhr -> {
    if (request.getReadyState() == XMLHttpRequest.DONE) {
      if (request.getStatus() == 200)       onComplete.invoke(new GwtDirectBuffer(request.getResponseArrayBuffer()));
 else       onError.invoke(new SilenceException("String_Node_Str" + request.getStatusText()));
    }
  }
);
  request.send();
}
Program: 96749
Project: 96749
Buggy source:
@Override public void readImage(DirectBuffer memory,UniCallback<Image> onComplete){
  getImage(((ArrayBufferView)memory.nativeBuffer()).buffer(),onComplete);
}

Fixed version (ground truth):
@Override public void readImage(DirectBuffer memory,UniCallback<Image> onComplete,UniCallback<Throwable> onError){
  getImage(((ArrayBufferView)memory.nativeBuffer()).buffer(),onComplete,e -> onError.invoke(new SilenceException(e)));
}
Program: 96750
Project: 96750
Buggy source:
private native void getImage(ArrayBuffer memory,UniCallback<Image> onComplete);

Fixed version (ground truth):
private native void getImage(ArrayBuffer memory,UniCallback<Image> onComplete,UniCallback<String> onError);
Program: 96751
Project: 96751
Buggy source:
private AABB getAABB(CollisionComponent3D e){
  AABB aabb;
  if (aabbMap.containsKey(e.id))   aabb=aabbMap.get(e.id);
 else {
    aabb=AABB.create(e);
    aabbMap.put(e.id,aabb);
  }
  Cuboid bounds=e.polyhedron.getBounds();
  aabb.min.set(bounds.getPosition()).subtract(bounds.getWidth() / 2,bounds.getHeight() / 2,bounds.getThickness() / 2);
  aabb.max.set(bounds.getPosition()).add(bounds.getWidth() / 2,bounds.getHeight() / 2,bounds.getThickness() / 2);
  return aabb;
}

Fixed version (ground truth):
private AABB getAABB(CollisionComponent3D e){
  AABB aabb;
  if (aabbMap.containsKey(e.id))   aabb=aabbMap.get(e.id);
 else {
    aabb=AABB.create(e);
    aabbMap.put(e.id,aabb);
  }
  Cuboid bounds=e.polyhedron.getBounds();
  aabb.min.set(bounds.position).subtract(bounds.width / 2,bounds.height / 2,bounds.thickness / 2);
  aabb.max.set(bounds.position).add(bounds.width / 2,bounds.height / 2,bounds.thickness / 2);
  return aabb;
}
Program: 96752
Project: 96752
Buggy source:
@Override public List<CollisionComponent3D> retrieve(Polyhedron bounds){
  retrieveList.clear();
  AABB aabb=new AABB();
  aabb.min.set(bounds.getPosition()).subtract(bounds.getWidth() / 2,bounds.getHeight() / 2,bounds.getThickness() / 2);
  aabb.max.set(bounds.getPosition()).add(bounds.getWidth() / 2,bounds.getHeight() / 2,bounds.getThickness() / 2);
  queryNode(aabb,root);
  return retrieveList;
}

Fixed version (ground truth):
@Override public List<CollisionComponent3D> retrieve(Cuboid bounds){
  retrieveList.clear();
  AABB aabb=new AABB();
  aabb.min.set(bounds.position).subtract(bounds.width / 2,bounds.height / 2,bounds.thickness / 2);
  aabb.max.set(bounds.position).add(bounds.width / 2,bounds.height / 2,bounds.thickness / 2);
  queryNode(aabb,root);
  return retrieveList;
}
Program: 96753
Project: 96753
Buggy source:
public static AABB create(CollisionComponent3D entity){
  Cuboid bounds=entity.polyhedron.getBounds();
  return new AABB(bounds.getPosition().subtract(bounds.getWidth() / 2,bounds.getHeight() / 2,bounds.getThickness() / 2),bounds.getWidth(),bounds.getHeight(),bounds.getThickness());
}

Fixed version (ground truth):
public static AABB create(CollisionComponent3D entity){
  Cuboid bounds=entity.polyhedron.getBounds();
  return new AABB(bounds.position.subtract(bounds.width / 2,bounds.height / 2,bounds.thickness / 2),bounds.width,bounds.height,bounds.thickness);
}
Program: 96754
Project: 96754
Buggy source:
List<CollisionComponent3D> retrieve(Polyhedron polyhedron);

Fixed version (ground truth):
default List<CollisionComponent3D> retrieve(Polyhedron polyhedron){
  return retrieve(polyhedron.getBounds());
}
Program: 96755
Project: 96755
Buggy source:
public void rotate(float angle,float originX,float originY){
  rotation+=angle;
  if (angle == 0 || this instanceof Circle)   return;
  for (  Vector2 vertex : vertices)   vertex.subtract(originX,originY).rotate(angle).add(originX,originY);
}

Fixed version (ground truth):
public void rotate(float angle,float originX,float originY){
  rotation+=angle;
  if (angle == 0)   return;
  for (  Vector2 vertex : vertices)   vertex.subtract(originX,originY).rotate(angle).add(originX,originY);
}
Program: 96756
Project: 96756
Buggy source:
public void render(Sprite sprite,Transform transform,Color tint,float opacity){
  Texture texture=sprite.getCurrentFrame();
  if (currentTexture == null || texture.getID() != currentTexture.getID()) {
    flush();
    texture.bind(0);
    program.setUniform("String_Node_Str",0);
    currentTexture=texture;
  }
  tempCol.set(tint).a*=opacity;
  final float tw=texture.getWidth() / 2;
  final float th=texture.getHeight() / 2;
  renderer.flushOnOverflow(6);
  renderer.vertex(tempVec.set(-1,-1,0).scale(tw,th,0).multiply(transform.matrix));
  renderer.texCoord(currentTexture.getMinU(),currentTexture.getMinV());
  renderer.color(tempCol);
  renderer.vertex(tempVec.set(1,-1,0).scale(tw,th,0).multiply(transform.matrix));
  renderer.texCoord(currentTexture.getMaxU(),currentTexture.getMinV());
  renderer.color(tempCol);
  renderer.vertex(tempVec.set(-1,1,0).scale(tw,th,0).multiply(transform.matrix));
  renderer.texCoord(currentTexture.getMinU(),currentTexture.getMaxV());
  renderer.color(tempCol);
  renderer.vertex(tempVec.set(1,-1,0).scale(tw,th,0).multiply(transform.matrix));
  renderer.texCoord(currentTexture.getMaxU(),currentTexture.getMinV());
  renderer.color(tempCol);
  renderer.vertex(tempVec.set(1,1,0).scale(tw,th,0).multiply(transform.matrix));
  renderer.texCoord(currentTexture.getMaxU(),currentTexture.getMaxV());
  renderer.color(tempCol);
  renderer.vertex(tempVec.set(-1,1,0).scale(tw,th,0).multiply(transform.matrix));
  renderer.texCoord(currentTexture.getMinU(),currentTexture.getMaxV());
  renderer.color(tempCol);
}

Fixed version (ground truth):
public void render(Sprite sprite,Transform transform,Color tint,float opacity){
  Texture texture=sprite.getCurrentFrame();
  if (currentTexture == null || texture.getID() != currentTexture.getID()) {
    flush();
    texture.bind(0);
    program.setUniform("String_Node_Str",0);
  }
  currentTexture=texture;
  tempCol.set(tint).a*=opacity;
  final float tw=texture.getWidth() / 2;
  final float th=texture.getHeight() / 2;
  renderer.flushOnOverflow(6);
  renderer.vertex(tempVec.set(-1,-1,0).scale(tw,th,0).multiply(transform.matrix));
  renderer.texCoord(currentTexture.getMinU(),currentTexture.getMinV());
  renderer.color(tempCol);
  renderer.vertex(tempVec.set(1,-1,0).scale(tw,th,0).multiply(transform.matrix));
  renderer.texCoord(currentTexture.getMaxU(),currentTexture.getMinV());
  renderer.color(tempCol);
  renderer.vertex(tempVec.set(-1,1,0).scale(tw,th,0).multiply(transform.matrix));
  renderer.texCoord(currentTexture.getMinU(),currentTexture.getMaxV());
  renderer.color(tempCol);
  renderer.vertex(tempVec.set(1,-1,0).scale(tw,th,0).multiply(transform.matrix));
  renderer.texCoord(currentTexture.getMaxU(),currentTexture.getMinV());
  renderer.color(tempCol);
  renderer.vertex(tempVec.set(1,1,0).scale(tw,th,0).multiply(transform.matrix));
  renderer.texCoord(currentTexture.getMaxU(),currentTexture.getMaxV());
  renderer.color(tempCol);
  renderer.vertex(tempVec.set(-1,1,0).scale(tw,th,0).multiply(transform.matrix));
  renderer.texCoord(currentTexture.getMinU(),currentTexture.getMaxV());
  renderer.color(tempCol);
}
Program: 96757
Project: 96757
Buggy source:
private void updateSources(float deltaTime){
  Iterator<PlayingSource> iterator=playingSources.keySet().iterator();
  while (iterator.hasNext()) {
    PlayingSource playingSource=iterator.next();
    ALSource source=playingSource.alSource;
    AudioSource audioSource=playingSources.get(playingSource);
    if (source.getState() != ALSource.State.PLAYING) {
      source.attachBuffer(null);
      iterator.remove();
      sourcesPool.push(source);
      playingSourcesPool.push(playingSource);
      continue;
    }
    if (audioSource.updated) {
      source.pause();
      source.setParameter(AL_POSITION,audioSource.position);
      source.setParameter(AL_VELOCITY,audioSource.velocity);
      source.setParameter(AL_DIRECTION,audioSource.direction);
      audioSource.updated=false;
      source.play();
    }
  }
}

Fixed version (ground truth):
private void updateSources(float deltaTime){
  Iterator<PlayingSource> iterator=playingSources.keySet().iterator();
  while (iterator.hasNext()) {
    PlayingSource playingSource=iterator.next();
    ALSource source=playingSource.alSource;
    AudioSource audioSource=playingSources.get(playingSource);
    ALSource.State state=source.getState();
    if (state != ALSource.State.PLAYING && state != ALSource.State.LOOPING) {
      source.attachBuffer(null);
      iterator.remove();
      sourcesPool.push(source);
      playingSourcesPool.push(playingSource);
      continue;
    }
    if (audioSource.updated) {
      source.pause();
      source.setParameter(AL_POSITION,audioSource.position);
      source.setParameter(AL_VELOCITY,audioSource.velocity);
      source.setParameter(AL_DIRECTION,audioSource.direction);
      audioSource.updated=false;
      source.play();
    }
  }
}
Program: 96758
Project: 96758
Buggy source:
@Override public void setIcon(FilePath filePath,SimpleCallback success){
}

Fixed version (ground truth):
@Override public void setIcon(FilePath filePath){
}
Program: 96759
Project: 96759
Buggy source:
@Override public boolean exists(){
  try {
    return getInputStream() != null;
  }
 catch (  IOException e) {
    e.printStackTrace();
    return false;
  }
}

Fixed version (ground truth):
@Override public boolean exists(){
  try {
    AssetFileDescriptor desc=assetManager.openFd(path);
    desc.close();
  }
 catch (  Exception e) {
    return true;
  }
  return false;
}
Program: 96760
Project: 96760
Buggy source:
@Override public boolean isDirectory(){
  return !isFile();
}

Fixed version (ground truth):
@Override public boolean isDirectory(){
  return exists;
}
Program: 96761
Project: 96761
Buggy source:
public void end(){
  renderer.end();
}

Fixed version (ground truth):
public void end(){
  renderer.end();
  currentTexture=null;
}
Program: 96762
Project: 96762
Buggy source:
public void begin(){
  renderer.begin(Primitive.TRIANGLES);
}

Fixed version (ground truth):
public void begin(){
  program.use();
  program.applyToRenderer(renderer);
  renderer.begin(Primitive.TRIANGLES);
}
Program: 96763
Project: 96763
Buggy source:
public void render(Sprite sprite,Transform transform,Color tint,float opacity){
  Texture texture=sprite.getCurrentFrame();
  if (currentTexture == null || texture.getID() != currentTexture.getID()) {
    flush();
    texture.bind(0);
    program.setUniform("String_Node_Str",0);
    currentTexture=texture;
  }
  tempCol.set(tint).a*=opacity;
  final float tw=texture.getWidth() / 2;
  final float th=texture.getHeight() / 2;
  renderer.vertex(tempVec.set(-1,-1,0).scale(tw,th,0).multiply(transform.matrix));
  renderer.texCoord(currentTexture.getMinU(),currentTexture.getMinV());
  renderer.color(tempCol);
  renderer.vertex(tempVec.set(1,-1,0).scale(tw,th,0).multiply(transform.matrix));
  renderer.texCoord(currentTexture.getMaxU(),currentTexture.getMinV());
  renderer.color(tempCol);
  renderer.vertex(tempVec.set(-1,1,0).scale(tw,th,0).multiply(transform.matrix));
  renderer.texCoord(currentTexture.getMinU(),currentTexture.getMaxV());
  renderer.color(tempCol);
  renderer.vertex(tempVec.set(1,-1,0).scale(tw,th,0).multiply(transform.matrix));
  renderer.texCoord(currentTexture.getMaxU(),currentTexture.getMinV());
  renderer.color(tempCol);
  renderer.vertex(tempVec.set(1,1,0).scale(tw,th,0).multiply(transform.matrix));
  renderer.texCoord(currentTexture.getMaxU(),currentTexture.getMaxV());
  renderer.color(tempCol);
  renderer.vertex(tempVec.set(-1,1,0).scale(tw,th,0).multiply(transform.matrix));
  renderer.texCoord(currentTexture.getMinU(),currentTexture.getMaxV());
  renderer.color(tempCol);
}

Fixed version (ground truth):
public void render(Sprite sprite,Transform transform,Color tint,float opacity){
  Texture texture=sprite.getCurrentFrame();
  if (currentTexture == null || texture.getID() != currentTexture.getID()) {
    flush();
    texture.bind(0);
    program.setUniform("String_Node_Str",0);
    currentTexture=texture;
  }
  tempCol.set(tint).a*=opacity;
  final float tw=texture.getWidth() / 2;
  final float th=texture.getHeight() / 2;
  renderer.flushOnOverflow(6);
  renderer.vertex(tempVec.set(-1,-1,0).scale(tw,th,0).multiply(transform.matrix));
  renderer.texCoord(currentTexture.getMinU(),currentTexture.getMinV());
  renderer.color(tempCol);
  renderer.vertex(tempVec.set(1,-1,0).scale(tw,th,0).multiply(transform.matrix));
  renderer.texCoord(currentTexture.getMaxU(),currentTexture.getMinV());
  renderer.color(tempCol);
  renderer.vertex(tempVec.set(-1,1,0).scale(tw,th,0).multiply(transform.matrix));
  renderer.texCoord(currentTexture.getMinU(),currentTexture.getMaxV());
  renderer.color(tempCol);
  renderer.vertex(tempVec.set(1,-1,0).scale(tw,th,0).multiply(transform.matrix));
  renderer.texCoord(currentTexture.getMaxU(),currentTexture.getMinV());
  renderer.color(tempCol);
  renderer.vertex(tempVec.set(1,1,0).scale(tw,th,0).multiply(transform.matrix));
  renderer.texCoord(currentTexture.getMaxU(),currentTexture.getMaxV());
  renderer.color(tempCol);
  renderer.vertex(tempVec.set(-1,1,0).scale(tw,th,0).multiply(transform.matrix));
  renderer.texCoord(currentTexture.getMinU(),currentTexture.getMaxV());
  renderer.color(tempCol);
}
Program: 96764
Project: 96764
Buggy source:
public AndroidDisplayDevice(){
  this.startTime=SystemClock.elapsedRealtimeNanos();
  this.activity=AndroidLauncher.instance;
  this.surfaceView=activity.surfaceView;
}

Fixed version (ground truth):
public AndroidDisplayDevice(){
  this.startTime=SystemClock.elapsedRealtimeNanos();
  this.activity=AndroidLauncher.instance;
  this.surfaceView=activity.surfaceView;
  setSize(800,600);
}
Program: 96765
Project: 96765
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  instance=this;
  requestWindowFeature(Window.FEATURE_NO_TITLE);
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
  surfaceView=new GLSurfaceView(this);
  surfaceView.setEGLContextClientVersion(3);
  surfaceView.setPreserveEGLContextOnPause(true);
  surfaceView.setRenderer(renderer=new AndroidWindow(this::launchGame));
  setContentView(surfaceView);
  setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  instance=this;
  requestWindowFeature(Window.FEATURE_NO_TITLE);
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
  surfaceView=new GLSurfaceView(this);
  surfaceView.setEGLContextClientVersion(3);
  surfaceView.setPreserveEGLContextOnPause(true);
  surfaceView.setRenderer(renderer=new AndroidWindow(this::launchGame));
  setContentView(surfaceView);
}
Program: 96766
Project: 96766
Buggy source:
private boolean onTouch(View v,MotionEvent e){
  final int action=e.getActionMasked();
switch (action) {
case MotionEvent.ACTION_DOWN:
    surfaceView.queueEvent(() -> postTouchEvent(FINGER_0,true,e.getX(),e.getY()));
  break;
case MotionEvent.ACTION_UP:
surfaceView.queueEvent(() -> postTouchEvent(FINGER_0,false,e.getX(),e.getY()));
break;
case MotionEvent.ACTION_POINTER_DOWN:
case MotionEvent.ACTION_POINTER_UP:
{
final int index=e.getActionIndex();
final int finger=index + 1;
if (finger < FINGER_1 || finger > FINGER_9) break;
final boolean isDown=action == MotionEvent.ACTION_POINTER_DOWN;
surfaceView.queueEvent(() -> postTouchEvent(finger,isDown,e.getX(),e.getY()));
}
break;
case MotionEvent.ACTION_MOVE:
for (int i=0; i < e.getPointerCount(); i++) {
final int finger=i + 1;
if (finger < FINGER_0 || finger > FINGER_9) break;
surfaceView.queueEvent(() -> postTouchEvent(finger,true,e.getX(finger - 1),e.getY(finger - 1)));
}
for (int i=e.getPointerCount(); i < FINGER_9; i++) {
final int finger=i + 1;
surfaceView.queueEvent(() -> postTouchEvent(finger,false,0,0));
}
break;
}
return true;
}

Fixed version (ground truth):
private boolean onTouch(View v,MotionEvent e){
  final int action=e.getActionMasked();
switch (action) {
case MotionEvent.ACTION_DOWN:
case MotionEvent.ACTION_UP:
{
      final boolean down=action == ACTION_DOWN;
      final float x=e.getX();
      final float y=e.getY();
      surfaceView.queueEvent(() -> postTouchEvent(FINGER_0,down,x,y));
      break;
    }
case MotionEvent.ACTION_POINTER_DOWN:
case MotionEvent.ACTION_POINTER_UP:
{
    final int index=e.getActionIndex();
    final int finger=index + 1;
    if (finger < FINGER_1 || finger > FINGER_9)     break;
    final float x=e.getX();
    final float y=e.getY();
    final boolean isDown=action == MotionEvent.ACTION_POINTER_DOWN;
    surfaceView.queueEvent(() -> postTouchEvent(finger,isDown,x,y));
    break;
  }
case MotionEvent.ACTION_MOVE:
{
  for (int i=0; i < e.getPointerCount(); i++) {
    final int finger=i + 1;
    if (finger < FINGER_0 || finger > FINGER_9)     break;
    final float x=e.getX(i);
    final float y=e.getY(i);
    surfaceView.queueEvent(() -> postTouchEvent(finger,true,x,y));
  }
  for (int i=e.getPointerCount(); i < FINGER_9; i++) {
    final int finger=i + 1;
    surfaceView.queueEvent(() -> postTouchEvent(finger,false,0,0));
  }
  break;
}
}
return true;
}
Program: 96767
Project: 96767
Buggy source:
@Override public void glClear(int flags){
  IGraphicsDevice.super.glClear(flags);
  GLES30.glClear(flags);
}

Fixed version (ground truth):
@Override public void glClear(int flags){
  Data.renderCallsThisFrame=0;
  GLES30.glClear(flags);
}
Program: 96768
Project: 96768
Buggy source:
@Override public void glDrawArrays(int primitive,int offset,int vertexCount){
  IGraphicsDevice.super.glDrawArrays(primitive,offset,vertexCount);
  GLES30.glDrawArrays(primitive,offset,vertexCount);
}

Fixed version (ground truth):
@Override public void glDrawArrays(int primitive,int offset,int vertexCount){
  Data.renderCallsThisFrame++;
  Data.totalRenderCalls++;
  GLES30.glDrawArrays(primitive,offset,vertexCount);
}
Program: 96769
Project: 96769
Buggy source:
@Override public void glDrawElements(int primitive,int vertexCount,int type,int offset){
  IGraphicsDevice.super.glDrawElements(primitive,vertexCount,type,offset);
  GLES30.glDrawElements(primitive,vertexCount,type,offset);
}

Fixed version (ground truth):
@Override public void glDrawElements(int primitive,int vertexCount,int type,int offset){
  Data.renderCallsThisFrame++;
  Data.totalRenderCalls++;
  GLES30.glDrawElements(primitive,vertexCount,type,offset);
}
Program: 96770
Project: 96770
Buggy source:
public void onFocusLost(){
  pausedSources.clear();
  for (  int source : sources) {
    if (AL.alIsSource(source) != 0) {
      pausedSources.add(source);
      alSourcePause(source);
    }
  }
}

Fixed version (ground truth):
public void onFocusLost(){
  pausedSources.clear();
  for (  int source : sources) {
    AL.alGetSourcei(source,AL_SOURCE_STATE,temp);
    if (temp.get(0) == AL_PLAYING || temp.get(0) == AL_LOOPING) {
      pausedSources.add(source);
      alSourcePause(source);
    }
  }
}
Program: 96771
Project: 96771
Buggy source:
@Override public void readImage(DirectBuffer memory,UniCallback<Image> uniCallback){
  new Thread(() -> {
    Bitmap bitmap=BitmapFactory.decodeStream(new DirectBufferInputStream(memory));
    if (bitmap == null)     throw new SilenceException(new IOException("String_Node_Str"));
    Image image=new Image(bitmap.getWidth(),bitmap.getHeight());
    for (int x=0; x < image.getWidth(); x++)     for (int y=0; y < image.getHeight(); y++)     image.setPixel(x,y,new Color(bitmap.getPixel(x,y)));
    bitmap.recycle();
    bitmap=null;
    TaskManager.runOnUpdate(() -> uniCallback.invoke(image));
  }
).start();
}

Fixed version (ground truth):
@Override public void readImage(DirectBuffer memory,UniCallback<Image> uniCallback){
  new Thread(() -> {
    Bitmap bitmap=BitmapFactory.decodeStream(new DirectBufferInputStream(memory));
    if (bitmap == null)     throw new SilenceException(new IOException("String_Node_Str"));
    Image image=new Image(bitmap.getWidth(),bitmap.getHeight());
    for (int x=0; x < image.getWidth(); x++)     for (int y=0; y < image.getHeight(); y++) {
      int rgba=bitmap.getPixel(x,y);
      float r=((rgba & 0x00FF0000) >> 16) / 255f;
      float g=((rgba & 0x0000FF00) >> 8) / 255f;
      float b=(rgba & 0x000000FF) / 255f;
      float a=((rgba & 0xFF000000) >> 24) / 255f;
      image.setPixel(x,y,new Color(r,g,b,a));
    }
    bitmap.recycle();
    bitmap=null;
    TaskManager.runOnUpdate(() -> uniCallback.invoke(image));
  }
).start();
}
Program: 96772
Project: 96772
Buggy source:
private static void jsLoadedCallback(ImageData pixels,int width,int height,int oWidth,int oHeight,UniCallback<Image> onComplete){
  Image image=new Image(width,height,oWidth,oHeight);
  for (int x=0; x < width; x++) {
    for (int y=0; y < height; y++)     image.setPixel(x,y,new Color(pixels.getRedAt(x,y) / 255f,pixels.getGreenAt(x,y) / 255f,pixels.getBlueAt(x,y) / 255f,1 - (pixels.getAlphaAt(x,y) / 255f)));
  }
  onComplete.invoke(image);
}

Fixed version (ground truth):
private static void jsLoadedCallback(ImageData pixels,int width,int height,int oWidth,int oHeight,UniCallback<Image> onComplete){
  Image image=new Image(width,height,oWidth,oHeight);
  for (int x=0; x < width; x++) {
    for (int y=0; y < height; y++)     image.setPixel(x,y,new Color(pixels.getRedAt(x,y) / 255f,pixels.getGreenAt(x,y) / 255f,pixels.getBlueAt(x,y) / 255f,pixels.getAlphaAt(x,y) / 255f));
  }
  onComplete.invoke(image);
}
Program: 96773
Project: 96773
Buggy source:
@Override public void readImage(DirectBuffer memory,UniCallback<Image> onComplete){
  new Thread(() -> {
    IntBuffer width=BufferUtils.createIntBuffer(1);
    IntBuffer height=BufferUtils.createIntBuffer(1);
    IntBuffer components=BufferUtils.createIntBuffer(1);
    ByteBuffer imageBuffer=stbi_load_from_memory((ByteBuffer)memory.nativeBuffer(),width,height,components,4);
    if (imageBuffer == null)     throw new SilenceException("String_Node_Str" + stbi_failure_reason());
    Image image=new Image(width.get(0),height.get(0));
    for (int y=0; y < image.getHeight(); y++) {
      for (int x=0; x < image.getWidth(); x++) {
        int start=4 * (y * image.getWidth() + x);
        float r=(imageBuffer.get(start) & 0xff) / 255f;
        float g=(imageBuffer.get(start + 1) & 0xff) / 255f;
        float b=(imageBuffer.get(start + 2) & 0xff) / 255f;
        float a=1 - (imageBuffer.get(start + 3) & 0xff) / 255f;
        image.setPixel(x,y,new Color(r,g,b,a));
      }
    }
    stbi_image_free(imageBuffer);
    TaskManager.runOnUpdate(() -> onComplete.invoke(image));
  }
).start();
}

Fixed version (ground truth):
@Override public void readImage(DirectBuffer memory,UniCallback<Image> onComplete){
  new Thread(() -> {
    IntBuffer width=BufferUtils.createIntBuffer(1);
    IntBuffer height=BufferUtils.createIntBuffer(1);
    IntBuffer components=BufferUtils.createIntBuffer(1);
    ByteBuffer imageBuffer=stbi_load_from_memory((ByteBuffer)memory.nativeBuffer(),width,height,components,4);
    if (imageBuffer == null)     throw new SilenceException("String_Node_Str" + stbi_failure_reason());
    Image image=new Image(width.get(0),height.get(0));
    for (int y=0; y < image.getHeight(); y++) {
      for (int x=0; x < image.getWidth(); x++) {
        int start=4 * (y * image.getWidth() + x);
        float r=(imageBuffer.get(start) & 0xff) / 255f;
        float g=(imageBuffer.get(start + 1) & 0xff) / 255f;
        float b=(imageBuffer.get(start + 2) & 0xff) / 255f;
        float a=(imageBuffer.get(start + 3) & 0xff) / 255f;
        image.setPixel(x,y,new Color(r,g,b,a));
      }
    }
    stbi_image_free(imageBuffer);
    TaskManager.runOnUpdate(() -> onComplete.invoke(image));
  }
).start();
}
Program: 96774
Project: 96774
Buggy source:
private boolean onTouch(View v,MotionEvent e){
  final int action=e.getActionMasked();
switch (action) {
case MotionEvent.ACTION_DOWN:
    surfaceView.queueEvent(() -> postTouchEvent(FINGER_0,true,e.getX(),e.getY()));
  break;
case MotionEvent.ACTION_UP:
surfaceView.queueEvent(() -> postTouchEvent(FINGER_0,false,e.getX(),e.getY()));
break;
case MotionEvent.ACTION_POINTER_DOWN:
case MotionEvent.ACTION_POINTER_UP:
{
final int index=e.getActionIndex();
final int finger=index + 1;
if (finger < FINGER_1 || finger > FINGER_9) break;
final boolean isDown=action == MotionEvent.ACTION_POINTER_DOWN;
surfaceView.queueEvent(() -> postTouchEvent(finger,isDown,e.getX(),e.getY()));
}
break;
case MotionEvent.ACTION_MOVE:
for (int i=0; i < e.getPointerCount(); i++) {
final int finger=i + 1;
if (finger < FINGER_1 || finger > FINGER_9) break;
surfaceView.queueEvent(() -> postTouchEvent(finger,true,e.getX(finger - 1),e.getY(finger - 1)));
}
for (int i=e.getPointerCount(); i < FINGER_9; i++) {
final int finger=i + 1;
surfaceView.queueEvent(() -> postTouchEvent(finger,false,0,0));
}
break;
}
return true;
}

Fixed version (ground truth):
private boolean onTouch(View v,MotionEvent e){
  final int action=e.getActionMasked();
switch (action) {
case MotionEvent.ACTION_DOWN:
    surfaceView.queueEvent(() -> postTouchEvent(FINGER_0,true,e.getX(),e.getY()));
  break;
case MotionEvent.ACTION_UP:
surfaceView.queueEvent(() -> postTouchEvent(FINGER_0,false,e.getX(),e.getY()));
break;
case MotionEvent.ACTION_POINTER_DOWN:
case MotionEvent.ACTION_POINTER_UP:
{
final int index=e.getActionIndex();
final int finger=index + 1;
if (finger < FINGER_1 || finger > FINGER_9) break;
final boolean isDown=action == MotionEvent.ACTION_POINTER_DOWN;
surfaceView.queueEvent(() -> postTouchEvent(finger,isDown,e.getX(),e.getY()));
}
break;
case MotionEvent.ACTION_MOVE:
for (int i=0; i < e.getPointerCount(); i++) {
final int finger=i + 1;
if (finger < FINGER_0 || finger > FINGER_9) break;
surfaceView.queueEvent(() -> postTouchEvent(finger,true,e.getX(finger - 1),e.getY(finger - 1)));
}
for (int i=e.getPointerCount(); i < FINGER_9; i++) {
final int finger=i + 1;
surfaceView.queueEvent(() -> postTouchEvent(finger,false,0,0));
}
break;
}
return true;
}
Program: 96775
Project: 96775
Buggy source:
@Override public void readTextFile(FilePath file,OnComplete<String> onComplete){
  XMLHttpRequest request=XMLHttpRequest.create();
  request.open("String_Node_Str",file.getAbsolutePath());
  request.setResponseType(XMLHttpRequest.ResponseType.Default);
  request.setOnReadyStateChange(xhr -> {
    if (request.getReadyState() == XMLHttpRequest.DONE)     onComplete.invoke(request.getResponseText());
  }
);
  request.send();
}

Fixed version (ground truth):
@Override public void readTextFile(FilePath file,UniCallback<String> onComplete){
  XMLHttpRequest request=XMLHttpRequest.create();
  request.open("String_Node_Str",file.getAbsolutePath());
  request.setResponseType(XMLHttpRequest.ResponseType.Default);
  request.setOnReadyStateChange(xhr -> {
    if (request.getReadyState() == XMLHttpRequest.DONE)     onComplete.invoke(request.getResponseText());
  }
);
  request.send();
}
Program: 96776
Project: 96776
Buggy source:
@Override public void readBinaryFile(FilePath file,OnComplete<DirectBuffer> onComplete){
  XMLHttpRequest request=XMLHttpRequest.create();
  request.open("String_Node_Str",file.getAbsolutePath());
  request.setResponseType(XMLHttpRequest.ResponseType.ArrayBuffer);
  request.setOnReadyStateChange(xhr -> {
    if (request.getReadyState() == XMLHttpRequest.DONE)     onComplete.invoke(new GwtDirectBuffer(request.getResponseArrayBuffer()));
  }
);
  request.send();
}

Fixed version (ground truth):
@Override public void readBinaryFile(FilePath file,UniCallback<DirectBuffer> onComplete){
  XMLHttpRequest request=XMLHttpRequest.create();
  request.open("String_Node_Str",file.getAbsolutePath());
  request.setResponseType(XMLHttpRequest.ResponseType.ArrayBuffer);
  request.setOnReadyStateChange(xhr -> {
    if (request.getReadyState() == XMLHttpRequest.DONE)     onComplete.invoke(new GwtDirectBuffer(request.getResponseArrayBuffer()));
  }
);
  request.send();
}
Program: 96777
Project: 96777
Buggy source:
private static void jsLoadedCallback(ImageData pixels,int width,int height,int oWidth,int oHeight,OnComplete onComplete){
  Image image=new Image(width,height,oWidth,oHeight);
  for (int x=0; x < width; x++) {
    for (int y=0; y < height; y++)     image.setPixel(x,y,new Color(pixels.getRedAt(x,y) / 255f,pixels.getGreenAt(x,y) / 255f,pixels.getBlueAt(x,y) / 255f,1 - (pixels.getAlphaAt(x,y) / 255f)));
  }
  onComplete.invoke(image);
}

Fixed version (ground truth):
private static void jsLoadedCallback(ImageData pixels,int width,int height,int oWidth,int oHeight,UniCallback<Image> onComplete){
  Image image=new Image(width,height,oWidth,oHeight);
  for (int x=0; x < width; x++) {
    for (int y=0; y < height; y++)     image.setPixel(x,y,new Color(pixels.getRedAt(x,y) / 255f,pixels.getGreenAt(x,y) / 255f,pixels.getBlueAt(x,y) / 255f,1 - (pixels.getAlphaAt(x,y) / 255f)));
  }
  onComplete.invoke(image);
}
Program: 96778
Project: 96778
Buggy source:
@Override public void readImage(DirectBuffer memory,OnComplete onComplete){
  getImage(((ArrayBufferView)memory.nativeBuffer()).buffer(),onComplete);
}

Fixed version (ground truth):
@Override public void readImage(DirectBuffer memory,UniCallback<Image> onComplete){
  getImage(((ArrayBufferView)memory.nativeBuffer()).buffer(),onComplete);
}
Program: 96779
Project: 96779
Buggy source:
private native void getImage(ArrayBuffer memory,OnComplete onComplete);

Fixed version (ground truth):
private native void getImage(ArrayBuffer memory,UniCallback<Image> onComplete);
Program: 96780
Project: 96780
Buggy source:
@Override public void readTextFile(FilePath file,OnComplete<String> onComplete){
  new Thread(() -> {
    try (InputStream inputStream=((LwjglFilePath)file).getInputStream();BufferedReader bufferedReader=new BufferedReader(new InputStreamReader(inputStream))){
      StringBuilder stringBuilder=new StringBuilder();
      String line=null;
      while ((line=bufferedReader.readLine()) != null)       stringBuilder.append(line).append("String_Node_Str");
      TaskManager.runOnUpdate(() -> onComplete.invoke(stringBuilder.toString()));
    }
 catch (    Exception e) {
      SilenceEngine.log.getRootLogger().error(e);
    }
  }
).start();
}

Fixed version (ground truth):
@Override public void readTextFile(FilePath file,UniCallback<String> onComplete){
  new Thread(() -> {
    try (InputStream inputStream=((LwjglFilePath)file).getInputStream();BufferedReader bufferedReader=new BufferedReader(new InputStreamReader(inputStream))){
      StringBuilder stringBuilder=new StringBuilder();
      String line=null;
      while ((line=bufferedReader.readLine()) != null)       stringBuilder.append(line).append("String_Node_Str");
      TaskManager.runOnUpdate(() -> onComplete.invoke(stringBuilder.toString()));
    }
 catch (    Exception e) {
      SilenceEngine.log.getRootLogger().error(e);
    }
  }
).start();
}
Program: 96781
Project: 96781
Buggy source:
@Override public void readBinaryFile(FilePath file,OnComplete<DirectBuffer> onComplete){
  new Thread(() -> {
    try {
      InputStream inputStream=((LwjglFilePath)file).getInputStream();
      ByteArrayOutputStream outputStream=new ByteArrayOutputStream();
      byte[] buffer=new byte[4096];
      while (true) {
        int n=inputStream.read(buffer);
        if (n < 0)         break;
        outputStream.write(buffer,0,n);
      }
      inputStream.close();
      byte[] bytes=outputStream.toByteArray();
      DirectBuffer directBuffer=new LwjglDirectBuffer(bytes.length);
      for (int i=0; i < bytes.length; i++)       directBuffer.writeByte(i,bytes[i]);
      TaskManager.runOnUpdate(() -> onComplete.invoke(directBuffer));
    }
 catch (    Exception e) {
      SilenceEngine.log.getRootLogger().error(e);
    }
  }
).start();
}

Fixed version (ground truth):
@Override public void readBinaryFile(FilePath file,UniCallback<DirectBuffer> onComplete){
  new Thread(() -> {
    try {
      InputStream inputStream=((LwjglFilePath)file).getInputStream();
      ByteArrayOutputStream outputStream=new ByteArrayOutputStream();
      byte[] buffer=new byte[4096];
      while (true) {
        int n=inputStream.read(buffer);
        if (n < 0)         break;
        outputStream.write(buffer,0,n);
      }
      inputStream.close();
      byte[] bytes=outputStream.toByteArray();
      DirectBuffer directBuffer=new LwjglDirectBuffer(bytes.length);
      for (int i=0; i < bytes.length; i++)       directBuffer.writeByte(i,bytes[i]);
      TaskManager.runOnUpdate(() -> onComplete.invoke(directBuffer));
    }
 catch (    Exception e) {
      SilenceEngine.log.getRootLogger().error(e);
    }
  }
).start();
}