nus-yam/ex-repair huggingface dataset:
Program: 181614
Project: 181614
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);
  }
  if (key == null) {
    throw new NullPointerException("String_Node_Str");
  }
  final String query=getEncodedQuery();
  if (query == null) {
    return null;
  }
  final String encodedKey=encode(key,null);
  final int encodedKeyLength=encodedKey.length();
  int encodedKeySearchIndex=0;
  final int encodedKeySearchEnd=query.length() - (encodedKeyLength + 1);
  while (encodedKeySearchIndex <= encodedKeySearchEnd) {
    int keyIndex=query.indexOf(encodedKey,encodedKeySearchIndex);
    if (keyIndex == -1) {
      break;
    }
    final int equalsIndex=keyIndex + encodedKeyLength;
    if (query.charAt(equalsIndex) != '=') {
      encodedKeySearchIndex=equalsIndex + 1;
      continue;
    }
    if (keyIndex == 0 || query.charAt(keyIndex - 1) == '&') {
      int end=query.indexOf('&',equalsIndex);
      if (end == -1) {
        end=query.length();
      }
      return decode(query.substring(equalsIndex + 1,end));
    }
 else {
      encodedKeySearchIndex=equalsIndex + 1;
    }
  }
  return null;
}

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);
  }
  if (key == null) {
    throw new NullPointerException("String_Node_Str");
  }
  final String query=getEncodedQuery();
  if (query == null) {
    return null;
  }
  final String encodedKey=encode(key,null);
  final int encodedKeyLength=encodedKey.length();
  int encodedKeySearchIndex=0;
  final int encodedKeySearchEnd=query.length() - (encodedKeyLength + 1);
  while (encodedKeySearchIndex <= encodedKeySearchEnd) {
    int keyIndex=query.indexOf(encodedKey,encodedKeySearchIndex);
    if (keyIndex == -1) {
      break;
    }
    final int equalsIndex=keyIndex + encodedKeyLength;
    if (equalsIndex >= query.length()) {
      break;
    }
    if (query.charAt(equalsIndex) != '=') {
      encodedKeySearchIndex=equalsIndex + 1;
      continue;
    }
    if (keyIndex == 0 || query.charAt(keyIndex - 1) == '&') {
      int end=query.indexOf('&',equalsIndex);
      if (end == -1) {
        end=query.length();
      }
      return decode(query.substring(equalsIndex + 1,end));
    }
 else {
      encodedKeySearchIndex=equalsIndex + 1;
    }
  }
  return null;
}
Program: 181616
Project: 181616
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);
  }
  if (key == null) {
    throw new NullPointerException("String_Node_Str");
  }
  final String query=getEncodedQuery();
  if (query == null) {
    return null;
  }
  final String encodedKey=encode(key,null);
  final int encodedKeyLength=encodedKey.length();
  int encodedKeySearchIndex=0;
  final int encodedKeySearchEnd=query.length() - (encodedKeyLength + 1);
  while (encodedKeySearchIndex <= encodedKeySearchEnd) {
    int keyIndex=query.indexOf(encodedKey,encodedKeySearchIndex);
    if (keyIndex == -1) {
      break;
    }
    final int equalsIndex=keyIndex + encodedKeyLength;
    if (query.charAt(equalsIndex) != '=') {
      encodedKeySearchIndex=equalsIndex + 1;
      continue;
    }
    if (keyIndex == 0 || query.charAt(keyIndex - 1) == '&') {
      int end=query.indexOf('&',equalsIndex);
      if (end == -1) {
        end=query.length();
      }
      return decode(query.substring(equalsIndex + 1,end));
    }
 else {
      encodedKeySearchIndex=equalsIndex + 1;
    }
  }
  return null;
}

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);
  }
  if (key == null) {
    throw new NullPointerException("String_Node_Str");
  }
  final String query=getEncodedQuery();
  if (query == null) {
    return null;
  }
  final String encodedKey=encode(key,null);
  final int encodedKeyLength=encodedKey.length();
  int encodedKeySearchIndex=0;
  final int encodedKeySearchEnd=query.length() - (encodedKeyLength + 1);
  while (encodedKeySearchIndex <= encodedKeySearchEnd) {
    int keyIndex=query.indexOf(encodedKey,encodedKeySearchIndex);
    if (keyIndex == -1) {
      break;
    }
    final int equalsIndex=keyIndex + encodedKeyLength;
    if (equalsIndex >= query.length()) {
      break;
    }
    if (query.charAt(equalsIndex) != '=') {
      encodedKeySearchIndex=equalsIndex + 1;
      continue;
    }
    if (keyIndex == 0 || query.charAt(keyIndex - 1) == '&') {
      int end=query.indexOf('&',equalsIndex);
      if (end == -1) {
        end=query.length();
      }
      return decode(query.substring(equalsIndex + 1,end));
    }
 else {
      encodedKeySearchIndex=equalsIndex + 1;
    }
  }
  return null;
}
Program: 181618
Project: 181618
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);
  }
  if (key == null) {
    throw new NullPointerException("String_Node_Str");
  }
  final String query=getEncodedQuery();
  if (query == null) {
    return null;
  }
  final String encodedKey=encode(key,null);
  final int encodedKeyLength=encodedKey.length();
  int encodedKeySearchIndex=0;
  final int encodedKeySearchEnd=query.length() - (encodedKeyLength + 1);
  while (encodedKeySearchIndex <= encodedKeySearchEnd) {
    int keyIndex=query.indexOf(encodedKey,encodedKeySearchIndex);
    if (keyIndex == -1) {
      break;
    }
    final int equalsIndex=keyIndex + encodedKeyLength;
    if (query.charAt(equalsIndex) != '=') {
      encodedKeySearchIndex=equalsIndex + 1;
      continue;
    }
    if (keyIndex == 0 || query.charAt(keyIndex - 1) == '&') {
      int end=query.indexOf('&',equalsIndex);
      if (end == -1) {
        end=query.length();
      }
      return decode(query.substring(equalsIndex + 1,end));
    }
 else {
      encodedKeySearchIndex=equalsIndex + 1;
    }
  }
  return null;
}

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);
  }
  if (key == null) {
    throw new NullPointerException("String_Node_Str");
  }
  final String query=getEncodedQuery();
  if (query == null) {
    return null;
  }
  final String encodedKey=encode(key,null);
  final int encodedKeyLength=encodedKey.length();
  int encodedKeySearchIndex=0;
  final int encodedKeySearchEnd=query.length() - (encodedKeyLength + 1);
  while (encodedKeySearchIndex <= encodedKeySearchEnd) {
    int keyIndex=query.indexOf(encodedKey,encodedKeySearchIndex);
    if (keyIndex == -1) {
      break;
    }
    final int equalsIndex=keyIndex + encodedKeyLength;
    if (equalsIndex >= query.length()) {
      break;
    }
    if (query.charAt(equalsIndex) != '=') {
      encodedKeySearchIndex=equalsIndex + 1;
      continue;
    }
    if (keyIndex == 0 || query.charAt(keyIndex - 1) == '&') {
      int end=query.indexOf('&',equalsIndex);
      if (end == -1) {
        end=query.length();
      }
      return decode(query.substring(equalsIndex + 1,end));
    }
 else {
      encodedKeySearchIndex=equalsIndex + 1;
    }
  }
  return null;
}
Program: 181620
Project: 181620
Buggy source:
/** 
 * TODO document for SDK Abandon audio focus.
 * @return {@link #AUDIOFOCUS_REQUEST_FAILED} or {@link #AUDIOFOCUS_REQUEST_GRANTED}
 */
