nus-yam/ex-repair huggingface dataset:
Program: 157397
Project: 157397
Buggy source:
@Override protected View onCreateView(ViewGroup parent){
  LayoutInflater inflator=(LayoutInflater)mContext.getSystemService(Service.LAYOUT_INFLATER_SERVICE);
  ViewGroup mySeekBarLayout=(ViewGroup)inflator.inflate(R.layout.slide_pref,null);
  mSeekBar=(SeekBar)mySeekBarLayout.findViewById(R.id.pref_seekbar);
  if (shouldPersist())   mValue=getPersistedInt(mDefault);
  mCurrentValue=(TextView)mySeekBarLayout.findViewById(R.id.pref_current_value);
  mMaxValue=(TextView)mySeekBarLayout.findViewById(R.id.pref_max_value);
  mMinValue=(TextView)mySeekBarLayout.findViewById(R.id.pref_min_value);
  mCurrentValue.setText(Integer.toString(mValue));
  ((TextView)mySeekBarLayout.findViewById(R.id.pref_title)).setText(mTitle);
  writeBoundaries();
  mSeekBar.setMax(mMax - mMin);
  mSeekBar.setProgress(mValue - mMin);
  mSeekBar.setOnSeekBarChangeListener(this);
  return mySeekBarLayout;
}

Fixed version (ground truth):
@Override protected View onCreateView(ViewGroup parent){
  View mySeekBarLayout=super.onCreateView(parent);
  mSeekBar=(SeekBar)mySeekBarLayout.findViewById(R.id.pref_seekbar);
  if (shouldPersist())   mValue=getPersistedInt(mDefault);
  mCurrentValue=(TextView)mySeekBarLayout.findViewById(R.id.pref_current_value);
  mMaxValue=(TextView)mySeekBarLayout.findViewById(R.id.pref_max_value);
  mMinValue=(TextView)mySeekBarLayout.findViewById(R.id.pref_min_value);
  mCurrentValue.setText(Integer.toString(mValue));
  ((TextView)mySeekBarLayout.findViewById(R.id.pref_title)).setText(mTitle);
  writeBoundaries();
  mSeekBar.setMax(mMax - mMin);
  mSeekBar.setProgress(mValue - mMin);
  mSeekBar.setOnSeekBarChangeListener(this);
  return mySeekBarLayout;
}
Program: 157399
Project: 157399
Buggy source:
@Override protected EditorWordsAdapter createAdapterForWords(List<EditorWord> wordsList){
  return new AbbreviationEditorWordsAdapter(wordsList,getActivity(),this);
}

Fixed version (ground truth):
@Override protected EditorWordsAdapter createAdapterForWords(List<EditorWord> wordsList){
  Activity activity=getActivity();
  if (activity == null)   return null;
  return new AbbreviationEditorWordsAdapter(wordsList,activity,this);
}
Program: 157400
Project: 157400
Buggy source:
protected EditorWordsAdapter createAdapterForWords(List<EditorWord> wordsList){
  return new EditorWordsAdapter(wordsList,LayoutInflater.from(getActivity()),this);
}

Fixed version (ground truth):
protected EditorWordsAdapter createAdapterForWords(List<EditorWord> wordsList){
  Activity activity=getActivity();
  if (activity == null)   return null;
  return new EditorWordsAdapter(wordsList,LayoutInflater.from(activity),this);
}
Program: 157401
Project: 157401
Buggy source:
private void fillWordsList(){
  Log.d(TAG,"String_Node_Str" + mSelectedLocale);
  new UserWordsEditorAsyncTask(this,true){
    private EditableDictionary mNewDictionary;
    private List<EditorWord> mWordsList;
    @Override protected void onPreExecute(){
      super.onPreExecute();
      mNewDictionary=getEditableDictionary(mSelectedLocale);
      if (mNewDictionary != mCurrentDictionary && mCurrentDictionary != null && mCursor != null) {
        mCurrentDictionary.close();
      }
    }
    @Override protected Void doAsyncTask(    Void[] params) throws Exception {
      mCurrentDictionary=mNewDictionary;
      mCurrentDictionary.loadDictionary();
      mCursor=mCurrentDictionary.getWordsCursor();
      Cursor cursor=mCursor.getCursor();
      mWordsList=new ArrayList<>(mCursor.getCursor().getCount());
      cursor.moveToFirst();
      while (!cursor.isAfterLast()) {
        EditorWord word=new EditorWord(mCursor.getCurrentWord(),mCursor.getCurrentWordFrequency());
        mWordsList.add(word);
        cursor.moveToNext();
      }
      Collections.sort(mWordsList,msWordsComparator);
      return null;
    }
    protected void applyResults(    Void result,    Exception backgroundException){
      mWordsRecyclerView.setAdapter(createAdapterForWords(mWordsList));
    }
  }
.execute();
}

Fixed version (ground truth):
private void fillWordsList(){
  Log.d(TAG,"String_Node_Str" + mSelectedLocale);
  new UserWordsEditorAsyncTask(this,true){
    private EditableDictionary mNewDictionary;
    private List<EditorWord> mWordsList;
    @Override protected void onPreExecute(){
      super.onPreExecute();
      mNewDictionary=getEditableDictionary(mSelectedLocale);
      if (mNewDictionary != mCurrentDictionary && mCurrentDictionary != null && mCursor != null) {
        mCurrentDictionary.close();
      }
    }
    @Override protected Void doAsyncTask(    Void[] params) throws Exception {
      mCurrentDictionary=mNewDictionary;
      mCurrentDictionary.loadDictionary();
      mCursor=mCurrentDictionary.getWordsCursor();
      Cursor cursor=mCursor.getCursor();
      mWordsList=new ArrayList<>(mCursor.getCursor().getCount());
      cursor.moveToFirst();
      while (!cursor.isAfterLast()) {
        EditorWord word=new EditorWord(mCursor.getCurrentWord(),mCursor.getCurrentWordFrequency());
        mWordsList.add(word);
        cursor.moveToNext();
      }
      Collections.sort(mWordsList,msWordsComparator);
      return null;
    }
    protected void applyResults(    Void result,    Exception backgroundException){
      RecyclerView.Adapter adapter=createAdapterForWords(mWordsList);
      if (adapter != null) {
        mWordsRecyclerView.setAdapter(adapter);
      }
    }
  }
.execute();
}
Program: 157402
Project: 157402
Buggy source:
public void removeFromUserDictionary(String word){
  if (mUserDictionary != null) {
    mUserDictionary.deleteWord(word);
    abortCorrection(true,false);
    if (mCandidateView != null)     mCandidateView.notifyAboutRemovedWord(word);
  }
}

