nus-yam/ex-repair huggingface dataset:
Program: 43023
Project: 43023
Buggy source:
public void destroy(){
  nContextDestroy(mContext);
  mContext=0;
  nDeviceDestroy(mDev);
  mDev=0;
}

Fixed version (ground truth):
public void destroy(){
  nContextDeinitToClient();
  mMessageThread.mRun=false;
  nContextDestroy(mContext);
  mContext=0;
  nDeviceDestroy(mDev);
  mDev=0;
}
Program: 43024
Project: 43024
Buggy source:
public RenderScript(Surface sur,boolean useDepth,boolean forceSW){
  mSurface=sur;
  mDev=nDeviceCreate();
  if (forceSW) {
    nDeviceSetConfig(mDev,0,1);
  }
  mContext=nContextCreate(mDev,mSurface,0,useDepth);
  Element.initPredefined(this);
}

Fixed version (ground truth):
public RenderScript(Surface sur,boolean useDepth,boolean forceSW){
  mSurface=sur;
  mDev=nDeviceCreate();
  if (forceSW) {
    nDeviceSetConfig(mDev,0,1);
  }
  mContext=nContextCreate(mDev,mSurface,0,useDepth);
  Element.initPredefined(this);
  mMessageThread=new MessageThread(this);
  mMessageThread.start();
}
Program: 43028
Project: 43028
Buggy source:
private static String getTitle(Context context,Uri uri,boolean followSettingsUri){
  Cursor cursor=null;
  ContentResolver res=context.getContentResolver();
  String title=null;
  if (uri != null) {
    String authority=uri.getAuthority();
    if (Settings.AUTHORITY.equals(authority)) {
      if (followSettingsUri) {
        Uri actualUri=RingtoneManager.getActualDefaultRingtoneUri(context,RingtoneManager.getDefaultType(uri));
        String actualTitle=getTitle(context,actualUri,false);
        title=context.getString(com.android.internal.R.string.ringtone_default_with_actual,actualTitle);
      }
    }
 else {
      if (DrmStore.AUTHORITY.equals(authority)) {
        cursor=res.query(uri,DRM_COLUMNS,null,null,null);
      }
 else       if (MediaStore.AUTHORITY.equals(authority)) {
        cursor=res.query(uri,MEDIA_COLUMNS,null,null,null);
      }
      if (cursor != null && cursor.getCount() == 1) {
        cursor.moveToFirst();
        return cursor.getString(2);
      }
 else {
        title=uri.getLastPathSegment();
      }
    }
  }
  if (title == null) {
    title=context.getString(com.android.internal.R.string.ringtone_unknown);
    if (title == null) {
      title="String_Node_Str";
    }
  }
  return title;
}

Fixed version (ground truth):
private static String getTitle(Context context,Uri uri,boolean followSettingsUri){
  Cursor cursor=null;
  ContentResolver res=context.getContentResolver();
  String title=null;
  if (uri != null) {
    String authority=uri.getAuthority();
    if (Settings.AUTHORITY.equals(authority)) {
      if (followSettingsUri) {
        Uri actualUri=RingtoneManager.getActualDefaultRingtoneUri(context,RingtoneManager.getDefaultType(uri));
        String actualTitle=getTitle(context,actualUri,false);
        title=context.getString(com.android.internal.R.string.ringtone_default_with_actual,actualTitle);
      }
    }
 else {
      if (DrmStore.AUTHORITY.equals(authority)) {
        cursor=res.query(uri,DRM_COLUMNS,null,null,null);
      }
 else       if (MediaStore.AUTHORITY.equals(authority)) {
        cursor=res.query(uri,MEDIA_COLUMNS,null,null,null);
      }
      try {
        if (cursor != null && cursor.getCount() == 1) {
          cursor.moveToFirst();
          return cursor.getString(2);
        }
 else {
          title=uri.getLastPathSegment();
        }
      }
  finally {
        if (cursor != null) {
          cursor.close();
        }
      }
    }
  }
  if (title == null) {
    title=context.getString(com.android.internal.R.string.ringtone_unknown);
    if (title == null) {
      title="String_Node_Str";
    }
  }
  return title;
}
Program: 43029
Project: 43029
Buggy source:
@Override public void handleMessage(Message msg){
synchronized (this) {
    updateKeyguardLocked();
    Log.d(TAG,"String_Node_Str" + mDockState);
    mPowerManager.userActivityWithForce(SystemClock.uptimeMillis(),false,true);
    Intent intent=new Intent(Intent.ACTION_DOCK_EVENT);
    intent.putExtra(Intent.EXTRA_DOCK_STATE,mDockState);
    mContext.sendStickyOrderedBroadcast(intent,mResultReceiver,null,Activity.RESULT_OK,null,null);
  }
}