public int abandonAudioFocus(OnAudioFocusChangeListener l){
  int status=AUDIOFOCUS_REQUEST_FAILED;
  registerAudioFocusListener(l);
  IAudioService service=getService();
  try {
    status=service.abandonAudioFocus(mAudioFocusDispatcher,getIdForAudioFocusListener(l));
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str" + e);
  }
  return status;
}

Fixed version (ground truth):
/** 
 * TODO document for SDK Abandon audio focus.
 * @return {@link #AUDIOFOCUS_REQUEST_FAILED} or {@link #AUDIOFOCUS_REQUEST_GRANTED}
 */
public int abandonAudioFocus(OnAudioFocusChangeListener l){
  int status=AUDIOFOCUS_REQUEST_FAILED;
  unregisterAudioFocusListener(l);
  IAudioService service=getService();
  try {
    status=service.abandonAudioFocus(mAudioFocusDispatcher,getIdForAudioFocusListener(l));
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str" + e);
  }
  return status;
}
Program: 181621
Project: 181621
Buggy source:
/** 
 * Register a listener for audio focus updates.
 */
public void registerAudioFocusListener(OnAudioFocusChangeListener l){
synchronized (mFocusListenerLock) {
    if (mAudioFocusIdListenerMap.containsKey(getIdForAudioFocusListener(l))) {
      return;
    }
    mAudioFocusIdListenerMap.put(getIdForAudioFocusListener(l),l);
  }
}

Fixed version (ground truth):
/** 
 * TODO hide
 */
public void registerAudioFocusListener(OnAudioFocusChangeListener l){
synchronized (mFocusListenerLock) {
    if (mAudioFocusIdListenerMap.containsKey(getIdForAudioFocusListener(l))) {
      return;
    }
    mAudioFocusIdListenerMap.put(getIdForAudioFocusListener(l),l);
  }
}
Program: 181622
Project: 181622
Buggy source:
/** 
 * TODO document for SDK
 */
public void unregisterAudioFocusListener(OnAudioFocusChangeListener l){
  IAudioService service=getService();
  try {
    service.unregisterAudioFocusClient(getIdForAudioFocusListener(l));
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str" + e);
  }
synchronized (mFocusListenerLock) {
    mAudioFocusIdListenerMap.remove(getIdForAudioFocusListener(l));
  }
}

Fixed version (ground truth):
/** 
 * TODO hide
 */
public void unregisterAudioFocusListener(OnAudioFocusChangeListener l){
synchronized (mFocusListenerLock) {
    mAudioFocusIdListenerMap.remove(getIdForAudioFocusListener(l));
  }
}
Program: 181623
Project: 181623
Buggy source:
/** 
 * @see AudioManager#abandonAudioFocus(IAudioFocusDispatcher) 
 */
public int abandonAudioFocus(IAudioFocusDispatcher fl,String clientId){
  Log.i(TAG,"String_Node_Str" + clientId);
synchronized (mFocusStack) {
    removeFocusStackEntry(clientId,true);
  }
  return AudioManager.AUDIOFOCUS_REQUEST_GRANTED;
}

Fixed version (ground truth):
/** 
 * @see AudioManager#abandonAudioFocus(IAudioFocusDispatcher) 
 */
public int abandonAudioFocus(IAudioFocusDispatcher fl,String clientId){
  Log.i(TAG,"String_Node_Str" + clientId);
  try {
synchronized (mAudioFocusLock) {
      removeFocusStackEntry(clientId,true);
    }
  }
 catch (  java.util.ConcurrentModificationException cme) {
    Log.e(TAG,"String_Node_Str" + cme);
    cme.printStackTrace();
  }
  return AudioManager.AUDIOFOCUS_REQUEST_GRANTED;
}
Program: 181624
Project: 181624
Buggy source:
public void binderDied(){
synchronized (mFocusStack) {
    Log.w(TAG,"String_Node_Str");
    removeFocusStackEntryForClient(mCb);
  }
}

Fixed version (ground truth):
public void binderDied(){
synchronized (mAudioFocusLock) {
    Log.w(TAG,"String_Node_Str");
    removeFocusStackEntryForClient(mCb);
  }
}
Program: 181625
Project: 181625
Buggy source:
public void unregisterAudioFocusClient(String clientId){
synchronized (mFocusStack) {
    removeFocusStackEntry(clientId,false);
  }
}

Fixed version (ground truth):
public void unregisterAudioFocusClient(String clientId){
synchronized (mAudioFocusLock) {
    removeFocusStackEntry(clientId,false);
  }
}
Program: 181627
Project: 181627
Buggy source:
/** 
 * Helper function: Display in the log the current entries in the audio focus stack
 */
private void dumpFocusStack(PrintWriter pw){
  pw.println("String_Node_Str");
synchronized (mFocusStack) {
    Iterator<FocusStackEntry> stackIterator=mFocusStack.iterator();
    while (stackIterator.hasNext()) {
      FocusStackEntry fse=stackIterator.next();
      pw.println("String_Node_Str" + fse.mSourceRef + "String_Node_Str"+ fse.mClientId+ "String_Node_Str"+ fse.mFocusChangeType);
    }
  }
}

Fixed version (ground truth):
/** 
 * Helper function: Display in the log the current entries in the audio focus stack
 */