Fixed version (ground truth):
public void removeFromUserDictionary(String word){
  mJustAutoAddedWord=false;
  if (mUserDictionary != null) {
    mUserDictionary.deleteWord(word);
    abortCorrection(true,false);
    if (mCandidateView != null)     mCandidateView.notifyAboutRemovedWord(word);
  }
}
Program: 157404
Project: 157404
Buggy source:
public void revertLastWord(boolean deleteChar){
  Log.d(TAG,"String_Node_Str" + deleteChar + "String_Node_Str"+ mWord.length()+ "String_Node_Str"+ mPredicting+ "String_Node_Str"+ mCommittedLength);
  final int length=mWord.length();
  if (!mPredicting && length > 0) {
    mAutoCorrectOn=false;
    final CharSequence typedWord=mWord.getTypedWord();
    final InputConnection ic=getCurrentInputConnection();
    mPredicting=true;
    mUndoCommitCursorPosition=-2;
    ic.beginBatchEdit();
    if (deleteChar)     ic.deleteSurroundingText(1,0);
    int toDelete=mCommittedLength;
    CharSequence toTheLeft=ic.getTextBeforeCursor(mCommittedLength,0);
    if (toTheLeft != null && toTheLeft.length() > 0 && isWordSeparator(toTheLeft.charAt(0))) {
      toDelete--;
    }
    ic.deleteSurroundingText(toDelete,0);
    ic.setComposingText(typedWord,1);
    TextEntryState.backspace();
    ic.endBatchEdit();
    postUpdateSuggestions(-1);
    if (mJustAutoAddedWord && mUserDictionary != null) {
      Log.i(TAG,"String_Node_Str" + typedWord + "String_Node_Str");
      removeFromUserDictionary(typedWord.toString());
    }
  }
 else {
    sendDownUpKeyEvents(KeyEvent.KEYCODE_DEL);
  }
}

Fixed version (ground truth):
public void revertLastWord(boolean deleteChar){
  Log.d(TAG,"String_Node_Str" + deleteChar + "String_Node_Str"+ mWord.length()+ "String_Node_Str"+ mPredicting+ "String_Node_Str"+ mCommittedLength);
  final int length=mWord.length();
  if (!mPredicting && length > 0) {
    mAutoCorrectOn=false;
    final CharSequence typedWord=mWord.getTypedWord();
    final InputConnection ic=getCurrentInputConnection();
    mPredicting=true;
    mUndoCommitCursorPosition=-2;
    ic.beginBatchEdit();
    if (deleteChar)     ic.deleteSurroundingText(1,0);
    int toDelete=mCommittedLength;
    CharSequence toTheLeft=ic.getTextBeforeCursor(mCommittedLength,0);
    if (toTheLeft != null && toTheLeft.length() > 0 && isWordSeparator(toTheLeft.charAt(0))) {
      toDelete--;
    }
    ic.deleteSurroundingText(toDelete,0);
    ic.setComposingText(typedWord,1);
    TextEntryState.backspace();
    ic.endBatchEdit();
    postUpdateSuggestions(-1);
    if (mJustAutoAddedWord && mUserDictionary != null) {
      removeFromUserDictionary(typedWord.toString());
    }
  }
 else {
    sendDownUpKeyEvents(KeyEvent.KEYCODE_DEL);
  }
}
Program: 157405
Project: 157405
Buggy source:
private void abortCorrection(boolean force,boolean forever){
  if (force || TextEntryState.isCorrecting()) {
    Log.d(TAG,"String_Node_Str");
    mHandler.removeMessages(KeyboardUIStateHandler.MSG_UPDATE_SUGGESTIONS);
    mHandler.removeMessages(KeyboardUIStateHandler.MSG_RESTART_NEW_WORD_SUGGESTIONS);
    final InputConnection ic=getCurrentInputConnection();
    if (ic != null)     ic.finishComposingText();
    clearSuggestions();
    TextEntryState.reset();
    mUndoCommitCursorPosition=-2;
    mWord.reset();
    mPredicting=false;
    mJustAddedAutoSpace=false;
    if (forever) {
      Log.d(TAG,"String_Node_Str");
      mPredictionOn=false;
      setCandidatesViewShown(false);
      if (mSuggest != null) {
        mSuggest.setCorrectionMode(false,false);
      }
    }
  }
}

Fixed version (ground truth):
private void abortCorrection(boolean force,boolean forever){
  if (force || TextEntryState.isCorrecting()) {
    Log.d(TAG,"String_Node_Str");
    mHandler.removeMessages(KeyboardUIStateHandler.MSG_UPDATE_SUGGESTIONS);
    mHandler.removeMessages(KeyboardUIStateHandler.MSG_RESTART_NEW_WORD_SUGGESTIONS);
    final InputConnection ic=getCurrentInputConnection();
    if (ic != null)     ic.finishComposingText();
    clearSuggestions();
    TextEntryState.reset();
    mUndoCommitCursorPosition=-2;
    mWord.reset();
    mPredicting=false;
    mJustAddedAutoSpace=false;
    mJustAutoAddedWord=false;
    if (forever) {
      Log.d(TAG,"String_Node_Str");
      mPredictionOn=false;
      setCandidatesViewShown(false);
      if (mSuggest != null) {
        mSuggest.setCorrectionMode(false,false);
      }
    }
  }
}
Program: 157406
Project: 157406
Buggy source:
public void removeFromUserDictionary(String word){
  if (mUserDictionary != null) {
    mUserDictionary.deleteWord(word);
    abortCorrection(true,false);
    if (mCandidateView != null)     mCandidateView.notifyAboutRemovedWord(word);
  }
}

Fixed version (ground truth):
public void removeFromUserDictionary(String word){
  mJustAutoAddedWord=false;
  if (mUserDictionary != null) {
    mUserDictionary.deleteWord(word);
    abortCorrection(true,false);
    if (mCandidateView != null)     mCandidateView.notifyAboutRemovedWord(word);
  }
}
Program: 157408
Project: 157408
Buggy source:
public void revertLastWord(boolean deleteChar){
  Log.d(TAG,"String_Node_Str" + deleteChar + "String_Node_Str"+ mWord.length()+ "String_Node_Str"+ mPredicting+ "String_Node_Str"+ mCommittedLength);
  final int length=mWord.length();
  if (!mPredicting && length > 0) {
    mAutoCorrectOn=false;
    final CharSequence typedWord=mWord.getTypedWord();
    final InputConnection ic=getCurrentInputConnection();
    mPredicting=true;
    mUndoCommitCursorPosition=-2;
    ic.beginBatchEdit();
    if (deleteChar)     ic.deleteSurroundingText(1,0);
    int toDelete=mCommittedLength;
    CharSequence toTheLeft=ic.getTextBeforeCursor(mCommittedLength,0);
    if (toTheLeft != null && toTheLeft.length() > 0 && isWordSeparator(toTheLeft.charAt(0))) {
      toDelete--;
    }
    ic.deleteSurroundingText(toDelete,0);
    ic.setComposingText(typedWord,1);
    TextEntryState.backspace();
    ic.endBatchEdit();
    postUpdateSuggestions(-1);
    if (mJustAutoAddedWord && mUserDictionary != null) {
      Log.i(TAG,"String_Node_Str" + typedWord + "String_Node_Str");
      removeFromUserDictionary(typedWord.toString());
    }
  }
 else {
    sendDownUpKeyEvents(KeyEvent.KEYCODE_DEL);
  }
}

