nus-yam/ex-repair huggingface dataset:
Program: 183421
Project: 183421
Buggy source:
public void setImageMatrix(Matrix matrix){
  if (matrix != null && matrix.isIdentity()) {
    matrix=null;
  }
  if (matrix == null && !mMatrix.isIdentity() || matrix != null && !mMatrix.equals(matrix)) {
    mMatrix.set(matrix);
    invalidate();
  }
}

Fixed version (ground truth):
public void setImageMatrix(Matrix matrix){
  if (matrix != null && matrix.isIdentity()) {
    matrix=null;
  }
  if (matrix == null && !mMatrix.isIdentity() || matrix != null && !mMatrix.equals(matrix)) {
    mMatrix.set(matrix);
    configureBounds();
    invalidate();
  }
}
Program: 183422
Project: 183422
Buggy source:
/** 
 * Handle   {@link #MSG_BATTERY_UPDATE}
 */
private void handleBatteryUpdate(int pluggedInStatus,int batteryLevel){
  if (DEBUG)   Log.d(TAG,"String_Node_Str");
  final boolean pluggedIn=isPluggedIn(pluggedInStatus);
  if (isBatteryUpdateInteresting(pluggedIn,batteryLevel)) {
    mBatteryLevel=batteryLevel;
    mDevicePluggedIn=pluggedIn;
    for (int i=0; i < mInfoCallbacks.size(); i++) {
      mInfoCallbacks.get(i).onRefreshBatteryInfo(shouldShowBatteryInfo(),pluggedIn,batteryLevel);
    }
  }
  if (batteryLevel == 0 && pluggedInStatus != BATTERY_STATUS_CHARGING && pluggedInStatus != BATTERY_STATUS_UNKNOWN) {
    ShutdownThread.shutdown(mContext,false);
  }
}

Fixed version (ground truth):
/** 
 * Handle   {@link #MSG_BATTERY_UPDATE}
 */
private void handleBatteryUpdate(int pluggedInStatus,int batteryLevel){
  if (DEBUG)   Log.d(TAG,"String_Node_Str");
  final boolean pluggedIn=isPluggedIn(pluggedInStatus);
  if (isBatteryUpdateInteresting(pluggedIn,batteryLevel)) {
    mBatteryLevel=batteryLevel;
    mDevicePluggedIn=pluggedIn;
    for (int i=0; i < mInfoCallbacks.size(); i++) {
      mInfoCallbacks.get(i).onRefreshBatteryInfo(shouldShowBatteryInfo(),pluggedIn,batteryLevel);
    }
  }
}
Program: 183423
Project: 183423
Buggy source:
/** 
 * Performs   {@link AccessibilityService}s delayed notification. The delay is configurable and denotes the period after the last event before notifying the service.
 * @param event The event.
 * @param isDefault True to notify default listeners, not default services.
 */
