nus-yam/ex-repair huggingface dataset:
Program: 163587
Project: 163587
Buggy source:
static public boolean ensureProperAVD(final Frame window,final AndroidMode mode,final AndroidSDK sdk,boolean wear){
  try {
    if (wear) {
      if (wearAVD.exists(sdk)) {
        return true;
      }
      if (wearAVD.badness()) {
        AndroidUtil.showMessage(AVD_LOAD_TITLE,AVD_LOAD_MESSAGE);
        return false;
      }
      if (wearAVD.hasWearImages(sdk)) {
        boolean res=AndroidSDK.locateSysImage(window,mode,true);
        if (!res) {
          return false;
        }
 else {
          wearAVD.refreshWearImages(sdk);
        }
      }
      if (wearAVD.create(sdk)) {
        return true;
      }
    }
 else {
      if (mobileAVD.exists(sdk)) {
        return true;
      }
      if (mobileAVD.badness()) {
        AndroidUtil.showMessage(AVD_LOAD_TITLE,AVD_LOAD_MESSAGE);
        return false;
      }
      if (mobileAVD.hasImages(sdk)) {
        boolean res=AndroidSDK.locateSysImage(window,mode,false);
        if (!res) {
          return false;
        }
 else {
          mobileAVD.refreshImages(sdk);
        }
      }
      if (mobileAVD.create(sdk)) {
        return true;
      }
    }
  }
 catch (  final Exception e) {
    e.printStackTrace();
    AndroidUtil.showMessage(AVD_CREATE_TITLE,String.format(AVD_CREATE_MESSAGE,AndroidBuild.TARGET_SDK));
  }
  return false;
}