Fixed version (ground truth):
public void revertLastWord(boolean deleteChar){
  Log.d(TAG,"String_Node_Str" + deleteChar + "String_Node_Str"+ mWord.length()+ "String_Node_Str"+ mPredicting+ "String_Node_Str"+ mCommittedLength);
  final int length=mWord.length();
  if (!mPredicting && length > 0) {
    mAutoCorrectOn=false;
    final CharSequence typedWord=mWord.getTypedWord();
    final InputConnection ic=getCurrentInputConnection();
    mPredicting=true;
    mUndoCommitCursorPosition=-2;
    ic.beginBatchEdit();
    if (deleteChar)     ic.deleteSurroundingText(1,0);
    int toDelete=mCommittedLength;
    CharSequence toTheLeft=ic.getTextBeforeCursor(mCommittedLength,0);
    if (toTheLeft != null && toTheLeft.length() > 0 && isWordSeparator(toTheLeft.charAt(0))) {
      toDelete--;
    }
    ic.deleteSurroundingText(toDelete,0);
    ic.setComposingText(typedWord,1);
    TextEntryState.backspace();
    ic.endBatchEdit();
    postUpdateSuggestions(-1);
    if (mJustAutoAddedWord && mUserDictionary != null) {
      removeFromUserDictionary(typedWord.toString());
    }
  }
 else {
    sendDownUpKeyEvents(KeyEvent.KEYCODE_DEL);
  }
}
Program: 157409
Project: 157409
Buggy source:
private void abortCorrection(boolean force,boolean forever){
  if (force || TextEntryState.isCorrecting()) {
    Log.d(TAG,"String_Node_Str");
    mHandler.removeMessages(KeyboardUIStateHandler.MSG_UPDATE_SUGGESTIONS);
    mHandler.removeMessages(KeyboardUIStateHandler.MSG_RESTART_NEW_WORD_SUGGESTIONS);
    final InputConnection ic=getCurrentInputConnection();
    if (ic != null)     ic.finishComposingText();
    clearSuggestions();
    TextEntryState.reset();
    mUndoCommitCursorPosition=-2;
    mWord.reset();
    mPredicting=false;
    mJustAddedAutoSpace=false;
    if (forever) {
      Log.d(TAG,"String_Node_Str");
      mPredictionOn=false;
      setCandidatesViewShown(false);
      if (mSuggest != null) {
        mSuggest.setCorrectionMode(false,false);
      }
    }
  }
}

Fixed version (ground truth):
private void abortCorrection(boolean force,boolean forever){
  if (force || TextEntryState.isCorrecting()) {
    Log.d(TAG,"String_Node_Str");
    mHandler.removeMessages(KeyboardUIStateHandler.MSG_UPDATE_SUGGESTIONS);
    mHandler.removeMessages(KeyboardUIStateHandler.MSG_RESTART_NEW_WORD_SUGGESTIONS);
    final InputConnection ic=getCurrentInputConnection();
    if (ic != null)     ic.finishComposingText();
    clearSuggestions();
    TextEntryState.reset();
    mUndoCommitCursorPosition=-2;
    mWord.reset();
    mPredicting=false;
    mJustAddedAutoSpace=false;
    mJustAutoAddedWord=false;
    if (forever) {
      Log.d(TAG,"String_Node_Str");
      mPredictionOn=false;
      setCandidatesViewShown(false);
      if (mSuggest != null) {
        mSuggest.setCorrectionMode(false,false);
      }
    }
  }
}
Program: 157410
Project: 157410
Buggy source:
public NextWordDictionary(Context context,String locale){
  super("String_Node_Str" + locale);
  mStorage=new NextWordsStorage(context,locale);
}

Fixed version (ground truth):
public NextWordDictionary(Context context,String locale){
  mStorage=new NextWordsStorage(context,locale);
}
Program: 157411
Project: 157411
Buggy source:
@Override public void storeNextWords(@NonNull Iterable<NextWordsContainer> nextWords,OutputStream outputStream) throws IOException {
  outputStream.write(1);
  for (  NextWordsContainer nextWordsContainer : nextWords) {
    writeWord(outputStream,nextWordsContainer.word);
    int maxWordsToStore=12;
    for (    NextWord nextWord : nextWordsContainer.getNextWordSuggestions()) {
      writeWord(outputStream,nextWord.nextWord);
      maxWordsToStore--;
      if (maxWordsToStore == 0)       break;
    }
  }
}

Fixed version (ground truth):
@Override public void storeNextWords(@NonNull Iterable<NextWordsContainer> nextWords,@NonNull OutputStream outputStream) throws IOException {
  outputStream.write(1);
  for (  NextWordsContainer nextWordsContainer : nextWords) {
    if (Utils.DEBUG)     Log.d(TAG,"String_Node_Str" + nextWordsContainer);
    writeWord(outputStream,nextWordsContainer.word);
    int maxWordsToStore=Math.min(12,nextWordsContainer.getNextWordSuggestions().size());
    outputStream.write(maxWordsToStore);
    if (Utils.DEBUG)     Log.d(TAG,"String_Node_Str" + maxWordsToStore + "String_Node_Str");
    for (    NextWord nextWord : nextWordsContainer.getNextWordSuggestions()) {
      if (Utils.DEBUG)       Log.d(TAG,"String_Node_Str" + nextWord.nextWord);
      writeWord(outputStream,nextWord.nextWord);
      maxWordsToStore--;
      if (maxWordsToStore == 0)       break;
    }
  }
}
Program: 157412
Project: 157412
Buggy source:
@NonNull @Override public Iterable<NextWordsContainer> loadStoredNextWords(InputStream inputStream) throws IOException {
  final byte[] buffer=new byte[256];
  LinkedList<NextWordsContainer> loadedEntries=new LinkedList<>();
  String word;
  while (null != (word=readWord(buffer,inputStream))) {
    final ArrayList<String> nextWords=new ArrayList<>();
    String nextWord;
    while (null != (nextWord=readWord(buffer,inputStream))) {
      nextWords.add(nextWord);
    }
    loadedEntries.add(new NextWordsContainer(word,nextWords));
  }
  return loadedEntries;
}