private void dumpFocusStack(PrintWriter pw){
  pw.println("String_Node_Str");
synchronized (mAudioFocusLock) {
    Iterator<FocusStackEntry> stackIterator=mFocusStack.iterator();
    while (stackIterator.hasNext()) {
      FocusStackEntry fse=stackIterator.next();
      pw.println("String_Node_Str" + fse.mSourceRef + "String_Node_Str"+ fse.mClientId+ "String_Node_Str"+ fse.mFocusChangeType);
    }
  }
}
Program: 181628
Project: 181628
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);
  }
  if (key == null) {
    throw new NullPointerException("String_Node_Str");
  }
  final String query=getEncodedQuery();
  if (query == null) {
    return null;
  }
  final String encodedKey=encode(key,null);
  final int encodedKeyLength=encodedKey.length();
  int encodedKeySearchIndex=0;
  final int encodedKeySearchEnd=query.length() - (encodedKeyLength + 1);
  while (encodedKeySearchIndex <= encodedKeySearchEnd) {
    int keyIndex=query.indexOf(encodedKey,encodedKeySearchIndex);
    if (keyIndex == -1) {
      break;
    }
    final int equalsIndex=keyIndex + encodedKeyLength;
    if (query.charAt(equalsIndex) != '=') {
      encodedKeySearchIndex=equalsIndex + 1;
      continue;
    }
    if (keyIndex == 0 || query.charAt(keyIndex - 1) == '&') {
      int end=query.indexOf('&',equalsIndex);
      if (end == -1) {
        end=query.length();
      }
      return decode(query.substring(equalsIndex + 1,end));
    }
 else {
      encodedKeySearchIndex=equalsIndex + 1;
    }
  }
  return null;
}

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);
  }
  if (key == null) {
    throw new NullPointerException("String_Node_Str");
  }
  final String query=getEncodedQuery();
  if (query == null) {
    return null;
  }
  final String encodedKey=encode(key,null);
  final int encodedKeyLength=encodedKey.length();
  int encodedKeySearchIndex=0;
  final int encodedKeySearchEnd=query.length() - (encodedKeyLength + 1);
  while (encodedKeySearchIndex <= encodedKeySearchEnd) {
    int keyIndex=query.indexOf(encodedKey,encodedKeySearchIndex);
    if (keyIndex == -1) {
      break;
    }
    final int equalsIndex=keyIndex + encodedKeyLength;
    if (equalsIndex >= query.length()) {
      break;
    }
    if (query.charAt(equalsIndex) != '=') {
      encodedKeySearchIndex=equalsIndex + 1;
      continue;
    }
    if (keyIndex == 0 || query.charAt(keyIndex - 1) == '&') {
      int end=query.indexOf('&',equalsIndex);
      if (end == -1) {
        end=query.length();
      }
      return decode(query.substring(equalsIndex + 1,end));
    }
 else {
      encodedKeySearchIndex=equalsIndex + 1;
    }
  }
  return null;
}
Program: 181630
Project: 181630
Buggy source:
/** 
 * TODO document for SDK Abandon audio focus.
 * @return {@link #AUDIOFOCUS_REQUEST_FAILED} or {@link #AUDIOFOCUS_REQUEST_GRANTED}
 */
public int abandonAudioFocus(OnAudioFocusChangeListener l){
  int status=AUDIOFOCUS_REQUEST_FAILED;
  registerAudioFocusListener(l);
  IAudioService service=getService();
  try {
    status=service.abandonAudioFocus(mAudioFocusDispatcher,getIdForAudioFocusListener(l));
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str" + e);
  }
  return status;
}

Fixed version (ground truth):
/** 
 * TODO document for SDK Abandon audio focus.
 * @return {@link #AUDIOFOCUS_REQUEST_FAILED} or {@link #AUDIOFOCUS_REQUEST_GRANTED}
 */
public int abandonAudioFocus(OnAudioFocusChangeListener l){
  int status=AUDIOFOCUS_REQUEST_FAILED;
  unregisterAudioFocusListener(l);
  IAudioService service=getService();
  try {
    status=service.abandonAudioFocus(mAudioFocusDispatcher,getIdForAudioFocusListener(l));
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str" + e);
  }
  return status;
}
Program: 181631
Project: 181631
Buggy source:
/** 
 * Register a listener for audio focus updates.
 */
public void registerAudioFocusListener(OnAudioFocusChangeListener l){
synchronized (mFocusListenerLock) {
    if (mAudioFocusIdListenerMap.containsKey(getIdForAudioFocusListener(l))) {
      return;
    }
    mAudioFocusIdListenerMap.put(getIdForAudioFocusListener(l),l);
  }
}

Fixed version (ground truth):
/** 
 * TODO hide
 */
public void registerAudioFocusListener(OnAudioFocusChangeListener l){
synchronized (mFocusListenerLock) {
    if (mAudioFocusIdListenerMap.containsKey(getIdForAudioFocusListener(l))) {
      return;
    }
    mAudioFocusIdListenerMap.put(getIdForAudioFocusListener(l),l);
  }
}
Program: 181632
Project: 181632
Buggy source:
/** 
 * TODO document for SDK
 */
public void unregisterAudioFocusListener(OnAudioFocusChangeListener l){
  IAudioService service=getService();
  try {
    service.unregisterAudioFocusClient(getIdForAudioFocusListener(l));
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str" + e);
  }
synchronized (mFocusListenerLock) {
    mAudioFocusIdListenerMap.remove(getIdForAudioFocusListener(l));
  }
}

Fixed version (ground truth):
/** 
 * TODO hide
 */
public void unregisterAudioFocusListener(OnAudioFocusChangeListener l){
synchronized (mFocusListenerLock) {
    mAudioFocusIdListenerMap.remove(getIdForAudioFocusListener(l));
  }
}
Program: 181633
Project: 181633
Buggy source:
/** 
 * @see AudioManager#abandonAudioFocus(IAudioFocusDispatcher) 
 */
public int abandonAudioFocus(IAudioFocusDispatcher fl,String clientId){
  Log.i(TAG,"String_Node_Str" + clientId);
synchronized (mFocusStack) {
    removeFocusStackEntry(clientId,true);
  }
  return AudioManager.AUDIOFOCUS_REQUEST_GRANTED;
}

Fixed version (ground truth):
/** 
 * @see AudioManager#abandonAudioFocus(IAudioFocusDispatcher) 
 */
public int abandonAudioFocus(IAudioFocusDispatcher fl,String clientId){
  Log.i(TAG,"String_Node_Str" + clientId);
  try {
synchronized (mAudioFocusLock) {
      removeFocusStackEntry(clientId,true);
    }
  }
 catch (  java.util.ConcurrentModificationException cme) {
    Log.e(TAG,"String_Node_Str" + cme);
    cme.printStackTrace();
  }
  return AudioManager.AUDIOFOCUS_REQUEST_GRANTED;
}
Program: 181634
Project: 181634
Buggy source:
public void binderDied(){
synchronized (mFocusStack) {
    Log.w(TAG,"String_Node_Str");
    removeFocusStackEntryForClient(mCb);
  }
}