Fixed version (ground truth):
@Override public void handleMessage(Message msg){
synchronized (this) {
    Log.i(TAG,"String_Node_Str" + mDockState);
    if (Settings.Secure.getInt(mContext.getContentResolver(),Settings.Secure.DEVICE_PROVISIONED,0) == 0) {
      Log.i(TAG,"String_Node_Str");
      return;
    }
    mPowerManager.userActivityWithForce(SystemClock.uptimeMillis(),false,true);
    Intent intent=new Intent(Intent.ACTION_DOCK_EVENT);
    intent.putExtra(Intent.EXTRA_DOCK_STATE,mDockState);
    mContext.sendStickyOrderedBroadcast(intent,mResultReceiver,null,Activity.RESULT_OK,null,null);
  }
}
Program: 43034
Project: 43034
Buggy source:
private boolean parseAllMetaData(Resources res,XmlPullParser parser,AttributeSet attrs,String tag,Component outInfo,String[] outError) throws XmlPullParserException, IOException {
  int outerDepth=parser.getDepth();
  int type;
  while ((type=parser.next()) != XmlPullParser.END_DOCUMENT && (type != XmlPullParser.END_TAG || parser.getDepth() > outerDepth)) {
    if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) {
      continue;
    }
    if (parser.getName().equals("String_Node_Str")) {
      if ((outInfo.metaData=parseMetaData(res,parser,attrs,outInfo.metaData,outError)) == null) {
        return false;
      }
    }
 else {
      if (!RIGID_PARSER) {
        Log.w(TAG,"String_Node_Str" + mArchiveSourcePath + "String_Node_Str");
        Log.w(TAG,"String_Node_Str" + tag + "String_Node_Str"+ parser.getName());
        XmlUtils.skipCurrentTag(parser);
        continue;
      }
      outError[0]="String_Node_Str" + tag + "String_Node_Str"+ parser.getName();
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
private boolean parseAllMetaData(Resources res,XmlPullParser parser,AttributeSet attrs,String tag,Component outInfo,String[] outError) throws XmlPullParserException, IOException {
  int outerDepth=parser.getDepth();
  int type;
  while ((type=parser.next()) != XmlPullParser.END_DOCUMENT && (type != XmlPullParser.END_TAG || parser.getDepth() > outerDepth)) {
    if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) {
      continue;
    }
    if (parser.getName().equals("String_Node_Str")) {
      if ((outInfo.metaData=parseMetaData(res,parser,attrs,outInfo.metaData,outError)) == null) {
        return false;
      }
    }
 else {
      if (!RIGID_PARSER) {
        Log.w(TAG,"String_Node_Str" + tag + "String_Node_Str"+ parser.getName()+ "String_Node_Str"+ mArchiveSourcePath+ "String_Node_Str"+ parser.getPositionDescription());
        XmlUtils.skipCurrentTag(parser);
        continue;
      }
      outError[0]="String_Node_Str" + tag + "String_Node_Str"+ parser.getName();
      return false;
    }
  }
  return true;
}
Program: 43039
Project: 43039
Buggy source:
/** 
 * Convenience function to retrieve the bookmarked Intent for a particular shortcut key.
 * @param cr The ContentResolver to query.
 * @param shortcut The shortcut key.
 * @return Intent The bookmarked URL, or null if there is no bookmarkmatching the given shortcut.
 */
public static Intent getIntentForShortcut(ContentResolver cr,char shortcut){
  Intent intent=null;
  Cursor c=cr.query(CONTENT_URI,sIntentProjection,sShortcutSelection,new String[]{String.valueOf((int)shortcut)},ORDERING);
  try {
    while (intent == null && c.moveToNext()) {
      try {
        String intentURI=c.getString(c.getColumnIndexOrThrow(INTENT));
        intent=Intent.getIntent(intentURI);
      }
 catch (      java.net.URISyntaxException e) {
      }
catch (      IllegalArgumentException e) {
        Log.e(TAG,"String_Node_Str",e);
      }
    }
  }
  finally {
    if (c != null)     c.close();
  }
  return intent;
}

Fixed version (ground truth):
/** 
 * Convenience function to retrieve the bookmarked Intent for a particular shortcut key.
 * @param cr The ContentResolver to query.
 * @param shortcut The shortcut key.
 * @return Intent The bookmarked URL, or null if there is no bookmarkmatching the given shortcut.
 */
public static Intent getIntentForShortcut(ContentResolver cr,char shortcut){
  Intent intent=null;
  Cursor c=cr.query(CONTENT_URI,sIntentProjection,sShortcutSelection,new String[]{String.valueOf((int)shortcut)},ORDERING);
  try {
    while (intent == null && c.moveToNext()) {
      try {
        String intentURI=c.getString(c.getColumnIndexOrThrow(INTENT));
        intent=Intent.getIntent(intentURI);
      }
 catch (      java.net.URISyntaxException e) {
      }
catch (      IllegalArgumentException e) {
        Log.w(TAG,"String_Node_Str",e);
      }
    }
  }
  finally {
    if (c != null)     c.close();
  }
  return intent;
}
Program: 43041
Project: 43041
Buggy source:
View createUnlockScreenFor(UnlockMode unlockMode){
  if (unlockMode == UnlockMode.Pattern) {
    return new UnlockScreen(mContext,mLockPatternUtils,mUpdateMonitor,mKeyguardScreenCallback,mUpdateMonitor.getFailedAttempts(),mEnableFallback);
  }
 else   if (unlockMode == UnlockMode.SimPin) {
    return new SimUnlockScreen(mContext,mUpdateMonitor,mKeyguardScreenCallback);
  }
 else   if (unlockMode == UnlockMode.Account) {
    try {
      return new AccountUnlockScreen(mContext,mKeyguardScreenCallback,mLockPatternUtils);
    }
 catch (    IllegalStateException e) {
      Log.i(TAG,"String_Node_Str" + "String_Node_Str");
      return createUnlockScreenFor(UnlockMode.Pattern);
    }
  }
 else {
    throw new IllegalArgumentException("String_Node_Str" + unlockMode);
  }
}

Fixed version (ground truth):
View createUnlockScreenFor(UnlockMode unlockMode){
  if (unlockMode == UnlockMode.Pattern) {
    UnlockScreen view=new UnlockScreen(mContext,mLockPatternUtils,mUpdateMonitor,mKeyguardScreenCallback,mUpdateMonitor.getFailedAttempts());
    view.setEnableFallback(mEnableFallback);
    return view;
  }
 else   if (unlockMode == UnlockMode.SimPin) {
    return new SimUnlockScreen(mContext,mUpdateMonitor,mKeyguardScreenCallback);
  }
 else   if (unlockMode == UnlockMode.Account) {
    try {
      return new AccountUnlockScreen(mContext,mKeyguardScreenCallback,mLockPatternUtils);
    }
 catch (    IllegalStateException e) {
      Log.i(TAG,"String_Node_Str" + "String_Node_Str");
      return createUnlockScreenFor(UnlockMode.Pattern);
    }
  }
 else {
    throw new IllegalArgumentException("String_Node_Str" + unlockMode);
  }
}
Program: 43045
Project: 43045
Buggy source:
public void saveMiniThumbToFile(byte[] data,long id,long magic) throws IOException {
  RandomAccessFile r=miniThumbDataFile();
  if (r == null)   return;
  long pos=id * BYTES_PER_MINTHUMB;
  FileLock lock=null;
  try {
    if (data != null) {
      if (data.length > BYTES_PER_MINTHUMB - HEADER_SIZE) {
        return;
      }
      mBuffer.clear();
      mBuffer.put((byte)1);
      mBuffer.putLong(magic);
      mBuffer.putInt(data.length);
      mBuffer.put(data);
      mBuffer.flip();
      lock=mChannel.lock(pos,BYTES_PER_MINTHUMB,false);
      mChannel.write(mBuffer,pos);
    }
  }
 catch (  IOException ex) {
    Log.e(TAG,"String_Node_Str" + id + "String_Node_Str",ex);
    throw ex;
  }
catch (  RuntimeException ex) {
    Log.e(TAG,"String_Node_Str" + id + "String_Node_Str"+ ex.getClass());
  }
 finally {
    try {
      if (lock != null)       lock.release();
    }
 catch (    IOException ex) {
    }
  }
}

Fixed version (ground truth):
public synchronized void saveMiniThumbToFile(byte[] data,long id,long magic) throws IOException {
  RandomAccessFile r=miniThumbDataFile();
  if (r == null)   return;
  long pos=id * BYTES_PER_MINTHUMB;
  FileLock lock=null;
  try {
    if (data != null) {
      if (data.length > BYTES_PER_MINTHUMB - HEADER_SIZE) {
        return;
      }
      mBuffer.clear();
      mBuffer.put((byte)1);
      mBuffer.putLong(magic);
      mBuffer.putInt(data.length);
      mBuffer.put(data);
      mBuffer.flip();
      lock=mChannel.lock(pos,BYTES_PER_MINTHUMB,false);
      mChannel.write(mBuffer,pos);
    }
  }
 catch (  IOException ex) {
    Log.e(TAG,"String_Node_Str" + id + "String_Node_Str",ex);
    throw ex;
  }
catch (  RuntimeException ex) {
    Log.e(TAG,"String_Node_Str" + id + "String_Node_Str"+ ex.getClass());
  }
 finally {
    try {
      if (lock != null)       lock.release();
    }
 catch (    IOException ex) {
    }
  }
}
Program: 43046
Project: 43046
Buggy source:
/** 
 * We store different types of thumbnails in different files. To remain backward compatibility, we should hashcode of content://media/external/images/media remains the same.
 */
public static synchronized void reset(){
  sThumbFiles.clear();
}

Fixed version (ground truth):
/** 
 * We store different types of thumbnails in different files. To remain backward compatibility, we should hashcode of content://media/external/images/media remains the same.
 */
public static synchronized void reset(){
  for (  MiniThumbFile file : sThumbFiles.values()) {
    file.deactivate();
  }
  sThumbFiles.clear();
}
Program: 43047
Project: 43047
Buggy source:
/** 
 * Gallery app can use this method to retrieve mini-thumbnail. Full size images share the same IDs with their corresponding thumbnails.
 * @param id the ID of the image (same of full size image).
 * @param data the buffer to store mini-thumbnail.
 */
public byte[] getMiniThumbFromFile(long id,byte[] data){
  RandomAccessFile r=miniThumbDataFile();
  if (r == null)   return null;
  long pos=id * BYTES_PER_MINTHUMB;
  FileLock lock=null;
  try {
    mBuffer.clear();
    lock=mChannel.lock(pos,BYTES_PER_MINTHUMB,true);
    int size=mChannel.read(mBuffer,pos);
    if (size > 1 + 8 + 4) {
      mBuffer.position(0);
      byte flag=mBuffer.get();
      long magic=mBuffer.getLong();
      int length=mBuffer.getInt();
      if (size >= 1 + 8 + 4+ length && data.length >= length) {
        mBuffer.get(data,0,length);
        return data;
      }
    }
  }
 catch (  IOException ex) {
    Log.w(TAG,"String_Node_Str" + id + "String_Node_Str"+ ex);
  }
catch (  RuntimeException ex) {
    Log.e(TAG,"String_Node_Str" + id + "String_Node_Str"+ ex.getClass());
  }
 finally {
    try {
      if (lock != null)       lock.release();
    }
 catch (    IOException ex) {
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Gallery app can use this method to retrieve mini-thumbnail. Full size images share the same IDs with their corresponding thumbnails.
 * @param id the ID of the image (same of full size image).
 * @param data the buffer to store mini-thumbnail.
 */
public synchronized byte[] getMiniThumbFromFile(long id,byte[] data){
  RandomAccessFile r=miniThumbDataFile();
  if (r == null)   return null;
  long pos=id * BYTES_PER_MINTHUMB;
  FileLock lock=null;
  try {
    mBuffer.clear();
    lock=mChannel.lock(pos,BYTES_PER_MINTHUMB,true);
    int size=mChannel.read(mBuffer,pos);
    if (size > 1 + 8 + 4) {
      mBuffer.position(0);
      byte flag=mBuffer.get();
      long magic=mBuffer.getLong();
      int length=mBuffer.getInt();
      if (size >= 1 + 8 + 4+ length && data.length >= length) {
        mBuffer.get(data,0,length);
        return data;
      }
    }
  }
 catch (  IOException ex) {
    Log.w(TAG,"String_Node_Str" + id + "String_Node_Str"+ ex);
  }
catch (  RuntimeException ex) {
    Log.e(TAG,"String_Node_Str" + id + "String_Node_Str"+ ex.getClass());
  }
 finally {
    try {
      if (lock != null)       lock.release();
    }
 catch (    IOException ex) {
    }
  }
  return null;
}
Program: 43048
Project: 43048
Buggy source:
public long getMagic(long id){
  RandomAccessFile r=miniThumbDataFile();
  if (r != null) {
    long pos=id * BYTES_PER_MINTHUMB;
    FileLock lock=null;
    try {
      mBuffer.clear();
      mBuffer.limit(1 + 8);
      lock=mChannel.lock(pos,1 + 8,true);
      if (mChannel.read(mBuffer,pos) == 9) {
        mBuffer.position(0);
        if (mBuffer.get() == 1) {
          return mBuffer.getLong();
        }
      }
    }
 catch (    IOException ex) {
      Log.v(TAG,"String_Node_Str",ex);
    }
catch (    RuntimeException ex) {
      Log.e(TAG,"String_Node_Str" + id + "String_Node_Str"+ ex.getClass());
    }
 finally {
      try {
        if (lock != null)         lock.release();
      }
 catch (      IOException ex) {
      }
    }
  }
  return 0;
}

Fixed version (ground truth):
public synchronized long getMagic(long id){
  RandomAccessFile r=miniThumbDataFile();
  if (r != null) {
    long pos=id * BYTES_PER_MINTHUMB;
    FileLock lock=null;
    try {
      mBuffer.clear();
      mBuffer.limit(1 + 8);
      lock=mChannel.lock(pos,1 + 8,true);
      if (mChannel.read(mBuffer,pos) == 9) {
        mBuffer.position(0);
        if (mBuffer.get() == 1) {
          return mBuffer.getLong();
        }
      }
    }
 catch (    IOException ex) {
      Log.v(TAG,"String_Node_Str",ex);
    }
catch (    RuntimeException ex) {
      Log.e(TAG,"String_Node_Str" + id + "String_Node_Str"+ ex.getClass());
    }
 finally {
      try {
        if (lock != null)         lock.release();
      }
 catch (      IOException ex) {
      }
    }
  }
  return 0;
}
Program: 43049
Project: 43049
Buggy source:
/** 
 * Trigger a dialog that lists the various methods of interacting with the requested   {@link Contacts} entry. This may be based on available{@link Data} rows under that contact, and may also include socialstatus and presence details.
 * @param context The parent {@link Context} that may be used as theparent for this dialog.
 * @param target Specific {@link Rect} that this dialog should becentered around, in screen coordinates. In particular, if the dialog has a "callout" arrow, it will be pointed and centered around this  {@link Rect}.
 * @param lookupUri A {@link Contacts#CONTENT_LOOKUP_URI} style{@link Uri} that describes a specific contact to featurein this dialog.
 * @param mode Any of {@link #MODE_SMALL},   {@link #MODE_MEDIUM}, or  {@link #MODE_LARGE}, indicating the desired dialog size, when supported.
 * @param excludeMimes Optional list of {@link Data#MIMETYPE} MIME-typesto exclude when showing this dialog. For example, when already viewing the contact details card, this can be used to omit the details entry from the dialog.
 */
public static void showQuickContact(Context context,Rect target,Uri lookupUri,int mode,String[] excludeMimes){
  final Intent intent=new Intent(ACTION_QUICK_CONTACT);
  intent.setData(lookupUri);
  intent.putExtra(EXTRA_TARGET_RECT,target);
  intent.putExtra(EXTRA_MODE,mode);
  intent.putExtra(EXTRA_EXCLUDE_MIMES,excludeMimes);
  intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
  context.startActivity(intent);
}

Fixed version (ground truth):
/** 
 * Trigger a dialog that lists the various methods of interacting with the requested   {@link Contacts} entry. This may be based on available{@link Data} rows under that contact, and may also include socialstatus and presence details.
 * @param context The parent {@link Context} that may be used as theparent for this dialog.
 * @param target Specific {@link Rect} that this dialog should becentered around, in screen coordinates. In particular, if the dialog has a "callout" arrow, it will be pointed and centered around this  {@link Rect}.
 * @param lookupUri A {@link ContactsContract.Contacts#CONTENT_LOOKUP_URI} style{@link Uri} that describes a specific contact to featurein this dialog.
 * @param mode Any of {@link #MODE_SMALL},   {@link #MODE_MEDIUM}, or  {@link #MODE_LARGE}, indicating the desired dialog size, when supported.
 * @param excludeMimes Optional list of {@link Data#MIMETYPE} MIME-typesto exclude when showing this dialog. For example, when already viewing the contact details card, this can be used to omit the details entry from the dialog.
 */
public static void showQuickContact(Context context,Rect target,Uri lookupUri,int mode,String[] excludeMimes){
  final Intent intent=new Intent(ACTION_QUICK_CONTACT);
  intent.setData(lookupUri);
  intent.putExtra(EXTRA_TARGET_RECT,target);
  intent.putExtra(EXTRA_MODE,mode);
  intent.putExtra(EXTRA_EXCLUDE_MIMES,excludeMimes);
  intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
  context.startActivity(intent);
}
Program: 43051
Project: 43051
Buggy source:
/** 
 * Once we know that we have asked an application to put an activity in the resumed state (either by launching it or explicitly telling it), this function updates the rest of our state to match that fact.
 */
private final void completeResumeLocked(HistoryRecord next){
  next.idle=false;
  next.results=null;
  next.newIntents=null;
  Message msg=mHandler.obtainMessage(IDLE_TIMEOUT_MSG);
  msg.obj=next;
  mHandler.sendMessageDelayed(msg,IDLE_TIMEOUT);
  if (false) {
    msg=mHandler.obtainMessage(IDLE_NOW_MSG);
    msg.obj=next;
    mHandler.sendMessage(msg);
  }
  reportResumedActivity(next);
  next.thumbnail=null;
  setFocusedActivityLocked(next);
  next.resumeKeyDispatchingLocked();
  ensureActivitiesVisibleLocked(null,0);
  mWindowManager.executeAppTransition();
  mNoAnimActivities.clear();
  if (next.app != null) {
synchronized (mProcessStatsThread) {
      next.cpuTimeAtResume=mProcessStats.getCpuTimeForPid(next.app.pid);
    }
  }
 else {
    next.cpuTimeAtResume=0;
  }
}

Fixed version (ground truth):
/** 
 * Once we know that we have asked an application to put an activity in the resumed state (either by launching it or explicitly telling it), this function updates the rest of our state to match that fact.
 */
private final void completeResumeLocked(HistoryRecord next){
  next.idle=false;
  next.results=null;
  next.newIntents=null;
  Message msg=mHandler.obtainMessage(IDLE_TIMEOUT_MSG);
  msg.obj=next;
  mHandler.sendMessageDelayed(msg,IDLE_TIMEOUT);
  if (false) {
    msg=mHandler.obtainMessage(IDLE_NOW_MSG);
    msg.obj=next;
    mHandler.sendMessage(msg);
  }
  reportResumedActivityLocked(next);
  next.thumbnail=null;
  setFocusedActivityLocked(next);
  next.resumeKeyDispatchingLocked();
  ensureActivitiesVisibleLocked(null,0);
  mWindowManager.executeAppTransition();
  mNoAnimActivities.clear();
  if (next.app != null) {
synchronized (mProcessStatsThread) {
      next.cpuTimeAtResume=mProcessStats.getCpuTimeForPid(next.app.pid);
    }
  }
 else {
    next.cpuTimeAtResume=0;
  }
}
Program: 43052
Project: 43052
Buggy source:
private final boolean relaunchActivityLocked(HistoryRecord r,int changes,boolean andResume){
  List<ResultInfo> results=null;
  List<Intent> newIntents=null;
  if (andResume) {
    results=r.results;
    newIntents=r.newIntents;
  }
  if (DEBUG_SWITCH)   Log.v(TAG,"String_Node_Str" + r + "String_Node_Str"+ results+ "String_Node_Str"+ newIntents+ "String_Node_Str"+ andResume);
  EventLog.writeEvent(andResume ? LOG_AM_RELAUNCH_RESUME_ACTIVITY : LOG_AM_RELAUNCH_ACTIVITY,System.identityHashCode(r),r.task.taskId,r.shortComponentName);
  r.startFreezingScreenLocked(r.app,0);
  try {
    if (DEBUG_SWITCH)     Log.i(TAG,"String_Node_Str" + r);
    r.app.thread.scheduleRelaunchActivity(r,results,newIntents,changes,!andResume);
  }
 catch (  RemoteException e) {
    return false;
  }
  if (andResume) {
    r.results=null;
    r.newIntents=null;
  }
  return true;
}

Fixed version (ground truth):
private final boolean relaunchActivityLocked(HistoryRecord r,int changes,boolean andResume){
  List<ResultInfo> results=null;
  List<Intent> newIntents=null;
  if (andResume) {
    results=r.results;
    newIntents=r.newIntents;
  }
  if (DEBUG_SWITCH)   Log.v(TAG,"String_Node_Str" + r + "String_Node_Str"+ results+ "String_Node_Str"+ newIntents+ "String_Node_Str"+ andResume);
  EventLog.writeEvent(andResume ? LOG_AM_RELAUNCH_RESUME_ACTIVITY : LOG_AM_RELAUNCH_ACTIVITY,System.identityHashCode(r),r.task.taskId,r.shortComponentName);
  r.startFreezingScreenLocked(r.app,0);
  try {
    if (DEBUG_SWITCH)     Log.i(TAG,"String_Node_Str" + r);
    r.app.thread.scheduleRelaunchActivity(r,results,newIntents,changes,!andResume);
  }
 catch (  RemoteException e) {
    return false;
  }
  if (andResume) {
    r.results=null;
    r.newIntents=null;
    reportResumedActivityLocked(r);
  }
  return true;
}
Program: 43057
Project: 43057
Buggy source:
private boolean parseAllMetaData(Resources res,XmlPullParser parser,AttributeSet attrs,String tag,Component outInfo,String[] outError) throws XmlPullParserException, IOException {
  int outerDepth=parser.getDepth();
  int type;
  while ((type=parser.next()) != XmlPullParser.END_DOCUMENT && (type != XmlPullParser.END_TAG || parser.getDepth() > outerDepth)) {
    if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) {
      continue;
    }
    if (parser.getName().equals("String_Node_Str")) {
      if ((outInfo.metaData=parseMetaData(res,parser,attrs,outInfo.metaData,outError)) == null) {
        return false;
      }
    }
 else {
      if (!RIGID_PARSER) {
        Log.w(TAG,"String_Node_Str" + mArchiveSourcePath + "String_Node_Str");
        Log.w(TAG,"String_Node_Str" + tag + "String_Node_Str"+ parser.getName());
        XmlUtils.skipCurrentTag(parser);
        continue;
      }
      outError[0]="String_Node_Str" + tag + "String_Node_Str"+ parser.getName();
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
private boolean parseAllMetaData(Resources res,XmlPullParser parser,AttributeSet attrs,String tag,Component outInfo,String[] outError) throws XmlPullParserException, IOException {
  int outerDepth=parser.getDepth();
  int type;
  while ((type=parser.next()) != XmlPullParser.END_DOCUMENT && (type != XmlPullParser.END_TAG || parser.getDepth() > outerDepth)) {
    if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) {
      continue;
    }
    if (parser.getName().equals("String_Node_Str")) {
      if ((outInfo.metaData=parseMetaData(res,parser,attrs,outInfo.metaData,outError)) == null) {
        return false;
      }
    }
 else {
      if (!RIGID_PARSER) {
        Log.w(TAG,"String_Node_Str" + tag + "String_Node_Str"+ parser.getName()+ "String_Node_Str"+ mArchiveSourcePath+ "String_Node_Str"+ parser.getPositionDescription());
        XmlUtils.skipCurrentTag(parser);
        continue;
      }
      outError[0]="String_Node_Str" + tag + "String_Node_Str"+ parser.getName();
      return false;
    }
  }
  return true;
}
Program: 43062
Project: 43062
Buggy source:
/** 
 * Convenience function to retrieve the bookmarked Intent for a particular shortcut key.
 * @param cr The ContentResolver to query.
 * @param shortcut The shortcut key.
 * @return Intent The bookmarked URL, or null if there is no bookmarkmatching the given shortcut.
 */
public static Intent getIntentForShortcut(ContentResolver cr,char shortcut){
  Intent intent=null;
  Cursor c=cr.query(CONTENT_URI,sIntentProjection,sShortcutSelection,new String[]{String.valueOf((int)shortcut)},ORDERING);
  try {
    while (intent == null && c.moveToNext()) {
      try {
        String intentURI=c.getString(c.getColumnIndexOrThrow(INTENT));
        intent=Intent.getIntent(intentURI);
      }
 catch (      java.net.URISyntaxException e) {
      }
catch (      IllegalArgumentException e) {
        Log.e(TAG,"String_Node_Str",e);
      }
    }
  }
  finally {
    if (c != null)     c.close();
  }
  return intent;
}

Fixed version (ground truth):
/** 
 * Convenience function to retrieve the bookmarked Intent for a particular shortcut key.
 * @param cr The ContentResolver to query.
 * @param shortcut The shortcut key.
 * @return Intent The bookmarked URL, or null if there is no bookmarkmatching the given shortcut.
 */
public static Intent getIntentForShortcut(ContentResolver cr,char shortcut){
  Intent intent=null;
  Cursor c=cr.query(CONTENT_URI,sIntentProjection,sShortcutSelection,new String[]{String.valueOf((int)shortcut)},ORDERING);
  try {
    while (intent == null && c.moveToNext()) {
      try {
        String intentURI=c.getString(c.getColumnIndexOrThrow(INTENT));
        intent=Intent.getIntent(intentURI);
      }
 catch (      java.net.URISyntaxException e) {
      }
catch (      IllegalArgumentException e) {
        Log.w(TAG,"String_Node_Str",e);
      }
    }
  }
  finally {
    if (c != null)     c.close();
  }
  return intent;
}
Program: 43067
Project: 43067
Buggy source:
private boolean parseAllMetaData(Resources res,XmlPullParser parser,AttributeSet attrs,String tag,Component outInfo,String[] outError) throws XmlPullParserException, IOException {
  int outerDepth=parser.getDepth();
  int type;
  while ((type=parser.next()) != XmlPullParser.END_DOCUMENT && (type != XmlPullParser.END_TAG || parser.getDepth() > outerDepth)) {
    if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) {
      continue;
    }
    if (parser.getName().equals("String_Node_Str")) {
      if ((outInfo.metaData=parseMetaData(res,parser,attrs,outInfo.metaData,outError)) == null) {
        return false;
      }
    }
 else {
      if (!RIGID_PARSER) {
        Log.w(TAG,"String_Node_Str" + mArchiveSourcePath + "String_Node_Str");
        Log.w(TAG,"String_Node_Str" + tag + "String_Node_Str"+ parser.getName());
        XmlUtils.skipCurrentTag(parser);
        continue;
      }
      outError[0]="String_Node_Str" + tag + "String_Node_Str"+ parser.getName();
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
private boolean parseAllMetaData(Resources res,XmlPullParser parser,AttributeSet attrs,String tag,Component outInfo,String[] outError) throws XmlPullParserException, IOException {
  int outerDepth=parser.getDepth();
  int type;
  while ((type=parser.next()) != XmlPullParser.END_DOCUMENT && (type != XmlPullParser.END_TAG || parser.getDepth() > outerDepth)) {
    if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) {
      continue;
    }
    if (parser.getName().equals("String_Node_Str")) {
      if ((outInfo.metaData=parseMetaData(res,parser,attrs,outInfo.metaData,outError)) == null) {
        return false;
      }
    }
 else {
      if (!RIGID_PARSER) {
        Log.w(TAG,"String_Node_Str" + tag + "String_Node_Str"+ parser.getName()+ "String_Node_Str"+ mArchiveSourcePath+ "String_Node_Str"+ parser.getPositionDescription());
        XmlUtils.skipCurrentTag(parser);
        continue;
      }
      outError[0]="String_Node_Str" + tag + "String_Node_Str"+ parser.getName();
      return false;
    }
  }
  return true;
}
Program: 43072
Project: 43072
Buggy source:
/** 
 * Convenience function to retrieve the bookmarked Intent for a particular shortcut key.
 * @param cr The ContentResolver to query.
 * @param shortcut The shortcut key.
 * @return Intent The bookmarked URL, or null if there is no bookmarkmatching the given shortcut.
 */
public static Intent getIntentForShortcut(ContentResolver cr,char shortcut){
  Intent intent=null;
  Cursor c=cr.query(CONTENT_URI,sIntentProjection,sShortcutSelection,new String[]{String.valueOf((int)shortcut)},ORDERING);
  try {
    while (intent == null && c.moveToNext()) {
      try {
        String intentURI=c.getString(c.getColumnIndexOrThrow(INTENT));
        intent=Intent.getIntent(intentURI);
      }
 catch (      java.net.URISyntaxException e) {
      }
catch (      IllegalArgumentException e) {
        Log.e(TAG,"String_Node_Str",e);
      }
    }
  }
  finally {
    if (c != null)     c.close();
  }
  return intent;
}

Fixed version (ground truth):
/** 
 * Convenience function to retrieve the bookmarked Intent for a particular shortcut key.
 * @param cr The ContentResolver to query.
 * @param shortcut The shortcut key.
 * @return Intent The bookmarked URL, or null if there is no bookmarkmatching the given shortcut.
 */
public static Intent getIntentForShortcut(ContentResolver cr,char shortcut){
  Intent intent=null;
  Cursor c=cr.query(CONTENT_URI,sIntentProjection,sShortcutSelection,new String[]{String.valueOf((int)shortcut)},ORDERING);
  try {
    while (intent == null && c.moveToNext()) {
      try {
        String intentURI=c.getString(c.getColumnIndexOrThrow(INTENT));
        intent=Intent.getIntent(intentURI);
      }
 catch (      java.net.URISyntaxException e) {
      }
catch (      IllegalArgumentException e) {
        Log.w(TAG,"String_Node_Str",e);
      }
    }
  }
  finally {
    if (c != null)     c.close();
  }
  return intent;
}
Program: 43074
Project: 43074
Buggy source:
View createUnlockScreenFor(UnlockMode unlockMode){
  if (unlockMode == UnlockMode.Pattern) {
    return new UnlockScreen(mContext,mLockPatternUtils,mUpdateMonitor,mKeyguardScreenCallback,mUpdateMonitor.getFailedAttempts(),mEnableFallback);
  }
 else   if (unlockMode == UnlockMode.SimPin) {
    return new SimUnlockScreen(mContext,mUpdateMonitor,mKeyguardScreenCallback);
  }
 else   if (unlockMode == UnlockMode.Account) {
    try {
      return new AccountUnlockScreen(mContext,mKeyguardScreenCallback,mLockPatternUtils);
    }
 catch (    IllegalStateException e) {
      Log.i(TAG,"String_Node_Str" + "String_Node_Str");
      return createUnlockScreenFor(UnlockMode.Pattern);
    }
  }
 else {
    throw new IllegalArgumentException("String_Node_Str" + unlockMode);
  }
}

Fixed version (ground truth):
View createUnlockScreenFor(UnlockMode unlockMode){
  if (unlockMode == UnlockMode.Pattern) {
    UnlockScreen view=new UnlockScreen(mContext,mLockPatternUtils,mUpdateMonitor,mKeyguardScreenCallback,mUpdateMonitor.getFailedAttempts());
    view.setEnableFallback(mEnableFallback);
    return view;
  }
 else   if (unlockMode == UnlockMode.SimPin) {
    return new SimUnlockScreen(mContext,mUpdateMonitor,mKeyguardScreenCallback);
  }
 else   if (unlockMode == UnlockMode.Account) {
    try {
      return new AccountUnlockScreen(mContext,mKeyguardScreenCallback,mLockPatternUtils);
    }
 catch (    IllegalStateException e) {
      Log.i(TAG,"String_Node_Str" + "String_Node_Str");
      return createUnlockScreenFor(UnlockMode.Pattern);
    }
  }
 else {
    throw new IllegalArgumentException("String_Node_Str" + unlockMode);
  }
}
Program: 43076
Project: 43076
Buggy source:
/** 
 * Plays a sound effect (Key clicks, lid open/close...)
 * @param effectType The type of sound effect. One of{@link #FX_KEY_CLICK},  {@link #FX_FOCUS_NAVIGATION_UP},  {@link #FX_FOCUS_NAVIGATION_DOWN},  {@link #FX_FOCUS_NAVIGATION_LEFT},  {@link #FX_FOCUS_NAVIGATION_RIGHT},  {@link #FX_KEYPRESS_STANDARD},  {@link #FX_KEYPRESS_SPACEBAR},  {@link #FX_KEYPRESS_DELETE},  {@link #FX_KEYPRESS_RETURN},
 * @param volume Sound effect volumeNOTE: This version is for applications that have their own settings panel for enabling and controlling volume.
 */
public void playSoundEffect(int effectType,float volume){
  if (effectType < 0 || effectType >= NUM_SOUND_EFFECTS) {
    return;
  }
  IAudioService service=getService();
  try {
    service.playSoundEffectVolume(effectType,volume);
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str" + e);
  }
}

Fixed version (ground truth):
/** 
 * Plays a sound effect (Key clicks, lid open/close...)
 * @param effectType The type of sound effect. One of{@link #FX_KEY_CLICK},  {@link #FX_FOCUS_NAVIGATION_UP},  {@link #FX_FOCUS_NAVIGATION_DOWN},  {@link #FX_FOCUS_NAVIGATION_LEFT},  {@link #FX_FOCUS_NAVIGATION_RIGHT},  {@link #FX_KEYPRESS_STANDARD},  {@link #FX_KEYPRESS_SPACEBAR},  {@link #FX_KEYPRESS_DELETE},  {@link #FX_KEYPRESS_RETURN},
 * @param volume Sound effect volume.The volume value is a raw scalar so UI controls should be scaled logarithmically. If a volume of -1 is specified, the AudioManager.STREAM_MUSIC stream volume minus 3dB will be used. NOTE: This version is for applications that have their own settings panel for enabling and controlling volume.
 */
public void playSoundEffect(int effectType,float volume){
  if (effectType < 0 || effectType >= NUM_SOUND_EFFECTS) {
    return;
  }
  IAudioService service=getService();
  try {
    service.playSoundEffectVolume(effectType,volume);
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str" + e);
  }
}
Program: 43078
Project: 43078
Buggy source:
/** 
 * Loads samples into the soundpool. This method must be called at when sound effects are enabled
 */
public boolean loadSoundEffects(){
synchronized (mSoundEffectsLock) {
    mSoundPool=new SoundPool(NUM_SOUNDPOOL_CHANNELS,AudioSystem.STREAM_SYSTEM,0);
    if (mSoundPool == null) {
      return false;
    }
    int[] poolId=new int[SOUND_EFFECT_FILES.length];
    for (int fileIdx=0; fileIdx < SOUND_EFFECT_FILES.length; fileIdx++) {
      poolId[fileIdx]=-1;
    }
    for (int effect=0; effect < AudioManager.NUM_SOUND_EFFECTS; effect++) {
      if (SOUND_EFFECT_FILES_MAP[effect][1] == 0) {
        continue;
      }
      if (poolId[SOUND_EFFECT_FILES_MAP[effect][0]] == -1) {
        String filePath=Environment.getRootDirectory() + SOUND_EFFECTS_PATH + SOUND_EFFECT_FILES[SOUND_EFFECT_FILES_MAP[effect][0]];
        int sampleId=mSoundPool.load(filePath,0);
        SOUND_EFFECT_FILES_MAP[effect][1]=sampleId;
        poolId[SOUND_EFFECT_FILES_MAP[effect][0]]=sampleId;
        if (sampleId <= 0) {
          Log.w(TAG,"String_Node_Str" + filePath);
        }
      }
 else {
        SOUND_EFFECT_FILES_MAP[effect][1]=poolId[SOUND_EFFECT_FILES_MAP[effect][0]];
      }
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Loads samples into the soundpool. This method must be called at when sound effects are enabled
 */
public boolean loadSoundEffects(){
synchronized (mSoundEffectsLock) {
    if (mSoundPool != null) {
      return true;
    }
    mSoundPool=new SoundPool(NUM_SOUNDPOOL_CHANNELS,AudioSystem.STREAM_SYSTEM,0);
    if (mSoundPool == null) {
      return false;
    }
    int[] poolId=new int[SOUND_EFFECT_FILES.length];
    for (int fileIdx=0; fileIdx < SOUND_EFFECT_FILES.length; fileIdx++) {
      poolId[fileIdx]=-1;
    }
    for (int effect=0; effect < AudioManager.NUM_SOUND_EFFECTS; effect++) {
      if (SOUND_EFFECT_FILES_MAP[effect][1] == 0) {
        continue;
      }
      if (poolId[SOUND_EFFECT_FILES_MAP[effect][0]] == -1) {
        String filePath=Environment.getRootDirectory() + SOUND_EFFECTS_PATH + SOUND_EFFECT_FILES[SOUND_EFFECT_FILES_MAP[effect][0]];
        int sampleId=mSoundPool.load(filePath,0);
        SOUND_EFFECT_FILES_MAP[effect][1]=sampleId;
        poolId[SOUND_EFFECT_FILES_MAP[effect][0]]=sampleId;
        if (sampleId <= 0) {
          Log.w(TAG,"String_Node_Str" + filePath);
        }
      }
 else {
        SOUND_EFFECT_FILES_MAP[effect][1]=poolId[SOUND_EFFECT_FILES_MAP[effect][0]];
      }
    }
  }
  return true;
}
Program: 43079
Project: 43079
Buggy source:
/** 
 * @see AudioManager#playSoundEffect(int,float) 
 */
public void playSoundEffectVolume(int effectType,float volume){
  sendMsg(mAudioHandler,MSG_PLAY_SOUND_EFFECT,SHARED_MSG,SENDMSG_NOOP,effectType,(int)(volume * 1000),null,0);
}

Fixed version (ground truth):
/** 
 * @see AudioManager#playSoundEffect(int,float) 
 */
public void playSoundEffectVolume(int effectType,float volume){
  loadSoundEffects();
  sendMsg(mAudioHandler,MSG_PLAY_SOUND_EFFECT,SHARED_MSG,SENDMSG_NOOP,effectType,(int)(volume * 1000),null,0);
}
Program: 43082
Project: 43082
Buggy source:
public void die(boolean immediate){
  checkThread();
  if (Config.LOGV)   Log.v("String_Node_Str","String_Node_Str" + this + "String_Node_Str"+ mSurface);
synchronized (this) {
    if (mAdded && !mFirst) {
      int viewVisibility=mView.getVisibility();
      boolean viewVisibilityChanged=mViewVisibility != viewVisibility;
      if (mWindowAttributesChanged || viewVisibilityChanged) {
        try {
          if ((relayoutWindow(mWindowAttributes,viewVisibility,false) & WindowManagerImpl.RELAYOUT_FIRST_TIME) != 0) {
            sWindowSession.finishDrawing(mWindow);
          }
        }
 catch (        RemoteException e) {
        }
      }
      mSurface.release();
    }
    if (mAdded) {
      mAdded=false;
      if (immediate) {
        dispatchDetachedFromWindow();
      }
 else       if (mView != null) {
        sendEmptyMessage(DIE);
      }
    }
  }
}

Fixed version (ground truth):
public void die(boolean immediate){
  if (immediate) {
    doDie();
  }
 else {
    sendEmptyMessage(DIE);
  }
}
Program: 43086
Project: 43086
Buggy source:
/** 
 * Called when the system is mostly done booting to dentermine whether the system should go into safe mode.
 */
public boolean detectSafeMode();

Fixed version (ground truth):
/** 
 * Called when the system is mostly done booting to determine whether the system should go into safe mode.
 */
public boolean detectSafeMode();
Program: 43089
Project: 43089
Buggy source:
public void performEnableScreen(){
synchronized (mWindowMap) {
    if (mDisplayEnabled) {
      return;
    }
    if (!mSystemBooted) {
      return;
    }
    final int N=mWindows.size();
    for (int i=0; i < N; i++) {
      WindowState w=(WindowState)mWindows.get(i);
      if (w.isVisibleLw() && !w.isDisplayedLw()) {
        return;
      }
    }
    mDisplayEnabled=true;
    if (false) {
      Log.i(TAG,"String_Node_Str");
      StringWriter sw=new StringWriter();
      PrintWriter pw=new PrintWriter(sw);
      this.dump(null,pw,null);
      Log.i(TAG,sw.toString());
    }
    try {
      IBinder surfaceFlinger=ServiceManager.getService("String_Node_Str");
      if (surfaceFlinger != null) {
        Parcel data=Parcel.obtain();
        data.writeInterfaceToken("String_Node_Str");
        surfaceFlinger.transact(IBinder.FIRST_CALL_TRANSACTION,data,null,0);
        data.recycle();
      }
    }
 catch (    RemoteException ex) {
      Log.e(TAG,"String_Node_Str");
    }
  }
  mPolicy.enableScreenAfterBoot();
  setRotationUnchecked(WindowManagerPolicy.USE_LAST_ROTATION,false,mLastRotationFlags | Surface.FLAGS_ORIENTATION_ANIMATION_DISABLE);
}

Fixed version (ground truth):
public void performEnableScreen(){
synchronized (mWindowMap) {
    if (mDisplayEnabled) {
      return;
    }
    if (!mSystemBooted) {
      return;
    }
    final int N=mWindows.size();
    for (int i=0; i < N; i++) {
      WindowState w=(WindowState)mWindows.get(i);
      if (w.isVisibleLw() && !w.isDrawnLw()) {
        return;
      }
    }
    mDisplayEnabled=true;
    if (false) {
      Log.i(TAG,"String_Node_Str");
      StringWriter sw=new StringWriter();
      PrintWriter pw=new PrintWriter(sw);
      this.dump(null,pw,null);
      Log.i(TAG,sw.toString());
    }
    try {
      IBinder surfaceFlinger=ServiceManager.getService("String_Node_Str");
      if (surfaceFlinger != null) {
        Parcel data=Parcel.obtain();
        data.writeInterfaceToken("String_Node_Str");
        surfaceFlinger.transact(IBinder.FIRST_CALL_TRANSACTION,data,null,0);
        data.recycle();
      }
    }
 catch (    RemoteException ex) {
      Log.e(TAG,"String_Node_Str");
    }
  }
  mPolicy.enableScreenAfterBoot();
  setRotationUnchecked(WindowManagerPolicy.USE_LAST_ROTATION,false,mLastRotationFlags | Surface.FLAGS_ORIENTATION_ANIMATION_DISABLE);
}
Program: 43092
Project: 43092
Buggy source:
Element(){
  super(null);
  mID=0;
  mSize=0;
}

Fixed version (ground truth):
Element(RenderScript rs,int count){
  super(rs);
  mSize=0;
  mEntries=new Entry[count];
}
Program: 43093
Project: 43093
Buggy source:
public Element create(){
  Element e=new Element();
  e.mEntries=new Entry[mEntryCount];
  java.lang.System.arraycopy(mEntries,0,e.mEntries,0,mEntryCount);
  e.init(mRS);
  return e;
}

Fixed version (ground truth):
public Element create(){
  Element e=new Element(mRS,mEntryCount);
  java.lang.System.arraycopy(mEntries,0,e.mEntries,0,mEntryCount);
  e.init();
  return e;
}
Program: 43094
Project: 43094
Buggy source:
void init(RenderScript rs){
  mRS=rs;
  internalCreate(mRS,this);
}

Fixed version (ground truth):
void init(){
  internalCreate(mRS,this);
}
Program: 43096
Project: 43096
Buggy source:
public MatrixAllocation(RenderScript rs){
  mModel=new Matrix();
  mProjection=new Matrix();
  mTexture=new Matrix();
  mAlloc=Allocation.createSized(rs,Element.USER_FLOAT,48);
  mAlloc.subData1D(MODELVIEW_OFFSET,16,mModel.mMat);
  mAlloc.subData1D(PROJECTION_OFFSET,16,mProjection.mMat);
  mAlloc.subData1D(TEXTURE_OFFSET,16,mTexture.mMat);
}

Fixed version (ground truth):
public MatrixAllocation(RenderScript rs){
  mModel=new Matrix();
  mProjection=new Matrix();
  mTexture=new Matrix();
  mAlloc=Allocation.createSized(rs,Element.USER_F32(rs),48);
  mAlloc.subData1D(MODELVIEW_OFFSET,16,mModel.mMat);
  mAlloc.subData1D(PROJECTION_OFFSET,16,mProjection.mMat);
  mAlloc.subData1D(TEXTURE_OFFSET,16,mTexture.mMat);
}
Program: 43097
Project: 43097
Buggy source:
public RenderScript(Surface sur,boolean useDepth,boolean forceSW){
  mSurface=sur;
  mDev=nDeviceCreate();
  if (forceSW) {
    nDeviceSetConfig(mDev,0,1);
  }
  mContext=nContextCreate(mDev,mSurface,0,useDepth);
  if (!mElementsInitialized) {
    Element.initPredefined(this);
    mElementsInitialized=true;
  }
}

Fixed version (ground truth):
public RenderScript(Surface sur,boolean useDepth,boolean forceSW){
  mSurface=sur;
  mDev=nDeviceCreate();
  if (forceSW) {
    nDeviceSetConfig(mDev,0,1);
  }
  mContext=nContextCreate(mDev,mSurface,0,useDepth);
  Element.initPredefined(this);
}
Program: 43098
Project: 43098
Buggy source:
public SimpleMesh create(){
  Element.Builder b=new Element.Builder(mRS);
  int floatCount=mVtxSize;
  if (mVtxSize == 2) {
    b.addFloatXY();
  }
 else {
    b.addFloatXYZ();
  }
  if (mTex) {
    floatCount+=2;
    b.addFloatST();
  }
  if (mNorm) {
    floatCount+=3;
    b.addFloatNorm();
  }
  mElement=b.create();
  Builder smb=new Builder(mRS);
  smb.addVertexType(mElement,mVtxCount / floatCount);
  smb.setIndexType(Element.INDEX_16,mIndexCount);
  smb.setPrimitive(Primitive.TRIANGLE);
  SimpleMesh sm=smb.create();
  Allocation vertexAlloc=sm.createVertexAllocation(0);
  Allocation indexAlloc=sm.createIndexAllocation();
  sm.bindVertexAllocation(vertexAlloc,0);
  sm.bindIndexAllocation(indexAlloc);
  vertexAlloc.data(mVtxData);
  vertexAlloc.uploadToBufferObject();
  indexAlloc.data(mIndexData);
  indexAlloc.uploadToBufferObject();
  return sm;
}

Fixed version (ground truth):
public SimpleMesh create(){
  Element.Builder b=new Element.Builder(mRS);
  int floatCount=mVtxSize;
  if (mVtxSize == 2) {
    b.addFloatXY();
  }
 else {
    b.addFloatXYZ();
  }
  if (mTex) {
    floatCount+=2;
    b.addFloatST();
  }
  if (mNorm) {
    floatCount+=3;
    b.addFloatNorm();
  }
  mElement=b.create();
  Builder smb=new Builder(mRS);
  smb.addVertexType(mElement,mVtxCount / floatCount);
  smb.setIndexType(Element.INDEX_16(mRS),mIndexCount);
  smb.setPrimitive(Primitive.TRIANGLE);
  SimpleMesh sm=smb.create();
  Allocation vertexAlloc=sm.createVertexAllocation(0);
  Allocation indexAlloc=sm.createIndexAllocation();
  sm.bindVertexAllocation(vertexAlloc,0);
  sm.bindIndexAllocation(indexAlloc);
  vertexAlloc.data(mVtxData);
  vertexAlloc.uploadToBufferObject();
  indexAlloc.data(mIndexData);
  indexAlloc.uploadToBufferObject();
  return sm;
}
Program: 43099
Project: 43099
Buggy source:
public void add(Dimension d,int value){
  if (mEntries.length >= mEntryCount) {
    Entry[] en=new Entry[mEntryCount + 8];
    System.arraycopy(mEntries,0,en,0,mEntries.length);
    mEntries=en;
  }
  mEntries[mEntryCount]=new Entry();
  mEntries[mEntryCount].mDim=d;
  mEntries[mEntryCount].mValue=value;
  mEntryCount++;
}

Fixed version (ground truth):
public void add(Dimension d,int value){
  if (value < 1) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (mEntries.length >= mEntryCount) {
    Entry[] en=new Entry[mEntryCount + 8];
    System.arraycopy(mEntries,0,en,0,mEntries.length);
    mEntries=en;
  }
  mEntries[mEntryCount]=new Entry();
  mEntries[mEntryCount].mDim=d;
  mEntries[mEntryCount].mValue=value;
  mEntryCount++;
}
Program: 43100
Project: 43100
Buggy source:
public Builder(RenderScript rs,Element e){
  mRS=rs;
  mEntries=new Entry[4];
  mElement=e;
}

Fixed version (ground truth):
public Builder(RenderScript rs,Element e){
  if (e.mID == 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  mRS=rs;
  mEntries=new Entry[4];
  mElement=e;
}
Program: 43102
Project: 43102
Buggy source:
private void initState(){
  mBufferState=new int[10];
  mAllocState=Allocation.createSized(mRS,Element.USER_FLOAT,mBufferState.length);
  mBufferState[STATE_LAST_FOCUS]=-1;
  mAllocState.data(mBufferState);
}

Fixed version (ground truth):
private void initState(){
  mBufferState=new int[10];
  mAllocState=Allocation.createSized(mRS,Element.USER_F32(mRS),mBufferState.length);
  mBufferState[STATE_LAST_FOCUS]=-1;
  mAllocState.data(mBufferState);
}