Fixed version (ground truth):
@NonNull @Override public Iterable<NextWordsContainer> loadStoredNextWords(@NonNull InputStream inputStream) throws IOException {
  final byte[] buffer=new byte[256];
  LinkedList<NextWordsContainer> loadedEntries=new LinkedList<>();
  String word;
  while (null != (word=readWord(buffer,inputStream))) {
    if (Utils.DEBUG)     Log.d(TAG,"String_Node_Str" + word);
    final int nextWordsCount=inputStream.read();
    if (Utils.DEBUG)     Log.d(TAG,"String_Node_Str" + word + "String_Node_Str"+ nextWordsCount+ "String_Node_Str");
    if (nextWordsCount <= 0)     break;
    final ArrayList<String> nextWords=new ArrayList<>(nextWordsCount);
    String nextWord;
    while (nextWordsCount > nextWords.size() && null != (nextWord=readWord(buffer,inputStream))) {
      nextWords.add(nextWord);
    }
    loadedEntries.add(new NextWordsContainer(word,nextWords));
  }
  return loadedEntries;
}
Program: 157413
Project: 157413
Buggy source:
private String readWord(byte[] buffer,InputStream inputStream) throws IOException {
  final int bytesToRead=inputStream.read();
  if (bytesToRead < 1)   return null;
  final int actualReadBytes=inputStream.read(buffer,0,bytesToRead);
  if (bytesToRead == actualReadBytes) {
    return new String(buffer,0,bytesToRead);
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
@Nullable private String readWord(@NonNull byte[] buffer,@NonNull InputStream inputStream) throws IOException {
  final int bytesToRead=inputStream.read();
  if (bytesToRead < 1)   return null;
  final int actualReadBytes=inputStream.read(buffer,0,bytesToRead);
  if (bytesToRead == actualReadBytes) {
    return new String(buffer,0,bytesToRead);
  }
 else {
    return null;
  }
}
Program: 157414
Project: 157414
Buggy source:
public void storeNextWords(@NonNull Iterable<NextWordsContainer> nextWords){
  NextWordsFileParser parser=new NextWordsFileParserV1();
  FileOutputStream outputStream=null;
  try {
    outputStream=mContext.openFileOutput(mNextWordsStorageFilename,Context.MODE_PRIVATE);
    parser.storeNextWords(nextWords,outputStream);
    outputStream.flush();
  }
 catch (  IOException e) {
    Log.w(TAG,e);
    Log.w(TAG,String.format("String_Node_Str",mNextWordsStorageFilename));
    mContext.deleteFile(mNextWordsStorageFilename);
  }
 finally {
    if (outputStream != null)     try {
      outputStream.close();
    }
 catch (    IOException e) {
    }
  }
}

Fixed version (ground truth):
public void storeNextWords(@NonNull Iterable<NextWordsContainer> nextWords){
  NextWordsFileParser parser=new NextWordsFileParserV1();
  FileOutputStream outputStream=null;
  try {
    Log.d(TAG,"String_Node_Str" + mNextWordsStorageFilename);
    outputStream=mContext.openFileOutput(mNextWordsStorageFilename,Context.MODE_PRIVATE);
    parser.storeNextWords(nextWords,outputStream);
    outputStream.flush();
  }
 catch (  IOException e) {
    Log.w(TAG,e);
    Log.w(TAG,String.format("String_Node_Str",mNextWordsStorageFilename));
    mContext.deleteFile(mNextWordsStorageFilename);
  }
 finally {
    if (outputStream != null)     try {
      outputStream.close();
    }
 catch (    IOException e) {
    }
  }
}
Program: 157415
Project: 157415
Buggy source:
@NonNull public Iterable<NextWordsContainer> loadStoredNextWords(){
  FileInputStream inputStream=null;
  try {
    inputStream=mContext.openFileInput(mNextWordsStorageFilename);
    final int version=inputStream.read();
    if (version < 1) {
      Log.w(TAG,"String_Node_Str");
      return Collections.emptyList();
    }
    final NextWordsFileParser parser;
switch (version) {
case 1:
      parser=new NextWordsFileParserV1();
    break;
default :
  Log.w(TAG,String.format("String_Node_Str",version));
return Collections.emptyList();
}
return parser.loadStoredNextWords(inputStream);
}
 catch (FileNotFoundException e) {
Log.w(TAG,e);
Log.w(TAG,String.format("String_Node_Str",mNextWordsStorageFilename));
return Collections.emptyList();
}
catch (IOException e) {
Log.w(TAG,e);
Log.w(TAG,String.format("String_Node_Str",mNextWordsStorageFilename));
return Collections.emptyList();
}
 finally {
if (inputStream != null) try {
inputStream.close();
}
 catch (IOException e) {
}
}
}

Fixed version (ground truth):
@NonNull public Iterable<NextWordsContainer> loadStoredNextWords(){
  FileInputStream inputStream=null;
  try {
    if (Utils.DEBUG)     Log.d(TAG,"String_Node_Str" + mNextWordsStorageFilename);
    inputStream=mContext.openFileInput(mNextWordsStorageFilename);
    final int version=inputStream.read();
    if (version < 1) {
      Log.w(TAG,"String_Node_Str" + mNextWordsStorageFilename);
      return Collections.emptyList();
    }
    final NextWordsFileParser parser;
switch (version) {
case 1:
      parser=new NextWordsFileParserV1();
    break;
default :
  Log.w(TAG,String.format("String_Node_Str",version));
return Collections.emptyList();
}
return parser.loadStoredNextWords(inputStream);
}
 catch (FileNotFoundException e) {
Log.w(TAG,e);
Log.w(TAG,String.format("String_Node_Str",mNextWordsStorageFilename));
return Collections.emptyList();
}
catch (IOException e) {
Log.w(TAG,e);
Log.w(TAG,String.format("String_Node_Str",mNextWordsStorageFilename));
return Collections.emptyList();
}
 finally {
if (inputStream != null) try {
inputStream.close();
}
 catch (IOException e) {
}
}
}
Program: 157416
Project: 157416
Buggy source:
private void abortCorrection(boolean force,boolean forever){
  if (force || TextEntryState.isCorrecting()) {
    Log.d(TAG,"String_Node_Str");
    mHandler.removeMessages(KeyboardUIStateHandler.MSG_UPDATE_SUGGESTIONS);
    mHandler.removeMessages(KeyboardUIStateHandler.MSG_RESTART_NEW_WORD_SUGGESTIONS);
    final InputConnection ic=getCurrentInputConnection();
    if (ic != null)     ic.finishComposingText();
    clearSuggestions();
    TextEntryState.reset();
    mUndoCommitCursorPosition=-2;
    mWord.reset();
    mPredicting=false;
    mJustAddedAutoSpace=false;
    mJustAutoAddedWord=false;
    if (forever) {
      Log.d(TAG,"String_Node_Str");
      mPredictionOn=false;
      setCandidatesViewShown(false);
      if (mSuggest != null) {
        mSuggest.setCorrectionMode(false,false);
      }
    }
  }
}

Fixed version (ground truth):
private void abortCorrection(boolean force,boolean forever){
  mSuggest.resetNextWordSentence();
  mJustAutoAddedWord=false;
  if (force || TextEntryState.isCorrecting()) {
    Log.d(TAG,"String_Node_Str");
    mHandler.removeMessages(KeyboardUIStateHandler.MSG_UPDATE_SUGGESTIONS);
    mHandler.removeMessages(KeyboardUIStateHandler.MSG_RESTART_NEW_WORD_SUGGESTIONS);
    final InputConnection ic=getCurrentInputConnection();
    if (ic != null)     ic.finishComposingText();
    clearSuggestions();
    TextEntryState.reset();
    mUndoCommitCursorPosition=-2;
    mWord.reset();
    mPredicting=false;
    mJustAddedAutoSpace=false;
    if (forever) {
      Log.d(TAG,"String_Node_Str");
      mPredictionOn=false;
      setCandidatesViewShown(false);
      if (mSuggest != null) {
        mSuggest.setCorrectionMode(false,false);
      }
    }
  }
}
Program: 157418
Project: 157418
Buggy source:
/** 
 * Returns a list of suggested next words for the given typed word
 * @return list of suggestions.
 */
public List<CharSequence> getNextSuggestions(WordComposer wordComposerOfCompletedWord){
  if (mUserDictionary == null || wordComposerOfCompletedWord.length() < mMinimumWordSizeToStartCorrecting)   return Collections.emptyList();
  mHaveCorrection=false;
  mIsFirstCharCapitalized=false;
  mIsAllUpperCase=wordComposerOfCompletedWord.isAllUpperCase();
  collectGarbage();
  Arrays.fill(mPriorities,0);
  final CharSequence preferredWord=wordComposerOfCompletedWord.getPreferredWord();
  if (isValidWord(preferredWord)) {
    wordComposerOfCompletedWord.setPreferredWord(preferredWord.toString().toLowerCase(mLocale));
    mUserDictionary.getNextWords(wordComposerOfCompletedWord,mNextWordsCallback,mPrefMaxSuggestions,mSuggestions,mLocaleSpecificPunctuations);
  }
  return mSuggestions;
}

Fixed version (ground truth):
/** 
 * Returns a list of suggested next words for the given typed word
 * @return list of suggestions.
 */
public List<CharSequence> getNextSuggestions(WordComposer wordComposerOfCompletedWord){
  if (mUserDictionary == null || wordComposerOfCompletedWord.length() < mMinimumWordSizeToStartCorrecting)   return Collections.emptyList();
  collectGarbage();
  mIsAllUpperCase=wordComposerOfCompletedWord.isAllUpperCase();
  final CharSequence preferredWord=wordComposerOfCompletedWord.getPreferredWord();
  if (isValidWord(preferredWord)) {
    mUserDictionary.getNextWords(preferredWord.toString().toLowerCase(mLocale),mPrefMaxSuggestions,mSuggestions,mLocaleSpecificPunctuations);
    if (mIsAllUpperCase) {
      for (int suggestionIndex=0; suggestionIndex < mSuggestions.size(); suggestionIndex++) {
        mSuggestions.set(suggestionIndex,mSuggestions.get(suggestionIndex).toString().toUpperCase(mLocale));
      }
    }
  }
  return mSuggestions;
}
Program: 157419
Project: 157419
Buggy source:
private void updateShiftStateNow(){
  final InputConnection ic=getCurrentInputConnection();
  EditorInfo ei=getCurrentInputEditorInfo();
  final int caps;
  if (mAutoCap && ei != null && ei.inputType != EditorInfo.TYPE_NULL) {
    caps=ic.getCursorCapsMode(ei.inputType);
  }
 else {
    caps=0;
  }
  final boolean inputSaysCaps=caps != 0;
  Log.d(TAG,"String_Node_Str",inputSaysCaps);
  mShiftKeyState.setActiveState(inputSaysCaps);
  handleShift();
}

Fixed version (ground truth):
private void updateShiftStateNow(){
  final InputConnection ic=getCurrentInputConnection();
  EditorInfo ei=getCurrentInputEditorInfo();
  final int caps;
  if (mAutoCap && ic != null && ei != null && ei.inputType != EditorInfo.TYPE_NULL) {
    caps=ic.getCursorCapsMode(ei.inputType);
  }
 else {
    caps=0;
  }
  final boolean inputSaysCaps=caps != 0;
  Log.d(TAG,"String_Node_Str",inputSaysCaps);
  mShiftKeyState.setActiveState(inputSaysCaps);
  handleShift();
}
Program: 157421
Project: 157421
Buggy source:
@Override protected boolean onLongPress(Context packageContext,Key key,boolean isSticky,boolean requireSlideInto){
  if (key != null && key instanceof AnyKey) {
    AnyKey anyKey=(AnyKey)key;
    if (anyKey.longPressCode != 0) {
      invokeOnKey(anyKey.longPressCode,anyKey,0);
      return true;
    }
 else     if (anyKey.codes[0] == KeyCodes.QUICK_TEXT) {
      invokeOnKey(KeyCodes.QUICK_TEXT_POPUP,null,0);
      return true;
    }
  }
  if (mAnimationLevel == AnimationsLevel.None) {
    mMiniKeyboardPopup.setAnimationStyle(0);
  }
 else   if (mExtensionVisible && mMiniKeyboardPopup.getAnimationStyle() != R.style.ExtensionKeyboardAnimation) {
    Log.d(TAG,"String_Node_Str");
    mMiniKeyboardPopup.setAnimationStyle(R.style.ExtensionKeyboardAnimation);
  }
 else   if (!mExtensionVisible && mMiniKeyboardPopup.getAnimationStyle() != R.style.MiniKeyboardAnimation) {
    Log.d(TAG,"String_Node_Str");
    mMiniKeyboardPopup.setAnimationStyle(R.style.MiniKeyboardAnimation);
  }
  return super.onLongPress(packageContext,key,isSticky,requireSlideInto);
}

Fixed version (ground truth):
@Override protected boolean onLongPress(Context packageContext,Key key,boolean isSticky,boolean requireSlideInto){
  if (key != null && key instanceof AnyKey) {
    AnyKey anyKey=(AnyKey)key;
    if (anyKey.longPressCode != 0) {
      invokeOnKey(anyKey.longPressCode,anyKey,0);
      return true;
    }
 else     if (anyKey.codes[0] == KeyCodes.QUICK_TEXT) {
      invokeOnKey(KeyCodes.QUICK_TEXT_POPUP,anyKey,0);
      return true;
    }
  }
  if (mAnimationLevel == AnimationsLevel.None) {
    mMiniKeyboardPopup.setAnimationStyle(0);
  }
 else   if (mExtensionVisible && mMiniKeyboardPopup.getAnimationStyle() != R.style.ExtensionKeyboardAnimation) {
    Log.d(TAG,"String_Node_Str");
    mMiniKeyboardPopup.setAnimationStyle(R.style.ExtensionKeyboardAnimation);
  }
 else   if (!mExtensionVisible && mMiniKeyboardPopup.getAnimationStyle() != R.style.MiniKeyboardAnimation) {
    Log.d(TAG,"String_Node_Str");
    mMiniKeyboardPopup.setAnimationStyle(R.style.MiniKeyboardAnimation);
  }
  return super.onLongPress(packageContext,key,isSticky,requireSlideInto);
}
Program: 157422
Project: 157422
Buggy source:
public boolean dismissPopupKeyboard(){
  if (isPopupShowing()) {
    mMiniKeyboard.closing();
    mMiniKeyboardPopup.dismiss();
    mMiniKeyboardVisible=false;
    mMiniKeyboardOriginX=0;
    mMiniKeyboardOriginY=0;
    invalidateAllKeys();
    return true;
  }
 else   return false;
}

Fixed version (ground truth):
public boolean dismissPopupKeyboard(){
  if (mMiniKeyboardPopup.isShowing()) {
    if (mMiniKeyboard != null)     mMiniKeyboard.closing();
    mMiniKeyboardPopup.dismiss();
    mMiniKeyboardOriginX=0;
    mMiniKeyboardOriginY=0;
    invalidateAllKeys();
    return true;
  }
 else   return false;
}
Program: 157424
Project: 157424
Buggy source:
/** 
 * Returns the state of the shift key of the keyboard, if any.
 * @return true if the shift is in a pressed state, false otherwise. Ifthere is no shift key on the keyboard or there is no keyboard attached, it returns false.
 */
public boolean isShifted(){
  if (isPopupShowing())   return mMiniKeyboard.isShifted();
  return mKeyboard != null && mKeyboard.isShifted();
}

Fixed version (ground truth):
/** 
 * Returns the state of the shift key of the keyboard, if any.
 * @return true if the shift is in a pressed state, false otherwise. Ifthere is no shift key on the keyboard or there is no keyboard attached, it returns false.
 */
public boolean isShifted(){
  if (mMiniKeyboardPopup.isShowing())   return mMiniKeyboard.isShifted();
  return mKeyboard != null && mKeyboard.isShifted();
}
Program: 157425
Project: 157425
Buggy source:
private void setPopupKeyboardWithView(int x,int y,View contentView){
  mMiniKeyboardVisible=true;
  mMiniKeyboardPopup.setContentView(contentView);
  mMiniKeyboardPopup.setWidth(contentView.getMeasuredWidth());
  mMiniKeyboardPopup.setHeight(contentView.getMeasuredHeight());
  mMiniKeyboardPopup.showAtLocation(this,Gravity.NO_GRAVITY,x,y);
  invalidateAllKeys();
}

Fixed version (ground truth):
private void setPopupKeyboardWithView(int x,int y,View contentView){
  mMiniKeyboardPopup.setContentView(contentView);
  mMiniKeyboardPopup.setWidth(contentView.getMeasuredWidth());
  mMiniKeyboardPopup.setHeight(contentView.getMeasuredHeight());
  mMiniKeyboardPopup.showAtLocation(this,Gravity.NO_GRAVITY,x,y);
  invalidateAllKeys();
}
Program: 157427
Project: 157427
Buggy source:
public boolean isInSlidingKeyInput(){
  if (mMiniKeyboard != null && mMiniKeyboardVisible) {
    return mMiniKeyboard.isInSlidingKeyInput();
  }
 else {
    return mPointerQueue.isInSlidingKeyInput();
  }
}

Fixed version (ground truth):
public boolean isInSlidingKeyInput(){
  if (mMiniKeyboard != null && mMiniKeyboardPopup.isShowing()) {
    return mMiniKeyboard.isInSlidingKeyInput();
  }
 else {
    return mPointerQueue.isInSlidingKeyInput();
  }
}
Program: 157429
Project: 157429
Buggy source:
public OrderedListViewHolder(View itemView){
  super(itemView);
  titleView=(TextView)itemView.findViewById(R.id.orderedListTitle);
  subtitleVew=(TextView)itemView.findViewById(R.id.orderedListSubTitle);
}

Fixed version (ground truth):
public OrderedListViewHolder(View itemView){
  super(itemView);
  title=(TextView)itemView.findViewById(R.id.orderedListTitle);
}
Program: 157430
Project: 157430
Buggy source:
@Override public void onBindViewHolder(OrderedListViewHolder viewHolder,int position){
  QuickTextKey value=mQuickKeysAddOnsToStore.get(position);
  viewHolder.titleView.setText(value.getName());
  viewHolder.subtitleVew.setText(value.getDescription());
}

Fixed version (ground truth):
@Override public void onBindViewHolder(OrderedListViewHolder viewHolder,int position){
  QuickTextKey value=mQuickKeysAddOnsToStore.get(position);
  viewHolder.title.setText(value.getName());
}
Program: 157433
Project: 157433
Buggy source:
@Override protected boolean onLongPress(Context packageContext,Key key,boolean isSticky,boolean requireSlideInto){
  if (key != null && key instanceof AnyKey) {
    AnyKey anyKey=(AnyKey)key;
    if (anyKey.longPressCode != 0) {
      invokeOnKey(anyKey.longPressCode,null,0);
      return true;
    }
 else     if (anyKey.codes[0] == KeyCodes.QUICK_TEXT) {
      invokeOnKey(KeyCodes.QUICK_TEXT_POPUP,null,0);
      return true;
    }
  }
  if (mAnimationLevel == AnimationsLevel.None) {
    mMiniKeyboardPopup.setAnimationStyle(0);
  }
 else   if (mExtensionVisible && mMiniKeyboardPopup.getAnimationStyle() != R.style.ExtensionKeyboardAnimation) {
    Log.d(TAG,"String_Node_Str");
    mMiniKeyboardPopup.setAnimationStyle(R.style.ExtensionKeyboardAnimation);
  }
 else   if (!mExtensionVisible && mMiniKeyboardPopup.getAnimationStyle() != R.style.MiniKeyboardAnimation) {
    Log.d(TAG,"String_Node_Str");
    mMiniKeyboardPopup.setAnimationStyle(R.style.MiniKeyboardAnimation);
  }
  return super.onLongPress(packageContext,key,isSticky,requireSlideInto);
}

Fixed version (ground truth):
@Override protected boolean onLongPress(Context packageContext,Key key,boolean isSticky,boolean requireSlideInto){
  if (key != null && key instanceof AnyKey) {
    AnyKey anyKey=(AnyKey)key;
    if (anyKey.longPressCode != 0) {
      invokeOnKey(anyKey.longPressCode,anyKey,0);
      return true;
    }
 else     if (anyKey.codes[0] == KeyCodes.QUICK_TEXT) {
      invokeOnKey(KeyCodes.QUICK_TEXT_POPUP,null,0);
      return true;
    }
  }
  if (mAnimationLevel == AnimationsLevel.None) {
    mMiniKeyboardPopup.setAnimationStyle(0);
  }
 else   if (mExtensionVisible && mMiniKeyboardPopup.getAnimationStyle() != R.style.ExtensionKeyboardAnimation) {
    Log.d(TAG,"String_Node_Str");
    mMiniKeyboardPopup.setAnimationStyle(R.style.ExtensionKeyboardAnimation);
  }
 else   if (!mExtensionVisible && mMiniKeyboardPopup.getAnimationStyle() != R.style.MiniKeyboardAnimation) {
    Log.d(TAG,"String_Node_Str");
    mMiniKeyboardPopup.setAnimationStyle(R.style.MiniKeyboardAnimation);
  }
  return super.onLongPress(packageContext,key,isSticky,requireSlideInto);
}
Program: 157434
Project: 157434
Buggy source:
public void testOnClickBackSpace() throws Exception {
  OnKeyboardActionListener keyboardActionListener=Mockito.mock(OnKeyboardActionListener.class);
  FrameKeyboardViewClickListener listener=new FrameKeyboardViewClickListener(keyboardActionListener);
  Mockito.verifyZeroInteractions(keyboardActionListener);
  View view=new View(Robolectric.application);
  view.setId(R.id.quick_keys_popup_backspace);
  listener.onClick(view);
  Mockito.verify(keyboardActionListener).onKey(KeyEvent.KEYCODE_DEL,null,0,null,true);
  Mockito.verifyNoMoreInteractions(keyboardActionListener);
}

Fixed version (ground truth):
@Test public void testOnClickBackSpace() throws Exception {
  OnKeyboardActionListener keyboardActionListener=Mockito.mock(OnKeyboardActionListener.class);
  FrameKeyboardViewClickListener listener=new FrameKeyboardViewClickListener(keyboardActionListener);
  Mockito.verifyZeroInteractions(keyboardActionListener);
  View view=new View(Robolectric.application);
  view.setId(R.id.quick_keys_popup_backspace);
  listener.onClick(view);
  Mockito.verify(keyboardActionListener).onKey(KeyCodes.DELETE,null,0,null,true);
  Mockito.verifyNoMoreInteractions(keyboardActionListener);
}
Program: 157435
Project: 157435
Buggy source:
public void testOnClickEnter() throws Exception {
  OnKeyboardActionListener keyboardActionListener=Mockito.mock(OnKeyboardActionListener.class);
  FrameKeyboardViewClickListener listener=new FrameKeyboardViewClickListener(keyboardActionListener);
  Mockito.verifyZeroInteractions(keyboardActionListener);
  View view=new View(Robolectric.application);
  view.setId(R.id.quick_keys_popup_return);
  listener.onClick(view);
  Mockito.verify(keyboardActionListener).onKey(KeyEvent.KEYCODE_ENTER,null,0,null,true);
  Mockito.verifyNoMoreInteractions(keyboardActionListener);
}

Fixed version (ground truth):
@Test public void testOnClickEnter() throws Exception {
  OnKeyboardActionListener keyboardActionListener=Mockito.mock(OnKeyboardActionListener.class);
  FrameKeyboardViewClickListener listener=new FrameKeyboardViewClickListener(keyboardActionListener);
  Mockito.verifyZeroInteractions(keyboardActionListener);
  View view=new View(Robolectric.application);
  view.setId(R.id.quick_keys_popup_return);
  listener.onClick(view);
  Mockito.verify(keyboardActionListener).onKey(KeyCodes.ENTER,null,0,null,true);
  Mockito.verifyNoMoreInteractions(keyboardActionListener);
}
Program: 157436
Project: 157436
Buggy source:
public void testOnClickClose() throws Exception {
  OnKeyboardActionListener keyboardActionListener=Mockito.mock(OnKeyboardActionListener.class);
  FrameKeyboardViewClickListener listener=new FrameKeyboardViewClickListener(keyboardActionListener);
  Mockito.verifyZeroInteractions(keyboardActionListener);
  View view=new View(Robolectric.application);
  view.setId(R.id.quick_keys_popup_close);
  listener.onClick(view);
  Mockito.verify(keyboardActionListener).onCancel();
  Mockito.verifyNoMoreInteractions(keyboardActionListener);
}

Fixed version (ground truth):
@Test public void testOnClickClose() throws Exception {
  OnKeyboardActionListener keyboardActionListener=Mockito.mock(OnKeyboardActionListener.class);
  FrameKeyboardViewClickListener listener=new FrameKeyboardViewClickListener(keyboardActionListener);
  Mockito.verifyZeroInteractions(keyboardActionListener);
  View view=new View(Robolectric.application);
  view.setId(R.id.quick_keys_popup_close);
  listener.onClick(view);
  Mockito.verify(keyboardActionListener).onCancel();
  Mockito.verifyNoMoreInteractions(keyboardActionListener);
}
Program: 157437
Project: 157437
Buggy source:
public QuickKeysPagerAdapter(@NonNull Context context,@NonNull List<QuickTextKey> quickTextKeys,OnKeyboardActionListener keyboardActionListener){
  mContext=context;
  mQuickTextKeys=quickTextKeys.toArray(new QuickTextKey[quickTextKeys.size()]);
  mLayoutInflater=LayoutInflater.from(context);
}

Fixed version (ground truth):
public QuickKeysPagerAdapter(@NonNull Context context,@NonNull List<QuickTextKey> quickTextKeys,OnKeyboardActionListener keyboardActionListener){
  mKeyboardActionListener=keyboardActionListener;
  mQuickTextKeys=quickTextKeys.toArray(new QuickTextKey[quickTextKeys.size()]);
  mLayoutInflater=LayoutInflater.from(context);
}
Program: 157438
Project: 157438
Buggy source:
@Override public Object instantiateItem(ViewGroup container,int position){
  TextView root=(TextView)mLayoutInflater.inflate(R.layout.quick_text_popup_keyboard_view,container,false);
  QuickTextKey quickTextKey=mQuickTextKeys[position];
  root.setTag(quickTextKey);
  root.setText(quickTextKey.getName());
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
    root.setCompoundDrawablesRelativeWithIntrinsicBounds(quickTextKey.getKeyIconResId(),0,0,0);
  }
 else {
    root.setCompoundDrawablesWithIntrinsicBounds(quickTextKey.getKeyIconResId(),0,0,0);
  }
  return root;
}

Fixed version (ground truth):
@Override public Object instantiateItem(ViewGroup container,int position){
  TextView root=(TextView)mLayoutInflater.inflate(R.layout.quick_text_popup_keyboard_view,container,false);
  QuickTextKey quickTextKey=mQuickTextKeys[position];
  root.setTag(quickTextKey);
  root.setText(quickTextKey.getName());
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
    root.setCompoundDrawablesRelativeWithIntrinsicBounds(quickTextKey.getKeyIconResId(),0,0,0);
  }
 else {
    root.setCompoundDrawablesWithIntrinsicBounds(quickTextKey.getKeyIconResId(),0,0,0);
  }
  container.addView(root);
  return root;
}
Program: 157439
Project: 157439
Buggy source:
@Override public boolean isViewFromObject(View view,Object object){
  return view.getTag() == object;
}