Fixed version (ground truth):
static public boolean ensureProperAVD(final Frame window,final AndroidMode mode,final AndroidSDK sdk,boolean wear){
  try {
    if (wear) {
      if (wearAVD.exists(sdk)) {
        return true;
      }
      if (wearAVD.badness()) {
        AndroidUtil.showMessage(AVD_LOAD_TITLE,AVD_LOAD_MESSAGE);
        return false;
      }
      if (!wearAVD.hasWearImages(sdk)) {
        boolean res=AndroidSDK.locateSysImage(window,mode,true);
        if (!res) {
          return false;
        }
 else {
          wearAVD.refreshWearImages(sdk);
        }
      }
      if (wearAVD.create(sdk)) {
        return true;
      }
    }
 else {
      if (mobileAVD.exists(sdk)) {
        return true;
      }
      if (mobileAVD.badness()) {
        AndroidUtil.showMessage(AVD_LOAD_TITLE,AVD_LOAD_MESSAGE);
        return false;
      }
      if (!mobileAVD.hasImages(sdk)) {
        boolean res=AndroidSDK.locateSysImage(window,mode,false);
        if (!res) {
          return false;
        }
 else {
          mobileAVD.refreshImages(sdk);
        }
      }
      if (mobileAVD.create(sdk)) {
        return true;
      }
    }
  }
 catch (  final Exception e) {
    e.printStackTrace();
    AndroidUtil.showMessage(AVD_CREATE_TITLE,String.format(AVD_CREATE_MESSAGE,AndroidBuild.TARGET_SDK));
  }
  return false;
}
Program: 163588
Project: 163588
Buggy source:
protected void getImages(final ArrayList<String> images,final AndroidSDK sdk,final String imageTag) throws IOException {
  ProcessBuilder pb=new ProcessBuilder(sdk.getAvdManagerPath(),"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  Map<String,String> env=pb.environment();
  env.clear();
  env.put("String_Node_Str",Platform.getJavaHome().getCanonicalPath());
  pb.redirectErrorStream(true);
  try {
    process=pb.start();
    StreamPump output=new StreamPump(process.getInputStream(),"String_Node_Str");
    output.addTarget(new LineProcessor(){
      @Override public void processLine(      String line){
        if (images != null && line.contains(AndroidBuild.TARGET_PLATFORM) && line.contains(imageTag))         System.out.println("String_Node_Str" + line);
        images.add(line);
      }
    }
).start();
    process.waitFor();
  }
 catch (  final InterruptedException ie) {
    ie.printStackTrace();
  }
 finally {
    process.destroy();
  }
}

Fixed version (ground truth):
protected void getImages(final ArrayList<String> images,final AndroidSDK sdk,final String imageTag) throws IOException {
  final String[] cmd=new String[]{sdk.getAvdManagerPath(),"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  ProcessBuilder pb=new ProcessBuilder(cmd);
  System.out.println(processing.core.PApplet.join(cmd,"String_Node_Str"));
  Map<String,String> env=pb.environment();
  env.clear();
  env.put("String_Node_Str",Platform.getJavaHome().getCanonicalPath());
  pb.redirectErrorStream(true);
  try {
    process=pb.start();
    StreamPump output=new StreamPump(process.getInputStream(),"String_Node_Str");
    output.addTarget(new LineProcessor(){
      @Override public void processLine(      String line){
        System.out.println("String_Node_Str" + line);
        if (images != null && line.contains(AndroidBuild.TARGET_PLATFORM) && line.contains(imageTag))         System.out.println("String_Node_Str");
        images.add(line);
      }
    }
).start();
    process.waitFor();
  }
 catch (  final InterruptedException ie) {
    ie.printStackTrace();
  }
 finally {
    process.destroy();
  }
}
Program: 163590
Project: 163590
Buggy source:
public void actionPerformed(ActionEvent actionEvent){
  cancelTasks();
  setVisible(false);
}

Fixed version (ground truth):
public void actionPerformed(ActionEvent actionEvent){
  cancelTasks();
  dispose();
}
Program: 163591
Project: 163591
Buggy source:
@Override protected Object doInBackground() throws Exception {
  ArrayList<String> cmd=new ArrayList<>();
  String path=toolsFolder + File.separator + "String_Node_Str"+ File.separator;
  if (Platform.isWindows())   path+="String_Node_Str";
 else   path+="String_Node_Str";
  cmd.add(path);
  if (installFlag) {
  }
 else {
    cmd.add("String_Node_Str");
    ProcessBuilder process=new ProcessBuilder(cmd);
    Process p=process.start();
    try {
      progressBar.setIndeterminate(true);
      p.waitFor();
    }
 catch (    InterruptedException e) {
      p.destroy();
    }
    progressBar.setIndeterminate(false);
  }
  return null;
}

Fixed version (ground truth):
@Override protected Object doInBackground() throws Exception {
  downloadTaskRunning=true;
  ArrayList<String> cmd=new ArrayList<>();
  String path=toolsFolder + File.separator + "String_Node_Str"+ File.separator;
  if (Platform.isWindows())   path+="String_Node_Str";
 else   path+="String_Node_Str";
  cmd.add(path);
  cmd.add("String_Node_Str");
  ProcessBuilder process=new ProcessBuilder(cmd);
  backgroundProcess=process.start();
  backgroundProcess.waitFor();
  return null;
}
Program: 163593
Project: 163593
Buggy source:
@Override public void propertyChange(PropertyChangeEvent evt){
switch (evt.getPropertyName()) {
case PROPERTY_CHANGE_QUERY:
    progressBar.setIndeterminate(false);
  if (requiredPackages.size() == 0) {
    if (updatesList.size() == 0) {
      status.setText("String_Node_Str");
      status.setForeground(Color.GREEN);
    }
 else {
      actionButton.setVisible(true);
      status.setText("String_Node_Str");
      status.setForeground(Color.BLUE);
    }
  }
 else {
    status.setText("String_Node_Str");
    status.setForeground(Color.RED);
    actionButton.setText("String_Node_Str");
    actionButton.setVisible(true);
    installFlag=true;
  }
break;
}
}

Fixed version (ground truth):
@Override public void propertyChange(PropertyChangeEvent evt){
switch (evt.getPropertyName()) {
case PROPERTY_CHANGE_QUERY:
    progressBar.setIndeterminate(false);
  if (updatesList.size() == 0) {
    status.setText("String_Node_Str");
    status.setForeground(Color.GREEN);
  }
 else {
    actionButton.setVisible(true);
    status.setText("String_Node_Str");
    status.setForeground(Color.BLUE);
  }
break;
}
}
Program: 163594
Project: 163594
Buggy source:
public SDKUpdater(){
  super("String_Node_Str");
  requiredPackages=new HashMap<>();
  requiredPackages.put("String_Node_Str",false);
  requiredPackages.put("String_Node_Str",false);
  requiredPackages.put("String_Node_Str",false);
  requiredPackages.put("String_Node_Str",false);
  requiredPackages.put("String_Node_Str",false);
  requiredPackages.put("String_Node_Str",false);
  try {
    sdk=AndroidSDK.load();
    toolsFolder=sdk.getToolsFolder();
    queryTask=new QueryTask();
    queryTask.addPropertyChangeListener(this);
    queryTask.execute();
    createLayout();
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public SDKUpdater(Editor editor,AndroidMode androidMode){
  super("String_Node_Str");
  androidMode.checkSDK(editor);
  try {
    sdk=AndroidSDK.load();
    if (sdk == null) {
      sdk=AndroidSDK.locate(editor,androidMode);
    }
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
catch (  AndroidSDK.CancelException e) {
    e.printStackTrace();
  }
catch (  AndroidSDK.BadSDKException e) {
    e.printStackTrace();
  }
  if (sdk == null)   return;
  toolsFolder=sdk.getToolsFolder();
  queryTask=new QueryTask();
  queryTask.addPropertyChangeListener(this);
  queryTask.execute();
  createLayout();
}
Program: 163595
Project: 163595
Buggy source:
public void cancelTasks(){
  queryTask.cancel(true);
}

Fixed version (ground truth):
public void cancelTasks(){
  queryTask.cancel(true);
  if (downloadTaskRunning) {
    JOptionPane.showMessageDialog(null,"String_Node_Str","String_Node_Str",JOptionPane.WARNING_MESSAGE);
    downloadTask.cancel(true);
  }
}
Program: 163596
Project: 163596
Buggy source:
@Override protected void done(){
  super.done();
  if (updatesList != null && installedList != null) {
    modelInstalled.setDataVector(installedList,columnsInstalled);
    modelUpdates.setDataVector(updatesList,columnsUpdates);
    modelUpdates.fireTableDataChanged();
    modelInstalled.fireTableDataChanged();
  }
}

Fixed version (ground truth):
@Override protected void done(){
  super.done();
  try {
    get();
    actionButton.setVisible(false);
    status.setText("String_Node_Str");
    queryTask=new QueryTask();
    queryTask.addPropertyChangeListener(SDKUpdater.this);
    queryTask.execute();
  }
 catch (  InterruptedException|CancellationException e) {
    backgroundProcess.destroy();
  }
catch (  ExecutionException e) {
    JOptionPane.showMessageDialog(null,e.getCause().toString(),"String_Node_Str",JOptionPane.ERROR_MESSAGE);
  }
 finally {
    downloadTaskRunning=false;
    progressBar.setIndeterminate(false);
  }
}
Program: 163598
Project: 163598
Buggy source:
private void writeBuildXML(final File xmlFile,final String projectName){
  File xmlTemplate=mode.getContentFile("String_Node_Str" + ANT_BUILD_TEMPLATE);
  HashMap<String,String> replaceMap=new HashMap<String,String>();
  replaceMap.put("String_Node_Str",projectName);
  replaceMap.put("String_Node_Str",Base.getToolsFolder().getPath());
  AndroidMode.createFileFromTemplate(xmlTemplate,xmlFile,replaceMap);
}

Fixed version (ground truth):
private void writeBuildXML(final File xmlFile,final String projectName){
  File xmlTemplate=mode.getContentFile("String_Node_Str" + ANT_BUILD_TEMPLATE);
  HashMap<String,String> replaceMap=new HashMap<String,String>();
  replaceMap.put("String_Node_Str",projectName);
  replaceMap.put("String_Node_Str",Base.getToolsFolder().getPath().replace('\\','/'));
  AndroidMode.createFileFromTemplate(xmlTemplate,xmlFile,replaceMap);
}
Program: 163600
Project: 163600
Buggy source:
private void initVR(){
  if (!initialized) {
    headRotation=new float[4];
    headView=new float[16];
    perspectiveMatrix=new PMatrix3D();
    viewMatrix=new PMatrix3D();
    initialized=true;
  }
}

Fixed version (ground truth):
private void initVR(){
  if (!initialized) {
    headRotation=new float[4];
    headView=new float[16];
    translationVector=new float[3];
    forwardVector=new float[3];
    rightVector=new float[3];
    upVector=new float[3];
    perspectiveMatrix=new PMatrix3D();
    viewMatrix=new PMatrix3D();
    initialized=true;
  }
}
Program: 163601
Project: 163601
Buggy source:
protected void eyeTransform(Eye eye){
  eyeType=eye.getType();
  viewPort=eye.getViewport();
  float[] p=eye.getPerspective(cameraNear,cameraFar);
  perspectiveMatrix.set(p[0],p[4],p[8],p[12],p[1],-p[5],p[9],p[13],p[2],p[6],p[10],p[14],p[3],p[7],p[11],p[15]);
  float[] v=eye.getEyeView();
  viewMatrix.set(v[0],v[4],v[8],v[12],v[1],v[5],v[9],v[13],v[2],v[6],v[10],v[14],v[3],v[7],v[11],v[15]);
}

Fixed version (ground truth):
protected void eyeTransform(Eye eye){
  eyeType=eye.getType();
  eyeViewPort=eye.getViewport();
  eyeFov=eye.getFov();
  eyePerspective=eye.getPerspective(cameraNear,cameraFar);
  perspectiveMatrix.set(eyePerspective[0],eyePerspective[4],eyePerspective[8],eyePerspective[12],eyePerspective[1],eyePerspective[5],eyePerspective[9],eyePerspective[13],eyePerspective[2],eyePerspective[6],eyePerspective[10],eyePerspective[14],eyePerspective[3],eyePerspective[7],eyePerspective[11],eyePerspective[15]);
  eyeView=eye.getEyeView();
  viewMatrix.set(eyeView[0],eyeView[4],eyeView[8],eyeView[12],eyeView[1],eyeView[5],eyeView[9],eyeView[13],eyeView[2],eyeView[6],eyeView[10],eyeView[14],eyeView[3],eyeView[7],eyeView[11],eyeView[15]);
}
Program: 163602
Project: 163602
Buggy source:
protected void headTransform(HeadTransform headTransform){
  initVR();
  headTransform.getHeadView(headView,0);
  headTransform.getQuaternion(headRotation,0);
}

Fixed version (ground truth):
protected void headTransform(HeadTransform headTransform){
  initVR();
  headTransform.getHeadView(headView,0);
  headTransform.getQuaternion(headRotation,0);
  headTransform.getTranslation(translationVector,0);
  headTransform.getForwardVector(forwardVector,0);
  headTransform.getRightVector(rightVector,0);
  headTransform.getUpVector(upVector,0);
}
Program: 163603
Project: 163603
Buggy source:
@Override public void beginDraw(){
  super.beginDraw();
  pgl.viewport(viewPort.x,viewPort.y,viewPort.width,viewPort.height);
  camera(0.0f,0.0f,defCameraZ,0.0f,0.0f,0.0f,0.0f,-1.0f,0.0f);
  setProjection(perspectiveMatrix);
  preApplyMatrix(viewMatrix);
}

Fixed version (ground truth):
@Override public void beginDraw(){
  super.beginDraw();
  pgl.viewport(eyeViewPort.x,eyeViewPort.y,eyeViewPort.width,eyeViewPort.height);
  camera(0.0f,0.0f,defCameraZ,0.0f,0.0f,0.0f,0.0f,1.0f,0.0f);
  setProjection(perspectiveMatrix);
  preApplyMatrix(viewMatrix);
}
Program: 163604
Project: 163604
Buggy source:
@Override public void endDraw(){
  if (bitmap == null)   return;
  if (primaryGraphics) {
    SurfaceHolder holder=parent.getSurfaceHolder();
    if (holder != null) {
      Canvas screen=null;
      try {
        screen=holder.lockCanvas(null);
        if (screen != null) {
          screen.drawBitmap(bitmap,new Matrix(),null);
        }
      }
  finally {
        if (screen != null) {
          parent.getSurfaceHolder().unlockCanvasAndPost(screen);
        }
      }
    }
  }
 else {
    loadPixels();
  }
  setModified();
  super.updatePixels();
}

Fixed version (ground truth):
@Override public void endDraw(){
  if (bitmap == null)   return;
  if (primaryGraphics) {
    SurfaceHolder holder=parent.getSurfaceHolder();
    if (holder != null) {
      Canvas screen=null;
      try {
        screen=holder.lockCanvas(null);
        if (screen != null) {
          screen.drawBitmap(bitmap,new Matrix(),null);
        }
      }
  finally {
        if (screen != null) {
          try {
            parent.getSurfaceHolder().unlockCanvasAndPost(screen);
          }
 catch (          IllegalStateException ex) {
          }
        }
      }
    }
  }
 else {
    loadPixels();
  }
  setModified();
  super.updatePixels();
}
Program: 163605
Project: 163605
Buggy source:
@Override public void onCreate(SurfaceHolder surfaceHolder){
  super.onCreate(surfaceHolder);
  if (sketch == null || isPreview()) {
    sketch=createSketch();
    sketch.initSurface(PWallpaper.this,getSurfaceHolder());
    sketch.startSurface();
    setTouchEventsEnabled(true);
  }
 else {
    sketch.resetSurface(PWallpaper.this,getSurfaceHolder());
    sketch.startSurface();
  }
  if (sketch != null) {
    sketch.preview=isPreview();
    if (!sketch.preview)     requestPermissions();
  }
}

Fixed version (ground truth):
@Override public void onCreate(SurfaceHolder surfaceHolder){
  super.onCreate(surfaceHolder);
  sketch=createSketch();
  sketch.initSurface(PWallpaper.this,getSurfaceHolder());
  sketch.startSurface();
  sketch.preview=isPreview();
  if (isPreview())   requestPermissions();
  setTouchEventsEnabled(true);
}
Program: 163606
Project: 163606
Buggy source:
@Override public void onDestroy(){
  super.onDestroy();
  if (!isPreview() && sketch != null) {
    sketch.onDestroy();
  }
}

Fixed version (ground truth):
@Override public void onDestroy(){
  super.onDestroy();
  if (sketch != null) {
    sketch.onDestroy();
  }
}
Program: 163607
Project: 163607
Buggy source:
@Override public void onTouchEvent(MotionEvent event){
  super.onTouchEvent(event);
  if (sketch != null)   sketch.surfaceTouchEvent(event);
}

Fixed version (ground truth):
@Override public void onTouchEvent(MotionEvent event){
  super.onTouchEvent(event);
  if (sketch != null) {
    sketch.surfaceTouchEvent(event);
  }
}
Program: 163608
Project: 163608
Buggy source:
public PApplet getSketch(){
  return sketch;
}

Fixed version (ground truth):
public PApplet getSketch(){
  return engine.sketch;
}
Program: 163609
Project: 163609
Buggy source:
@Override public void onVisibilityChanged(boolean visible){
  if (!isPreview() && sketch != null) {
    if (visible) {
      sketch.onResume();
    }
 else {
      sketch.onPause();
    }
  }
  super.onVisibilityChanged(visible);
}

Fixed version (ground truth):
@Override public void onVisibilityChanged(boolean visible){
  if (sketch != null) {
    if (visible) {
      sketch.onResume();
    }
 else {
      sketch.onPause();
    }
  }
  super.onVisibilityChanged(visible);
}
Program: 163610
Project: 163610
Buggy source:
public void setSketch(PApplet sketch){
}

Fixed version (ground truth):
public void setSketch(PApplet sketch){
  engine.sketch=sketch;
}
Program: 163611
Project: 163611
Buggy source:
public void onPermissionsGranted(){
  if (sketch != null)   sketch.onPermissionsGranted();
}

Fixed version (ground truth):
public void onPermissionsGranted(){
  if (sketch != null) {
    sketch.onPermissionsGranted();
  }
}
Program: 163612
Project: 163612
Buggy source:
public void onPause(){
  if (g != null) {
    savedStyle=new PStyle();
    g.getStyle(savedStyle);
  }
  handleMethods("String_Node_Str");
  surface.pauseThread();
  pause();
}

Fixed version (ground truth):
public void onPause(){
  if (g != null && 0 < frameCount) {
    savedStyle=new PStyle();
    g.getStyle(savedStyle);
  }
  handleMethods("String_Node_Str");
  surface.pauseThread();
  pause();
}
Program: 163613
Project: 163613
Buggy source:
/** 
 * Called to dispose of resources and shut down the sketch. Destroys the thread, dispose the renderer, and notify listeners. <p> Not to be called or overriden by users. If called multiple times, will only notify listeners once. Register a dispose listener instead.
 */
final public void dispose(){
  finished=true;
  if (surface != null && surface.stopThread()) {
    if (g != null) {
      g.dispose();
      surface.dispose();
    }
  }
  handleMethods("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Called to dispose of resources and shut down the sketch. Destroys the thread, dispose the renderer, and notify listeners. <p> Not to be called or overriden by users. If called multiple times, will only notify listeners once. Register a dispose listener instead.
 */
final public void dispose(){
  finished=true;
  if (surface != null) {
    surface.stopThread();
    surface.dispose();
  }
  if (g != null) {
    g.dispose();
  }
  handleMethods("String_Node_Str");
}
Program: 163614
Project: 163614
Buggy source:
public boolean stopThread(boolean killProc);

Fixed version (ground truth):
public boolean stopThread();
Program: 163615
Project: 163615
Buggy source:
/** 
 * Main method for the primary animation thread. <A HREF="http://java.sun.com/products/jfc/tsc/articles/painting/">Painting in AWT and Swing</A>
 */
@Override public void run(){
  long beforeTime=System.nanoTime();
  long overSleepTime=0L;
  int noDelays=0;
  final int NO_DELAYS_PER_YIELD=15;
  if (sketch == null)   return;
  sketch.start();
  while ((Thread.currentThread() == thread) && (sketch != null && !sketch.finished)) {
    checkPause();
    callDraw();
    long afterTime=System.nanoTime();
    long timeDiff=afterTime - beforeTime;
    long sleepTime=(frameRatePeriod - timeDiff) - overSleepTime;
    if (sleepTime > 0) {
      try {
        Thread.sleep(sleepTime / 1000000L,(int)(sleepTime % 1000000L));
        noDelays=0;
      }
 catch (      InterruptedException ex) {
      }
      overSleepTime=(System.nanoTime() - afterTime) - sleepTime;
    }
 else {
      overSleepTime=0L;
      noDelays++;
      if (noDelays > NO_DELAYS_PER_YIELD) {
        Thread.yield();
        noDelays=0;
      }
    }
    beforeTime=System.nanoTime();
  }
  if (killProcAfterStop)   finish();
}

Fixed version (ground truth):
/** 
 * Main method for the primary animation thread. <A HREF="http://java.sun.com/products/jfc/tsc/articles/painting/">Painting in AWT and Swing</A>
 */
@Override public void run(){
  long beforeTime=System.nanoTime();
  long overSleepTime=0L;
  int noDelays=0;
  final int NO_DELAYS_PER_YIELD=15;
  if (sketch == null)   return;
  sketch.start();
  while ((Thread.currentThread() == thread) && (sketch != null && !sketch.finished)) {
    checkPause();
    callDraw();
    long afterTime=System.nanoTime();
    long timeDiff=afterTime - beforeTime;
    long sleepTime=(frameRatePeriod - timeDiff) - overSleepTime;
    if (sleepTime > 0) {
      try {
        Thread.sleep(sleepTime / 1000000L,(int)(sleepTime % 1000000L));
        noDelays=0;
      }
 catch (      InterruptedException ex) {
      }
      overSleepTime=(System.nanoTime() - afterTime) - sleepTime;
    }
 else {
      overSleepTime=0L;
      noDelays++;
      if (noDelays > NO_DELAYS_PER_YIELD) {
        Thread.yield();
        noDelays=0;
      }
    }
    beforeTime=System.nanoTime();
  }
  finish();
}
Program: 163616
Project: 163616
Buggy source:
@Override public boolean stopThread(boolean killProc){
  killProcAfterStop=killProc;
  if (thread == null) {
    return false;
  }
  thread=null;
  return true;
}

Fixed version (ground truth):
@Override public boolean stopThread(){
  if (thread == null) {
    return false;
  }
  thread=null;
  return true;
}
Program: 163617
Project: 163617
Buggy source:
public AndroidRenderer getRenderer(){
  renderer=new AndroidRenderer();
  return renderer;
}

Fixed version (ground truth):
public AndroidRenderer getRenderer(){
  return new AndroidRenderer();
}
Program: 163618
Project: 163618
Buggy source:
public AndroidConfigChooser getConfigChooser(int r,int g,int b,int a,int d,int s,int samples){
  configChooser=new AndroidConfigChooser(r,g,b,a,d,s,samples);
  return configChooser;
}

Fixed version (ground truth):
public AndroidConfigChooser getConfigChooser(int r,int g,int b,int a,int d,int s,int samples){
  return new AndroidConfigChooser(r,g,b,a,d,s,samples);
}
Program: 163619
Project: 163619
Buggy source:
public boolean addTexture(PGraphicsOpenGL pg){
  int w, h;
  boolean resize;
  w=maxSize;
  if (-1 < lastTex && textures[lastTex].glHeight < maxSize) {
    h=PApplet.min(2 * textures[lastTex].glHeight,maxSize);
    resize=true;
  }
 else {
    h=minSize;
    resize=false;
  }
  Texture tex;
  if (is3D) {
    tex=new Texture(pg,w,h,new Texture.Parameters(ARGB,Texture.BILINEAR,false));
  }
 else {
    tex=new Texture(pg,w,h,new Texture.Parameters(ARGB,Texture.LINEAR,false));
  }
  if (textures == null) {
    textures=new Texture[1];
    textures[0]=tex;
    images=new PImage[1];
    images[0]=pg.wrapTexture(tex);
    lastTex=0;
  }
 else   if (resize) {
    Texture tex0=textures[lastTex];
    tex.pg.pushStyle();
    tex.pg.blendMode(REPLACE);
    tex.put(tex0);
    tex.pg.popStyle();
    textures[lastTex]=tex;
    pg.setCache(images[lastTex],tex);
    images[lastTex].width=tex.width;
    images[lastTex].height=tex.height;
  }
 else {
    lastTex=textures.length;
    Texture[] tempTex=new Texture[lastTex + 1];
    PApplet.arrayCopy(textures,tempTex,textures.length);
    tempTex[lastTex]=tex;
    textures=tempTex;
    PImage[] tempImg=new PImage[textures.length];
    PApplet.arrayCopy(images,tempImg,images.length);
    tempImg[lastTex]=pg.wrapTexture(tex);
    images=tempImg;
  }
  tex.bind();
  return resize;
}

Fixed version (ground truth):
public boolean addTexture(PGraphicsOpenGL pg){
  int w, h;
  boolean resize;
  w=maxSize;
  if (-1 < lastTex && textures[lastTex].glHeight < maxSize) {
    h=PApplet.min(2 * textures[lastTex].glHeight,maxSize);
    resize=true;
  }
 else {
    h=minSize;
    resize=false;
  }
  Texture tex;
  if (is3D) {
    tex=new Texture(pg,w,h,new Texture.Parameters(ARGB,Texture.BILINEAR,false));
  }
 else {
    tex=new Texture(pg,w,h,new Texture.Parameters(ARGB,Texture.LINEAR,false));
  }
  if (textures == null) {
    textures=new Texture[1];
    textures[0]=tex;
    images=new PImage[1];
    images[0]=pg.wrapTexture(tex);
    lastTex=0;
  }
 else   if (resize) {
    Texture tex0=textures[lastTex];
    tex.put(tex0);
    textures[lastTex]=tex;
    pg.setCache(images[lastTex],tex);
    images[lastTex].width=tex.width;
    images[lastTex].height=tex.height;
  }
 else {
    lastTex=textures.length;
    Texture[] tempTex=new Texture[lastTex + 1];
    PApplet.arrayCopy(textures,tempTex,textures.length);
    tempTex[lastTex]=tex;
    textures=tempTex;
    PImage[] tempImg=new PImage[textures.length];
    PApplet.arrayCopy(images,tempImg,images.length);
    tempImg[lastTex]=pg.wrapTexture(tex);
    images=tempImg;
  }
  tex.bind();
  return resize;
}
Program: 163620
Project: 163620
Buggy source:
protected void copyTexture(int texTarget,int texName,int texWidth,int texHeight,int x,int y,int w,int h,boolean scale){
  if (tempFbo == null) {
    tempFbo=new FrameBuffer(pg,glWidth,glHeight);
  }
  tempFbo.setColorBuffer(this);
  tempFbo.disableDepthTest();
  pg.pushFramebuffer();
  pg.setFramebuffer(tempFbo);
  if (scale) {
    pgl.drawTexture(texTarget,texName,texWidth,texHeight,0,0,tempFbo.width,tempFbo.height,x,y,w,h,0,0,width,height);
  }
 else {
    pgl.drawTexture(texTarget,texName,texWidth,texHeight,0,0,tempFbo.width,tempFbo.height,x,y,w,h,x,y,w,h);
  }
  pg.popFramebuffer();
  updateTexels(x,y,w,h);
}

Fixed version (ground truth):
protected void copyTexture(int texTarget,int texName,int texWidth,int texHeight,int x,int y,int w,int h,boolean scale){
  if (tempFbo == null) {
    tempFbo=new FrameBuffer(pg,glWidth,glHeight);
  }
  tempFbo.setColorBuffer(this);
  tempFbo.disableDepthTest();
  pg.pushFramebuffer();
  pg.setFramebuffer(tempFbo);
  pg.pushStyle();
  pg.blendMode(REPLACE);
  if (scale) {
    pgl.drawTexture(texTarget,texName,texWidth,texHeight,0,0,tempFbo.width,tempFbo.height,x,y,w,h,0,0,width,height);
  }
 else {
    pgl.drawTexture(texTarget,texName,texWidth,texHeight,0,0,tempFbo.width,tempFbo.height,x,y,w,h,x,y,w,h);
  }
  pgl.flush();
  pg.popStyle();
  pg.popFramebuffer();
  updateTexels(x,y,w,h);
}
Program: 163622
Project: 163622
Buggy source:
private void downloadAndUnpack(String urlString,File saveTo,File unpackTo) throws IOException {
  URL url=new URL(urlString);
  URLConnection conn=url.openConnection();
  InputStream inputStream=conn.getInputStream();
  FileOutputStream outputStream=new FileOutputStream(saveTo);
  byte[] b=new byte[BUFFER_SIZE];
  int count;
  while ((count=inputStream.read(b)) >= 0) {
    outputStream.write(b,0,count);
    downloadedSize+=count;
    firePropertyChange(PROPERTY_CHANGE_EVENT_DOWNLOADED,0,downloadedSize);
  }
  outputStream.flush();
  outputStream.close();
  inputStream.close();
  inputStream.close();
  outputStream.close();
  extractFolder(saveTo,unpackTo);
}

Fixed version (ground truth):
private void downloadAndUnpack(String urlString,File saveTo,File unpackTo) throws IOException {
  URL url=null;
  try {
    url=new URL(urlString);
  }
 catch (  MalformedURLException e) {
    try {
      url=new URL(URL_REPOSITORY_FOLDER + urlString);
    }
 catch (    MalformedURLException e1) {
      e1.printStackTrace();
      return;
    }
  }
  URLConnection conn=url.openConnection();
  InputStream inputStream=conn.getInputStream();
  FileOutputStream outputStream=new FileOutputStream(saveTo);
  byte[] b=new byte[BUFFER_SIZE];
  int count;
  while ((count=inputStream.read(b)) >= 0) {
    outputStream.write(b,0,count);
    downloadedSize+=count;
    firePropertyChange(PROPERTY_CHANGE_EVENT_DOWNLOADED,0,downloadedSize);
  }
  outputStream.flush();
  outputStream.close();
  inputStream.close();
  inputStream.close();
  outputStream.close();
  extractFolder(saveTo,unpackTo);
}
Program: 163623
Project: 163623
Buggy source:
public void checkSDK(Editor parent){
  if (sdk == null) {
    try {
      sdk=AndroidSDK.load();
      if (sdk == null && parent != null) {
        sdk=AndroidSDK.locate(parent,this);
      }
    }
 catch (    BadSDKException e) {
      e.printStackTrace();
    }
catch (    IOException e) {
      e.printStackTrace();
    }
  }
  if (sdk == null) {
    if (!AndroidSDK.isDownloading()) {
      Messages.showWarning("String_Node_Str","String_Node_Str" + "String_Node_Str");
    }
  }
}

Fixed version (ground truth):
public void checkSDK(Editor editor){
  if (sdk == null) {
    try {
      sdk=AndroidSDK.load();
      if (sdk == null && editor != null) {
        sdk=AndroidSDK.locate(editor,this);
      }
    }
 catch (    BadSDKException e) {
      e.printStackTrace();
    }
catch (    IOException e) {
      e.printStackTrace();
    }
  }
  if (sdk == null) {
    if (!AndroidSDK.isDownloading()) {
      Messages.showWarning("String_Node_Str","String_Node_Str" + "String_Node_Str");
    }
  }
}
Program: 163624
Project: 163624
Buggy source:
public AndroidMode(Base base,File folder){
  super(base,folder);
  checkSDK(null);
}

Fixed version (ground truth):
public AndroidMode(Base base,File folder){
  super(base,folder);
}
Program: 163627
Project: 163627
Buggy source:
/** 
 * Create a bitmap font on the fly from either a font name that's installed on the system, or from a .ttf or .otf that's inside the data folder of this sketch. <P/> Use 'null' for the charset if you want to dynamically create character bitmaps only as they're needed.
 */
public PFont createFont(String name,float size,boolean smooth,char[] charset){
  String lowerName=name.toLowerCase();
  Typeface baseFont=null;
  if (lowerName.endsWith("String_Node_Str") || lowerName.endsWith("String_Node_Str")) {
    AssetManager assets=getBaseContext().getAssets();
    baseFont=Typeface.createFromAsset(assets,name);
  }
 else {
    baseFont=(Typeface)PFont.findNative(name);
  }
  return new PFont(baseFont,round(size),smooth,charset);
}

Fixed version (ground truth):
/** 
 * Create a bitmap font on the fly from either a font name that's installed on the system, or from a .ttf or .otf that's inside the data folder of this sketch. <P/> Use 'null' for the charset if you want to dynamically create character bitmaps only as they're needed.
 */
public PFont createFont(String name,float size,boolean smooth,char[] charset){
  String lowerName=name.toLowerCase();
  Typeface baseFont=null;
  if (lowerName.endsWith("String_Node_Str") || lowerName.endsWith("String_Node_Str")) {
    AssetManager assets=activity.getAssets();
    baseFont=Typeface.createFromAsset(assets,name);
  }
 else {
    baseFont=(Typeface)PFont.findNative(name);
  }
  return new PFont(baseFont,round(size),smooth,charset);
}
Program: 163628
Project: 163628
Buggy source:
@Override protected void onStop(){
  tellPDE("String_Node_Str");
  super.onStop();
}

Fixed version (ground truth):
@Override public void onStop(){
  tellPDE("String_Node_Str");
  super.onStop();
}
Program: 163629
Project: 163629
Buggy source:
@Override protected void onPause(){
  super.onPause();
  paused=true;
  handleMethods("String_Node_Str");
  pause();
}

Fixed version (ground truth):
@Override public void onPause(){
  super.onPause();
  paused=true;
  handleMethods("String_Node_Str");
  pause();
}
Program: 163630
Project: 163630
Buggy source:
private void tellPDE(final String message){
  Log.i(getComponentName().getPackageName(),"String_Node_Str" + message);
}

Fixed version (ground truth):
private void tellPDE(final String message){
  Log.i(activity.getComponentName().getPackageName(),"String_Node_Str" + message);
}
Program: 163632
Project: 163632
Buggy source:
/** 
 * Prepend the sketch folder path to the filename (or path) that is passed in. External libraries should use this function to save to the sketch folder. <p/> Note that when running as an applet inside a web browser, the sketchPath will be set to null, because security restrictions prevent applets from accessing that information. <p/> This will also cause an error if the sketch is not inited properly, meaning that init() was never called on the PApplet when hosted my some other main() or by other code. For proper use of init(), see the examples in the main description text for PApplet.
 */
public String sketchPath(String where){
  if (sketchPath == null) {
    return where;
  }
  try {
    if (new File(where).isAbsolute())     return where;
  }
 catch (  Exception e) {
  }
  Context context=getApplicationContext();
  return context.getFileStreamPath(where).getAbsolutePath();
}

Fixed version (ground truth):
/** 
 * Prepend the sketch folder path to the filename (or path) that is passed in. External libraries should use this function to save to the sketch folder. <p/> Note that when running as an applet inside a web browser, the sketchPath will be set to null, because security restrictions prevent applets from accessing that information. <p/> This will also cause an error if the sketch is not inited properly, meaning that init() was never called on the PApplet when hosted my some other main() or by other code. For proper use of init(), see the examples in the main description text for PApplet.
 */
public String sketchPath(String where){
  if (sketchPath == null) {
    return where;
  }
  try {
    if (new File(where).isAbsolute())     return where;
  }
 catch (  Exception e) {
  }
  return activity.getFileStreamPath(where).getAbsolutePath();
}
Program: 163633
Project: 163633
Buggy source:
public SketchSurfaceViewGL(Context context,int wide,int high,Class<? extends PGraphicsOpenGL> clazz){
  super(context);
  final ActivityManager activityManager=(ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);
  final ConfigurationInfo configurationInfo=activityManager.getDeviceConfigurationInfo();
  final boolean supportsGLES2=configurationInfo.reqGlEsVersion >= 0x20000;
  if (!supportsGLES2) {
    throw new RuntimeException("String_Node_Str");
  }
  surfaceHolder=getHolder();
  surfaceHolder.addCallback(this);
  if (clazz.equals(PGraphics2D.class)) {
    g3=new PGraphics2D();
  }
 else   if (clazz.equals(PGraphics3D.class)) {
    g3=new PGraphics3D();
  }
 else {
    try {
      Constructor<? extends PGraphicsOpenGL> constructor=clazz.getConstructor();
      g3=constructor.newInstance();
    }
 catch (    Exception exception) {
      throw new RuntimeException("String_Node_Str",exception);
    }
  }
  g3.setParent(PApplet.this);
  g3.setPrimary(true);
  g3.setSize(wide,high);
  setEGLContextClientVersion(2);
  int quality=sketchQuality();
  if (1 < quality) {
    setEGLConfigChooser(((PGLES)g3.pgl).getConfigChooser(quality));
  }
  setRenderer(((PGLES)g3.pgl).getRenderer());
  setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
  g=g3;
  setFocusable(true);
  setFocusableInTouchMode(true);
  requestFocus();
}

Fixed version (ground truth):
public SketchSurfaceViewGL(Context context,int wide,int high,Class<? extends PGraphicsOpenGL> clazz){
  super(context);
  final ActivityManager activityManager=(ActivityManager)activity.getSystemService(Context.ACTIVITY_SERVICE);
  final ConfigurationInfo configurationInfo=activityManager.getDeviceConfigurationInfo();
  final boolean supportsGLES2=configurationInfo.reqGlEsVersion >= 0x20000;
  if (!supportsGLES2) {
    throw new RuntimeException("String_Node_Str");
  }
  surfaceHolder=getHolder();
  surfaceHolder.addCallback(this);
  if (clazz.equals(PGraphics2D.class)) {
    g3=new PGraphics2D();
  }
 else   if (clazz.equals(PGraphics3D.class)) {
    g3=new PGraphics3D();
  }
 else {
    try {
      Constructor<? extends PGraphicsOpenGL> constructor=clazz.getConstructor();
      g3=constructor.newInstance();
    }
 catch (    Exception exception) {
      throw new RuntimeException("String_Node_Str",exception);
    }
  }
  g3.setParent(PApplet.this);
  g3.setPrimary(true);
  g3.setSize(wide,high);
  setEGLContextClientVersion(2);
  int quality=sketchQuality();
  if (1 < quality) {
    setEGLConfigChooser(((PGLES)g3.pgl).getConfigChooser(quality));
  }
  setRenderer(((PGLES)g3.pgl).getRenderer());
  setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
  g=g3;
  setFocusable(true);
  setFocusableInTouchMode(true);
  requestFocus();
}
Program: 163634
Project: 163634
Buggy source:
@Override protected void onStart(){
  tellPDE("String_Node_Str");
  super.onStart();
}

Fixed version (ground truth):
@Override public void onStart(){
  tellPDE("String_Node_Str");
  super.onStart();
}
Program: 163635
Project: 163635
Buggy source:
@Override protected void onResume(){
  super.onResume();
  if (DEBUG)   System.out.println("String_Node_Str");
  paused=false;
  handleMethods("String_Node_Str");
  resume();
}

Fixed version (ground truth):
@Override public void onResume(){
  super.onResume();
  if (DEBUG)   System.out.println("String_Node_Str");
  paused=false;
  handleMethods("String_Node_Str");
  resume();
}
Program: 163636
Project: 163636
Buggy source:
protected boolean create(final AndroidSDK sdk) throws IOException {
  final String[] params={sdk.getAndroidToolPath(),"String_Node_Str","String_Node_Str","String_Node_Str",name,"String_Node_Str",target,"String_Node_Str",DEFAULT_SDCARD_SIZE,"String_Node_Str",DEFAULT_SKIN};
  avdList=null;
  final ProcessHelper p=new ProcessHelper(params);
  try {
    final ProcessResult createAvdResult=p.execute("String_Node_Str");
    if (createAvdResult.succeeded()) {
      return true;
    }
    if (createAvdResult.toString().contains("String_Node_Str")) {
      Base.showWarningTiered("String_Node_Str",AVD_TARGET_PRIMARY,AVD_TARGET_SECONDARY,null);
    }
 else {
      Base.showWarningTiered("String_Node_Str",AVD_CREATE_PRIMARY,AVD_CREATE_SECONDARY,null);
      System.out.println(createAvdResult);
    }
  }
 catch (  final InterruptedException ie) {
  }
  return false;
}

Fixed version (ground truth):
protected boolean create(final AndroidSDK sdk) throws IOException {
  final String[] params={sdk.getAndroidToolPath(),"String_Node_Str","String_Node_Str","String_Node_Str",name,"String_Node_Str",target,"String_Node_Str",DEFAULT_SDCARD_SIZE,"String_Node_Str",DEFAULT_SKIN,"String_Node_Str","String_Node_Str"};
  avdList=null;
  final ProcessHelper p=new ProcessHelper(params);
  try {
    final ProcessResult createAvdResult=p.execute("String_Node_Str");
    if (createAvdResult.succeeded()) {
      return true;
    }
    if (createAvdResult.toString().contains("String_Node_Str")) {
      Base.showWarningTiered("String_Node_Str",AVD_TARGET_PRIMARY,AVD_TARGET_SECONDARY,null);
    }
 else {
      Base.showWarningTiered("String_Node_Str",AVD_CREATE_PRIMARY,AVD_CREATE_SECONDARY,null);
      System.out.println(createAvdResult);
    }
  }
 catch (  final InterruptedException ie) {
  }
  return false;
}
Program: 163637
Project: 163637
Buggy source:
private File zipalignPackage(File signedPackage,File projectFolder) throws IOException, InterruptedException {
  String zipalignPath=sdk.getSdkFolder().getAbsolutePath() + "String_Node_Str";
  File alignedPackage=new File(projectFolder,"String_Node_Str" + sketch.getName() + "String_Node_Str");
  String[] args={zipalignPath,"String_Node_Str","String_Node_Str","String_Node_Str",signedPackage.getAbsolutePath(),alignedPackage.getAbsolutePath()};
  Process alignProcess=Runtime.getRuntime().exec(args);
  alignProcess.waitFor();
  if (alignedPackage.exists())   return alignedPackage;
  return null;
}

Fixed version (ground truth):
private File zipalignPackage(File signedPackage,File projectFolder) throws IOException, InterruptedException {
  File buildToolsFolder=new File(sdk.getSdkFolder(),"String_Node_Str").listFiles()[0];
  String zipalignPath=buildToolsFolder.getAbsolutePath() + "String_Node_Str";
  File alignedPackage=new File(projectFolder,"String_Node_Str" + sketch.getName() + "String_Node_Str");
  String[] args={zipalignPath,"String_Node_Str","String_Node_Str","String_Node_Str",signedPackage.getAbsolutePath(),alignedPackage.getAbsolutePath()};
  Process alignProcess=Runtime.getRuntime().exec(args);
  alignProcess.waitFor();
  if (alignedPackage.exists())   return alignedPackage;
  return null;
}
Program: 163638
Project: 163638
Buggy source:
public void launch(Future<Device> deviceFuture){
  listener.statusNotice("String_Node_Str");
  final Device device=waitForDevice(deviceFuture,listener);
  if (device == null || !device.isAlive()) {
    listener.statusError("String_Node_Str");
    Devices.killAdbServer();
    return;
  }
  device.addListener(this);
  listener.statusNotice("String_Node_Str" + device.getId());
  if (!device.installApp(build.getPathForAPK(),listener)) {
    listener.statusError("String_Node_Str");
    Devices.killAdbServer();
    return;
  }
  listener.statusNotice("String_Node_Str" + device.getId());
  if (startSketch(build,device)) {
    listener.statusNotice("String_Node_Str" + (device.isEmulator() ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str");
  }
 else {
    listener.statusError("String_Node_Str");
  }
  listener.stopIndeterminate();
  lastRunDevice=device;
}

Fixed version (ground truth):
public void launch(Future<Device> deviceFuture){
  listener.statusNotice("String_Node_Str");
  final Device device=waitForDevice(deviceFuture,listener);
  if (device == null || !device.isAlive()) {
    listener.statusError("String_Node_Str");
    Devices.killAdbServer();
    return;
  }
  device.addListener(this);
  listener.statusNotice("String_Node_Str" + device.getId());
  if (!device.installApp(build,listener)) {
    listener.statusError("String_Node_Str");
    Devices.killAdbServer();
    return;
  }
  listener.statusNotice("String_Node_Str" + device.getId());
  if (startSketch(build,device)) {
    listener.statusNotice("String_Node_Str" + (device.isEmulator() ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str");
  }
 else {
    listener.statusError("String_Node_Str");
  }
  listener.stopIndeterminate();
  lastRunDevice=device;
}
Program: 163639
Project: 163639
Buggy source:
public boolean installApp(final String apkPath,final RunnerListener status){
  if (!isAlive()) {
    return false;
  }
  bringLauncherToFront();
  try {
    final ProcessResult installResult=adb("String_Node_Str","String_Node_Str",apkPath);
    if (!installResult.succeeded()) {
      status.statusError("String_Node_Str");
      System.err.println(installResult);
      return false;
    }
    String errorMsg=null;
    for (    final String line : installResult) {
      if (line.startsWith("String_Node_Str")) {
        errorMsg=line.substring(8);
        System.err.println(line);
      }
    }
    if (errorMsg == null) {
      status.statusNotice("String_Node_Str");
      return true;
    }
    status.statusError("String_Node_Str" + errorMsg);
  }
 catch (  final IOException e) {
    status.statusError(e);
  }
catch (  final InterruptedException e) {
  }
  return false;
}

Fixed version (ground truth):
public boolean installApp(final AndroidBuild build,final RunnerListener status){
  if (!isAlive()) {
    return false;
  }
  bringLauncherToFront();
  try {
    final ProcessResult installResult=adb("String_Node_Str","String_Node_Str",build.getPathForAPK());
    if (!installResult.succeeded()) {
      status.statusError("String_Node_Str");
      System.err.println(installResult);
      return false;
    }
    String errorMsg=null;
    for (    final String line : installResult) {
      if (line.startsWith("String_Node_Str")) {
        errorMsg=line.substring(8);
        if (line.contains("String_Node_Str")) {
          boolean removeResult=removeApp(build.getPackageName());
          if (removeResult)           return installApp(build,status);
        }
        System.err.println(line);
      }
    }
    if (errorMsg == null) {
      status.statusNotice("String_Node_Str");
      return true;
    }
    status.statusError("String_Node_Str" + errorMsg);
  }
 catch (  final IOException e) {
    status.statusError(e);
  }
catch (  final InterruptedException e) {
  }
  return false;
}
Program: 163641
Project: 163641
Buggy source:
public static void setSdkTarget(AndroidSDK.SDKTarget target,Sketch sketch){
  sdkName=target.name;
  sdkVersion=Integer.toString(target.version);
  Manifest manifest=new Manifest(sketch);
  manifest.setSdkTarget(sdkVersion);
  Preferences.set("String_Node_Str",sdkVersion);
}

Fixed version (ground truth):
public static void setSdkTarget(AndroidSDK.SDKTarget target,Sketch sketch){
  sdkName=target.name;
  sdkVersion=Integer.toString(target.version);
  sdkTarget="String_Node_Str" + sdkVersion;
  Manifest manifest=new Manifest(sketch);
  manifest.setSdkTarget(sdkVersion);
  Preferences.set("String_Node_Str",sdkVersion);
}
Program: 163643
Project: 163643
Buggy source:
protected static IntBuffer updateIntBuffer(IntBuffer buf,int[] arr,boolean wrap){
  if (USE_DIRECT_BUFFERS) {
    if (buf == null || buf.capacity() < arr.length) {
      buf=PGL.allocateDirectIntBuffer(arr.length);
    }
    buf.position(0);
    buf.put(arr);
    buf.rewind();
  }
 else {
    if (wrap) {
      buf=IntBuffer.wrap(arr);
    }
 else {
      if (buf == null || buf.capacity() < arr.length) {
        buf=IntBuffer.allocate(arr.length);
      }
      buf.position(0);
      buf.put(arr);
      buf.rewind();
    }
  }
  return buf;
}

Fixed version (ground truth):
protected static void updateIntBuffer(IntBuffer buf,int[] arr,int offset,int size){
  if (USE_DIRECT_BUFFERS || (buf.hasArray() && buf.array() != arr)) {
    buf.position(offset);
    buf.put(arr,offset,size);
    buf.rewind();
  }
}
Program: 163644
Project: 163644
Buggy source:
protected static FloatBuffer updateFloatBuffer(FloatBuffer buf,float[] arr,boolean wrap){
  if (USE_DIRECT_BUFFERS) {
    if (buf == null || buf.capacity() < arr.length) {
      buf=PGL.allocateDirectFloatBuffer(arr.length);
    }
    buf.position(0);
    buf.put(arr);
    buf.rewind();
  }
 else {
    if (wrap) {
      buf=FloatBuffer.wrap(arr);
    }
 else {
      if (buf == null || buf.capacity() < arr.length) {
        buf=FloatBuffer.allocate(arr.length);
      }
      buf.position(0);
      buf.put(arr);
      buf.rewind();
    }
  }
  return buf;
}

Fixed version (ground truth):
protected static void updateFloatBuffer(FloatBuffer buf,float[] arr,int offset,int size){
  if (USE_DIRECT_BUFFERS || (buf.hasArray() && buf.array() != arr)) {
    buf.position(offset);
    buf.put(arr,offset,size);
    buf.rewind();
  }
}
Program: 163645
Project: 163645
Buggy source:
protected static ByteBuffer updateByteBuffer(ByteBuffer buf,byte[] arr,boolean wrap){
  if (USE_DIRECT_BUFFERS) {
    if (buf == null || buf.capacity() < arr.length) {
      buf=PGL.allocateDirectByteBuffer(arr.length);
    }
    buf.position(0);
    buf.put(arr);
    buf.rewind();
  }
 else {
    if (wrap) {
      buf=ByteBuffer.wrap(arr);
    }
 else {
      if (buf == null || buf.capacity() < arr.length) {
        buf=ByteBuffer.allocate(arr.length);
      }
      buf.position(0);
      buf.put(arr);
      buf.rewind();
    }
  }
  return buf;
}

Fixed version (ground truth):
protected static void updateByteBuffer(ByteBuffer buf,byte[] arr,int offset,int size){
  if (USE_DIRECT_BUFFERS || (buf.hasArray() && buf.array() != arr)) {
    buf.position(offset);
    buf.put(arr,offset,size);
    buf.rewind();
  }
}
Program: 163646
Project: 163646
Buggy source:
protected static ShortBuffer updateShortBuffer(ShortBuffer buf,short[] arr,boolean wrap){
  if (USE_DIRECT_BUFFERS) {
    if (buf == null || buf.capacity() < arr.length) {
      buf=PGL.allocateDirectShortBuffer(arr.length);
    }
    buf.position(0);
    buf.put(arr);
    buf.rewind();
  }
 else {
    if (wrap) {
      buf=ShortBuffer.wrap(arr);
    }
 else {
      if (buf == null || buf.capacity() < arr.length) {
        buf=ShortBuffer.allocate(arr.length);
      }
      buf.position(0);
      buf.put(arr);
      buf.rewind();
    }
  }
  return buf;
}

Fixed version (ground truth):
protected static void updateShortBuffer(ShortBuffer buf,short[] arr,int offset,int size){
  if (USE_DIRECT_BUFFERS || (buf.hasArray() && buf.array() != arr)) {
    buf.position(offset);
    buf.put(arr,offset,size);
    buf.rewind();
  }
}