nus-yam/ex-repair huggingface dataset:
Program: 21896
Project: 21896
Buggy source:
/** 
 * {@inheritDoc} 
 */
public void animatingWindowLw(WindowState win,WindowManager.LayoutParams attrs){
  if (mTopFullscreenOpaqueWindowState == null && win.isVisibleOrBehindKeyguardLw()) {
    if ((attrs.flags & FLAG_FORCE_NOT_FULLSCREEN) != 0) {
      mForceStatusBar=true;
    }
    if (attrs.type >= FIRST_APPLICATION_WINDOW && attrs.type <= LAST_APPLICATION_WINDOW && win.fillsScreenLw(mW,mH,false,false)) {
      if (DEBUG_LAYOUT)       Log.v(TAG,"String_Node_Str" + win);
      mTopFullscreenOpaqueWindowState=win;
      if ((attrs.flags & FLAG_SHOW_WHEN_LOCKED) != 0) {
        if (localLOGV)         Log.v(TAG,"String_Node_Str" + win);
        mHideLockScreen=true;
      }
      if ((attrs.flags & FLAG_DISMISS_KEYGUARD) != 0) {
        if (localLOGV)         Log.v(TAG,"String_Node_Str" + win);
        mDismissKeyguard=true;
      }
      if ((attrs.flags & FLAG_ALLOW_LOCK_WHILE_SCREEN_ON) != 0) {
        mAllowLockscreenWhenOn=true;
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
public void animatingWindowLw(WindowState win,WindowManager.LayoutParams attrs){
  if (mTopFullscreenOpaqueWindowState == null && win.isVisibleOrBehindKeyguardLw()) {
    if ((attrs.flags & FLAG_FORCE_NOT_FULLSCREEN) != 0) {
      mForceStatusBar=true;
    }
    if (attrs.type >= FIRST_APPLICATION_WINDOW && attrs.type <= LAST_APPLICATION_WINDOW && attrs.x == 0 && attrs.y == 0 && attrs.width == WindowManager.LayoutParams.MATCH_PARENT && attrs.height == WindowManager.LayoutParams.MATCH_PARENT) {
      if (DEBUG_LAYOUT)       Log.v(TAG,"String_Node_Str" + win);
      mTopFullscreenOpaqueWindowState=win;
      if ((attrs.flags & FLAG_SHOW_WHEN_LOCKED) != 0) {
        if (localLOGV)         Log.v(TAG,"String_Node_Str" + win);
        mHideLockScreen=true;
      }
      if ((attrs.flags & FLAG_DISMISS_KEYGUARD) != 0) {
        if (localLOGV)         Log.v(TAG,"String_Node_Str" + win);
        mDismissKeyguard=true;
      }
      if ((attrs.flags & FLAG_ALLOW_LOCK_WHILE_SCREEN_ON) != 0) {
        mAllowLockscreenWhenOn=true;
      }
    }
  }
}
Program: 21897
Project: 21897
Buggy source:
private void printRestoreSets(RestoreSet[] sets){
  for (  RestoreSet s : sets) {
    System.out.println("String_Node_Str" + Long.toHexString(s.token) + "String_Node_Str"+ s.name);
  }
}

Fixed version (ground truth):
private void printRestoreSets(RestoreSet[] sets){
  if (sets == null || sets.length == 0) {
    System.out.println("String_Node_Str");
    return;
  }
  for (  RestoreSet s : sets) {
    System.out.println("String_Node_Str" + Long.toHexString(s.token) + "String_Node_Str"+ s.name);
  }
}
Program: 21898
Project: 21898
Buggy source:
/** 
 * {@inheritDoc} 
 */
public void animatingWindowLw(WindowState win,WindowManager.LayoutParams attrs){
  if (mTopFullscreenOpaqueWindowState == null && win.isVisibleOrBehindKeyguardLw()) {
    if ((attrs.flags & FLAG_FORCE_NOT_FULLSCREEN) != 0) {
      mForceStatusBar=true;
    }
    if (attrs.type >= FIRST_APPLICATION_WINDOW && attrs.type <= LAST_APPLICATION_WINDOW && win.fillsScreenLw(mW,mH,false,false)) {
      if (DEBUG_LAYOUT)       Log.v(TAG,"String_Node_Str" + win);
      mTopFullscreenOpaqueWindowState=win;
      if ((attrs.flags & FLAG_SHOW_WHEN_LOCKED) != 0) {
        if (localLOGV)         Log.v(TAG,"String_Node_Str" + win);
        mHideLockScreen=true;
      }
      if ((attrs.flags & FLAG_DISMISS_KEYGUARD) != 0) {
        if (localLOGV)         Log.v(TAG,"String_Node_Str" + win);
        mDismissKeyguard=true;
      }
      if ((attrs.flags & FLAG_ALLOW_LOCK_WHILE_SCREEN_ON) != 0) {
        mAllowLockscreenWhenOn=true;
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
public void animatingWindowLw(WindowState win,WindowManager.LayoutParams attrs){
  if (mTopFullscreenOpaqueWindowState == null && win.isVisibleOrBehindKeyguardLw()) {
    if ((attrs.flags & FLAG_FORCE_NOT_FULLSCREEN) != 0) {
      mForceStatusBar=true;
    }
    if (attrs.type >= FIRST_APPLICATION_WINDOW && attrs.type <= LAST_APPLICATION_WINDOW && attrs.x == 0 && attrs.y == 0 && attrs.width == WindowManager.LayoutParams.MATCH_PARENT && attrs.height == WindowManager.LayoutParams.MATCH_PARENT) {
      if (DEBUG_LAYOUT)       Log.v(TAG,"String_Node_Str" + win);
      mTopFullscreenOpaqueWindowState=win;
      if ((attrs.flags & FLAG_SHOW_WHEN_LOCKED) != 0) {
        if (localLOGV)         Log.v(TAG,"String_Node_Str" + win);
        mHideLockScreen=true;
      }
      if ((attrs.flags & FLAG_DISMISS_KEYGUARD) != 0) {
        if (localLOGV)         Log.v(TAG,"String_Node_Str" + win);
        mDismissKeyguard=true;
      }
      if ((attrs.flags & FLAG_ALLOW_LOCK_WHILE_SCREEN_ON) != 0) {
        mAllowLockscreenWhenOn=true;
      }
    }
  }
}
Program: 21899
Project: 21899
Buggy source:
@Override public void onChanged(SipAudioCall call){
synchronized (SipPhone.class) {
    Call.State newState=getCallStateFrom(call);
    if (mState == newState)     return;
    if (newState == Call.State.INCOMING) {
      setState(mOwner.getState());
    }
 else {
      if (mOwner == ringingCall) {
        if (ringingCall.getState() == Call.State.WAITING) {
          try {
            switchHoldingAndActive();
          }
 catch (          CallStateException e) {
            onCallEnded(DisconnectCause.LOCAL);
            return;
          }
        }
        foregroundCall.switchWith(ringingCall);
      }
      if (newState == Call.State.ACTIVE)       call.startAudio();
      setState(newState);
    }
    mOwner.onConnectionStateChanged(SipConnection.this);
    Log.v(LOG_TAG,"String_Node_Str" + mPeer.getUriString() + "String_Node_Str"+ mState+ "String_Node_Str"+ getPhone());
  }
}

Fixed version (ground truth):
@Override public void onChanged(SipAudioCall call){
synchronized (SipPhone.class) {
    Call.State newState=getCallStateFrom(call);
    if (mState == newState)     return;
    if (newState == Call.State.INCOMING) {
      setState(mOwner.getState());
    }
 else {
      if (mOwner == ringingCall) {
        if (ringingCall.getState() == Call.State.WAITING) {
          try {
            switchHoldingAndActive();
          }
 catch (          CallStateException e) {
            onCallEnded(DisconnectCause.LOCAL);
            return;
          }
        }
        foregroundCall.switchWith(ringingCall);
      }
      setState(newState);
    }
    mOwner.onConnectionStateChanged(SipConnection.this);
    Log.v(LOG_TAG,"String_Node_Str" + mPeer.getUriString() + "String_Node_Str"+ mState+ "String_Node_Str"+ getPhone());
  }
}
Program: 21901
Project: 21901
Buggy source:
@SmallTest public void testRecurrenceSet2() throws Exception {
  String recurrence="String_Node_Str" + "String_Node_Str";
  verifyPopulateContentValues(recurrence,"String_Node_Str",null,null,null,1250812800000L,null,"String_Node_Str",1);
}

Fixed version (ground truth):
@SmallTest public void testRecurrenceSet2() throws Exception {
  String recurrence="String_Node_Str" + "String_Node_Str";
  verifyPopulateContentValues(recurrence,"String_Node_Str",null,null,null,1250812800000L,"String_Node_Str","String_Node_Str",1);
}
Program: 21902
Project: 21902
Buggy source:
@SmallTest public void testRecurrenceSet1() throws Exception {
  String recurrence="String_Node_Str" + "String_Node_Str";
  verifyPopulateContentValues(recurrence,"String_Node_Str",null,null,null,1250812800000L,null,"String_Node_Str",1);
}

Fixed version (ground truth):
@SmallTest public void testRecurrenceSet1() throws Exception {
  String recurrence="String_Node_Str" + "String_Node_Str";
  verifyPopulateContentValues(recurrence,"String_Node_Str",null,null,null,1250812800000L,"String_Node_Str","String_Node_Str",1);
}
Program: 21905
Project: 21905
Buggy source:
void skipCurrentReceiverLocked(ProcessRecord app){
  boolean reschedule=false;
  BroadcastRecord r=app.curReceiver;
  if (r != null) {
    logBroadcastReceiverDiscard(r);
    finishReceiverLocked(r.receiver,r.resultCode,r.resultData,r.resultExtras,r.resultAbort,true);
    reschedule=true;
  }
  r=mPendingBroadcast;
  if (r != null && r.curApp == app) {
    if (DEBUG_BROADCAST)     Slog.v(TAG,"String_Node_Str" + r);
    logBroadcastReceiverDiscard(r);
    finishReceiverLocked(r.receiver,r.resultCode,r.resultData,r.resultExtras,r.resultAbort,true);
    reschedule=true;
  }
  if (reschedule) {
    scheduleBroadcastsLocked();
  }
}

Fixed version (ground truth):
void skipCurrentReceiverLocked(ProcessRecord app){
  boolean reschedule=false;
  BroadcastRecord r=app.curReceiver;
  if (r != null) {
    logBroadcastReceiverDiscardLocked(r);
    finishReceiverLocked(r.receiver,r.resultCode,r.resultData,r.resultExtras,r.resultAbort,true);
    reschedule=true;
  }
  r=mPendingBroadcast;
  if (r != null && r.curApp == app) {
    if (DEBUG_BROADCAST)     Slog.v(TAG,"String_Node_Str" + r);
    logBroadcastReceiverDiscardLocked(r);
    finishReceiverLocked(r.receiver,r.resultCode,r.resultData,r.resultExtras,r.resultAbort,true);
    reschedule=true;
  }
  if (reschedule) {
    scheduleBroadcastsLocked();
  }
}
Program: 21906
Project: 21906
Buggy source:
static void performReceive(ProcessRecord app,IIntentReceiver receiver,Intent intent,int resultCode,String data,Bundle extras,boolean ordered,boolean sticky) throws RemoteException {
  if (app != null && app.thread != null) {
    app.thread.scheduleRegisteredReceiver(receiver,intent,resultCode,data,extras,ordered,sticky);
  }
 else {
    receiver.performReceive(intent,resultCode,data,extras,ordered,sticky);
  }
}

Fixed version (ground truth):
public void performReceive(Intent intent,int resultCode,String data,Bundle extras,boolean ordered,boolean sticky){
  mHandler.post(new Runnable(){
    public void run(){
synchronized (ActivityManagerService.this) {
        mDidUpdate=true;
      }
      systemReady(goingCallback);
    }
  }
);
}
Program: 21909
Project: 21909
Buggy source:
@SmallTest public void testRecurrenceSet2() throws Exception {
  String recurrence="String_Node_Str" + "String_Node_Str";
  verifyPopulateContentValues(recurrence,"String_Node_Str",null,null,null,1250812800000L,null,"String_Node_Str",1);
}

Fixed version (ground truth):
@SmallTest public void testRecurrenceSet2() throws Exception {
  String recurrence="String_Node_Str" + "String_Node_Str";
  verifyPopulateContentValues(recurrence,"String_Node_Str",null,null,null,1250812800000L,"String_Node_Str","String_Node_Str",1);
}
Program: 21910
Project: 21910
Buggy source:
@SmallTest public void testRecurrenceSet1() throws Exception {
  String recurrence="String_Node_Str" + "String_Node_Str";
  verifyPopulateContentValues(recurrence,"String_Node_Str",null,null,null,1250812800000L,null,"String_Node_Str",1);
}

Fixed version (ground truth):
@SmallTest public void testRecurrenceSet1() throws Exception {
  String recurrence="String_Node_Str" + "String_Node_Str";
  verifyPopulateContentValues(recurrence,"String_Node_Str",null,null,null,1250812800000L,"String_Node_Str","String_Node_Str",1);
}
Program: 21911
Project: 21911
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: 21912
Project: 21912
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: 21914
Project: 21914
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: 21915
Project: 21915
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: 21917
Project: 21917
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: 21918
Project: 21918
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: 21919
Project: 21919
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: 21920
Project: 21920
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: 21921
Project: 21921
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: 21922
Project: 21922
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: 21926
Project: 21926
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: 21927
Project: 21927
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: 21928
Project: 21928
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: 21929
Project: 21929
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: 21933
Project: 21933
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: 21934
Project: 21934
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: 21935
Project: 21935
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: 21936
Project: 21936
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: 21937
Project: 21937
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: 21938
Project: 21938
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: 21939
Project: 21939
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: 21941
Project: 21941
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: 21942
Project: 21942
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: 21943
Project: 21943
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: 21944
Project: 21944
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);
}