Fixed version (ground truth):
@Override public boolean isViewFromObject(View view,Object object){
  return view == object;
}
Program: 157440
Project: 157440
Buggy source:
private void handleControl(boolean reset){
  if (mInputView == null)   return;
  if (reset) {
    mInputView.setControl(false);
  }
 else {
    mInputView.setControl(!mInputView.isControl());
  }
}

Fixed version (ground truth):
private void handleControl(boolean reset){
  if (mInputView != null && mKeyboardSwitcher.isAlphabetMode()) {
    if (reset) {
      mControlKeyState.reset();
    }
    mInputView.setControl(mControlKeyState.isActive());
  }
}
Program: 157443
Project: 157443
Buggy source:
@Override public boolean onTouchEvent(MotionEvent ev){
  int singleFingerEventPointerId=mSingleFingerEventPointerId;
switch (MotionEventCompat.getActionMasked(ev)) {
case MotionEvent.ACTION_DOWN:
    if (ev.getPointerCount() == 1) {
      mSingleFingerEventPointerId=ev.getPointerId(0);
      singleFingerEventPointerId=mSingleFingerEventPointerId;
    }
  break;
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
if (ev.getPointerCount() == 1) mSingleFingerEventPointerId=NOT_A_POINTER_ID;
}
try {
mScaleGestureDetector.onTouchEvent(ev);
}
 catch (IllegalArgumentException e) {
}
catch (ArrayIndexOutOfBoundsException e) {
}
if (ev.getPointerCount() == 1 && ev.getPointerId(0) == singleFingerEventPointerId) return super.onTouchEvent(ev);
 else return false;
}