Fixed version (ground truth):
public void binderDied(){
synchronized (mAudioFocusLock) {
    Log.w(TAG,"String_Node_Str");
    removeFocusStackEntryForClient(mCb);
  }
}
Program: 181635
Project: 181635
Buggy source:
public void unregisterAudioFocusClient(String clientId){
synchronized (mFocusStack) {
    removeFocusStackEntry(clientId,false);
  }
}

Fixed version (ground truth):
public void unregisterAudioFocusClient(String clientId){
synchronized (mAudioFocusLock) {
    removeFocusStackEntry(clientId,false);
  }
}
Program: 181637
Project: 181637
Buggy source:
/** 
 * Helper function: Display in the log the current entries in the audio focus stack
 */
private void dumpFocusStack(PrintWriter pw){
  pw.println("String_Node_Str");
synchronized (mFocusStack) {
    Iterator<FocusStackEntry> stackIterator=mFocusStack.iterator();
    while (stackIterator.hasNext()) {
      FocusStackEntry fse=stackIterator.next();
      pw.println("String_Node_Str" + fse.mSourceRef + "String_Node_Str"+ fse.mClientId+ "String_Node_Str"+ fse.mFocusChangeType);
    }
  }
}

Fixed version (ground truth):
/** 
 * Helper function: Display in the log the current entries in the audio focus stack
 */
private void dumpFocusStack(PrintWriter pw){
  pw.println("String_Node_Str");
synchronized (mAudioFocusLock) {
    Iterator<FocusStackEntry> stackIterator=mFocusStack.iterator();
    while (stackIterator.hasNext()) {
      FocusStackEntry fse=stackIterator.next();
      pw.println("String_Node_Str" + fse.mSourceRef + "String_Node_Str"+ fse.mClientId+ "String_Node_Str"+ fse.mFocusChangeType);
    }
  }
}
Program: 181638
Project: 181638
Buggy source:
/** 
 * {@inheritDoc}
 */
