nus-yam/ex-repair huggingface dataset:
Program: 181360
Project: 181360
Buggy source:
private static void showUsage(){
  System.err.println("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
}

Fixed version (ground truth):
private static void showUsage(){
  System.err.println("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
}
Program: 181361
Project: 181361
Buggy source:
private void run(String[] args) throws Exception {
  if (args.length < 1) {
    showUsage();
    return;
  }
  mAm=ActivityManagerNative.getDefault();
  if (mAm == null) {
    System.err.println(NO_SYSTEM_ERROR_CODE);
    throw new AndroidException("String_Node_Str");
  }
  mArgs=args;
  String op=args[0];
  mNextArg=1;
  if (op.equals("String_Node_Str")) {
    runStart();
  }
 else   if (op.equals("String_Node_Str")) {
    runStartService();
  }
 else   if (op.equals("String_Node_Str")) {
    runInstrument();
  }
 else   if (op.equals("String_Node_Str")) {
    sendBroadcast();
  }
 else   if (op.equals("String_Node_Str")) {
    runProfile();
  }
 else {
    throw new IllegalArgumentException("String_Node_Str" + op);
  }
}

Fixed version (ground truth):
void run() throws RemoteException {
  try {
    printMessageForState();
    mAm.setActivityController(this);
    mState=STATE_NORMAL;
    InputStreamReader converter=new InputStreamReader(System.in);
    BufferedReader in=new BufferedReader(converter);
    String line;
    while ((line=in.readLine()) != null) {
      boolean addNewline=true;
      if (line.length() <= 0) {
        addNewline=false;
      }
 else       if ("String_Node_Str".equals(line) || "String_Node_Str".equals(line)) {
        resumeController(RESULT_DEFAULT);
        break;
      }
 else       if (mState == STATE_CRASHED) {
        if ("String_Node_Str".equals(line) || "String_Node_Str".equals(line)) {
          resumeController(RESULT_CRASH_DIALOG);
        }
 else         if ("String_Node_Str".equals(line) || "String_Node_Str".equals(line)) {
          resumeController(RESULT_CRASH_KILL);
        }
 else {
          System.out.println("String_Node_Str" + line);
        }
      }
 else       if (mState == STATE_ANR) {
        if ("String_Node_Str".equals(line) || "String_Node_Str".equals(line)) {
          resumeController(RESULT_ANR_DIALOG);
        }
 else         if ("String_Node_Str".equals(line) || "String_Node_Str".equals(line)) {
          resumeController(RESULT_ANR_KILL);
        }
 else         if ("String_Node_Str".equals(line) || "String_Node_Str".equals(line)) {
          resumeController(RESULT_ANR_WAIT);
        }
 else {
          System.out.println("String_Node_Str" + line);
        }
      }
 else       if (mState == STATE_EARLY_ANR) {
        if ("String_Node_Str".equals(line) || "String_Node_Str".equals(line)) {
          resumeController(RESULT_EARLY_ANR_CONTINUE);
        }
 else         if ("String_Node_Str".equals(line) || "String_Node_Str".equals(line)) {
          resumeController(RESULT_EARLY_ANR_KILL);
        }
 else {
          System.out.println("String_Node_Str" + line);
        }
      }
 else {
        System.out.println("String_Node_Str" + line);
      }
synchronized (this) {
        if (addNewline) {
          System.out.println("String_Node_Str");
        }
        printMessageForState();
      }
    }
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
 finally {
    mAm.setActivityController(null);
  }
}
Program: 181363
Project: 181363
Buggy source:
private final void queueOrSendMessage(int what,Object obj,int arg1,int arg2){
synchronized (this) {
    if (localLOGV)     Slog.v(TAG,"String_Node_Str" + what + "String_Node_Str"+ mH.codeToString(what)+ "String_Node_Str"+ arg1+ "String_Node_Str"+ obj);
    Message msg=Message.obtain();
    msg.what=what;
    msg.obj=obj;
    msg.arg1=arg1;
    msg.arg2=arg2;
    mH.sendMessage(msg);
  }
}

Fixed version (ground truth):
private final void queueOrSendMessage(int what,Object obj,int arg1,int arg2){
synchronized (this) {
    if (DEBUG_MESSAGES)     Slog.v(TAG,"String_Node_Str" + what + "String_Node_Str"+ mH.codeToString(what)+ "String_Node_Str"+ arg1+ "String_Node_Str"+ obj);
    Message msg=Message.obtain();
    msg.what=what;
    msg.obj=obj;
    msg.arg1=arg1;
    msg.arg2=arg2;
    mH.sendMessage(msg);
  }
}
Program: 181364
Project: 181364
Buggy source:
public static final void main(String[] args){
  SamplingProfilerIntegration.start();
  Process.setArgV0("String_Node_Str");
  Looper.prepareMainLooper();
  if (sMainThreadHandler == null) {
    sMainThreadHandler=new Handler();
  }
  ActivityThread thread=new ActivityThread();
  thread.attach(false);
  Looper.loop();
  if (Process.supportsProcesses()) {
    throw new RuntimeException("String_Node_Str");
  }
  thread.detach();
  String name=(thread.mInitialApplication != null) ? thread.mInitialApplication.getPackageName() : "String_Node_Str";
  Slog.i(TAG,"String_Node_Str" + name + "String_Node_Str");
}

Fixed version (ground truth):
public static final void main(String[] args){
  SamplingProfilerIntegration.start();
  Process.setArgV0("String_Node_Str");
  Looper.prepareMainLooper();
  if (sMainThreadHandler == null) {
    sMainThreadHandler=new Handler();
  }
  ActivityThread thread=new ActivityThread();
  thread.attach(false);
  if (false) {
    Looper.myLooper().setMessageLogging(new LogPrinter(Log.DEBUG,"String_Node_Str"));
  }
  Looper.loop();
  if (Process.supportsProcesses()) {
    throw new RuntimeException("String_Node_Str");
  }
  thread.detach();
  String name=(thread.mInitialApplication != null) ? thread.mInitialApplication.getPackageName() : "String_Node_Str";
  Slog.i(TAG,"String_Node_Str" + name + "String_Node_Str");
}
Program: 181366
Project: 181366
Buggy source:
/** 
 * Enable or disable the visualization engine.
 * @param enabled requested enable state
 * @return {@link #SUCCESS} in case of success,{@link #ERROR_INVALID_OPERATION} or {@link #ERROR_DEAD_OBJECT} in case of failure.
 * @throws IllegalStateException
 */
public int setEnabled(boolean enabled) throws IllegalStateException {
synchronized (mStateLock) {
    if ((enabled && mState != STATE_INITIALIZED) || (!enabled && mState != STATE_ENABLED)) {
      throw (new IllegalStateException("String_Node_Str" + mState));
    }
    int status=native_setEnabled(enabled);
    if (status == SUCCESS) {
      mState=enabled ? STATE_ENABLED : STATE_INITIALIZED;
    }
    return status;
  }
}

Fixed version (ground truth):
/** 
 * Enable or disable the visualization engine.
 * @param enabled requested enable state
 * @return {@link #SUCCESS} in case of success,{@link #ERROR_INVALID_OPERATION} or {@link #ERROR_DEAD_OBJECT} in case of failure.
 * @throws IllegalStateException
 */
public int setEnabled(boolean enabled) throws IllegalStateException {
synchronized (mStateLock) {
    if (mState == STATE_UNINITIALIZED) {
      throw (new IllegalStateException("String_Node_Str" + mState));
    }
    int status=SUCCESS;
    if ((enabled && (mState == STATE_INITIALIZED)) || (!enabled && (mState == STATE_ENABLED))) {
      status=native_setEnabled(enabled);
      if (status == SUCCESS) {
        mState=enabled ? STATE_ENABLED : STATE_INITIALIZED;
      }
    }
    return status;
  }
}
Program: 181367
Project: 181367
Buggy source:
/** 
 * It's difficult to discern from the spec when impl.create() should be called, but it seems like a reasonable rule is "as soon as possible, but not in a context where IOException cannot be thrown"
 * @throws IOException from SocketImpl.create()
 */
private void implCreateIfNeeded() throws IOException {
  if (!implCreated) {
synchronized (this) {
      if (!implCreated) {
        implCreated=true;
        impl.create(true);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * It's difficult to discern from the spec when impl.create() should be called, but it seems like a reasonable rule is "as soon as possible, but not in a context where IOException cannot be thrown"
 * @throws IOException from SocketImpl.create()
 */
private void implCreateIfNeeded() throws IOException {
  if (!implCreated) {
synchronized (this) {
      if (!implCreated) {
        try {
          impl.create(true);
        }
  finally {
          implCreated=true;
        }
      }
    }
  }
}
Program: 181368
Project: 181368
Buggy source:
/** 
 * Enable or disable the visualization engine.
 * @param enabled requested enable state
 * @return {@link #SUCCESS} in case of success,{@link #ERROR_INVALID_OPERATION} or {@link #ERROR_DEAD_OBJECT} in case of failure.
 * @throws IllegalStateException
 */
public int setEnabled(boolean enabled) throws IllegalStateException {
synchronized (mStateLock) {
    if ((enabled && mState != STATE_INITIALIZED) || (!enabled && mState != STATE_ENABLED)) {
      throw (new IllegalStateException("String_Node_Str" + mState));
    }
    int status=native_setEnabled(enabled);
    if (status == SUCCESS) {
      mState=enabled ? STATE_ENABLED : STATE_INITIALIZED;
    }
    return status;
  }
}

Fixed version (ground truth):
/** 
 * Enable or disable the visualization engine.
 * @param enabled requested enable state
 * @return {@link #SUCCESS} in case of success,{@link #ERROR_INVALID_OPERATION} or {@link #ERROR_DEAD_OBJECT} in case of failure.
 * @throws IllegalStateException
 */
public int setEnabled(boolean enabled) throws IllegalStateException {
synchronized (mStateLock) {
    if (mState == STATE_UNINITIALIZED) {
      throw (new IllegalStateException("String_Node_Str" + mState));
    }
    int status=SUCCESS;
    if ((enabled && (mState == STATE_INITIALIZED)) || (!enabled && (mState == STATE_ENABLED))) {
      status=native_setEnabled(enabled);
      if (status == SUCCESS) {
        mState=enabled ? STATE_ENABLED : STATE_INITIALIZED;
      }
    }
    return status;
  }
}
Program: 181369
Project: 181369
Buggy source:
/** 
 * It's difficult to discern from the spec when impl.create() should be called, but it seems like a reasonable rule is "as soon as possible, but not in a context where IOException cannot be thrown"
 * @throws IOException from SocketImpl.create()
 */
private void implCreateIfNeeded() throws IOException {
  if (!implCreated) {
synchronized (this) {
      if (!implCreated) {
        implCreated=true;
        impl.create(true);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * It's difficult to discern from the spec when impl.create() should be called, but it seems like a reasonable rule is "as soon as possible, but not in a context where IOException cannot be thrown"
 * @throws IOException from SocketImpl.create()
 */
private void implCreateIfNeeded() throws IOException {
  if (!implCreated) {
synchronized (this) {
      if (!implCreated) {
        try {
          impl.create(true);
        }
  finally {
          implCreated=true;
        }
      }
    }
  }
}
Program: 181370
Project: 181370
Buggy source:
private void updateConnectivity(Intent intent){
  NetworkInfo info=(NetworkInfo)(intent.getParcelableExtra(ConnectivityManager.EXTRA_NETWORK_INFO));
  int connectionStatus=intent.getIntExtra(ConnectivityManager.EXTRA_INET_CONDITION,0);
  Slog.d(TAG,"String_Node_Str" + info + "String_Node_Str"+ connectionStatus);
  if (info.isConnected() == false)   return;
switch (info.getType()) {
case ConnectivityManager.TYPE_MOBILE:
    if (info.isConnected()) {
      updateDataNetType(info.getSubtype(),connectionStatus);
      updateDataIcon();
      updateSignalStrength();
    }
  break;
case ConnectivityManager.TYPE_WIFI:
if (info.isConnected()) {
  mIsWifiConnected=true;
  mInetCondition=(connectionStatus > INET_CONDITION_THRESHOLD ? 1 : 0);
  int iconId;
  if (mLastWifiSignalLevel == -1) {
    iconId=sWifiSignalImages[mInetCondition][0];
  }
 else {
    iconId=sWifiSignalImages[mInetCondition][mLastWifiSignalLevel];
  }
  mService.setIcon("String_Node_Str",iconId,0);
  mService.setIconVisibility("String_Node_Str",true);
}
 else {
  mLastWifiSignalLevel=-1;
  mIsWifiConnected=false;
  mInetCondition=0;
  int iconId=sWifiSignalImages[0][0];
  mService.setIcon("String_Node_Str",iconId,0);
  mService.setIconVisibility("String_Node_Str",false);
}
updateSignalStrength();
break;
}
}

Fixed version (ground truth):
private void updateConnectivity(Intent intent){
  NetworkInfo info=(NetworkInfo)(intent.getParcelableExtra(ConnectivityManager.EXTRA_NETWORK_INFO));
  int connectionStatus=intent.getIntExtra(ConnectivityManager.EXTRA_INET_CONDITION,0);
  Slog.d(TAG,"String_Node_Str" + info + "String_Node_Str"+ connectionStatus);
  int inetCondition=(connectionStatus > INET_CONDITION_THRESHOLD ? 1 : 0);
switch (info.getType()) {
case ConnectivityManager.TYPE_MOBILE:
    mInetCondition=inetCondition;
  updateDataNetType(info.getSubtype());
updateDataIcon();
updateSignalStrength();
break;
case ConnectivityManager.TYPE_WIFI:
mInetCondition=inetCondition;
if (info.isConnected()) {
mIsWifiConnected=true;
int iconId;
if (mLastWifiSignalLevel == -1) {
iconId=sWifiSignalImages[mInetCondition][0];
}
 else {
iconId=sWifiSignalImages[mInetCondition][mLastWifiSignalLevel];
}
mService.setIcon("String_Node_Str",iconId,0);
mService.setIconVisibility("String_Node_Str",true);
}
 else {
mLastWifiSignalLevel=-1;
mIsWifiConnected=false;
int iconId=sWifiSignalImages[0][0];
mService.setIcon("String_Node_Str",iconId,0);
mService.setIconVisibility("String_Node_Str",false);
}
updateSignalStrength();
break;
}
}
Program: 181371
Project: 181371
Buggy source:
@Override public void onDataConnectionStateChanged(int state,int networkType){
  mDataState=state;
  updateDataNetType(networkType,0);
  updateDataIcon();
  updateSignalStrength();
}

Fixed version (ground truth):
@Override public void onDataConnectionStateChanged(int state,int networkType){
  mDataState=state;
  updateDataNetType(networkType);
  updateDataIcon();
}
Program: 181372
Project: 181372
Buggy source:
private final void updateDataNetType(int net,int inetCondition){
  mInetCondition=(inetCondition > INET_CONDITION_THRESHOLD ? 1 : 0);
switch (net) {
case TelephonyManager.NETWORK_TYPE_EDGE:
    mDataIconList=sDataNetType_e[mInetCondition];
  break;
case TelephonyManager.NETWORK_TYPE_UMTS:
mDataIconList=sDataNetType_3g[mInetCondition];
break;
case TelephonyManager.NETWORK_TYPE_HSDPA:
case TelephonyManager.NETWORK_TYPE_HSUPA:
case TelephonyManager.NETWORK_TYPE_HSPA:
if (mHspaDataDistinguishable) {
mDataIconList=sDataNetType_h[mInetCondition];
}
 else {
mDataIconList=sDataNetType_3g[mInetCondition];
}
break;
case TelephonyManager.NETWORK_TYPE_CDMA:
mDataIconList=sDataNetType_1x[mInetCondition];
break;
case TelephonyManager.NETWORK_TYPE_1xRTT:
mDataIconList=sDataNetType_1x[mInetCondition];
break;
case TelephonyManager.NETWORK_TYPE_EVDO_0:
case TelephonyManager.NETWORK_TYPE_EVDO_A:
case TelephonyManager.NETWORK_TYPE_EVDO_B:
mDataIconList=sDataNetType_3g[mInetCondition];
break;
default :
mDataIconList=sDataNetType_g[mInetCondition];
break;
}
}

Fixed version (ground truth):
private final void updateDataNetType(int net){
switch (net) {
case TelephonyManager.NETWORK_TYPE_EDGE:
    mDataIconList=sDataNetType_e[mInetCondition];
  break;
case TelephonyManager.NETWORK_TYPE_UMTS:
mDataIconList=sDataNetType_3g[mInetCondition];
break;
case TelephonyManager.NETWORK_TYPE_HSDPA:
case TelephonyManager.NETWORK_TYPE_HSUPA:
case TelephonyManager.NETWORK_TYPE_HSPA:
if (mHspaDataDistinguishable) {
mDataIconList=sDataNetType_h[mInetCondition];
}
 else {
mDataIconList=sDataNetType_3g[mInetCondition];
}
break;
case TelephonyManager.NETWORK_TYPE_CDMA:
mDataIconList=sDataNetType_1x[mInetCondition];
break;
case TelephonyManager.NETWORK_TYPE_1xRTT:
mDataIconList=sDataNetType_1x[mInetCondition];
break;
case TelephonyManager.NETWORK_TYPE_EVDO_0:
case TelephonyManager.NETWORK_TYPE_EVDO_A:
case TelephonyManager.NETWORK_TYPE_EVDO_B:
mDataIconList=sDataNetType_3g[mInetCondition];
break;
default :
mDataIconList=sDataNetType_g[mInetCondition];
break;
}
}
Program: 181377
Project: 181377
Buggy source:
private void updateConnectivity(Intent intent){
  NetworkInfo info=(NetworkInfo)(intent.getParcelableExtra(ConnectivityManager.EXTRA_NETWORK_INFO));
  int connectionStatus=intent.getIntExtra(ConnectivityManager.EXTRA_INET_CONDITION,0);
  Slog.d(TAG,"String_Node_Str" + info + "String_Node_Str"+ connectionStatus);
  if (info.isConnected() == false)   return;
switch (info.getType()) {
case ConnectivityManager.TYPE_MOBILE:
    if (info.isConnected()) {
      updateDataNetType(info.getSubtype(),connectionStatus);
      updateDataIcon();
      updateSignalStrength();
    }
  break;
case ConnectivityManager.TYPE_WIFI:
if (info.isConnected()) {
  mIsWifiConnected=true;
  mInetCondition=(connectionStatus > INET_CONDITION_THRESHOLD ? 1 : 0);
  int iconId;
  if (mLastWifiSignalLevel == -1) {
    iconId=sWifiSignalImages[mInetCondition][0];
  }
 else {
    iconId=sWifiSignalImages[mInetCondition][mLastWifiSignalLevel];
  }
  mService.setIcon("String_Node_Str",iconId,0);
  mService.setIconVisibility("String_Node_Str",true);
}
 else {
  mLastWifiSignalLevel=-1;
  mIsWifiConnected=false;
  mInetCondition=0;
  int iconId=sWifiSignalImages[0][0];
  mService.setIcon("String_Node_Str",iconId,0);
  mService.setIconVisibility("String_Node_Str",false);
}
updateSignalStrength();
break;
}
}

Fixed version (ground truth):
private void updateConnectivity(Intent intent){
  NetworkInfo info=(NetworkInfo)(intent.getParcelableExtra(ConnectivityManager.EXTRA_NETWORK_INFO));
  int connectionStatus=intent.getIntExtra(ConnectivityManager.EXTRA_INET_CONDITION,0);
  Slog.d(TAG,"String_Node_Str" + info + "String_Node_Str"+ connectionStatus);
  int inetCondition=(connectionStatus > INET_CONDITION_THRESHOLD ? 1 : 0);
switch (info.getType()) {
case ConnectivityManager.TYPE_MOBILE:
    mInetCondition=inetCondition;
  updateDataNetType(info.getSubtype());
updateDataIcon();
updateSignalStrength();
break;
case ConnectivityManager.TYPE_WIFI:
mInetCondition=inetCondition;
if (info.isConnected()) {
mIsWifiConnected=true;
int iconId;
if (mLastWifiSignalLevel == -1) {
iconId=sWifiSignalImages[mInetCondition][0];
}
 else {
iconId=sWifiSignalImages[mInetCondition][mLastWifiSignalLevel];
}
mService.setIcon("String_Node_Str",iconId,0);
mService.setIconVisibility("String_Node_Str",true);
}
 else {
mLastWifiSignalLevel=-1;
mIsWifiConnected=false;
int iconId=sWifiSignalImages[0][0];
mService.setIcon("String_Node_Str",iconId,0);
mService.setIconVisibility("String_Node_Str",false);
}
updateSignalStrength();
break;
}
}
Program: 181378
Project: 181378
Buggy source:
@Override public void onDataConnectionStateChanged(int state,int networkType){
  mDataState=state;
  updateDataNetType(networkType,0);
  updateDataIcon();
  updateSignalStrength();
}

Fixed version (ground truth):
@Override public void onDataConnectionStateChanged(int state,int networkType){
  mDataState=state;
  updateDataNetType(networkType);
  updateDataIcon();
}
Program: 181379
Project: 181379
Buggy source:
private final void updateDataNetType(int net,int inetCondition){
  mInetCondition=(inetCondition > INET_CONDITION_THRESHOLD ? 1 : 0);
switch (net) {
case TelephonyManager.NETWORK_TYPE_EDGE:
    mDataIconList=sDataNetType_e[mInetCondition];
  break;
case TelephonyManager.NETWORK_TYPE_UMTS:
mDataIconList=sDataNetType_3g[mInetCondition];
break;
case TelephonyManager.NETWORK_TYPE_HSDPA:
case TelephonyManager.NETWORK_TYPE_HSUPA:
case TelephonyManager.NETWORK_TYPE_HSPA:
if (mHspaDataDistinguishable) {
mDataIconList=sDataNetType_h[mInetCondition];
}
 else {
mDataIconList=sDataNetType_3g[mInetCondition];
}
break;
case TelephonyManager.NETWORK_TYPE_CDMA:
mDataIconList=sDataNetType_1x[mInetCondition];
break;
case TelephonyManager.NETWORK_TYPE_1xRTT:
mDataIconList=sDataNetType_1x[mInetCondition];
break;
case TelephonyManager.NETWORK_TYPE_EVDO_0:
case TelephonyManager.NETWORK_TYPE_EVDO_A:
case TelephonyManager.NETWORK_TYPE_EVDO_B:
mDataIconList=sDataNetType_3g[mInetCondition];
break;
default :
mDataIconList=sDataNetType_g[mInetCondition];
break;
}
}

Fixed version (ground truth):
private final void updateDataNetType(int net){
switch (net) {
case TelephonyManager.NETWORK_TYPE_EDGE:
    mDataIconList=sDataNetType_e[mInetCondition];
  break;
case TelephonyManager.NETWORK_TYPE_UMTS:
mDataIconList=sDataNetType_3g[mInetCondition];
break;
case TelephonyManager.NETWORK_TYPE_HSDPA:
case TelephonyManager.NETWORK_TYPE_HSUPA:
case TelephonyManager.NETWORK_TYPE_HSPA:
if (mHspaDataDistinguishable) {
mDataIconList=sDataNetType_h[mInetCondition];
}
 else {
mDataIconList=sDataNetType_3g[mInetCondition];
}
break;
case TelephonyManager.NETWORK_TYPE_CDMA:
mDataIconList=sDataNetType_1x[mInetCondition];
break;
case TelephonyManager.NETWORK_TYPE_1xRTT:
mDataIconList=sDataNetType_1x[mInetCondition];
break;
case TelephonyManager.NETWORK_TYPE_EVDO_0:
case TelephonyManager.NETWORK_TYPE_EVDO_A:
case TelephonyManager.NETWORK_TYPE_EVDO_B:
mDataIconList=sDataNetType_3g[mInetCondition];
break;
default :
mDataIconList=sDataNetType_g[mInetCondition];
break;
}
}
Program: 181382
Project: 181382
Buggy source:
/** 
 * @hide
 */
@Override public void onDrawOverlay(Canvas canvas){
  if ((mGroupFlags & FLAG_CHILD_HAS_OVERLAY) == FLAG_CHILD_HAS_OVERLAY) {
    final int childCount=getChildCount();
    for (int i=0; i < childCount; i++) {
      final View child=getChildAt(i);
      if (child.isOverlayEnabled()) {
        canvas.translate(child.mLeft + child.mScrollX,child.mTop + child.mScrollY);
        child.onDrawOverlay(canvas);
        canvas.translate(-(child.mLeft + child.mScrollX),-(child.mTop + child.mScrollY));
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * @hide
 */
@Override public void onDrawOverlay(Canvas canvas){
  if ((mGroupFlags & FLAG_CHILD_HAS_OVERLAY) == FLAG_CHILD_HAS_OVERLAY) {
    final int childCount=getChildCount();
    for (int i=0; i < childCount; i++) {
      final View child=getChildAt(i);
      if (child.isOverlayEnabled()) {
        canvas.translate(child.mLeft - child.mScrollX,child.mTop - child.mScrollY);
        child.onDrawOverlay(canvas);
        canvas.translate(-(child.mLeft - child.mScrollX),-(child.mTop - child.mScrollY));
      }
    }
  }
}
Program: 181383
Project: 181383
Buggy source:
void positionAtCursor(final int offset,boolean bottom){
  final int drawableWidth=mDrawable.getIntrinsicWidth();
  final int drawableHeight=mDrawable.getIntrinsicHeight();
  final int line=mLayout.getLineForOffset(offset);
  final int lineTop=mLayout.getLineTop(line);
  final int lineBottom=mLayout.getLineBottom(line);
  mHotSpotVerticalPosition=lineTop;
  final Rect bounds=sCursorControllerTempRect;
  bounds.left=(int)(mLayout.getPrimaryHorizontal(offset) - drawableWidth / 2.0) + mScrollX;
  bounds.top=(bottom ? lineBottom : lineTop) + mScrollY;
  mTopExtension=bottom ? 0 : drawableHeight / 2;
  mBottomExtension=0;
  if (line == mLayout.getLineCount() - 1) {
    mTopExtension=(lineBottom - lineTop) - drawableHeight / 2;
  }
  bounds.right=bounds.left + drawableWidth;
  bounds.bottom=bounds.top + drawableHeight;
  convertFromViewportToContentCoordinates(bounds);
  mDrawable.setBounds(bounds);
  postInvalidate();
}

Fixed version (ground truth):
void positionAtCursor(final int offset,boolean bottom){
  final int drawableWidth=mDrawable.getIntrinsicWidth();
  final int drawableHeight=mDrawable.getIntrinsicHeight();
  final int line=mLayout.getLineForOffset(offset);
  final int lineTop=mLayout.getLineTop(line);
  final int lineBottom=mLayout.getLineBottom(line);
  mHotSpotVerticalPosition=lineTop;
  final Rect bounds=sCursorControllerTempRect;
  bounds.left=(int)(mLayout.getPrimaryHorizontal(offset) - drawableWidth / 2.0) + mScrollX;
  bounds.top=(bottom ? lineBottom : lineTop) + mScrollY;
  mTopExtension=bottom ? 0 : drawableHeight / 2;
  mBottomExtension=0;
  if (line == mLayout.getLineCount() - 1) {
    mTopExtension=(lineBottom - lineTop) - drawableHeight / 2;
  }
  bounds.right=bounds.left + drawableWidth;
  bounds.bottom=bounds.top + drawableHeight;
  convertFromViewportToContentCoordinates(bounds);
  invalidate();
  mDrawable.setBounds(bounds);
  invalidate();
}
Program: 181384
Project: 181384
Buggy source:
/** 
 * @hide
 */
@Override public void onDrawOverlay(Canvas canvas){
  if ((mGroupFlags & FLAG_CHILD_HAS_OVERLAY) == FLAG_CHILD_HAS_OVERLAY) {
    final int childCount=getChildCount();
    for (int i=0; i < childCount; i++) {
      final View child=getChildAt(i);
      if (child.isOverlayEnabled()) {
        canvas.translate(child.mLeft + child.mScrollX,child.mTop + child.mScrollY);
        child.onDrawOverlay(canvas);
        canvas.translate(-(child.mLeft + child.mScrollX),-(child.mTop + child.mScrollY));
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * @hide
 */
@Override public void onDrawOverlay(Canvas canvas){
  if ((mGroupFlags & FLAG_CHILD_HAS_OVERLAY) == FLAG_CHILD_HAS_OVERLAY) {
    final int childCount=getChildCount();
    for (int i=0; i < childCount; i++) {
      final View child=getChildAt(i);
      if (child.isOverlayEnabled()) {
        canvas.translate(child.mLeft - child.mScrollX,child.mTop - child.mScrollY);
        child.onDrawOverlay(canvas);
        canvas.translate(-(child.mLeft - child.mScrollX),-(child.mTop - child.mScrollY));
      }
    }
  }
}
Program: 181385
Project: 181385
Buggy source:
void positionAtCursor(final int offset,boolean bottom){
  final int drawableWidth=mDrawable.getIntrinsicWidth();
  final int drawableHeight=mDrawable.getIntrinsicHeight();
  final int line=mLayout.getLineForOffset(offset);
  final int lineTop=mLayout.getLineTop(line);
  final int lineBottom=mLayout.getLineBottom(line);
  mHotSpotVerticalPosition=lineTop;
  final Rect bounds=sCursorControllerTempRect;
  bounds.left=(int)(mLayout.getPrimaryHorizontal(offset) - drawableWidth / 2.0) + mScrollX;
  bounds.top=(bottom ? lineBottom : lineTop) + mScrollY;
  mTopExtension=bottom ? 0 : drawableHeight / 2;
  mBottomExtension=0;
  if (line == mLayout.getLineCount() - 1) {
    mTopExtension=(lineBottom - lineTop) - drawableHeight / 2;
  }
  bounds.right=bounds.left + drawableWidth;
  bounds.bottom=bounds.top + drawableHeight;
  convertFromViewportToContentCoordinates(bounds);
  mDrawable.setBounds(bounds);
  postInvalidate();
}

Fixed version (ground truth):
void positionAtCursor(final int offset,boolean bottom){
  final int drawableWidth=mDrawable.getIntrinsicWidth();
  final int drawableHeight=mDrawable.getIntrinsicHeight();
  final int line=mLayout.getLineForOffset(offset);
  final int lineTop=mLayout.getLineTop(line);
  final int lineBottom=mLayout.getLineBottom(line);
  mHotSpotVerticalPosition=lineTop;
  final Rect bounds=sCursorControllerTempRect;
  bounds.left=(int)(mLayout.getPrimaryHorizontal(offset) - drawableWidth / 2.0) + mScrollX;
  bounds.top=(bottom ? lineBottom : lineTop) + mScrollY;
  mTopExtension=bottom ? 0 : drawableHeight / 2;
  mBottomExtension=0;
  if (line == mLayout.getLineCount() - 1) {
    mTopExtension=(lineBottom - lineTop) - drawableHeight / 2;
  }
  bounds.right=bounds.left + drawableWidth;
  bounds.bottom=bounds.top + drawableHeight;
  convertFromViewportToContentCoordinates(bounds);
  invalidate();
  mDrawable.setBounds(bounds);
  invalidate();
}
Program: 181386
Project: 181386
Buggy source:
@Override public void hangup() throws CallStateException {
synchronized (SipPhone.class) {
    Log.v(LOG_TAG,"String_Node_Str" + mPeer.getUriString() + "String_Node_Str"+ "String_Node_Str"+ getPhone().getPhoneName());
    try {
      mSipAudioCall.endCall();
      setState(Call.State.DISCONNECTING);
      setDisconnectCause(DisconnectCause.LOCAL);
    }
 catch (    SipException e) {
      throw new CallStateException("String_Node_Str" + e);
    }
  }
}

Fixed version (ground truth):
@Override public void hangup() throws CallStateException {
synchronized (SipPhone.class) {
    Log.v(LOG_TAG,"String_Node_Str" + mPeer.getUriString() + "String_Node_Str"+ "String_Node_Str"+ getPhone().getPhoneName());
    try {
      if (mSipAudioCall != null)       mSipAudioCall.endCall();
      setState(Call.State.DISCONNECTING);
      setDisconnectCause(DisconnectCause.LOCAL);
    }
 catch (    SipException e) {
      throw new CallStateException("String_Node_Str" + e);
    }
  }
}
Program: 181387
Project: 181387
Buggy source:
void noteStopWakeLocked(WakeLock wl,WorkSource ws){
  try {
    if (ws != null) {
      mBatteryStats.noteStopWakelockFromSource(ws,wl.pid,wl.tag,wl.monitorType);
    }
 else {
      mBatteryStats.noteStopWakelock(wl.uid,wl.pid,wl.tag,wl.monitorType);
    }
  }
 catch (  RemoteException e) {
  }
}

Fixed version (ground truth):
void noteStopWakeLocked(WakeLock wl,WorkSource ws){
  if (wl.monitorType >= 0) {
    long origId=Binder.clearCallingIdentity();
    try {
      if (ws != null) {
        mBatteryStats.noteStopWakelockFromSource(ws,wl.pid,wl.tag,wl.monitorType);
      }
 else {
        mBatteryStats.noteStopWakelock(wl.uid,wl.pid,wl.tag,wl.monitorType);
      }
    }
 catch (    RemoteException e) {
    }
 finally {
      Binder.restoreCallingIdentity(origId);
    }
  }
}
Program: 181388
Project: 181388
Buggy source:
public void updateWakeLockWorkSource(IBinder lock,WorkSource ws){
  int uid=Binder.getCallingUid();
  int pid=Binder.getCallingPid();
  if (ws != null && ws.size() == 0) {
    ws=null;
  }
  if (ws != null) {
    enforceWakeSourcePermission(uid,pid);
  }
  long ident=Binder.clearCallingIdentity();
  try {
synchronized (mLocks) {
      int index=mLocks.getIndex(lock);
      if (index < 0) {
        throw new IllegalArgumentException("String_Node_Str");
      }
      WakeLock wl=mLocks.get(index);
      WorkSource oldsource=wl.ws;
      wl.ws=ws != null ? new WorkSource(ws) : null;
      noteStopWakeLocked(wl,oldsource);
      noteStartWakeLocked(wl,ws);
    }
  }
  finally {
    Binder.restoreCallingIdentity(ident);
  }
}

Fixed version (ground truth):
public void updateWakeLockWorkSource(IBinder lock,WorkSource ws){
  int uid=Binder.getCallingUid();
  int pid=Binder.getCallingPid();
  if (ws != null && ws.size() == 0) {
    ws=null;
  }
  if (ws != null) {
    enforceWakeSourcePermission(uid,pid);
  }
synchronized (mLocks) {
    int index=mLocks.getIndex(lock);
    if (index < 0) {
      throw new IllegalArgumentException("String_Node_Str");
    }
    WakeLock wl=mLocks.get(index);
    WorkSource oldsource=wl.ws;
    wl.ws=ws != null ? new WorkSource(ws) : null;
    noteStopWakeLocked(wl,oldsource);
    noteStartWakeLocked(wl,ws);
  }
}
Program: 181389
Project: 181389
Buggy source:
void noteStartWakeLocked(WakeLock wl,WorkSource ws){
  try {
    if (ws != null) {
      mBatteryStats.noteStartWakelockFromSource(ws,wl.pid,wl.tag,wl.monitorType);
    }
 else {
      mBatteryStats.noteStartWakelock(wl.uid,wl.pid,wl.tag,wl.monitorType);
    }
  }
 catch (  RemoteException e) {
  }
}

Fixed version (ground truth):
void noteStartWakeLocked(WakeLock wl,WorkSource ws){
  if (wl.monitorType >= 0) {
    long origId=Binder.clearCallingIdentity();
    try {
      if (ws != null) {
        mBatteryStats.noteStartWakelockFromSource(ws,wl.pid,wl.tag,wl.monitorType);
      }
 else {
        mBatteryStats.noteStartWakelock(wl.uid,wl.pid,wl.tag,wl.monitorType);
      }
    }
 catch (    RemoteException e) {
    }
 finally {
      Binder.restoreCallingIdentity(origId);
    }
  }
}
Program: 181390
Project: 181390
Buggy source:
private void releaseWakeLockLocked(IBinder lock,int flags,boolean death){
  WakeLock wl=mLocks.removeLock(lock);
  if (wl == null) {
    return;
  }
  if (mSpew) {
    Slog.d(TAG,"String_Node_Str" + Integer.toHexString(wl.flags) + "String_Node_Str"+ wl.tag);
  }
  if (isScreenLock(wl.flags)) {
    mWakeLockState=mLocks.gatherState();
    if ((wl.flags & PowerManager.ON_AFTER_RELEASE) != 0) {
      userActivity(SystemClock.uptimeMillis(),false);
    }
    setPowerState(mWakeLockState | mUserState);
  }
 else   if ((wl.flags & LOCK_MASK) == PowerManager.PARTIAL_WAKE_LOCK) {
    mPartialCount--;
    if (mPartialCount == 0) {
      if (LOG_PARTIAL_WL)       EventLog.writeEvent(EventLogTags.POWER_PARTIAL_WAKE_STATE,0,wl.tag);
      Power.releaseWakeLock(PARTIAL_NAME);
    }
  }
 else   if ((wl.flags & LOCK_MASK) == PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK) {
    mProximityWakeLockCount--;
    if (mProximityWakeLockCount == 0) {
      if (mProximitySensorActive && ((flags & PowerManager.WAIT_FOR_PROXIMITY_NEGATIVE) != 0)) {
        if (mDebugProximitySensor) {
          Slog.d(TAG,"String_Node_Str");
        }
      }
 else {
        disableProximityLockLocked();
      }
    }
  }
  wl.binder.unlinkToDeath(wl,0);
  if (wl.monitorType >= 0) {
    long origId=Binder.clearCallingIdentity();
    try {
      noteStopWakeLocked(wl,wl.ws);
    }
  finally {
      Binder.restoreCallingIdentity(origId);
    }
  }
}

Fixed version (ground truth):
private void releaseWakeLockLocked(IBinder lock,int flags,boolean death){
  WakeLock wl=mLocks.removeLock(lock);
  if (wl == null) {
    return;
  }
  if (mSpew) {
    Slog.d(TAG,"String_Node_Str" + Integer.toHexString(wl.flags) + "String_Node_Str"+ wl.tag);
  }
  if (isScreenLock(wl.flags)) {
    mWakeLockState=mLocks.gatherState();
    if ((wl.flags & PowerManager.ON_AFTER_RELEASE) != 0) {
      userActivity(SystemClock.uptimeMillis(),false);
    }
    setPowerState(mWakeLockState | mUserState);
  }
 else   if ((wl.flags & LOCK_MASK) == PowerManager.PARTIAL_WAKE_LOCK) {
    mPartialCount--;
    if (mPartialCount == 0) {
      if (LOG_PARTIAL_WL)       EventLog.writeEvent(EventLogTags.POWER_PARTIAL_WAKE_STATE,0,wl.tag);
      Power.releaseWakeLock(PARTIAL_NAME);
    }
  }
 else   if ((wl.flags & LOCK_MASK) == PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK) {
    mProximityWakeLockCount--;
    if (mProximityWakeLockCount == 0) {
      if (mProximitySensorActive && ((flags & PowerManager.WAIT_FOR_PROXIMITY_NEGATIVE) != 0)) {
        if (mDebugProximitySensor) {
          Slog.d(TAG,"String_Node_Str");
        }
      }
 else {
        disableProximityLockLocked();
      }
    }
  }
  wl.binder.unlinkToDeath(wl,0);
  noteStopWakeLocked(wl,wl.ws);
}
Program: 181391
Project: 181391
Buggy source:
void clearModes(int modeFlags){
  if ((modeFlags & Intent.FLAG_GRANT_READ_URI_PERMISSION) != 0) {
    globalModeFlags&=~Intent.FLAG_GRANT_READ_URI_PERMISSION;
    modeFlags&=~Intent.FLAG_GRANT_READ_URI_PERMISSION;
    if (readOwners.size() > 0) {
      for (      UriPermissionOwner r : readOwners) {
        r.removeReadPermission(this);
      }
      readOwners.clear();
    }
  }
  if ((modeFlags & Intent.FLAG_GRANT_WRITE_URI_PERMISSION) != 0) {
    globalModeFlags&=~Intent.FLAG_GRANT_WRITE_URI_PERMISSION;
    modeFlags&=~Intent.FLAG_GRANT_WRITE_URI_PERMISSION;
    if (readOwners.size() > 0) {
      for (      UriPermissionOwner r : writeOwners) {
        r.removeWritePermission(this);
      }
      readOwners.clear();
    }
  }
}

Fixed version (ground truth):
void clearModes(int modeFlagsToClear){
  if ((modeFlagsToClear & Intent.FLAG_GRANT_READ_URI_PERMISSION) != 0) {
    globalModeFlags&=~Intent.FLAG_GRANT_READ_URI_PERMISSION;
    modeFlags&=~Intent.FLAG_GRANT_READ_URI_PERMISSION;
    if (readOwners.size() > 0) {
      for (      UriPermissionOwner r : readOwners) {
        r.removeReadPermission(this);
      }
      readOwners.clear();
    }
  }
  if ((modeFlagsToClear & Intent.FLAG_GRANT_WRITE_URI_PERMISSION) != 0) {
    globalModeFlags&=~Intent.FLAG_GRANT_WRITE_URI_PERMISSION;
    modeFlags&=~Intent.FLAG_GRANT_WRITE_URI_PERMISSION;
    if (readOwners.size() > 0) {
      for (      UriPermissionOwner r : writeOwners) {
        r.removeWritePermission(this);
      }
      readOwners.clear();
    }
  }
}
Program: 181393
Project: 181393
Buggy source:
void clearModes(int modeFlags){
  if ((modeFlags & Intent.FLAG_GRANT_READ_URI_PERMISSION) != 0) {
    globalModeFlags&=~Intent.FLAG_GRANT_READ_URI_PERMISSION;
    modeFlags&=~Intent.FLAG_GRANT_READ_URI_PERMISSION;
    if (readOwners.size() > 0) {
      for (      UriPermissionOwner r : readOwners) {
        r.removeReadPermission(this);
      }
      readOwners.clear();
    }
  }
  if ((modeFlags & Intent.FLAG_GRANT_WRITE_URI_PERMISSION) != 0) {
    globalModeFlags&=~Intent.FLAG_GRANT_WRITE_URI_PERMISSION;
    modeFlags&=~Intent.FLAG_GRANT_WRITE_URI_PERMISSION;
    if (readOwners.size() > 0) {
      for (      UriPermissionOwner r : writeOwners) {
        r.removeWritePermission(this);
      }
      readOwners.clear();
    }
  }
}

Fixed version (ground truth):
void clearModes(int modeFlagsToClear){
  if ((modeFlagsToClear & Intent.FLAG_GRANT_READ_URI_PERMISSION) != 0) {
    globalModeFlags&=~Intent.FLAG_GRANT_READ_URI_PERMISSION;
    modeFlags&=~Intent.FLAG_GRANT_READ_URI_PERMISSION;
    if (readOwners.size() > 0) {
      for (      UriPermissionOwner r : readOwners) {
        r.removeReadPermission(this);
      }
      readOwners.clear();
    }
  }
  if ((modeFlagsToClear & Intent.FLAG_GRANT_WRITE_URI_PERMISSION) != 0) {
    globalModeFlags&=~Intent.FLAG_GRANT_WRITE_URI_PERMISSION;
    modeFlags&=~Intent.FLAG_GRANT_WRITE_URI_PERMISSION;
    if (readOwners.size() > 0) {
      for (      UriPermissionOwner r : writeOwners) {
        r.removeWritePermission(this);
      }
      readOwners.clear();
    }
  }
}
Program: 181394
Project: 181394
Buggy source:
public boolean remove(WorkSource other){
  int N1=mNum;
  final int[] uids1=mUids;
  final int N2=other.mNum;
  final int[] uids2=other.mUids;
  boolean changed=false;
  int i1=0;
  for (int i2=0; i2 < N2 && i1 < N1; i2++) {
    if (uids2[i2] == uids1[i1]) {
      N1--;
      if (i1 < N1)       System.arraycopy(uids1,i1,uids1,i1 - 1,N1 - i1);
    }
    while (i1 < N1 && uids2[i2] > uids1[i1]) {
      i1++;
    }
  }
  mNum=N1;
  return changed;
}

Fixed version (ground truth):
public boolean remove(WorkSource other){
  int N1=mNum;
  final int[] uids1=mUids;
  final int N2=other.mNum;
  final int[] uids2=other.mUids;
  boolean changed=false;
  int i1=0;
  for (int i2=0; i2 < N2 && i1 < N1; i2++) {
    if (uids2[i2] == uids1[i1]) {
      N1--;
      if (i1 < N1)       System.arraycopy(uids1,i1 + 1,uids1,i1,N1 - i1);
    }
    while (i1 < N1 && uids2[i2] > uids1[i1]) {
      i1++;
    }
  }
  mNum=N1;
  return changed;
}
Program: 181395
Project: 181395
Buggy source:
public boolean remove(WorkSource other){
  int N1=mNum;
  final int[] uids1=mUids;
  final int N2=other.mNum;
  final int[] uids2=other.mUids;
  boolean changed=false;
  int i1=0;
  for (int i2=0; i2 < N2 && i1 < N1; i2++) {
    if (uids2[i2] == uids1[i1]) {
      N1--;
      if (i1 < N1)       System.arraycopy(uids1,i1,uids1,i1 - 1,N1 - i1);
    }
    while (i1 < N1 && uids2[i2] > uids1[i1]) {
      i1++;
    }
  }
  mNum=N1;
  return changed;
}

Fixed version (ground truth):
public boolean remove(WorkSource other){
  int N1=mNum;
  final int[] uids1=mUids;
  final int N2=other.mNum;
  final int[] uids2=other.mUids;
  boolean changed=false;
  int i1=0;
  for (int i2=0; i2 < N2 && i1 < N1; i2++) {
    if (uids2[i2] == uids1[i1]) {
      N1--;
      if (i1 < N1)       System.arraycopy(uids1,i1 + 1,uids1,i1,N1 - i1);
    }
    while (i1 < N1 && uids2[i2] > uids1[i1]) {
      i1++;
    }
  }
  mNum=N1;
  return changed;
}
Program: 181396
Project: 181396
Buggy source:
void noteStopWakeLocked(WakeLock wl,WorkSource ws){
  try {
    if (ws != null) {
      mBatteryStats.noteStopWakelockFromSource(ws,wl.pid,wl.tag,wl.monitorType);
    }
 else {
      mBatteryStats.noteStopWakelock(wl.uid,wl.pid,wl.tag,wl.monitorType);
    }
  }
 catch (  RemoteException e) {
  }
}

Fixed version (ground truth):
void noteStopWakeLocked(WakeLock wl,WorkSource ws){
  if (wl.monitorType >= 0) {
    long origId=Binder.clearCallingIdentity();
    try {
      if (ws != null) {
        mBatteryStats.noteStopWakelockFromSource(ws,wl.pid,wl.tag,wl.monitorType);
      }
 else {
        mBatteryStats.noteStopWakelock(wl.uid,wl.pid,wl.tag,wl.monitorType);
      }
    }
 catch (    RemoteException e) {
    }
 finally {
      Binder.restoreCallingIdentity(origId);
    }
  }
}
Program: 181397
Project: 181397
Buggy source:
public void updateWakeLockWorkSource(IBinder lock,WorkSource ws){
  int uid=Binder.getCallingUid();
  int pid=Binder.getCallingPid();
  if (ws != null && ws.size() == 0) {
    ws=null;
  }
  if (ws != null) {
    enforceWakeSourcePermission(uid,pid);
  }
  long ident=Binder.clearCallingIdentity();
  try {
synchronized (mLocks) {
      int index=mLocks.getIndex(lock);
      if (index < 0) {
        throw new IllegalArgumentException("String_Node_Str");
      }
      WakeLock wl=mLocks.get(index);
      WorkSource oldsource=wl.ws;
      wl.ws=ws != null ? new WorkSource(ws) : null;
      noteStopWakeLocked(wl,oldsource);
      noteStartWakeLocked(wl,ws);
    }
  }
  finally {
    Binder.restoreCallingIdentity(ident);
  }
}

Fixed version (ground truth):
public void updateWakeLockWorkSource(IBinder lock,WorkSource ws){
  int uid=Binder.getCallingUid();
  int pid=Binder.getCallingPid();
  if (ws != null && ws.size() == 0) {
    ws=null;
  }
  if (ws != null) {
    enforceWakeSourcePermission(uid,pid);
  }
synchronized (mLocks) {
    int index=mLocks.getIndex(lock);
    if (index < 0) {
      throw new IllegalArgumentException("String_Node_Str");
    }
    WakeLock wl=mLocks.get(index);
    WorkSource oldsource=wl.ws;
    wl.ws=ws != null ? new WorkSource(ws) : null;
    noteStopWakeLocked(wl,oldsource);
    noteStartWakeLocked(wl,ws);
  }
}
Program: 181398
Project: 181398
Buggy source:
void noteStartWakeLocked(WakeLock wl,WorkSource ws){
  try {
    if (ws != null) {
      mBatteryStats.noteStartWakelockFromSource(ws,wl.pid,wl.tag,wl.monitorType);
    }
 else {
      mBatteryStats.noteStartWakelock(wl.uid,wl.pid,wl.tag,wl.monitorType);
    }
  }
 catch (  RemoteException e) {
  }
}

Fixed version (ground truth):
void noteStartWakeLocked(WakeLock wl,WorkSource ws){
  if (wl.monitorType >= 0) {
    long origId=Binder.clearCallingIdentity();
    try {
      if (ws != null) {
        mBatteryStats.noteStartWakelockFromSource(ws,wl.pid,wl.tag,wl.monitorType);
      }
 else {
        mBatteryStats.noteStartWakelock(wl.uid,wl.pid,wl.tag,wl.monitorType);
      }
    }
 catch (    RemoteException e) {
    }
 finally {
      Binder.restoreCallingIdentity(origId);
    }
  }
}
Program: 181399
Project: 181399
Buggy source:
private void releaseWakeLockLocked(IBinder lock,int flags,boolean death){
  WakeLock wl=mLocks.removeLock(lock);
  if (wl == null) {
    return;
  }
  if (mSpew) {
    Slog.d(TAG,"String_Node_Str" + Integer.toHexString(wl.flags) + "String_Node_Str"+ wl.tag);
  }
  if (isScreenLock(wl.flags)) {
    mWakeLockState=mLocks.gatherState();
    if ((wl.flags & PowerManager.ON_AFTER_RELEASE) != 0) {
      userActivity(SystemClock.uptimeMillis(),false);
    }
    setPowerState(mWakeLockState | mUserState);
  }
 else   if ((wl.flags & LOCK_MASK) == PowerManager.PARTIAL_WAKE_LOCK) {
    mPartialCount--;
    if (mPartialCount == 0) {
      if (LOG_PARTIAL_WL)       EventLog.writeEvent(EventLogTags.POWER_PARTIAL_WAKE_STATE,0,wl.tag);
      Power.releaseWakeLock(PARTIAL_NAME);
    }
  }
 else   if ((wl.flags & LOCK_MASK) == PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK) {
    mProximityWakeLockCount--;
    if (mProximityWakeLockCount == 0) {
      if (mProximitySensorActive && ((flags & PowerManager.WAIT_FOR_PROXIMITY_NEGATIVE) != 0)) {
        if (mDebugProximitySensor) {
          Slog.d(TAG,"String_Node_Str");
        }
      }
 else {
        disableProximityLockLocked();
      }
    }
  }
  wl.binder.unlinkToDeath(wl,0);
  if (wl.monitorType >= 0) {
    long origId=Binder.clearCallingIdentity();
    try {
      noteStopWakeLocked(wl,wl.ws);
    }
  finally {
      Binder.restoreCallingIdentity(origId);
    }
  }
}

Fixed version (ground truth):
private void releaseWakeLockLocked(IBinder lock,int flags,boolean death){
  WakeLock wl=mLocks.removeLock(lock);
  if (wl == null) {
    return;
  }
  if (mSpew) {
    Slog.d(TAG,"String_Node_Str" + Integer.toHexString(wl.flags) + "String_Node_Str"+ wl.tag);
  }
  if (isScreenLock(wl.flags)) {
    mWakeLockState=mLocks.gatherState();
    if ((wl.flags & PowerManager.ON_AFTER_RELEASE) != 0) {
      userActivity(SystemClock.uptimeMillis(),false);
    }
    setPowerState(mWakeLockState | mUserState);
  }
 else   if ((wl.flags & LOCK_MASK) == PowerManager.PARTIAL_WAKE_LOCK) {
    mPartialCount--;
    if (mPartialCount == 0) {
      if (LOG_PARTIAL_WL)       EventLog.writeEvent(EventLogTags.POWER_PARTIAL_WAKE_STATE,0,wl.tag);
      Power.releaseWakeLock(PARTIAL_NAME);
    }
  }
 else   if ((wl.flags & LOCK_MASK) == PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK) {
    mProximityWakeLockCount--;
    if (mProximityWakeLockCount == 0) {
      if (mProximitySensorActive && ((flags & PowerManager.WAIT_FOR_PROXIMITY_NEGATIVE) != 0)) {
        if (mDebugProximitySensor) {
          Slog.d(TAG,"String_Node_Str");
        }
      }
 else {
        disableProximityLockLocked();
      }
    }
  }
  wl.binder.unlinkToDeath(wl,0);
  noteStopWakeLocked(wl,wl.ws);
}
Program: 181400
Project: 181400
Buggy source:
private boolean handleAuthentication(ResponseEvent event) throws SipException {
  Response response=event.getResponse();
  String nonce=getNonceFromResponse(response);
  if (((nonce != null) && nonce.equals(mLastNonce)) || (nonce == mLastNonce)) {
    return false;
  }
 else {
    mClientTransaction=mSipHelper.handleChallenge(event,getAccountManager());
    mDialog=mClientTransaction.getDialog();
    mLastNonce=nonce;
    return true;
  }
}

Fixed version (ground truth):
private boolean handleAuthentication(ResponseEvent event) throws SipException {
  Response response=event.getResponse();
  String nonce=getNonceFromResponse(response);
  if (((nonce != null) && nonce.equals(mLastNonce)) || (nonce == null)) {
    mLastNonce=nonce;
    return false;
  }
 else {
    mClientTransaction=mSipHelper.handleChallenge(event,getAccountManager());
    mDialog=mClientTransaction.getDialog();
    mLastNonce=nonce;
    return true;
  }
}
Program: 181401
Project: 181401
Buggy source:
private String getNonceFromResponse(Response response){
  WWWAuthenticate authHeader=(WWWAuthenticate)(response.getHeader(SIPHeaderNames.WWW_AUTHENTICATE));
  return (authHeader == null) ? null : authHeader.getNonce();
}

Fixed version (ground truth):
private String getNonceFromResponse(Response response){
  WWWAuthenticate wwwAuth=(WWWAuthenticate)response.getHeader(SIPHeaderNames.WWW_AUTHENTICATE);
  if (wwwAuth != null)   return wwwAuth.getNonce();
  ProxyAuthenticate proxyAuth=(ProxyAuthenticate)response.getHeader(SIPHeaderNames.PROXY_AUTHENTICATE);
  return (proxyAuth == null) ? null : proxyAuth.getNonce();
}
Program: 181402
Project: 181402
Buggy source:
private boolean handleAuthentication(ResponseEvent event) throws SipException {
  Response response=event.getResponse();
  String nonce=getNonceFromResponse(response);
  if (((nonce != null) && nonce.equals(mLastNonce)) || (nonce == mLastNonce)) {
    return false;
  }
 else {
    mClientTransaction=mSipHelper.handleChallenge(event,getAccountManager());
    mDialog=mClientTransaction.getDialog();
    mLastNonce=nonce;
    return true;
  }
}

Fixed version (ground truth):
private boolean handleAuthentication(ResponseEvent event) throws SipException {
  Response response=event.getResponse();
  String nonce=getNonceFromResponse(response);
  if (((nonce != null) && nonce.equals(mLastNonce)) || (nonce == null)) {
    mLastNonce=nonce;
    return false;
  }
 else {
    mClientTransaction=mSipHelper.handleChallenge(event,getAccountManager());
    mDialog=mClientTransaction.getDialog();
    mLastNonce=nonce;
    return true;
  }
}