Fixed version (ground truth):
@Override public boolean onTouchEvent(@Nonnull MotionEvent ev){
  int singleFingerEventPointerId=mSingleFingerEventPointerId;
switch (MotionEventCompat.getActionMasked(ev)) {
case MotionEvent.ACTION_DOWN:
    if (ev.getPointerCount() == 1) {
      mSingleFingerEventPointerId=ev.getPointerId(0);
      singleFingerEventPointerId=mSingleFingerEventPointerId;
    }
  break;
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
if (ev.getPointerCount() == 1) mSingleFingerEventPointerId=NOT_A_POINTER_ID;
}
try {
mScaleGestureDetector.onTouchEvent(ev);
}
 catch (IllegalArgumentException e) {
}
catch (ArrayIndexOutOfBoundsException e) {
}
if (ev.getPointerCount() == 1 && ev.getPointerId(0) == singleFingerEventPointerId) return super.onTouchEvent(ev);
 else return false;
}
Program: 157444
Project: 157444
Buggy source:
public AskV8GestureDetector(Context context,AskOnGestureListener listener,Handler handler,boolean ignoreMultitouch){
  super(context,listener,handler,ignoreMultitouch);
  mListener=listener;
  mScaleGestureDetector=new ScaleGestureDetector(context,new ScaleGestureDetector.SimpleOnScaleGestureListener(){
    @Override public boolean onScale(    ScaleGestureDetector detector){
      final float factor=detector.getScaleFactor();
      Log.d(TAG,"String_Node_Str" + factor);
      if (factor > 1.1)       return mListener.onSeparate(factor);
 else       if (factor < 0.9)       return mListener.onPinch(factor);
      return false;
    }
  }
);
}

