nus-yam/ex-repair huggingface dataset:
Program: 41560
Project: 41560
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: 41562
Project: 41562
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: 41563
Project: 41563
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: 41567
Project: 41567
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: 41569
Project: 41569
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: 41570
Project: 41570
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: 41571
Project: 41571
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: 41572
Project: 41572
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: 41573
Project: 41573
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: 41574
Project: 41574
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: 41576
Project: 41576
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: 41577
Project: 41577
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: 41579
Project: 41579
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: 41580
Project: 41580
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: 41581
Project: 41581
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: 41582
Project: 41582
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: 41583
Project: 41583
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: 41584
Project: 41584
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: 41586
Project: 41586
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: 41587
Project: 41587
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: 41592
Project: 41592
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: 41593
Project: 41593
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: 41595
Project: 41595
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: 41596
Project: 41596
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: 41600
Project: 41600
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: 41601
Project: 41601
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: 41603
Project: 41603
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: 41604
Project: 41604
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: 41605
Project: 41605
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: 41606
Project: 41606
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: 41610
Project: 41610
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: 41611
Project: 41611
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: 41613
Project: 41613
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: 41614
Project: 41614
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: 41618
Project: 41618
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: 41619
Project: 41619
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: 41621
Project: 41621
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: 41622
Project: 41622
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: 41626
Project: 41626
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;
}