public void playSoundEffect(int effectId){
  checkThread();
  final AudioManager audioManager=getAudioManager();
switch (effectId) {
case SoundEffectConstants.CLICK:
    audioManager.playSoundEffect(AudioManager.FX_KEY_CLICK);
  return;
case SoundEffectConstants.NAVIGATION_DOWN:
audioManager.playSoundEffect(AudioManager.FX_FOCUS_NAVIGATION_DOWN);
return;
case SoundEffectConstants.NAVIGATION_LEFT:
audioManager.playSoundEffect(AudioManager.FX_FOCUS_NAVIGATION_LEFT);
return;
case SoundEffectConstants.NAVIGATION_RIGHT:
audioManager.playSoundEffect(AudioManager.FX_FOCUS_NAVIGATION_RIGHT);
return;
case SoundEffectConstants.NAVIGATION_UP:
audioManager.playSoundEffect(AudioManager.FX_FOCUS_NAVIGATION_UP);
return;
default :
throw new IllegalArgumentException("String_Node_Str" + effectId + "String_Node_Str"+ SoundEffectConstants.class.getCanonicalName());
}
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
public void playSoundEffect(int effectId){
  checkThread();
  try {
    final AudioManager audioManager=getAudioManager();
switch (effectId) {
case SoundEffectConstants.CLICK:
      audioManager.playSoundEffect(AudioManager.FX_KEY_CLICK);
    return;
case SoundEffectConstants.NAVIGATION_DOWN:
  audioManager.playSoundEffect(AudioManager.FX_FOCUS_NAVIGATION_DOWN);
return;
case SoundEffectConstants.NAVIGATION_LEFT:
audioManager.playSoundEffect(AudioManager.FX_FOCUS_NAVIGATION_LEFT);
return;
case SoundEffectConstants.NAVIGATION_RIGHT:
audioManager.playSoundEffect(AudioManager.FX_FOCUS_NAVIGATION_RIGHT);
return;
case SoundEffectConstants.NAVIGATION_UP:
audioManager.playSoundEffect(AudioManager.FX_FOCUS_NAVIGATION_UP);
return;
default :
throw new IllegalArgumentException("String_Node_Str" + effectId + "String_Node_Str"+ SoundEffectConstants.class.getCanonicalName());
}
}
 catch (IllegalStateException e) {
Log.e(TAG,"String_Node_Str" + e);
e.printStackTrace();
}
}
Program: 181639
Project: 181639
Buggy source:
/** 
 * {@inheritDoc}
 */
public void playSoundEffect(int effectId){
  checkThread();
  final AudioManager audioManager=getAudioManager();
switch (effectId) {
case SoundEffectConstants.CLICK:
    audioManager.playSoundEffect(AudioManager.FX_KEY_CLICK);
  return;
case SoundEffectConstants.NAVIGATION_DOWN:
audioManager.playSoundEffect(AudioManager.FX_FOCUS_NAVIGATION_DOWN);
return;
case SoundEffectConstants.NAVIGATION_LEFT:
audioManager.playSoundEffect(AudioManager.FX_FOCUS_NAVIGATION_LEFT);
return;
case SoundEffectConstants.NAVIGATION_RIGHT:
audioManager.playSoundEffect(AudioManager.FX_FOCUS_NAVIGATION_RIGHT);
return;
case SoundEffectConstants.NAVIGATION_UP:
audioManager.playSoundEffect(AudioManager.FX_FOCUS_NAVIGATION_UP);
return;
default :
throw new IllegalArgumentException("String_Node_Str" + effectId + "String_Node_Str"+ SoundEffectConstants.class.getCanonicalName());
}
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
public void playSoundEffect(int effectId){
  checkThread();
  try {
    final AudioManager audioManager=getAudioManager();
switch (effectId) {
case SoundEffectConstants.CLICK:
      audioManager.playSoundEffect(AudioManager.FX_KEY_CLICK);
    return;
case SoundEffectConstants.NAVIGATION_DOWN:
  audioManager.playSoundEffect(AudioManager.FX_FOCUS_NAVIGATION_DOWN);
return;
case SoundEffectConstants.NAVIGATION_LEFT:
audioManager.playSoundEffect(AudioManager.FX_FOCUS_NAVIGATION_LEFT);
return;
case SoundEffectConstants.NAVIGATION_RIGHT:
audioManager.playSoundEffect(AudioManager.FX_FOCUS_NAVIGATION_RIGHT);
return;
case SoundEffectConstants.NAVIGATION_UP:
audioManager.playSoundEffect(AudioManager.FX_FOCUS_NAVIGATION_UP);
return;
default :
throw new IllegalArgumentException("String_Node_Str" + effectId + "String_Node_Str"+ SoundEffectConstants.class.getCanonicalName());
}
}
 catch (IllegalStateException e) {
Log.e(TAG,"String_Node_Str" + e);
e.printStackTrace();
}
}
Program: 181640
Project: 181640
Buggy source:
/** 
 * {@inheritDoc}
 */
public void playSoundEffect(int effectId){
  checkThread();
  final AudioManager audioManager=getAudioManager();
switch (effectId) {
case SoundEffectConstants.CLICK:
    audioManager.playSoundEffect(AudioManager.FX_KEY_CLICK);
  return;
case SoundEffectConstants.NAVIGATION_DOWN:
audioManager.playSoundEffect(AudioManager.FX_FOCUS_NAVIGATION_DOWN);
return;
case SoundEffectConstants.NAVIGATION_LEFT:
audioManager.playSoundEffect(AudioManager.FX_FOCUS_NAVIGATION_LEFT);
return;
case SoundEffectConstants.NAVIGATION_RIGHT:
audioManager.playSoundEffect(AudioManager.FX_FOCUS_NAVIGATION_RIGHT);
return;
case SoundEffectConstants.NAVIGATION_UP:
audioManager.playSoundEffect(AudioManager.FX_FOCUS_NAVIGATION_UP);
return;
default :
throw new IllegalArgumentException("String_Node_Str" + effectId + "String_Node_Str"+ SoundEffectConstants.class.getCanonicalName());
}
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
public void playSoundEffect(int effectId){
  checkThread();
  try {
    final AudioManager audioManager=getAudioManager();
switch (effectId) {
case SoundEffectConstants.CLICK:
      audioManager.playSoundEffect(AudioManager.FX_KEY_CLICK);
    return;
case SoundEffectConstants.NAVIGATION_DOWN:
  audioManager.playSoundEffect(AudioManager.FX_FOCUS_NAVIGATION_DOWN);
return;
case SoundEffectConstants.NAVIGATION_LEFT:
audioManager.playSoundEffect(AudioManager.FX_FOCUS_NAVIGATION_LEFT);
return;
case SoundEffectConstants.NAVIGATION_RIGHT:
audioManager.playSoundEffect(AudioManager.FX_FOCUS_NAVIGATION_RIGHT);
return;
case SoundEffectConstants.NAVIGATION_UP:
audioManager.playSoundEffect(AudioManager.FX_FOCUS_NAVIGATION_UP);
return;
default :
throw new IllegalArgumentException("String_Node_Str" + effectId + "String_Node_Str"+ SoundEffectConstants.class.getCanonicalName());
}
}
 catch (IllegalStateException e) {
Log.e(TAG,"String_Node_Str" + e);
e.printStackTrace();
}
}
Program: 181641
Project: 181641
Buggy source:
/** 
 * Invokes the item by calling various listeners or callbacks.
 * @return true if the invocation was handled, false otherwise
 */
public boolean invoke(){
  if (mClickListener != null && mClickListener.onMenuItemClick(this)) {
    return true;
  }
  MenuBuilder.Callback callback=mMenu.getCallback();
  if (callback != null && callback.onMenuItemSelected(mMenu.getRootMenu(),this)) {
    return true;
  }
  if (mItemCallback != null) {
    mItemCallback.run();
    return true;
  }
  if (mIntent != null) {
    mMenu.getContext().startActivity(mIntent);
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Invokes the item by calling various listeners or callbacks.
 * @return true if the invocation was handled, false otherwise
 */
public boolean invoke(){
  if (mClickListener != null && mClickListener.onMenuItemClick(this)) {
    return true;
  }
  MenuBuilder.Callback callback=mMenu.getCallback();
  if (callback != null && callback.onMenuItemSelected(mMenu.getRootMenu(),this)) {
    return true;
  }
  if (mItemCallback != null) {
    mItemCallback.run();
    return true;
  }
  if (mIntent != null) {
    try {
      mMenu.getContext().startActivity(mIntent);
      return true;
    }
 catch (    ActivityNotFoundException e) {
      Log.e(TAG,"String_Node_Str",e);
    }
  }
  return false;
}
Program: 181645
Project: 181645
Buggy source:
private void putCachedString(ResourceName name,CharSequence cs){
  establishPackageRemovedReceiver();
synchronized (sSync) {
    sStringCache.put(name,new WeakReference<CharSequence>(cs));
  }
}

Fixed version (ground truth):
private void putCachedString(ResourceName name,CharSequence cs){
synchronized (sSync) {
    sStringCache.put(name,new WeakReference<CharSequence>(cs));
  }
}
Program: 181646
Project: 181646
Buggy source:
private void putCachedIcon(ResourceName name,Drawable dr){
  establishPackageRemovedReceiver();
synchronized (sSync) {
    sIconCache.put(name,new WeakReference<Drawable>(dr));
    if (DEBUG_ICONS)     Log.v(TAG,"String_Node_Str" + name + "String_Node_Str"+ dr);
  }
}

Fixed version (ground truth):
private void putCachedIcon(ResourceName name,Drawable dr){
synchronized (sSync) {
    sIconCache.put(name,new WeakReference<Drawable>(dr));
    if (DEBUG_ICONS)     Log.v(TAG,"String_Node_Str" + name + "String_Node_Str"+ dr);
  }
}
Program: 181651
Project: 181651
Buggy source:
private void putCachedString(ResourceName name,CharSequence cs){
  establishPackageRemovedReceiver();
synchronized (sSync) {
    sStringCache.put(name,new WeakReference<CharSequence>(cs));
  }
}

Fixed version (ground truth):
private void putCachedString(ResourceName name,CharSequence cs){
synchronized (sSync) {
    sStringCache.put(name,new WeakReference<CharSequence>(cs));
  }
}
Program: 181652
Project: 181652
Buggy source:
private void putCachedIcon(ResourceName name,Drawable dr){
  establishPackageRemovedReceiver();
synchronized (sSync) {
    sIconCache.put(name,new WeakReference<Drawable>(dr));
    if (DEBUG_ICONS)     Log.v(TAG,"String_Node_Str" + name + "String_Node_Str"+ dr);
  }
}

Fixed version (ground truth):
private void putCachedIcon(ResourceName name,Drawable dr){
synchronized (sSync) {
    sIconCache.put(name,new WeakReference<Drawable>(dr));
    if (DEBUG_ICONS)     Log.v(TAG,"String_Node_Str" + name + "String_Node_Str"+ dr);
  }
}
Program: 181657
Project: 181657
Buggy source:
private void putCachedString(ResourceName name,CharSequence cs){
  establishPackageRemovedReceiver();
synchronized (sSync) {
    sStringCache.put(name,new WeakReference<CharSequence>(cs));
  }
}

Fixed version (ground truth):
private void putCachedString(ResourceName name,CharSequence cs){
synchronized (sSync) {
    sStringCache.put(name,new WeakReference<CharSequence>(cs));
  }
}
Program: 181658
Project: 181658
Buggy source:
private void putCachedIcon(ResourceName name,Drawable dr){
  establishPackageRemovedReceiver();
synchronized (sSync) {
    sIconCache.put(name,new WeakReference<Drawable>(dr));
    if (DEBUG_ICONS)     Log.v(TAG,"String_Node_Str" + name + "String_Node_Str"+ dr);
  }
}

Fixed version (ground truth):
private void putCachedIcon(ResourceName name,Drawable dr){
synchronized (sSync) {
    sIconCache.put(name,new WeakReference<Drawable>(dr));
    if (DEBUG_ICONS)     Log.v(TAG,"String_Node_Str" + name + "String_Node_Str"+ dr);
  }
}
Program: 181660
Project: 181660
Buggy source:
/** 
 * {@inheritDoc}
 */
public void playSoundEffect(int effectId){
  checkThread();
  final AudioManager audioManager=getAudioManager();
switch (effectId) {
case SoundEffectConstants.CLICK:
    audioManager.playSoundEffect(AudioManager.FX_KEY_CLICK);
  return;
case SoundEffectConstants.NAVIGATION_DOWN:
audioManager.playSoundEffect(AudioManager.FX_FOCUS_NAVIGATION_DOWN);
return;
case SoundEffectConstants.NAVIGATION_LEFT:
audioManager.playSoundEffect(AudioManager.FX_FOCUS_NAVIGATION_LEFT);
return;
case SoundEffectConstants.NAVIGATION_RIGHT:
audioManager.playSoundEffect(AudioManager.FX_FOCUS_NAVIGATION_RIGHT);
return;
case SoundEffectConstants.NAVIGATION_UP:
audioManager.playSoundEffect(AudioManager.FX_FOCUS_NAVIGATION_UP);
return;
default :
throw new IllegalArgumentException("String_Node_Str" + effectId + "String_Node_Str"+ SoundEffectConstants.class.getCanonicalName());
}
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
public void playSoundEffect(int effectId){
  checkThread();
  try {
    final AudioManager audioManager=getAudioManager();
switch (effectId) {
case SoundEffectConstants.CLICK:
      audioManager.playSoundEffect(AudioManager.FX_KEY_CLICK);
    return;
case SoundEffectConstants.NAVIGATION_DOWN:
  audioManager.playSoundEffect(AudioManager.FX_FOCUS_NAVIGATION_DOWN);
return;
case SoundEffectConstants.NAVIGATION_LEFT:
audioManager.playSoundEffect(AudioManager.FX_FOCUS_NAVIGATION_LEFT);
return;
case SoundEffectConstants.NAVIGATION_RIGHT:
audioManager.playSoundEffect(AudioManager.FX_FOCUS_NAVIGATION_RIGHT);
return;
case SoundEffectConstants.NAVIGATION_UP:
audioManager.playSoundEffect(AudioManager.FX_FOCUS_NAVIGATION_UP);
return;
default :
throw new IllegalArgumentException("String_Node_Str" + effectId + "String_Node_Str"+ SoundEffectConstants.class.getCanonicalName());
}
}
 catch (IllegalStateException e) {
Log.e(TAG,"String_Node_Str" + e);
e.printStackTrace();
}
}
Program: 181661
Project: 181661
Buggy source:
/** 
 * Invokes the item by calling various listeners or callbacks.
 * @return true if the invocation was handled, false otherwise
 */
public boolean invoke(){
  if (mClickListener != null && mClickListener.onMenuItemClick(this)) {
    return true;
  }
  MenuBuilder.Callback callback=mMenu.getCallback();
  if (callback != null && callback.onMenuItemSelected(mMenu.getRootMenu(),this)) {
    return true;
  }
  if (mItemCallback != null) {
    mItemCallback.run();
    return true;
  }
  if (mIntent != null) {
    mMenu.getContext().startActivity(mIntent);
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Invokes the item by calling various listeners or callbacks.
 * @return true if the invocation was handled, false otherwise
 */
public boolean invoke(){
  if (mClickListener != null && mClickListener.onMenuItemClick(this)) {
    return true;
  }
  MenuBuilder.Callback callback=mMenu.getCallback();
  if (callback != null && callback.onMenuItemSelected(mMenu.getRootMenu(),this)) {
    return true;
  }
  if (mItemCallback != null) {
    mItemCallback.run();
    return true;
  }
  if (mIntent != null) {
    try {
      mMenu.getContext().startActivity(mIntent);
      return true;
    }
 catch (    ActivityNotFoundException e) {
      Log.e(TAG,"String_Node_Str",e);
    }
  }
  return false;
}
Program: 181662
Project: 181662
Buggy source:
/** 
 * Invokes the item by calling various listeners or callbacks.
 * @return true if the invocation was handled, false otherwise
 */
public boolean invoke(){
  if (mClickListener != null && mClickListener.onMenuItemClick(this)) {
    return true;
  }
  MenuBuilder.Callback callback=mMenu.getCallback();
  if (callback != null && callback.onMenuItemSelected(mMenu.getRootMenu(),this)) {
    return true;
  }
  if (mItemCallback != null) {
    mItemCallback.run();
    return true;
  }
  if (mIntent != null) {
    mMenu.getContext().startActivity(mIntent);
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Invokes the item by calling various listeners or callbacks.
 * @return true if the invocation was handled, false otherwise
 */
public boolean invoke(){
  if (mClickListener != null && mClickListener.onMenuItemClick(this)) {
    return true;
  }
  MenuBuilder.Callback callback=mMenu.getCallback();
  if (callback != null && callback.onMenuItemSelected(mMenu.getRootMenu(),this)) {
    return true;
  }
  if (mItemCallback != null) {
    mItemCallback.run();
    return true;
  }
  if (mIntent != null) {
    try {
      mMenu.getContext().startActivity(mIntent);
      return true;
    }
 catch (    ActivityNotFoundException e) {
      Log.e(TAG,"String_Node_Str",e);
    }
  }
  return false;
}
Program: 181666
Project: 181666
Buggy source:
private void putCachedString(ResourceName name,CharSequence cs){
  establishPackageRemovedReceiver();
synchronized (sSync) {
    sStringCache.put(name,new WeakReference<CharSequence>(cs));
  }
}

Fixed version (ground truth):
private void putCachedString(ResourceName name,CharSequence cs){
synchronized (sSync) {
    sStringCache.put(name,new WeakReference<CharSequence>(cs));
  }
}
Program: 181667
Project: 181667
Buggy source:
private void putCachedIcon(ResourceName name,Drawable dr){
  establishPackageRemovedReceiver();
synchronized (sSync) {
    sIconCache.put(name,new WeakReference<Drawable>(dr));
    if (DEBUG_ICONS)     Log.v(TAG,"String_Node_Str" + name + "String_Node_Str"+ dr);
  }
}

Fixed version (ground truth):
private void putCachedIcon(ResourceName name,Drawable dr){
synchronized (sSync) {
    sIconCache.put(name,new WeakReference<Drawable>(dr));
    if (DEBUG_ICONS)     Log.v(TAG,"String_Node_Str" + name + "String_Node_Str"+ dr);
  }
}
Program: 181669
Project: 181669
Buggy source:
@Override protected void onRestoreInstanceState(Parcelable state){
  SavedState ss=(SavedState)state;
  super.onRestoreInstanceState(ss.getSuperState());
  mYear=ss.getYear();
  mMonth=ss.getMonth();
  mDay=ss.getDay();
}

Fixed version (ground truth):
@Override protected void onRestoreInstanceState(Parcelable state){
  SavedState ss=(SavedState)state;
  super.onRestoreInstanceState(ss.getSuperState());
  mYear=ss.getYear();
  mMonth=ss.getMonth();
  mDay=ss.getDay();
  updateSpinners();
}
Program: 181673
Project: 181673
Buggy source:
/** 
 * Call this when you want to know the new location.  If it returns true, the animation is not yet finished.  loc will be altered to provide the new location.
 */
public boolean computeScrollOffset(){
  if (mFinished) {
    return false;
  }
  int timePassed=(int)(AnimationUtils.currentAnimationTimeMillis() - mStartTime);
  if (timePassed < mDuration) {
switch (mMode) {
case SCROLL_MODE:
      float x=(float)timePassed * mDurationReciprocal;
    if (mInterpolator == null)     x=viscousFluid(x);
 else     x=mInterpolator.getInterpolation(x);
  mCurrX=mStartX + Math.round(x * mDeltaX);
mCurrY=mStartY + Math.round(x * mDeltaY);
if ((mCurrX == mFinalX) && (mCurrY == mFinalY)) {
mFinished=true;
}
break;
case FLING_MODE:
float timePassedSeconds=timePassed / 1000.0f;
float distance=(mVelocity * timePassedSeconds) - (mDeceleration * timePassedSeconds * timePassedSeconds / 2.0f);
mCurrX=mStartX + Math.round(distance * mCoeffX);
mCurrX=Math.min(mCurrX,mMaxX);
mCurrX=Math.max(mCurrX,mMinX);
mCurrY=mStartY + Math.round(distance * mCoeffY);
mCurrY=Math.min(mCurrY,mMaxY);
mCurrY=Math.max(mCurrY,mMinY);
if (mCurrX == mFinalX && mCurrY == mFinalY) {
mFinished=true;
}
break;
}
}
 else {
mCurrX=mFinalX;
mCurrY=mFinalY;
mFinished=true;
}
return true;
}

Fixed version (ground truth):
/** 
 * Call this when you want to know the new location.  If it returns true, the animation is not yet finished.  loc will be altered to provide the new location.
 */
public boolean computeScrollOffset(){
  if (mFinished) {
    return false;
  }
  int timePassed=(int)(AnimationUtils.currentAnimationTimeMillis() - mStartTime);
  if (timePassed < mDuration) {
switch (mMode) {
case SCROLL_MODE:
      float x=(float)timePassed * mDurationReciprocal;
    if (mInterpolator == null)     x=viscousFluid(x);
 else     x=mInterpolator.getInterpolation(x);
  mCurrX=mStartX + Math.round(x * mDeltaX);
mCurrY=mStartY + Math.round(x * mDeltaY);
break;
case FLING_MODE:
float timePassedSeconds=timePassed / 1000.0f;
float distance=(mVelocity * timePassedSeconds) - (mDeceleration * timePassedSeconds * timePassedSeconds / 2.0f);
mCurrX=mStartX + Math.round(distance * mCoeffX);
mCurrX=Math.min(mCurrX,mMaxX);
mCurrX=Math.max(mCurrX,mMinX);
mCurrY=mStartY + Math.round(distance * mCoeffY);
mCurrY=Math.min(mCurrY,mMaxY);
mCurrY=Math.max(mCurrY,mMinY);
break;
}
}
 else {
mCurrX=mFinalX;
mCurrY=mFinalY;
mFinished=true;
}
return true;
}
Program: 181674
Project: 181674
Buggy source:
/** 
 * Call this when you want to know the new location.  If it returns true, the animation is not yet finished.  loc will be altered to provide the new location.
 */
public boolean computeScrollOffset(){
  if (mFinished) {
    return false;
  }
  int timePassed=(int)(AnimationUtils.currentAnimationTimeMillis() - mStartTime);
  if (timePassed < mDuration) {
switch (mMode) {
case SCROLL_MODE:
      float x=(float)timePassed * mDurationReciprocal;
    if (mInterpolator == null)     x=viscousFluid(x);
 else     x=mInterpolator.getInterpolation(x);
  mCurrX=mStartX + Math.round(x * mDeltaX);
mCurrY=mStartY + Math.round(x * mDeltaY);
if ((mCurrX == mFinalX) && (mCurrY == mFinalY)) {
mFinished=true;
}
break;
case FLING_MODE:
float timePassedSeconds=timePassed / 1000.0f;
float distance=(mVelocity * timePassedSeconds) - (mDeceleration * timePassedSeconds * timePassedSeconds / 2.0f);
mCurrX=mStartX + Math.round(distance * mCoeffX);
mCurrX=Math.min(mCurrX,mMaxX);
mCurrX=Math.max(mCurrX,mMinX);
mCurrY=mStartY + Math.round(distance * mCoeffY);
mCurrY=Math.min(mCurrY,mMaxY);
mCurrY=Math.max(mCurrY,mMinY);
if (mCurrX == mFinalX && mCurrY == mFinalY) {
mFinished=true;
}
break;
}
}
 else {
mCurrX=mFinalX;
mCurrY=mFinalY;
mFinished=true;
}
return true;
}

Fixed version (ground truth):
/** 
 * Call this when you want to know the new location.  If it returns true, the animation is not yet finished.  loc will be altered to provide the new location.
 */
public boolean computeScrollOffset(){
  if (mFinished) {
    return false;
  }
  int timePassed=(int)(AnimationUtils.currentAnimationTimeMillis() - mStartTime);
  if (timePassed < mDuration) {
switch (mMode) {
case SCROLL_MODE:
      float x=(float)timePassed * mDurationReciprocal;
    if (mInterpolator == null)     x=viscousFluid(x);
 else     x=mInterpolator.getInterpolation(x);
  mCurrX=mStartX + Math.round(x * mDeltaX);
mCurrY=mStartY + Math.round(x * mDeltaY);
break;
case FLING_MODE:
float timePassedSeconds=timePassed / 1000.0f;
float distance=(mVelocity * timePassedSeconds) - (mDeceleration * timePassedSeconds * timePassedSeconds / 2.0f);
mCurrX=mStartX + Math.round(distance * mCoeffX);
mCurrX=Math.min(mCurrX,mMaxX);
mCurrX=Math.max(mCurrX,mMinX);
mCurrY=mStartY + Math.round(distance * mCoeffY);
mCurrY=Math.min(mCurrY,mMaxY);
mCurrY=Math.max(mCurrY,mMinY);
break;
}
}
 else {
mCurrX=mFinalX;
mCurrY=mFinalY;
mFinished=true;
}
return true;
}
Program: 181675
Project: 181675
Buggy source:
/** 
 * Call this when you want to know the new location.  If it returns true, the animation is not yet finished.  loc will be altered to provide the new location.
 */
public boolean computeScrollOffset(){
  if (mFinished) {
    return false;
  }
  int timePassed=(int)(AnimationUtils.currentAnimationTimeMillis() - mStartTime);
  if (timePassed < mDuration) {
switch (mMode) {
case SCROLL_MODE:
      float x=(float)timePassed * mDurationReciprocal;
    if (mInterpolator == null)     x=viscousFluid(x);
 else     x=mInterpolator.getInterpolation(x);
  mCurrX=mStartX + Math.round(x * mDeltaX);
mCurrY=mStartY + Math.round(x * mDeltaY);
if ((mCurrX == mFinalX) && (mCurrY == mFinalY)) {
mFinished=true;
}
break;
case FLING_MODE:
float timePassedSeconds=timePassed / 1000.0f;
float distance=(mVelocity * timePassedSeconds) - (mDeceleration * timePassedSeconds * timePassedSeconds / 2.0f);
mCurrX=mStartX + Math.round(distance * mCoeffX);
mCurrX=Math.min(mCurrX,mMaxX);
mCurrX=Math.max(mCurrX,mMinX);
mCurrY=mStartY + Math.round(distance * mCoeffY);
mCurrY=Math.min(mCurrY,mMaxY);
mCurrY=Math.max(mCurrY,mMinY);
if (mCurrX == mFinalX && mCurrY == mFinalY) {
mFinished=true;
}
break;
}
}
 else {
mCurrX=mFinalX;
mCurrY=mFinalY;
mFinished=true;
}
return true;
}

Fixed version (ground truth):
/** 
 * Call this when you want to know the new location.  If it returns true, the animation is not yet finished.  loc will be altered to provide the new location.
 */
public boolean computeScrollOffset(){
  if (mFinished) {
    return false;
  }
  int timePassed=(int)(AnimationUtils.currentAnimationTimeMillis() - mStartTime);
  if (timePassed < mDuration) {
switch (mMode) {
case SCROLL_MODE:
      float x=(float)timePassed * mDurationReciprocal;
    if (mInterpolator == null)     x=viscousFluid(x);
 else     x=mInterpolator.getInterpolation(x);
  mCurrX=mStartX + Math.round(x * mDeltaX);
mCurrY=mStartY + Math.round(x * mDeltaY);
break;
case FLING_MODE:
float timePassedSeconds=timePassed / 1000.0f;
float distance=(mVelocity * timePassedSeconds) - (mDeceleration * timePassedSeconds * timePassedSeconds / 2.0f);
mCurrX=mStartX + Math.round(distance * mCoeffX);
mCurrX=Math.min(mCurrX,mMaxX);
mCurrX=Math.max(mCurrX,mMinX);
mCurrY=mStartY + Math.round(distance * mCoeffY);
mCurrY=Math.min(mCurrY,mMaxY);
mCurrY=Math.max(mCurrY,mMinY);
break;
}
}
 else {
mCurrX=mFinalX;
mCurrY=mFinalY;
mFinished=true;
}
return true;
}
Program: 181683
Project: 181683
Buggy source:
private void updateSettingsLI(PackageParser.Package newPackage,String installerPackageName,PackageInstalledInfo res){
  String pkgName=newPackage.packageName;
synchronized (mPackages) {
    mSettings.setInstallStatus(pkgName,PKG_INSTALL_INCOMPLETE);
    mSettings.writeLP();
  }
  if ((res.returnCode=moveDexFilesLI(newPackage)) != PackageManager.INSTALL_SUCCEEDED) {
    return;
  }
  if ((res.returnCode=setPermissionsLI(newPackage)) != PackageManager.INSTALL_SUCCEEDED) {
    if (mInstaller != null) {
      mInstaller.rmdex(newPackage.mScanPath);
    }
    return;
  }
 else {
    Log.d(TAG,"String_Node_Str" + newPackage.mPath);
  }
synchronized (mPackages) {
    updatePermissionsLP(newPackage.packageName,newPackage,newPackage.permissions.size() > 0,true);
    res.name=pkgName;
    res.uid=newPackage.applicationInfo.uid;
    res.pkg=newPackage;
    mSettings.setInstallStatus(pkgName,PKG_INSTALL_COMPLETE);
    mSettings.setInstallerPackageName(pkgName,installerPackageName);
    res.returnCode=PackageManager.INSTALL_SUCCEEDED;
    mSettings.writeLP();
  }
}

Fixed version (ground truth):
private void updateSettingsLI(PackageParser.Package newPackage,String installerPackageName,PackageInstalledInfo res){
  String pkgName=newPackage.packageName;
synchronized (mPackages) {
    mSettings.setInstallStatus(pkgName,PKG_INSTALL_INCOMPLETE);
    mSettings.writeLP();
  }
  if ((res.returnCode=moveDexFilesLI(newPackage)) != PackageManager.INSTALL_SUCCEEDED) {
    return;
  }
  if ((res.returnCode=setPermissionsLI(newPackage)) != PackageManager.INSTALL_SUCCEEDED) {
    if (mInstaller != null) {
      mInstaller.rmdex(newPackage.mScanPath);
    }
    return;
  }
 else {
    Log.d(TAG,"String_Node_Str" + newPackage.mPath);
  }
synchronized (mPackages) {
    updatePermissionsLP(newPackage.packageName,newPackage,newPackage.permissions.size() > 0,true,false);
    res.name=pkgName;
    res.uid=newPackage.applicationInfo.uid;
    res.pkg=newPackage;
    mSettings.setInstallStatus(pkgName,PKG_INSTALL_COMPLETE);
    mSettings.setInstallerPackageName(pkgName,installerPackageName);
    res.returnCode=PackageManager.INSTALL_SUCCEEDED;
    mSettings.writeLP();
  }
}