Fixed version (ground truth):
public AskV8GestureDetector(Context context,AskOnGestureListener listener){
  super(context,listener,null,true);
  mListener=listener;
  mScaleGestureDetector=new ScaleGestureDetector(context,new ScaleGestureDetector.SimpleOnScaleGestureListener(){
    @Override public boolean onScale(    ScaleGestureDetector detector){
      final float factor=detector.getScaleFactor();
      Log.d(TAG,"String_Node_Str" + factor);
      if (factor > 1.1)       return mListener.onSeparate(factor);
 else       if (factor < 0.9)       return mListener.onPinch(factor);
      return false;
    }
  }
);
}
Program: 157445
Project: 157445
Buggy source:
@Override public GestureDetector createGestureDetector(Context appContext,AskOnGestureListener listener){
  return new AskV8GestureDetector(appContext,listener,null,true);
}

Fixed version (ground truth):
@Override public GestureDetector createGestureDetector(Context appContext,AskOnGestureListener listener){
  return new AskV8GestureDetector(appContext,listener);
}
Program: 157446
Project: 157446
Buggy source:
private boolean canRestartWordSuggestion(final InputConnection ic){
  if (mPredicting || !isPredictionOn() || !mAllowSuggestionsRestart|| !mCurrentlyAllowSuggestionRestart|| mInputView == null || !mInputView.isShown()) {
    Log.d(TAG,"String_Node_Str" + "String_Node_Str" + mPredicting + "String_Node_Str"+ isPredictionOn()+ "String_Node_Str"+ mAllowSuggestionsRestart+ "String_Node_Str"+ mCurrentlyAllowSuggestionRestart);
    return false;
  }
 else   if (!isCursorTouchingWord()) {
    Log.d(TAG,"String_Node_Str");
    return false;
  }
  return true;
}