private void notifyAccessibilityServicesDelayedLocked(AccessibilityEvent event,boolean isDefault){
  for (int i=0, count=mServices.size(); i < count; i++) {
    Service service=mServices.get(i);
    if (service.mIsDefault == isDefault) {
      if (canDispathEventLocked(service,event,mHandledFeedbackTypes)) {
        mHandledFeedbackTypes|=service.mFeedbackType;
        notifyAccessibilityServiceDelayedLocked(service,event);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Performs   {@link AccessibilityService}s delayed notification. The delay is configurable and denotes the period after the last event before notifying the service.
 * @param event The event.
 * @param isDefault True to notify default listeners, not default services.
 */
private void notifyAccessibilityServicesDelayedLocked(AccessibilityEvent event,boolean isDefault){
  try {
    for (int i=0, count=mServices.size(); i < count; i++) {
      Service service=mServices.get(i);
      if (service.mIsDefault == isDefault) {
        if (canDispathEventLocked(service,event,mHandledFeedbackTypes)) {
          mHandledFeedbackTypes|=service.mFeedbackType;
          notifyAccessibilityServiceDelayedLocked(service,event);
        }
      }
    }
  }
 catch (  IndexOutOfBoundsException oobe) {
    return;
  }
}
Program: 183425
Project: 183425
Buggy source:
static void sendCloseSystemWindows(Context context,String reason){
  if (ActivityManagerNative.isSystemReady()) {
    Intent intent=new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
    if (reason != null) {
      intent.putExtra(SYSTEM_DIALOG_REASON_KEY,reason);
    }
    context.sendBroadcast(intent);
  }
}

Fixed version (ground truth):
static void sendCloseSystemWindows(Context context,String reason){
  if (ActivityManagerNative.isSystemReady()) {
    try {
      ActivityManagerNative.getDefault().closeSystemDialogs(reason);
    }
 catch (    RemoteException e) {
    }
  }
}
Program: 183426
Project: 183426
Buggy source:
/** 
 * goes to the home screen
 * @return whether it did anything
 */
boolean goHome(){
  if (false) {
    try {
      ActivityManagerNative.getDefault().stopAppSwitches();
    }
 catch (    RemoteException e) {
    }
    mContext.startActivity(mHomeIntent);
  }
 else {
    try {
      ActivityManagerNative.getDefault().stopAppSwitches();
      int result=ActivityManagerNative.getDefault().startActivity(null,mHomeIntent,mHomeIntent.resolveTypeIfNeeded(mContext.getContentResolver()),null,0,null,null,0,true,false);
      if (result == IActivityManager.START_RETURN_INTENT_TO_CALLER) {
        return false;
      }
    }
 catch (    RemoteException ex) {
    }
  }
  sendCloseSystemWindows();
  return true;
}

Fixed version (ground truth):
/** 
 * goes to the home screen
 * @return whether it did anything
 */
boolean goHome(){
  if (false) {
    try {
      ActivityManagerNative.getDefault().stopAppSwitches();
    }
 catch (    RemoteException e) {
    }
    sendCloseSystemWindows();
    mContext.startActivity(mHomeIntent);
  }
 else {
    try {
      ActivityManagerNative.getDefault().stopAppSwitches();
      sendCloseSystemWindows();
      int result=ActivityManagerNative.getDefault().startActivity(null,mHomeIntent,mHomeIntent.resolveTypeIfNeeded(mContext.getContentResolver()),null,0,null,null,0,true,false);
      if (result == IActivityManager.START_RETURN_INTENT_TO_CALLER) {
        return false;
      }
    }
 catch (    RemoteException ex) {
    }
  }
  return true;
}
Program: 183427
Project: 183427
Buggy source:
/** 
 * A home key -> launch home action was detected.  Take the appropriate action given the situation with the keyguard.
 */
void launchHomeFromHotKey(){
  if (mKeyguardMediator.isShowing()) {
  }
 else   if (mKeyguardMediator.isInputRestricted()) {
    mKeyguardMediator.verifyUnlock(new OnKeyguardExitResult(){
      public void onKeyguardExitResult(      boolean success){
        if (success) {
          try {
            ActivityManagerNative.getDefault().stopAppSwitches();
          }
 catch (          RemoteException e) {
          }
          mContext.startActivity(mHomeIntent);
          sendCloseSystemWindows();
        }
      }
    }
);
  }
 else {
    try {
      ActivityManagerNative.getDefault().stopAppSwitches();
    }
 catch (    RemoteException e) {
    }
    mContext.startActivity(mHomeIntent);
    sendCloseSystemWindows();
  }
}

Fixed version (ground truth):
/** 
 * A home key -> launch home action was detected.  Take the appropriate action given the situation with the keyguard.
 */
void launchHomeFromHotKey(){
  if (mKeyguardMediator.isShowing()) {
  }
 else   if (mKeyguardMediator.isInputRestricted()) {
    mKeyguardMediator.verifyUnlock(new OnKeyguardExitResult(){
      public void onKeyguardExitResult(      boolean success){
        if (success) {
          try {
            ActivityManagerNative.getDefault().stopAppSwitches();
          }
 catch (          RemoteException e) {
          }
          sendCloseSystemWindows();
          mContext.startActivity(mHomeIntent);
        }
      }
    }
);
  }
 else {
    try {
      ActivityManagerNative.getDefault().stopAppSwitches();
    }
 catch (    RemoteException e) {
    }
    sendCloseSystemWindows();
    mContext.startActivity(mHomeIntent);
  }
}
Program: 183428
Project: 183428
Buggy source:
public void onKeyguardExitResult(boolean success){
  if (success) {
    try {
      ActivityManagerNative.getDefault().stopAppSwitches();
    }
 catch (    RemoteException e) {
    }
    mContext.startActivity(mHomeIntent);
    sendCloseSystemWindows();
  }
}

Fixed version (ground truth):
public void onKeyguardExitResult(boolean success){
  if (success) {
    try {
      ActivityManagerNative.getDefault().stopAppSwitches();
    }
 catch (    RemoteException e) {
    }
    sendCloseSystemWindows();
    mContext.startActivity(mHomeIntent);
  }
}
Program: 183429
Project: 183429
Buggy source:
/** 
 * Checks whether the speakerphone is on or off.
 * @return true if speakerphone is on, false if it's off
 */
public boolean isSpeakerphoneOn(){
  if (AudioSystem.getForceUse(AudioSystem.FOR_COMMUNICATION) == AudioSystem.FORCE_SPEAKER) {
    return true;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
/** 
 * Checks whether the speakerphone is on or off.
 * @return true if speakerphone is on, false if it's off
 */
public boolean isSpeakerphoneOn(){
  IAudioService service=getService();
  try {
    return service.isSpeakerphoneOn();
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str",e);
    return false;
  }
}
Program: 183430
Project: 183430
Buggy source:
/** 
 * Request use of Bluetooth SCO headset for communications.
 * @param on set <var>true</var> to use bluetooth SCO for communications;<var>false</var> to not use bluetooth SCO for communications
 */
public void setBluetoothScoOn(boolean on){
  if (on) {
    AudioSystem.setForceUse(AudioSystem.FOR_COMMUNICATION,AudioSystem.FORCE_BT_SCO);
  }
 else {
    AudioSystem.setForceUse(AudioSystem.FOR_COMMUNICATION,AudioSystem.FORCE_NONE);
  }
}

Fixed version (ground truth):
/** 
 * Request use of Bluetooth SCO headset for communications.
 * @param on set <var>true</var> to use bluetooth SCO for communications;<var>false</var> to not use bluetooth SCO for communications
 */
public void setBluetoothScoOn(boolean on){
  IAudioService service=getService();
  try {
    service.setBluetoothScoOn(on);
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str",e);
  }
}
Program: 183431
Project: 183431
Buggy source:
/** 
 * Sets the speakerphone on or off.
 * @param on set <var>true</var> to turn on speakerphone;<var>false</var> to turn it off
 */
public void setSpeakerphoneOn(boolean on){
  if (on) {
    AudioSystem.setForceUse(AudioSystem.FOR_COMMUNICATION,AudioSystem.FORCE_SPEAKER);
  }
 else {
    AudioSystem.setForceUse(AudioSystem.FOR_COMMUNICATION,AudioSystem.FORCE_NONE);
  }
}

Fixed version (ground truth):
/** 
 * Sets the speakerphone on or off.
 * @param on set <var>true</var> to turn on speakerphone;<var>false</var> to turn it off
 */
public void setSpeakerphoneOn(boolean on){
  IAudioService service=getService();
  try {
    service.setSpeakerphoneOn(on);
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str",e);
  }
}
Program: 183432
Project: 183432
Buggy source:
/** 
 * Checks whether communications use Bluetooth SCO.
 * @return true if SCO is used for communications;false if otherwise
 */
public boolean isBluetoothScoOn(){
  if (AudioSystem.getForceUse(AudioSystem.FOR_COMMUNICATION) == AudioSystem.FORCE_BT_SCO) {
    return true;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
/** 
 * Checks whether communications use Bluetooth SCO.
 * @return true if SCO is used for communications;false if otherwise
 */
public boolean isBluetoothScoOn(){
  IAudioService service=getService();
  try {
    return service.isBluetoothScoOn();
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str",e);
    return false;
  }
}
Program: 183433
Project: 183433
Buggy source:
/** 
 * @hide 
 */
public AudioService(Context context){
  mContext=context;
  mContentResolver=context.getContentResolver();
  mVolumePanel=new VolumePanel(context,this);
  mSettingsObserver=new SettingsObserver();
  createAudioSystemThread();
  readPersistedSettings();
  createStreamStates();
  mMediaServerOk=true;
  AudioSystem.setErrorCallback(mAudioSystemCallback);
  loadSoundEffects();
  IntentFilter intentFilter=new IntentFilter(Intent.ACTION_HEADSET_PLUG);
  intentFilter.addAction(BluetoothA2dp.SINK_STATE_CHANGED_ACTION);
  intentFilter.addAction(BluetoothIntent.HEADSET_AUDIO_STATE_CHANGED_ACTION);
  context.registerReceiver(mReceiver,intentFilter);
}

Fixed version (ground truth):
/** 
 * @hide 
 */
public AudioService(Context context){
  mContext=context;
  mContentResolver=context.getContentResolver();
  mVolumePanel=new VolumePanel(context,this);
  mSettingsObserver=new SettingsObserver();
  mMode=AudioSystem.MODE_NORMAL;
  mHeadsetState=0;
  mForcedUseForComm=AudioSystem.FORCE_NONE;
  createAudioSystemThread();
  readPersistedSettings();
  createStreamStates();
  mMediaServerOk=true;
  AudioSystem.setErrorCallback(mAudioSystemCallback);
  loadSoundEffects();
  IntentFilter intentFilter=new IntentFilter(Intent.ACTION_HEADSET_PLUG);
  intentFilter.addAction(BluetoothA2dp.SINK_STATE_CHANGED_ACTION);
  intentFilter.addAction(BluetoothIntent.HEADSET_AUDIO_STATE_CHANGED_ACTION);
  context.registerReceiver(mReceiver,intentFilter);
}
Program: 183435
Project: 183435
Buggy source:
@Override public void handleMessage(Message msg){
  int baseMsgWhat=getMsgBase(msg.what);
switch (baseMsgWhat) {
case MSG_SET_SYSTEM_VOLUME:
    setSystemVolume((VolumeStreamState)msg.obj);
  break;
case MSG_PERSIST_VOLUME:
persistVolume((VolumeStreamState)msg.obj);
break;
case MSG_PERSIST_RINGER_MODE:
persistRingerMode();
break;
case MSG_PERSIST_VIBRATE_SETTING:
persistVibrateSetting();
break;
case MSG_MEDIA_SERVER_DIED:
Log.e(TAG,"String_Node_Str");
mMediaServerOk=false;
AudioSystem.getMode();
break;
case MSG_MEDIA_SERVER_STARTED:
Log.e(TAG,"String_Node_Str");
int numStreamTypes=AudioSystem.getNumStreamTypes();
for (int streamType=numStreamTypes - 1; streamType >= 0; streamType--) {
int index;
VolumeStreamState streamState=mStreamStates[streamType];
if (streamState.muteCount() == 0) {
index=streamState.mIndex;
}
 else {
index=0;
}
setStreamVolumeIndex(streamType,index);
}
setRingerMode(mRingerMode);
mMediaServerOk=true;
break;
case MSG_PLAY_SOUND_EFFECT:
playSoundEffect(msg.arg1,msg.arg2);
break;
}
}

Fixed version (ground truth):
@Override public void handleMessage(Message msg){
  int baseMsgWhat=getMsgBase(msg.what);
switch (baseMsgWhat) {
case MSG_SET_SYSTEM_VOLUME:
    setSystemVolume((VolumeStreamState)msg.obj);
  break;
case MSG_PERSIST_VOLUME:
persistVolume((VolumeStreamState)msg.obj);
break;
case MSG_PERSIST_RINGER_MODE:
persistRingerMode();
break;
case MSG_PERSIST_VIBRATE_SETTING:
persistVibrateSetting();
break;
case MSG_MEDIA_SERVER_DIED:
Log.e(TAG,"String_Node_Str");
mMediaServerOk=false;
AudioSystem.isMusicActive();
break;
case MSG_MEDIA_SERVER_STARTED:
Log.e(TAG,"String_Node_Str");
Set set=mConnectedDevices.entrySet();
Iterator i=set.iterator();
while (i.hasNext()) {
Map.Entry device=(Map.Entry)i.next();
AudioSystem.setDeviceConnectionState(((Integer)device.getKey()).intValue(),AudioSystem.DEVICE_STATE_AVAILABLE,(String)device.getValue());
}
AudioSystem.setPhoneState(mMode);
AudioSystem.setForceUse(AudioSystem.FOR_COMMUNICATION,mForcedUseForComm);
int numStreamTypes=AudioSystem.getNumStreamTypes();
for (int streamType=numStreamTypes - 1; streamType >= 0; streamType--) {
int index;
VolumeStreamState streamState=mStreamStates[streamType];
AudioSystem.initStreamVolume(streamType,0,(streamState.mIndexMax + 5) / 10);
if (streamState.muteCount() == 0) {
index=streamState.mIndex;
}
 else {
index=0;
}
setStreamVolumeIndex(streamType,index);
}
setRingerModeInt(getRingerMode(),false);
mMediaServerOk=true;
break;
case MSG_PLAY_SOUND_EFFECT:
playSoundEffect(msg.arg1,msg.arg2);
break;
}
}
Program: 183437
Project: 183437
Buggy source:
static void sendCloseSystemWindows(Context context,String reason){
  if (ActivityManagerNative.isSystemReady()) {
    Intent intent=new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
    if (reason != null) {
      intent.putExtra(SYSTEM_DIALOG_REASON_KEY,reason);
    }
    context.sendBroadcast(intent);
  }
}

Fixed version (ground truth):
static void sendCloseSystemWindows(Context context,String reason){
  if (ActivityManagerNative.isSystemReady()) {
    try {
      ActivityManagerNative.getDefault().closeSystemDialogs(reason);
    }
 catch (    RemoteException e) {
    }
  }
}
Program: 183438
Project: 183438
Buggy source:
/** 
 * goes to the home screen
 * @return whether it did anything
 */
boolean goHome(){
  if (false) {
    try {
      ActivityManagerNative.getDefault().stopAppSwitches();
    }
 catch (    RemoteException e) {
    }
    mContext.startActivity(mHomeIntent);
  }
 else {
    try {
      ActivityManagerNative.getDefault().stopAppSwitches();
      int result=ActivityManagerNative.getDefault().startActivity(null,mHomeIntent,mHomeIntent.resolveTypeIfNeeded(mContext.getContentResolver()),null,0,null,null,0,true,false);
      if (result == IActivityManager.START_RETURN_INTENT_TO_CALLER) {
        return false;
      }
    }
 catch (    RemoteException ex) {
    }
  }
  sendCloseSystemWindows();
  return true;
}

Fixed version (ground truth):
/** 
 * goes to the home screen
 * @return whether it did anything
 */
boolean goHome(){
  if (false) {
    try {
      ActivityManagerNative.getDefault().stopAppSwitches();
    }
 catch (    RemoteException e) {
    }
    sendCloseSystemWindows();
    mContext.startActivity(mHomeIntent);
  }
 else {
    try {
      ActivityManagerNative.getDefault().stopAppSwitches();
      sendCloseSystemWindows();
      int result=ActivityManagerNative.getDefault().startActivity(null,mHomeIntent,mHomeIntent.resolveTypeIfNeeded(mContext.getContentResolver()),null,0,null,null,0,true,false);
      if (result == IActivityManager.START_RETURN_INTENT_TO_CALLER) {
        return false;
      }
    }
 catch (    RemoteException ex) {
    }
  }
  return true;
}
Program: 183439
Project: 183439
Buggy source:
/** 
 * A home key -> launch home action was detected.  Take the appropriate action given the situation with the keyguard.
 */
void launchHomeFromHotKey(){
  if (mKeyguardMediator.isShowing()) {
  }
 else   if (mKeyguardMediator.isInputRestricted()) {
    mKeyguardMediator.verifyUnlock(new OnKeyguardExitResult(){
      public void onKeyguardExitResult(      boolean success){
        if (success) {
          try {
            ActivityManagerNative.getDefault().stopAppSwitches();
          }
 catch (          RemoteException e) {
          }
          mContext.startActivity(mHomeIntent);
          sendCloseSystemWindows();
        }
      }
    }
);
  }
 else {
    try {
      ActivityManagerNative.getDefault().stopAppSwitches();
    }
 catch (    RemoteException e) {
    }
    mContext.startActivity(mHomeIntent);
    sendCloseSystemWindows();
  }
}

Fixed version (ground truth):
/** 
 * A home key -> launch home action was detected.  Take the appropriate action given the situation with the keyguard.
 */
void launchHomeFromHotKey(){
  if (mKeyguardMediator.isShowing()) {
  }
 else   if (mKeyguardMediator.isInputRestricted()) {
    mKeyguardMediator.verifyUnlock(new OnKeyguardExitResult(){
      public void onKeyguardExitResult(      boolean success){
        if (success) {
          try {
            ActivityManagerNative.getDefault().stopAppSwitches();
          }
 catch (          RemoteException e) {
          }
          sendCloseSystemWindows();
          mContext.startActivity(mHomeIntent);
        }
      }
    }
);
  }
 else {
    try {
      ActivityManagerNative.getDefault().stopAppSwitches();
    }
 catch (    RemoteException e) {
    }
    sendCloseSystemWindows();
    mContext.startActivity(mHomeIntent);
  }
}
Program: 183440
Project: 183440
Buggy source:
public void onKeyguardExitResult(boolean success){
  if (success) {
    try {
      ActivityManagerNative.getDefault().stopAppSwitches();
    }
 catch (    RemoteException e) {
    }
    mContext.startActivity(mHomeIntent);
    sendCloseSystemWindows();
  }
}

Fixed version (ground truth):
public void onKeyguardExitResult(boolean success){
  if (success) {
    try {
      ActivityManagerNative.getDefault().stopAppSwitches();
    }
 catch (    RemoteException e) {
    }
    sendCloseSystemWindows();
    mContext.startActivity(mHomeIntent);
  }
}
Program: 183443
Project: 183443
Buggy source:
final void handleConfigurationChanged(Configuration config){
synchronized (mRelaunchingActivities) {
    if (mPendingConfiguration != null) {
      config=mPendingConfiguration;
      mPendingConfiguration=null;
    }
  }
  ArrayList<ComponentCallbacks> callbacks=new ArrayList<ComponentCallbacks>();
synchronized (mPackages) {
    if (mConfiguration == null) {
      mConfiguration=new Configuration();
    }
    mConfiguration.updateFrom(config);
    DisplayMetrics dm=getDisplayMetricsLocked(true);
    if (config.locale != null) {
      Locale.setDefault(config.locale);
    }
    Resources.updateSystemConfiguration(config,null);
    ApplicationContext.ApplicationPackageManager.configurationChanged();
{
      Iterator<WeakReference<Resources>> it=mActiveResources.values().iterator();
      while (it.hasNext()) {
        WeakReference<Resources> v=it.next();
        Resources r=v.get();
        if (r != null) {
          r.updateConfiguration(config,dm);
        }
 else {
          it.remove();
        }
      }
    }
    callbacks=collectComponentCallbacksLocked(false,config);
  }
  final int N=callbacks.size();
  for (int i=0; i < N; i++) {
    performConfigurationChanged(callbacks.get(i),config);
  }
}

Fixed version (ground truth):
final void handleConfigurationChanged(Configuration config){
synchronized (mRelaunchingActivities) {
    if (mPendingConfiguration != null) {
      config=mPendingConfiguration;
      mPendingConfiguration=null;
    }
  }
  ArrayList<ComponentCallbacks> callbacks=new ArrayList<ComponentCallbacks>();
synchronized (mPackages) {
    if (mConfiguration == null) {
      mConfiguration=new Configuration();
    }
    mConfiguration.updateFrom(config);
    DisplayMetrics dm=getDisplayMetricsLocked(true);
    if (config.locale != null) {
      Locale.setDefault(config.locale);
    }
    Resources.updateSystemConfiguration(config,dm);
    ApplicationContext.ApplicationPackageManager.configurationChanged();
{
      Iterator<WeakReference<Resources>> it=mActiveResources.values().iterator();
      while (it.hasNext()) {
        WeakReference<Resources> v=it.next();
        Resources r=v.get();
        if (r != null) {
          r.updateConfiguration(config,dm);
        }
 else {
          it.remove();
        }
      }
    }
    callbacks=collectComponentCallbacksLocked(false,config);
  }
  final int N=callbacks.size();
  for (int i=0; i < N; i++) {
    performConfigurationChanged(callbacks.get(i),config);
  }
}
Program: 183446
Project: 183446
Buggy source:
/** 
 * Create a new MotionEvent, copying from an existing one.
 */
static public MotionEvent obtain(MotionEvent o){
  MotionEvent ev=obtain();
  ev.mDeviceId=o.mDeviceId;
  ev.mEdgeFlags=o.mEdgeFlags;
  ev.mDownTime=o.mDownTime;
  ev.mEventTimeNano=o.mEventTimeNano;
  ev.mAction=o.mAction;
  ev.mNumPointers=o.mNumPointers;
  ev.mRawX=o.mRawX;
  ev.mRawY=o.mRawY;
  ev.mMetaState=o.mMetaState;
  ev.mXPrecision=o.mXPrecision;
  ev.mYPrecision=o.mYPrecision;
  final int NT=ev.mNumSamples=o.mNumSamples;
  if (ev.mTimeSamples.length < NT) {
    System.arraycopy(o.mTimeSamples,0,ev.mTimeSamples,0,NT);
  }
 else {
    ev.mTimeSamples=(long[])o.mTimeSamples.clone();
  }
  final int NS=(ev.mNumPointers=o.mNumPointers) * NT;
  if (ev.mStateSamples.length < NS) {
    System.arraycopy(o.mStateSamples,0,ev.mStateSamples,0,NS);
  }
 else {
    ev.mStateSamples=(int[])o.mStateSamples.clone();
  }
  final int ND=NS * NUM_SAMPLE_DATA;
  if (ev.mDataSamples.length < ND) {
    System.arraycopy(o.mDataSamples,0,ev.mDataSamples,0,ND);
  }
 else {
    ev.mDataSamples=(float[])o.mDataSamples.clone();
  }
  return ev;
}

Fixed version (ground truth):
/** 
 * Create a new MotionEvent, copying from an existing one.
 */
static public MotionEvent obtain(MotionEvent o){
  MotionEvent ev=obtain();
  ev.mDeviceId=o.mDeviceId;
  ev.mEdgeFlags=o.mEdgeFlags;
  ev.mDownTime=o.mDownTime;
  ev.mEventTimeNano=o.mEventTimeNano;
  ev.mAction=o.mAction;
  ev.mNumPointers=o.mNumPointers;
  ev.mRawX=o.mRawX;
  ev.mRawY=o.mRawY;
  ev.mMetaState=o.mMetaState;
  ev.mXPrecision=o.mXPrecision;
  ev.mYPrecision=o.mYPrecision;
  final int NT=ev.mNumSamples=o.mNumSamples;
  if (ev.mTimeSamples.length >= NT) {
    System.arraycopy(o.mTimeSamples,0,ev.mTimeSamples,0,NT);
  }
 else {
    ev.mTimeSamples=(long[])o.mTimeSamples.clone();
  }
  final int NS=(ev.mNumPointers=o.mNumPointers) * NT;
  if (ev.mStateSamples.length < NS) {
    System.arraycopy(o.mStateSamples,0,ev.mStateSamples,0,NS);
  }
 else {
    ev.mStateSamples=(int[])o.mStateSamples.clone();
  }
  final int ND=NS * NUM_SAMPLE_DATA;
  if (ev.mDataSamples.length < ND) {
    System.arraycopy(o.mDataSamples,0,ev.mDataSamples,0,ND);
  }
 else {
    ev.mDataSamples=(float[])o.mDataSamples.clone();
  }
  return ev;
}
Program: 183448
Project: 183448
Buggy source:
/** 
 * Stops all speech output and removes any utterances still in the queue globally.
 */
private int stopAll(String callingApp){
  int result=TextToSpeech.TTS_ERROR;
  boolean speechQueueAvailable=false;
  try {
    speechQueueAvailable=speechQueueLock.tryLock(1000,TimeUnit.MILLISECONDS);
    if (speechQueueAvailable) {
      for (int i=mSpeechQueue.size() - 1; i > -1; i--) {
        if (mSpeechQueue.get(i).mType != SpeechItem.TEXT_TO_FILE) {
          mSpeechQueue.remove(i);
        }
      }
      if ((mCurrentSpeechItem != null) && ((mCurrentSpeechItem.mType != SpeechItem.TEXT_TO_FILE) || mCurrentSpeechItem.mCallingApp.equals(callingApp))) {
        result=sNativeSynth.stop();
        mKillList.put(mCurrentSpeechItem,true);
        if (mPlayer != null) {
          try {
            mPlayer.stop();
          }
 catch (          IllegalStateException e) {
          }
        }
        mIsSpeaking=false;
        mCurrentSpeechItem=null;
      }
 else {
        result=TextToSpeech.TTS_SUCCESS;
      }
      Log.i("String_Node_Str","String_Node_Str");
    }
  }
 catch (  InterruptedException e) {
    Log.e("String_Node_Str","String_Node_Str");
    e.printStackTrace();
  }
 finally {
    if (speechQueueAvailable) {
      speechQueueLock.unlock();
    }
    return result;
  }
}

Fixed version (ground truth):
/** 
 * Stops all speech output and removes any utterances still in the queue globally.
 */
private int stopAll(String callingApp){
  int result=TextToSpeech.TTS_ERROR;
  boolean speechQueueAvailable=false;
  try {
    speechQueueAvailable=speechQueueLock.tryLock(SPEECHQUEUELOCK_TIMEOUT,TimeUnit.MILLISECONDS);
    if (speechQueueAvailable) {
      for (int i=mSpeechQueue.size() - 1; i > -1; i--) {
        if (mSpeechQueue.get(i).mType != SpeechItem.TEXT_TO_FILE) {
          mSpeechQueue.remove(i);
        }
      }
      if ((mCurrentSpeechItem != null) && ((mCurrentSpeechItem.mType != SpeechItem.TEXT_TO_FILE) || mCurrentSpeechItem.mCallingApp.equals(callingApp))) {
        result=sNativeSynth.stop();
        mKillList.put(mCurrentSpeechItem,true);
        if (mPlayer != null) {
          try {
            mPlayer.stop();
          }
 catch (          IllegalStateException e) {
          }
        }
        mIsSpeaking=false;
        mCurrentSpeechItem=null;
      }
 else {
        result=TextToSpeech.TTS_SUCCESS;
      }
      Log.i("String_Node_Str","String_Node_Str");
    }
  }
 catch (  InterruptedException e) {
    Log.e("String_Node_Str","String_Node_Str");
    e.printStackTrace();
  }
 finally {
    if (speechQueueAvailable) {
      speechQueueLock.unlock();
    }
    return result;
  }
}
Program: 183450
Project: 183450
Buggy source:
private Object responseCdmaCallWaiting(Parcel p){
  CdmaCallWaitingNotification notification=new CdmaCallWaitingNotification();
  notification.number=p.readString();
  notification.numberPresentation=p.readInt();
  notification.name=p.readString();
  notification.namePresentation=notification.numberPresentation;
  notification.isPresent=p.readInt();
  notification.signalType=p.readInt();
  notification.alertPitch=p.readInt();
  notification.signal=p.readInt();
  return notification;
}

Fixed version (ground truth):
private Object responseCdmaCallWaiting(Parcel p){
  CdmaCallWaitingNotification notification=new CdmaCallWaitingNotification();
  notification.number=p.readString();
  notification.numberPresentation=notification.presentationFromCLIP(p.readInt());
  notification.name=p.readString();
  notification.namePresentation=notification.numberPresentation;
  notification.isPresent=p.readInt();
  notification.signalType=p.readInt();
  notification.alertPitch=p.readInt();
  notification.signal=p.readInt();
  return notification;
}
Program: 183453
Project: 183453
Buggy source:
/** 
 * Recycles an event if it can be safely recycled. The condition is that no not notified service is interested in the event.
 * @param event The event.
 */
private void tryRecycleLocked(AccessibilityEvent event){
  int eventType=event.getEventType();
  List<Service> services=mServices;
  for (int i=0, count=services.size(); i < count; i++) {
    Service service=services.get(i);
    if (service.mPendingEvents.get(eventType) == event) {
      return;
    }
  }
  event.recycle();
}

Fixed version (ground truth):
/** 
 * Recycles an event if it can be safely recycled. The condition is that no not notified service is interested in the event.
 * @param event The event.
 */
private void tryRecycleLocked(AccessibilityEvent event){
  if (event == null) {
    return;
  }
  int eventType=event.getEventType();
  List<Service> services=mServices;
  for (int i=0, count=services.size(); i < count; i++) {
    Service service=services.get(i);
    if (service.mPendingEvents.get(eventType) == event) {
      return;
    }
  }
  event.recycle();
}
Program: 183454
Project: 183454
Buggy source:
/** 
 * Request the device MDN / H_SID / H_NID / MIN. "response" is const char  [0] is MDN if CDMA subscription is available [1] is H_SID (Home SID) if CDMA subscription is available [2] is H_NID (Home NID) if CDMA subscription is available [3] is MIN (10 digits, MIN2+MIN1) if CDMA subscription is available
 */
public void getCDMASubscription(Message response);

Fixed version (ground truth):
/** 
 * Request the device MDN / H_SID / H_NID / MIN. "response" is const char  [0] is MDN if CDMA subscription is available [1] is H_SID (Home SID) in hexadecimal if CDMA subscription is available [2] is H_NID (Home NID) in hexadecimal if CDMA subscription is available [3] is MIN (10 digits, MIN2+MIN1) if CDMA subscription is available
 */
public void getCDMASubscription(Message response);
Program: 183456
Project: 183456
Buggy source:
/** 
 * @return Whether music is being played right now.
 */
boolean isMusicActive(){
  final IAudioService audio=getAudioInterface();
  if (audio == null) {
    Log.w(TAG,"String_Node_Str");
    return false;
  }
  try {
    return audio.isMusicActive();
  }
 catch (  RemoteException e) {
    Log.w(TAG,"String_Node_Str" + e);
    return false;
  }
}

Fixed version (ground truth):
/** 
 * @return Whether music is being played right now.
 */
boolean isMusicActive(){
  final AudioManager am=(AudioManager)mContext.getSystemService(Context.AUDIO_SERVICE);
  if (am == null) {
    Log.w(TAG,"String_Node_Str");
    return false;
  }
  return am.isMusicActive();
}
Program: 183458
Project: 183458
Buggy source:
private void assertParse() throws Exception {
  mParcel.writeInt(kToken);
  mParcel.setDataPosition(0);
  assertTrue(mMetadata.parse(mParcel));
  assertEquals(kToken,mParcel.readInt());
}

Fixed version (ground truth):
private void assertParse() throws Exception {
  mParcel.setDataPosition(0);
  assertTrue(mMetadata.parse(mParcel));
}
Program: 183459
Project: 183459
Buggy source:
private void persistVolume(VolumeStreamState streamState){
  System.putInt(mContentResolver,streamState.mVolumeIndexSettingName,streamState.mIndex);
  System.putInt(mContentResolver,streamState.mLastAudibleVolumeIndexSettingName,streamState.mLastAudibleIndex);
}

Fixed version (ground truth):
private void persistVolume(VolumeStreamState streamState){
  if (streamState.mStreamType != AudioManager.STREAM_BLUETOOTH_SCO) {
    System.putInt(mContentResolver,streamState.mVolumeIndexSettingName,streamState.mIndex);
    System.putInt(mContentResolver,streamState.mLastAudibleVolumeIndexSettingName,streamState.mLastAudibleIndex);
  }
}
Program: 183460
Project: 183460
Buggy source:
void acceptCall() throws CallStateException {
  if (ringingCall.getState() == CdmaCall.State.INCOMING) {
    Log.i("String_Node_Str","String_Node_Str");
    setMute(false);
    cm.acceptCall(obtainCompleteMessage());
  }
 else   if (ringingCall.getState() == CdmaCall.State.WAITING) {
    CdmaConnection cwConn=(CdmaConnection)(ringingCall.getLatestConnection());
    cwConn.updateParent(ringingCall,foregroundCall);
    cwConn.onConnectedInOrOut();
    switchWaitingOrHoldingAndActive();
  }
 else {
    throw new CallStateException("String_Node_Str");
  }
}

Fixed version (ground truth):
void acceptCall() throws CallStateException {
  if (ringingCall.getState() == CdmaCall.State.INCOMING) {
    Log.i("String_Node_Str","String_Node_Str");
    setMute(false);
    cm.acceptCall(obtainCompleteMessage());
  }
 else   if (ringingCall.getState() == CdmaCall.State.WAITING) {
    CdmaConnection cwConn=(CdmaConnection)(ringingCall.getLatestConnection());
    cwConn.updateParent(ringingCall,foregroundCall);
    cwConn.onConnectedInOrOut();
    updatePhoneState();
    switchWaitingOrHoldingAndActive();
  }
 else {
    throw new CallStateException("String_Node_Str");
  }
}
Program: 183462
Project: 183462
Buggy source:
private void handleCallWaitingInfo(CdmaCallWaitingNotification cw){
  if (foregroundCall.connections.size() > 1) {
    foregroundCall.setGeneric(true);
  }
  ringingCall.setGeneric(false);
  new CdmaConnection(phone.getContext(),cw,this,ringingCall);
  notifyCallWaitingInfo(cw);
}

Fixed version (ground truth):
private void handleCallWaitingInfo(CdmaCallWaitingNotification cw){
  if (foregroundCall.connections.size() > 1) {
    foregroundCall.setGeneric(true);
  }
  ringingCall.setGeneric(false);
  new CdmaConnection(phone.getContext(),cw,this,ringingCall);
  updatePhoneState();
  notifyCallWaitingInfo(cw);
}
Program: 183463
Project: 183463
Buggy source:
public ConfigurationInfo getDeviceConfigurationInfo(){
  ConfigurationInfo config=new ConfigurationInfo();
synchronized (this) {
    config.reqTouchScreen=mConfiguration.touchscreen;
    config.reqKeyboardType=mConfiguration.keyboard;
    config.reqNavigation=mConfiguration.navigation;
    if (mConfiguration.navigation != Configuration.NAVIGATION_NONAV) {
      config.reqInputFeatures|=ConfigurationInfo.INPUT_FEATURE_FIVE_WAY_NAV;
    }
    if (mConfiguration.keyboard != Configuration.KEYBOARD_UNDEFINED) {
      config.reqInputFeatures|=ConfigurationInfo.INPUT_FEATURE_HARD_KEYBOARD;
    }
  }
  return config;
}

Fixed version (ground truth):
public ConfigurationInfo getDeviceConfigurationInfo(){
  ConfigurationInfo config=new ConfigurationInfo();
synchronized (this) {
    config.reqTouchScreen=mConfiguration.touchscreen;
    config.reqKeyboardType=mConfiguration.keyboard;
    config.reqNavigation=mConfiguration.navigation;
    if (mConfiguration.navigation == Configuration.NAVIGATION_DPAD || mConfiguration.navigation == Configuration.NAVIGATION_TRACKBALL) {
      config.reqInputFeatures|=ConfigurationInfo.INPUT_FEATURE_FIVE_WAY_NAV;
    }
    if (mConfiguration.keyboard != Configuration.KEYBOARD_UNDEFINED && mConfiguration.keyboard != Configuration.KEYBOARD_NOKEYS) {
      config.reqInputFeatures|=ConfigurationInfo.INPUT_FEATURE_HARD_KEYBOARD;
    }
  }
  return config;
}
Program: 183464
Project: 183464
Buggy source:
public ConfigurationInfo getDeviceConfigurationInfo(){
  ConfigurationInfo config=new ConfigurationInfo();
synchronized (this) {
    config.reqTouchScreen=mConfiguration.touchscreen;
    config.reqKeyboardType=mConfiguration.keyboard;
    config.reqNavigation=mConfiguration.navigation;
    if (mConfiguration.navigation != Configuration.NAVIGATION_NONAV) {
      config.reqInputFeatures|=ConfigurationInfo.INPUT_FEATURE_FIVE_WAY_NAV;
    }
    if (mConfiguration.keyboard != Configuration.KEYBOARD_UNDEFINED) {
      config.reqInputFeatures|=ConfigurationInfo.INPUT_FEATURE_HARD_KEYBOARD;
    }
  }
  return config;
}

Fixed version (ground truth):
public ConfigurationInfo getDeviceConfigurationInfo(){
  ConfigurationInfo config=new ConfigurationInfo();
synchronized (this) {
    config.reqTouchScreen=mConfiguration.touchscreen;
    config.reqKeyboardType=mConfiguration.keyboard;
    config.reqNavigation=mConfiguration.navigation;
    if (mConfiguration.navigation == Configuration.NAVIGATION_DPAD || mConfiguration.navigation == Configuration.NAVIGATION_TRACKBALL) {
      config.reqInputFeatures|=ConfigurationInfo.INPUT_FEATURE_FIVE_WAY_NAV;
    }
    if (mConfiguration.keyboard != Configuration.KEYBOARD_UNDEFINED && mConfiguration.keyboard != Configuration.KEYBOARD_NOKEYS) {
      config.reqInputFeatures|=ConfigurationInfo.INPUT_FEATURE_HARD_KEYBOARD;
    }
  }
  return config;
}
Program: 183467
Project: 183467
Buggy source:
/** 
 * Converts the byte array provided to a unicode string.
 * @param b the byte array to convert to a string
 * @param includesNull determine if the byte string provided contains theUNICODE null character at the end or not; if it does, it will be removed
 * @return a Unicode string
 * @throws IllegalArgumentException if the byte array has an odd length
 */
public static String convertToUnicode(byte[] b,boolean includesNull){
  if (b == null) {
    return null;
  }
  int arrayLength=b.length;
  if (!((arrayLength % 2) == 0)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  arrayLength=(arrayLength >> 1);
  if (includesNull) {
    arrayLength-=1;
  }
  char[] c=new char[arrayLength];
  for (int i=0; i < arrayLength; i++) {
    int upper=b[2 * i];
    int lower=b[(2 * i) + 1];
    if (upper < 0) {
      upper+=256;
    }
    if (lower < 0) {
      lower+=256;
    }
    c[i]=(char)((upper << 8) | lower);
  }
  return new String(c);
}

Fixed version (ground truth):
/** 
 * Converts the byte array provided to a unicode string.
 * @param b the byte array to convert to a string
 * @param includesNull determine if the byte string provided contains theUNICODE null character at the end or not; if it does, it will be removed
 * @return a Unicode string
 * @throws IllegalArgumentException if the byte array has an odd length
 */
public static String convertToUnicode(byte[] b,boolean includesNull){
  if (b == null || b.length == 0) {
    return null;
  }
  int arrayLength=b.length;
  if (!((arrayLength % 2) == 0)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  arrayLength=(arrayLength >> 1);
  if (includesNull) {
    arrayLength-=1;
  }
  char[] c=new char[arrayLength];
  for (int i=0; i < arrayLength; i++) {
    int upper=b[2 * i];
    int lower=b[(2 * i) + 1];
    if (upper < 0) {
      upper+=256;
    }
    if (lower < 0) {
      lower+=256;
    }
    c[i]=(char)((upper << 8) | lower);
  }
  return new String(c);
}
Program: 183468
Project: 183468
Buggy source:
public void onCompletion(MediaPlayer arg0){
  String callingApp=mCurrentSpeechItem.mCallingApp;
  ArrayList<String> params=mCurrentSpeechItem.mParams;
  String utteranceId="String_Node_Str";
  if (params != null) {
    for (int i=0; i < params.size() - 1; i=i + 2) {
      String param=params.get(i);
      if (param.equals(TextToSpeech.Engine.TTS_KEY_PARAM_UTTERANCE_ID)) {
        utteranceId=params.get(i + 1);
      }
    }
  }
  if (utteranceId.length() > 0) {
    dispatchUtteranceCompletedCallback(utteranceId,callingApp);
  }
  mCurrentSpeechItem=null;
  processSpeechQueue();
}

Fixed version (ground truth):
public void onCompletion(MediaPlayer arg0){
  String callingApp=mCurrentSpeechItem.mCallingApp;
  ArrayList<String> params=mCurrentSpeechItem.mParams;
  String utteranceId="String_Node_Str";
  if (params != null) {
    for (int i=0; i < params.size() - 1; i=i + 2) {
      String param=params.get(i);
      if (param.equals(TextToSpeech.Engine.TTS_KEY_PARAM_UTTERANCE_ID)) {
        utteranceId=params.get(i + 1);
      }
    }
  }
  if (utteranceId.length() > 0) {
    dispatchUtteranceCompletedCallback(utteranceId,callingApp);
  }
  processSpeechQueue();
}
Program: 183470
Project: 183470
Buggy source:
private void silence(final SpeechItem speechItem){
class SilenceThread implements Runnable {
    public void run(){
      String utteranceId="String_Node_Str";
      if (speechItem.mParams != null) {
        for (int i=0; i < speechItem.mParams.size() - 1; i=i + 2) {
          String param=speechItem.mParams.get(i);
          if (param.equals(TextToSpeech.Engine.TTS_KEY_PARAM_UTTERANCE_ID)) {
            utteranceId=speechItem.mParams.get(i + 1);
          }
        }
      }
      try {
        Thread.sleep(speechItem.mDuration);
      }
 catch (      InterruptedException e) {
        e.printStackTrace();
      }
 finally {
        if (utteranceId.length() > 0) {
          dispatchUtteranceCompletedCallback(utteranceId,speechItem.mCallingApp);
        }
        mCurrentSpeechItem=null;
        processSpeechQueue();
      }
    }
  }
  Thread slnc=(new Thread(new SilenceThread()));
  slnc.setPriority(Thread.MIN_PRIORITY);
  slnc.start();
}

Fixed version (ground truth):
private void silence(final SpeechItem speechItem){
class SilenceThread implements Runnable {
    public void run(){
      String utteranceId="String_Node_Str";
      if (speechItem.mParams != null) {
        for (int i=0; i < speechItem.mParams.size() - 1; i=i + 2) {
          String param=speechItem.mParams.get(i);
          if (param.equals(TextToSpeech.Engine.TTS_KEY_PARAM_UTTERANCE_ID)) {
            utteranceId=speechItem.mParams.get(i + 1);
          }
        }
      }
      try {
        Thread.sleep(speechItem.mDuration);
      }
 catch (      InterruptedException e) {
        e.printStackTrace();
      }
 finally {
        if (utteranceId.length() > 0) {
          dispatchUtteranceCompletedCallback(utteranceId,speechItem.mCallingApp);
        }
        processSpeechQueue();
      }
    }
  }
  Thread slnc=(new Thread(new SilenceThread()));
  slnc.setPriority(Thread.MIN_PRIORITY);
  slnc.start();
}
Program: 183473
Project: 183473
Buggy source:
public void onChanged(NumberPicker picker,int oldVal,int newVal){
  mYear=newVal;
  if (mOnDateChangedListener != null) {
    mOnDateChangedListener.onDateChanged(DatePicker.this,mYear,mMonth,mDay);
  }
}

Fixed version (ground truth):
public void onChanged(NumberPicker picker,int oldVal,int newVal){
  mYear=newVal;
  adjustMaxDay();
  if (mOnDateChangedListener != null) {
    mOnDateChangedListener.onDateChanged(DatePicker.this,mYear,mMonth,mDay);
  }
  updateDaySpinner();
}
Program: 183475
Project: 183475
Buggy source:
private void validateCurrentView(CharSequence str){
  int val=getSelectedPos(str.toString());
  if ((val >= mStart) && (val <= mEnd)) {
    mPrevious=mCurrent;
    mCurrent=val;
    notifyChange();
  }
  updateView();
}

Fixed version (ground truth):
private void validateCurrentView(CharSequence str){
  int val=getSelectedPos(str.toString());
  if ((val >= mStart) && (val <= mEnd)) {
    if (mCurrent != val) {
      mPrevious=mCurrent;
      mCurrent=val;
      notifyChange();
    }
  }
  updateView();
}
Program: 183476
Project: 183476
Buggy source:
private String makeUriString(){
  StringBuilder builder=new StringBuilder();
  if (scheme != null) {
    builder.append(scheme).append(':');
  }
  appendSspTo(builder);
  if (fragment != null && !fragment.isEmpty()) {
    builder.append('#').append(fragment.getEncoded());
  }
  return builder.toString();
}

Fixed version (ground truth):
private String makeUriString(){
  StringBuilder builder=new StringBuilder();
  if (scheme != null) {
    builder.append(scheme).append(':');
  }
  appendSspTo(builder);
  if (!fragment.isEmpty()) {
    builder.append('#').append(fragment.getEncoded());
  }
  return builder.toString();
}
Program: 183477
Project: 183477
Buggy source:
/** 
 * Searches the query string for parameter values with the given key.
 * @param key which will be encoded
 * @throws UnsupportedOperationException if this isn't a hierarchical URI
 * @throws NullPointerException if key is null
 * @return a list of decoded values
 */
public List<String> getQueryParameters(String key){
  if (isOpaque()) {
    throw new UnsupportedOperationException(NOT_HIERARCHICAL);
  }
  String query=getQuery();
  if (query == null) {
    return Collections.emptyList();
  }
  String encodedKey;
  try {
    encodedKey=URLEncoder.encode(key,DEFAULT_ENCODING);
  }
 catch (  UnsupportedEncodingException e) {
    throw new AssertionError(e);
  }
  query="String_Node_Str" + query;
  String prefix="String_Node_Str" + encodedKey + "String_Node_Str";
  ArrayList<String> values=new ArrayList<String>();
  int start=0;
  int length=query.length();
  while (start < length) {
    start=query.indexOf(prefix,start);
    if (start == -1) {
      break;
    }
    start+=prefix.length();
    int end=query.indexOf('&',start);
    if (end == -1) {
      end=query.length();
    }
    String value=query.substring(start,end);
    values.add(decode(value));
    start=end;
  }
  return Collections.unmodifiableList(values);
}

Fixed version (ground truth):
/** 
 * Searches the query string for parameter values with the given key.
 * @param key which will be encoded
 * @throws UnsupportedOperationException if this isn't a hierarchical URI
 * @throws NullPointerException if key is null
 * @return a list of decoded values
 */
public List<String> getQueryParameters(String key){
  if (isOpaque()) {
    throw new UnsupportedOperationException(NOT_HIERARCHICAL);
  }
  String query=getEncodedQuery();
  if (query == null) {
    return Collections.emptyList();
  }
  String encodedKey;
  try {
    encodedKey=URLEncoder.encode(key,DEFAULT_ENCODING);
  }
 catch (  UnsupportedEncodingException e) {
    throw new AssertionError(e);
  }
  query="String_Node_Str" + query;
  String prefix="String_Node_Str" + encodedKey + "String_Node_Str";
  ArrayList<String> values=new ArrayList<String>();
  int start=0;
  int length=query.length();
  while (start < length) {
    start=query.indexOf(prefix,start);
    if (start == -1) {
      break;
    }
    start+=prefix.length();
    int end=query.indexOf('&',start);
    if (end == -1) {
      end=query.length();
    }
    String value=query.substring(start,end);
    values.add(decode(value));
    start=end;
  }
  return Collections.unmodifiableList(values);
}
Program: 183478
Project: 183478
Buggy source:
/** 
 * Searches the query string for the first value with the given key.
 * @param key which will be encoded
 * @throws UnsupportedOperationException if this isn't a hierarchical URI
 * @throws NullPointerException if key is null
 * @return the decoded value or null if no parameter is found
 */
public String getQueryParameter(String key){
  if (isOpaque()) {
    throw new UnsupportedOperationException(NOT_HIERARCHICAL);
  }
  String query=getQuery();
  if (query == null) {
    return null;
  }
  String encodedKey;
  try {
    encodedKey=URLEncoder.encode(key,DEFAULT_ENCODING);
  }
 catch (  UnsupportedEncodingException e) {
    throw new AssertionError(e);
  }
  String prefix=encodedKey + "String_Node_Str";
  if (query.length() < prefix.length()) {
    return null;
  }
  int start;
  if (query.startsWith(prefix)) {
    start=prefix.length();
  }
 else {
    prefix="String_Node_Str" + prefix;
    start=query.indexOf(prefix);
    if (start == -1) {
      return null;
    }
    start+=prefix.length();
  }
  int end=query.indexOf('&',start);
  if (end == -1) {
    end=query.length();
  }
  String value=query.substring(start,end);
  return decode(value);
}

Fixed version (ground truth):
/** 
 * Searches the query string for the first value with the given key.
 * @param key which will be encoded
 * @throws UnsupportedOperationException if this isn't a hierarchical URI
 * @throws NullPointerException if key is null
 * @return the decoded value or null if no parameter is found
 */
public String getQueryParameter(String key){
  if (isOpaque()) {
    throw new UnsupportedOperationException(NOT_HIERARCHICAL);
  }
  String query=getEncodedQuery();
  if (query == null) {
    return null;
  }
  String encodedKey;
  try {
    encodedKey=URLEncoder.encode(key,DEFAULT_ENCODING);
  }
 catch (  UnsupportedEncodingException e) {
    throw new AssertionError(e);
  }
  String prefix=encodedKey + "String_Node_Str";
  if (query.length() < prefix.length()) {
    return null;
  }
  int start;
  if (query.startsWith(prefix)) {
    start=prefix.length();
  }
 else {
    prefix="String_Node_Str" + prefix;
    start=query.indexOf(prefix);
    if (start == -1) {
      return null;
    }
    start+=prefix.length();
  }
  int end=query.indexOf('&',start);
  if (end == -1) {
    end=query.length();
  }
  String value=query.substring(start,end);
  return decode(value);
}