Fixed version (ground truth):
private boolean canRestartWordSuggestion(final InputConnection ic){
  if (mPredicting || !isPredictionOn() || !mAllowSuggestionsRestart|| !mCurrentlyAllowSuggestionRestart|| mInputView == null || !mInputView.isShown()) {
    Log.d(TAG,"String_Node_Str",mPredicting,isPredictionOn(),mAllowSuggestionsRestart,mCurrentlyAllowSuggestionRestart);
    return false;
  }
 else   if (!isCursorTouchingWord()) {
    Log.d(TAG,"String_Node_Str");
    return false;
  }
  return true;
}
Program: 157448
Project: 157448
Buggy source:
@Override public void onCreate(){
  SharedPreferencesBackupHelper helper=new SharedPreferencesBackupHelper(getApplicationContext(),DEFAULT_PREFS_FILE){
    @Override public void restoreEntity(    BackupDataInputStream data){
      final String key=data.getKey();
      if (!TextUtils.isEmpty(key)) {
        if (key.equalsIgnoreCase(getApplicationContext().getString(R.string.settings_key_default_split_state)))         return;
        if (key.equalsIgnoreCase("String_Node_Str"))         return;
        if (key.equalsIgnoreCase("String_Node_Str"))         return;
        if (key.equalsIgnoreCase(getApplicationContext().getString(R.string.settings_key_portrait_fullscreen)))         return;
        if (key.equalsIgnoreCase(getApplicationContext().getString(R.string.settings_key_landscape_fullscreen)))         return;
        if (key.equalsIgnoreCase(getApplicationContext().getString(R.string.settings_key_workaround_disable_rtl_fix)))         return;
      }
      super.restoreEntity(data);
    }
  }
;
  addHelper(PREFS_BACKUP_KEY,helper);
}

Fixed version (ground truth):
@Override public void onCreate(){
  SharedPreferencesBackupHelper helper=new SharedPreferencesBackupHelper(getApplicationContext(),DEFAULT_PREFS_FILE){
    @Override public void restoreEntity(    BackupDataInputStream data){
      final String key=data.getKey();
      if (!TextUtils.isEmpty(key)) {
        if (key.equalsIgnoreCase(getApplicationContext().getString(R.string.settings_key_default_split_state)))         return;
        if (key.equalsIgnoreCase("String_Node_Str"))         return;
        if (key.equalsIgnoreCase("String_Node_Str"))         return;
        if (key.equalsIgnoreCase(getApplicationContext().getString(R.string.settings_key_portrait_fullscreen)))         return;
        if (key.equalsIgnoreCase(getApplicationContext().getString(R.string.settings_key_landscape_fullscreen)))         return;
        if (key.equalsIgnoreCase(getApplicationContext().getString(R.string.settings_key_workaround_disable_rtl_fix)))         return;
        if (key.equalsIgnoreCase(getApplicationContext().getString(R.string.settings_key_allow_suggestions_restart)))         return;
      }
      super.restoreEntity(data);
    }
  }
;
  addHelper(PREFS_BACKUP_KEY,helper);
}