nus-yam/ex-repair huggingface dataset:
Program: 134552
Project: 134552
Buggy source:
@Override public boolean performFinish(){
  boolean res=super.performFinish();
  if (res) {
    IProject project=ResourcesPlugin.getWorkspace().getRoot().getProject(getModel().getArtifactId());
    IFolder folder=project.getFolder(yangPage.getRootDir());
    if (!folder.exists()) {
      try {
        folder.create(true,true,null);
        if (yangPage.createExampleFile()) {
          folder.getFile("String_Node_Str").create(FileLocator.openStream(YangUI.getDefault().getBundle(),new Path("String_Node_Str"),false),true,null);
        }
      }
 catch (      CoreException|IOException e) {
        e.printStackTrace();
        return false;
      }
    }
  }
  return res;
}

Fixed version (ground truth):
@Override public boolean performFinish(){
  boolean res=super.performFinish();
  if (res) {
    IProject project=ResourcesPlugin.getWorkspace().getRoot().getProject(getModel().getArtifactId());
    IFolder folder=project.getFolder(yangPage.getRootDir());
    if (!folder.exists()) {
      try {
        folder.create(true,true,null);
        if (yangPage.createExampleFile()) {
          folder.getFile("String_Node_Str").create(FileLocator.openStream(YangUIPlugin.getDefault().getBundle(),new Path("String_Node_Str"),false),true,null);
        }
      }
 catch (      CoreException e) {
        YangUIPlugin.log(e.getMessage(),e);
        e.printStackTrace();
        return false;
      }
catch (      IOException e) {
        YangUIPlugin.log(e.getMessage(),e);
        e.printStackTrace();
        return false;
      }
    }
  }
  return res;
}
Program: 134554
Project: 134554
Buggy source:
@Override public void removeListener(ILabelProviderListener listener){
}

Fixed version (ground truth):
public void removeListener(ILabelProviderListener listener){
}
Program: 134555
Project: 134555
Buggy source:
@Override public Image getColumnImage(Object element,int columnIndex){
  return null;
}

Fixed version (ground truth):
public Image getColumnImage(Object element,int columnIndex){
  return null;
}
Program: 134556
Project: 134556
Buggy source:
public List<CodeGeneratorConfig> getCodeGenerators(){
  List<CodeGeneratorConfig> list=new ArrayList<>();
  for (  TableItem item : generatorsTable.getItems()) {
    list.add((CodeGeneratorConfig)item.getData());
  }
  return list;
}

Fixed version (ground truth):
public List<CodeGeneratorConfig> getCodeGenerators(){
  List<CodeGeneratorConfig> list=new ArrayList<CodeGeneratorConfig>();
  for (  TableItem item : generatorsTable.getItems()) {
    list.add((CodeGeneratorConfig)item.getData());
  }
  return list;
}
Program: 134557
Project: 134557
Buggy source:
@Override public String getColumnText(Object element,int columnIndex){
  if (element instanceof CodeGeneratorConfig) {
    CodeGeneratorConfig conf=(CodeGeneratorConfig)element;
    String txt=null;
switch (columnIndex) {
case 0:
      txt=conf.getGroupId();
    break;
case 1:
  txt=conf.getArtifactId();
break;
case 2:
txt=conf.getVersion();
break;
case 3:
txt=conf.getGenClassName();
break;
case 4:
txt=conf.getGenOutputDirectory();
break;
}
return txt != null ? txt : "String_Node_Str";
}
return "String_Node_Str";
}

Fixed version (ground truth):
public String getColumnText(Object element,int columnIndex){
  if (element instanceof CodeGeneratorConfig) {
    CodeGeneratorConfig conf=(CodeGeneratorConfig)element;
    String txt=null;
switch (columnIndex) {
case 0:
      txt=conf.getGroupId();
    break;
case 1:
  txt=conf.getArtifactId();
break;
case 2:
txt=conf.getVersion();
break;
case 3:
txt=conf.getGenClassName();
break;
case 4:
txt=conf.getGenOutputDirectory();
break;
}
return txt != null ? txt : "String_Node_Str";
}
return "String_Node_Str";
}
Program: 134558
Project: 134558
Buggy source:
@Override public void dispose(){
}

Fixed version (ground truth):
public void dispose(){
}
Program: 134559
Project: 134559
Buggy source:
@Override public boolean isLabelProperty(Object element,String property){
  return false;
}

Fixed version (ground truth):
public boolean isLabelProperty(Object element,String property){
  return false;
}
Program: 134561
Project: 134561
Buggy source:
@Override public void addListener(ILabelProviderListener listener){
}

Fixed version (ground truth):
public void addListener(ILabelProviderListener listener){
}
Program: 134562
Project: 134562
Buggy source:
@Override public Set<IProject> build(int kind,IProgressMonitor monitor) throws Exception {
  IMaven maven=MavenPlugin.getMaven();
  BuildContext buildContext=getBuildContext();
  File[] sources=maven.getMojoParameterValue(getSession().getCurrentProject(),getMojoExecution(),"String_Node_Str",File[].class,monitor);
  boolean changed=false;
  for (  File source : sources) {
    Scanner ds=buildContext.newScanner(source);
    ds.scan();
    String[] includedFiles=ds.getIncludedFiles();
    if (includedFiles != null && includedFiles.length > 0) {
      changed=true;
    }
  }
  if (!changed) {
    return null;
  }
  Set<IProject> result=super.build(kind,monitor);
  YangGeneratorConfiguration[] confs=maven.getMojoParameterValue(getSession().getCurrentProject(),getMojoExecution(),"String_Node_Str",YangGeneratorConfiguration[].class,monitor);
  if (confs != null) {
    for (    YangGeneratorConfiguration conf : confs) {
      if (conf.getOutputBaseDir() != null) {
        buildContext.refresh(conf.getOutputBaseDir());
      }
    }
  }
  return result;
}

Fixed version (ground truth):
@Override public Set<IProject> build(int kind,IProgressMonitor monitor) throws Exception {
  IMaven maven=MavenPlugin.getMaven();
  BuildContext buildContext=getBuildContext();
  File source=maven.getMojoParameterValue(getSession().getCurrentProject(),getMojoExecution(),"String_Node_Str",File.class,monitor);
  Scanner ds=buildContext.newScanner(source);
  ds.scan();
  String[] includedFiles=ds.getIncludedFiles();
  if (includedFiles == null || includedFiles.length <= 0) {
    return null;
  }
  Set<IProject> result=super.build(kind,monitor);
  YangGeneratorConfiguration[] confs=maven.getMojoParameterValue(getSession().getCurrentProject(),getMojoExecution(),"String_Node_Str",YangGeneratorConfiguration[].class,monitor);
  if (confs != null) {
    for (    YangGeneratorConfiguration conf : confs) {
      if (conf.getOutputBaseDir() != null) {
        buildContext.refresh(conf.getOutputBaseDir());
      }
    }
  }
  return result;
}
Program: 134563
Project: 134563
Buggy source:
private static long getStatusID(Uri uri){
  String str="String_Node_Str";
  String[] arrayOfString=uri.toString().split("String_Node_Str");
  for (int i=0; i < arrayOfString.length; i++) {
    if (arrayOfString[i].startsWith("String_Node_Str")) {
      str=arrayOfString[(i + 1)];
      break;
    }
  }
  return Long.parseLong(str);
}

Fixed version (ground truth):
private static long getStatusID(Uri uri){
  String str="String_Node_Str";
  String[] arrayOfString=uri.getPath().toString().split("String_Node_Str");
  for (int i=0; i < arrayOfString.length; i++) {
    if (arrayOfString[i].startsWith("String_Node_Str")) {
      str=arrayOfString[(i + 1)];
      break;
    }
  }
  return Long.parseLong(str);
}
Program: 134564
Project: 134564
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View page=inflater.inflate(R.layout.fragment_search,container,false);
  int fragmentIndex=getAdapterIndex();
  PullToRefreshListView listView=getListView(page);
  SearchListAdapter adapter=(SearchListAdapter)getListAdapter(fragmentIndex);
  listView.setAdapter(adapter);
  listView.setOnScrollListener(this);
  listView.setOnRefreshListener(this);
  listView.setMode(getRefreshMode());
  ImageButton buttonQueries=getQueriesButton(page);
  buttonQueries.setOnClickListener(this);
  ImageButton buttonExecute=getExecuteButton(page);
  buttonExecute.setOnClickListener(this);
  ImageButton buttonSave=getSaveButton(page);
  buttonSave.setOnClickListener(this);
  editText=getEditText(page);
  editText.setOnFocusChangeListener(this);
  editText.setText(adapter.getQuery());
  adapter.setOnQueryChangeListener(this);
  return page;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View page=inflater.inflate(R.layout.fragment_search,container,false);
  int fragmentIndex=getAdapterIndex();
  PullToRefreshListView listView=getListView(page);
  SearchListAdapter adapter=(SearchListAdapter)getListAdapter(fragmentIndex);
  listView.setAdapter(adapter);
  listView.setOnScrollListener(this);
  listView.setOnRefreshListener(this);
  listView.setMode(getRefreshMode());
  ImageButton buttonQueries=getQueriesButton(page);
  buttonQueries.setOnClickListener(this);
  ImageButton buttonExecute=getExecuteButton(page);
  buttonExecute.setOnClickListener(this);
  ImageButton buttonSave=getSaveButton(page);
  buttonSave.setOnClickListener(this);
  editText=getEditText(page);
  editText.setOnFocusChangeListener(this);
  editText.setText(adapter.getQuery());
  editText.setMovementMethod(new ArrowKeyMovementMethod(){
    @Override protected boolean right(    TextView widget,    Spannable buffer){
      return widget.getSelectionEnd() == widget.length() || super.right(widget,buffer);
    }
    @Override protected boolean left(    TextView widget,    Spannable buffer){
      return widget.getSelectionStart() == 0 || super.left(widget,buffer);
    }
  }
);
  adapter.setOnQueryChangeListener(this);
  return page;
}
Program: 134566
Project: 134566
Buggy source:
private boolean isNotRetweetable(Account account,Status status){
  User user=TwitterUtils.getOriginalStatus(status).getUser();
  return status.getUser().isProtected() || status.getUser().getId() == account.userID;
}

Fixed version (ground truth):
private boolean isNotRetweetable(Account account,Status status){
  User user=TwitterUtils.getOriginalStatus(status).getUser();
  return user.isProtected() || user.getId() == account.userID;
}
Program: 134567
Project: 134567
Buggy source:
private boolean isDeletable(Account account,Status status){
  boolean deletable=false;
  if (!status.isRetweet()) {
    deletable=status.getUser().getId() == account.userID;
  }
 else {
    deletable=status.getRetweetedStatus().getUser().getId() == account.userID;
  }
  return deletable;
}

Fixed version (ground truth):
private boolean isDeletable(Account account,Status status){
  boolean deletable;
  if (!status.isRetweet()) {
    deletable=status.getUser().getId() == account.userID;
  }
 else {
    deletable=status.getRetweetedStatus().getUser().getId() == account.userID;
  }
  return deletable;
}
Program: 134568
Project: 134568
Buggy source:
private void setStateFromView(){
  PostState state=PostState.getState();
  state.removeListener();
  state.beginTransaction().setText(editText.getText().toString()).setSelection(editText.getSelectionStart(),editText.getSelectionEnd()).commit();
  state.setListener(this);
}

Fixed version (ground truth):
private void setStateFromView(){
  PostState state=PostState.getState();
  state.removeListener();
  state.beginTransaction().setText(editText.getText().toString()).commit();
  state.setListener(this);
}
Program: 134569
Project: 134569
Buggy source:
private void handleError(SwitchListenerResult result){
  Log.d(getClass().getName(),"String_Node_Str");
  if (result == null || result.isSuccess()) {
    if (!missingRequirement) {
      errorText.setVisibility(View.GONE);
      showLogsButton.setVisibility(View.GONE);
    }
  }
 else   if (result.getError() instanceof MissingRequirementException) {
    final int resId=((MissingRequirementException)result.getError()).getRequirement().getErrorTextResId();
    updateMissingRequirement(resId);
  }
 else {
    updateError(result.getError().getMessage(),result.getLogs());
  }
}

Fixed version (ground truth):
private void handleError(SwitchListenerResult result){
  Log.d(getClass().getName(),"String_Node_Str");
  if (result == null || result.isSuccess()) {
    if (!missingRequirement) {
      errorText.setVisibility(View.GONE);
      showLogsButton.setVisibility(View.GONE);
    }
  }
 else   if (result.getError() instanceof MissingRequirementException) {
    final int resId=((MissingRequirementException)result.getError()).getRequirement().getErrorTextResId();
    updateMissingRequirement(resId);
  }
 else {
    updateError(result.getError().getMessage(),result);
  }
}
Program: 134572
Project: 134572
Buggy source:
private void handleError(SwitchListenerResult result){
  Log.d(getClass().getName(),"String_Node_Str");
  if (result == null || result.isSuccess()) {
    errorText.setVisibility(View.GONE);
    showLogsButton.setVisibility(View.GONE);
  }
 else   if (result.getError() instanceof MissingRequirementException) {
    final int resId=((MissingRequirementException)result.getError()).getRequirement().getErrorTextResId();
    updateMissingRequirement(resId);
  }
 else {
    updateError(result.getError().getMessage(),result.getLogs());
  }
}

Fixed version (ground truth):
private void handleError(SwitchListenerResult result){
  Log.d(getClass().getName(),"String_Node_Str");
  if (result == null || result.isSuccess()) {
    if (!missingRequirement) {
      errorText.setVisibility(View.GONE);
      showLogsButton.setVisibility(View.GONE);
    }
  }
 else   if (result.getError() instanceof MissingRequirementException) {
    final int resId=((MissingRequirementException)result.getError()).getRequirement().getErrorTextResId();
    updateMissingRequirement(resId);
  }
 else {
    updateError(result.getError().getMessage(),result.getLogs());
  }
}
Program: 134574
Project: 134574
Buggy source:
private void updateMissingRequirement(int textResId){
  Log.d(getClass().getName(),"String_Node_Str");
  listenerSwitch.setClickable(false);
  secondaryActionButton.setClickable(false);
  errorText.setTextColor(Color.RED);
  errorText.setVisibility(View.VISIBLE);
  errorText.setText(textResId);
}

Fixed version (ground truth):
private void updateMissingRequirement(int textResId){
  Log.d(getClass().getName(),"String_Node_Str");
  missingRequirement=true;
  listenerSwitch.setClickable(false);
  secondaryActionButton.setClickable(false);
  errorText.setTextColor(Color.RED);
  errorText.setVisibility(View.VISIBLE);
  errorText.setText(textResId);
}
Program: 134575
Project: 134575
Buggy source:
@Override public void onClick(View v){
  Log.d(getClass().getName(),"String_Node_Str");
  checkBox.setChecked(!checkBox.isChecked());
}

Fixed version (ground truth):
@Override public void onClick(View v){
  Log.d(getClass().getName(),"String_Node_Str");
  item.setChoosen(!item.isChoosen());
  checkBox.setChecked(item.isChoosen());
}
Program: 134578
Project: 134578
Buggy source:
@Override public void onClick(View v){
  Log.d(getClass().getName(),"String_Node_Str");
  checkBox.setChecked(!checkBox.isChecked());
}

Fixed version (ground truth):
@Override public void onClick(View v){
  Log.d(getClass().getName(),"String_Node_Str");
  item.setChoosen(!item.isChoosen());
  checkBox.setChecked(item.isChoosen());
}
Program: 134580
Project: 134580
Buggy source:
private void changeParser(final TextParser parser){
  this.parser=parser;
  parserReceived=true;
  readable=parser.getReadable();
  wordList=readable.getWordList();
  emphasisList=readable.getEmphasisList();
  delayList=readable.getDelayList();
  if (isStorable(readable)) {
    bytePosition=((Storable)readable).getBytePosition();
  }
}

Fixed version (ground truth):
private void changeParser(final TextParser parser){
  parserReceived=true;
  readable=parser.getReadable();
  wordList=readable.getWordList();
  emphasisList=readable.getEmphasisList();
  delayList=readable.getDelayList();
  if (isStorable(readable)) {
    bytePosition=((Storable)readable).getBytePosition();
  }
}
Program: 134581
Project: 134581
Buggy source:
private int calcDelay(){
  return delayList.get(position) * Math.round(100 * 60 * 1f / settingsBundle.getWPM());
}

Fixed version (ground truth):
private int calcDelay(){
  return (delayList.isEmpty()) ? 10 * Math.round(100 * 60 * 1f / settingsBundle.getWPM()) : delayList.get(position) * Math.round(100 * 60 * 1f / settingsBundle.getWPM());
}
Program: 134582
Project: 134582
Buggy source:
@Override public void readData(){
  try {
    inputDataLength=fileInputStream.read(inputData);
    if (inputDataLength != -1) {
      setText(new StringBuilder((new String(inputData,encoding)).substring(0,(int)inputDataLength)));
    }
 else {
      setText("String_Node_Str");
    }
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
@Override public void readData(){
  try {
    if ((inputDataLength=fileInputStream.read(inputData)) != -1) {
      String toSet=new String(inputData,encoding);
      if (inputDataLength < toSet.length())       toSet=toSet.substring(0,(int)inputDataLength);
      setText(new StringBuilder(toSet));
    }
 else {
      setText("String_Node_Str");
    }
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}
Program: 134583
Project: 134583
Buggy source:
@Override public void run(){
  while (reader == null || !reader.isCompleted()) {
    try {
synchronized (parserDeque) {
        if (!currentReadable.isProcessed()) {
          currentReadable.process(getActivity());
          if (isFileStorable=isFileStorable(readable)) {
            fileSize=((FileStorable)readable).getFileSize();
          }
          currentReadable.readData();
          TextParser toAdd=TextParser.newInstance(currentReadable,settingsBundle);
          toAdd.process();
          parserDeque.add(toAdd);
        }
        while (parserDeque.size() < DEQUE_SIZE_LIMIT && parserDeque.size() > 0 && !TextUtils.isEmpty(parserDeque.getLast().getReadable().getText())) {
          parserDeque.addLast(getNextParser(parserDeque.getLast()));
        }
      }
      if (reader == null) {
        startReader(removeDequeHead());
      }
      if (reader != null) {
        reader.setChunkReady(parserDeque.size() > 1);
        object.pauseTask();
      }
 else {
        break;
      }
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  while (reader == null || !reader.isCompleted()) {
    try {
synchronized (parserDeque) {
        if (!currentReadable.isProcessed()) {
          currentReadable.process(getActivity());
          if (isFileStorable=isFileStorable(readable)) {
            fileSize=((FileStorable)readable).getFileSize();
          }
          currentReadable.readData();
          TextParser toAdd=TextParser.newInstance(currentReadable,settingsBundle);
          toAdd.process();
          parserDeque.add(toAdd);
        }
        while (parserDeque.size() < DEQUE_SIZE_LIMIT && parserDeque.size() > 0 && !TextUtils.isEmpty(parserDeque.getLast().getReadable().getText())) {
          parserDeque.addLast(getNextParser(parserDeque.getLast()));
        }
      }
      if (reader == null) {
        startReader(removeDequeHead());
      }
      if (reader != null) {
        reader.setChunkAvailable(isChunkAvailable());
        object.pauseTask();
      }
 else {
        break;
      }
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
}
Program: 134584
Project: 134584
Buggy source:
public void setPosition(int position){
  if (wordList != null && position < wordList.size() && position >= 0) {
    this.position=position;
    updateView(position);
    showInfo(this);
  }
}

Fixed version (ground truth):
public void setPosition(int position){
  if (wordList != null && emphasisList != null && delayList != null && position < wordList.size() && position >= 0) {
    this.position=position;
    updateView(position);
    showInfo(this);
  }
}
Program: 134585
Project: 134585
Buggy source:
private void changeParser(final TextParser parser){
  this.parser=parser;
  parserReceived=true;
  readable=parser.getReadable();
  wordList=readable.getWordList();
  emphasisList=readable.getEmphasisList();
  delayList=readable.getDelayList();
  if (isStorable=isStorable(readable)) {
    bytePosition=((Storable)readable).getBytePosition();
  }
}

Fixed version (ground truth):
private void changeParser(final TextParser parser){
  this.parser=parser;
  parserReceived=true;
  readable=parser.getReadable();
  wordList=readable.getWordList();
  emphasisList=readable.getEmphasisList();
  delayList=readable.getDelayList();
  if (isStorable(readable)) {
    bytePosition=((Storable)readable).getBytePosition();
  }
}
Program: 134586
Project: 134586
Buggy source:
private void updateView(int pos){
  currentTextView.setText(getCurrentFormattedText(pos));
  leftTextView.setText(getLeftFormattedText(pos));
  rightTextView.setText(getRightFormattedText(pos));
  approxCharCount+=wordList.get(pos).length();
  progress=(isFileStorable) ? Math.min((int)(100f * (bytePosition + approxCharCount) / fileSize + .5f),99) : (int)(100f / wordList.size() * (pos + 1) + .5f);
  progressBar.setProgress(progress);
  hideNotification(false);
}

Fixed version (ground truth):
private void updateView(int pos){
  if (pos >= wordList.size())   return;
  currentTextView.setText(getCurrentFormattedText(pos));
  leftTextView.setText(getLeftFormattedText(pos));
  rightTextView.setText(getRightFormattedText(pos));
  approxCharCount+=wordList.get(pos).length();
  progress=(isFileStorable) ? Math.min((int)(100f * (bytePosition + approxCharCount) / fileSize + .5f),99) : (int)(100f / wordList.size() * (pos + 1) + .5f);
  progressBar.setProgress(progress);
  hideNotification(false);
}
Program: 134587
Project: 134587
Buggy source:
public void copyListPrefix(Readable next){
  List<String> nextWordList=next.getWordList();
  wordList.addAll(new ArrayList<String>(nextWordList.subList(0,Math.min(LAST_WORD_PREFIX_SIZE,nextWordList.size()))));
}

Fixed version (ground truth):
public void copyListPrefix(Readable next){
  List<String> nextWordList=next.getWordList();
  wordList.addAll(new ArrayList<String>(nextWordList.subList(0,Math.min(LAST_WORD_PREFIX_SIZE,nextWordList.size()))));
  List<Integer> nextEmphasisList=next.getEmphasisList();
  emphasisList.addAll(new ArrayList<Integer>(nextEmphasisList.subList(0,Math.min(LAST_WORD_PREFIX_SIZE,nextEmphasisList.size()))));
  List<Integer> nextDelayList=next.getDelayList();
  delayList.addAll(new ArrayList<Integer>(nextDelayList.subList(0,Math.min(LAST_WORD_PREFIX_SIZE,nextDelayList.size()))));
}
Program: 134588
Project: 134588
Buggy source:
public void checkResult(){
  int resultCode;
  if (readable != null) {
    if (TextUtils.isEmpty(readable.getText()) || readable.getWordList().isEmpty() || readable.getWordList().size() < 2 || readable.isProcessFailed()) {
switch (this.getReadable().getType()) {
case Readable.TYPE_CLIPBOARD:
        resultCode=RESULT_CODE_EMPTY_CLIPBOARD;
      break;
case Readable.TYPE_FILE:
    resultCode=RESULT_CODE_WRONG_EXT;
  break;
case Readable.TYPE_TXT:
resultCode=RESULT_CODE_WRONG_EXT;
break;
case Readable.TYPE_EPUB:
resultCode=RESULT_CODE_WRONG_EXT;
break;
case Readable.TYPE_NET:
resultCode=RESULT_CODE_CANT_FETCH;
break;
default :
resultCode=RESULT_CODE_WTF;
break;
}
}
 else {
resultCode=RESULT_CODE_OK;
}
}
 else {
resultCode=RESULT_CODE_WTF;
}
setResultCode(resultCode);
}

Fixed version (ground truth):
public void checkResult(){
  int resultCode;
  if (readable != null) {
    if (TextUtils.isEmpty(readable.getText()) || readable.getWordList().isEmpty() || readable.isProcessFailed()) {
switch (this.getReadable().getType()) {
case Readable.TYPE_CLIPBOARD:
        resultCode=RESULT_CODE_EMPTY_CLIPBOARD;
      break;
case Readable.TYPE_FILE:
    resultCode=RESULT_CODE_WRONG_EXT;
  break;
case Readable.TYPE_TXT:
resultCode=RESULT_CODE_WRONG_EXT;
break;
case Readable.TYPE_EPUB:
resultCode=RESULT_CODE_WRONG_EXT;
break;
case Readable.TYPE_NET:
resultCode=RESULT_CODE_CANT_FETCH;
break;
default :
resultCode=RESULT_CODE_WTF;
break;
}
}
 else {
resultCode=RESULT_CODE_OK;
}
}
 else {
resultCode=RESULT_CODE_WTF;
}
setResultCode(resultCode);
}
Program: 134589
Project: 134589
Buggy source:
/** 
 * @return serialized instance
 */
@Override public String toString(){
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  ObjectOutputStream oos=null;
  try {
    oos=new ObjectOutputStream(baos);
    oos.writeObject(this);
    oos.close();
    return new String(Base64Coder.encode(baos.toByteArray()));
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  return null;
}

Fixed version (ground truth):
/** 
 * @return serialized instance
 */
@Override public String toString(){
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  ObjectOutputStream oos;
  try {
    oos=new ObjectOutputStream(baos);
    oos.writeObject(this);
    oos.close();
    return new String(Base64Coder.encode(baos.toByteArray()));
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  return null;
}
Program: 134590
Project: 134590
Buggy source:
@Override public void readData(){
  try {
    if (fileReader.read(inputData) != -1) {
      setText(new StringBuilder(new String(inputData)));
    }
 else {
      setText("String_Node_Str");
    }
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
@Override public void readData(){
  try {
    int inputDataLength=fileReader.read(inputData);
    if (inputDataLength != -1) {
      setText(new StringBuilder((new String(inputData)).substring(0,inputDataLength)));
    }
 else {
      setText("String_Node_Str");
    }
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}
Program: 134591
Project: 134591
Buggy source:
public void assignFields(){
  WPM=Integer.parseInt(sharedPreferences.getString(Constants.Preferences.WPM,Constants.DEFAULT_WPM));
  typeface=Integer.parseInt(sharedPreferences.getString(Constants.Preferences.TYPEFACE,"String_Node_Str"));
  swipesEnabled=sharedPreferences.getBoolean(Constants.Preferences.SWIPE,true);
  showingContextEnabled=sharedPreferences.getBoolean(Constants.Preferences.SHOW_CONTEXT,true);
  punctuationSpeedDiffers=sharedPreferences.getBoolean(Constants.Preferences.PUNCTUATION_DIFFERS,true);
  delayCoefficients=buildDelayListCoefficients();
}

Fixed version (ground truth):
public void assignFields(){
  WPM=Integer.parseInt(sharedPreferences.getString(Constants.Preferences.WPM,Constants.DEFAULT_WPM));
  typeface=Integer.parseInt(sharedPreferences.getString(Constants.Preferences.TYPEFACE,"String_Node_Str"));
  swipesEnabled=sharedPreferences.getBoolean(Constants.Preferences.SWIPE,false);
  showingContextEnabled=sharedPreferences.getBoolean(Constants.Preferences.SHOW_CONTEXT,true);
  punctuationSpeedDiffers=sharedPreferences.getBoolean(Constants.Preferences.PUNCTUATION_DIFFERS,true);
  delayCoefficients=buildDelayListCoefficients();
}
Program: 134592
Project: 134592
Buggy source:
private void inflateActionMenu(View v){
  View actionView=v.findViewById(R.id.action_view);
  View mainView=v.findViewById(R.id.main_view);
  int height=mainView.getLayoutParams().height;
  actionView.setMinimumHeight(height);
  YoYo.with(Techniques.SlideOutRight).duration(DURATION).playOn(mainView);
  actionView.setVisibility(View.VISIBLE);
  YoYo.with(Techniques.FadeIn).duration(DURATION).playOn(actionView);
}

Fixed version (ground truth):
private void inflateActionMenu(View v){
  View actionView=v.findViewById(R.id.action_view);
  View mainView=v.findViewById(R.id.main_view);
  int height=mainView.getHeight();
  actionView.setMinimumHeight(height);
  YoYo.with(Techniques.SlideOutRight).duration(DURATION).playOn(mainView);
  actionView.setVisibility(View.VISIBLE);
  YoYo.with(Techniques.FadeIn).duration(DURATION).playOn(actionView);
}
Program: 134594
Project: 134594
Buggy source:
protected String insertSpacesAfterPunctuation(String text){
  StringBuilder res=new StringBuilder();
  String madeMeSpecial=makeMeSpecial.substring(1,9) + "String_Node_Str";
  for (int i=0; i < text.length(); ++i) {
    Character ch=text.charAt(i);
    res.append(ch);
    if (i < text.length() - 1) {
      Character nextCh=text.charAt(i + 1);
      if (madeMeSpecial.indexOf(ch) > -1 && Character.isLetter(nextCh))       res.append("String_Node_Str");
    }
  }
  for (  Character ch : text.toCharArray()) {
    res.append(ch);
    if (madeMeSpecial.indexOf(ch) > -1)     res.append("String_Node_Str");
  }
  return res.toString();
}

Fixed version (ground truth):
protected String insertSpacesAfterPunctuation(String text){
  StringBuilder res=new StringBuilder();
  String madeMeSpecial=makeMeSpecial.substring(1,9) + "String_Node_Str";
  for (int i=0; i < text.length(); ++i) {
    Character ch=text.charAt(i);
    res.append(ch);
    if (i < text.length() - 1) {
      Character nextCh=text.charAt(i + 1);
      if (madeMeSpecial.indexOf(ch) > -1 && Character.isLetter(nextCh))       res.append("String_Node_Str");
    }
  }
  return res.toString();
}
Program: 134595
Project: 134595
Buggy source:
protected String clearFromRepetitions(String text){
  StringBuilder result=new StringBuilder();
  int previousPosition=-1;
  for (  Character ch : text.toCharArray()) {
    int position=makeMeSpecial.indexOf(ch);
    if (position > -1 && position != previousPosition) {
      previousPosition=position;
      result.append(ch);
    }
 else     if (position < 0) {
      previousPosition=-1;
      result.append(ch);
    }
  }
  return result.toString();
}

Fixed version (ground truth):
protected String clearFromRepetitions(String text){
  StringBuilder res=new StringBuilder();
  int previousPosition=-1;
  for (  Character ch : text.toCharArray()) {
    int position=makeMeSpecial.indexOf(ch);
    if (position > -1 && position != previousPosition) {
      previousPosition=position;
      res.append(ch);
    }
 else     if (position < 0) {
      previousPosition=-1;
      res.append(ch);
    }
  }
  return res.toString();
}
Program: 134596
Project: 134596
Buggy source:
@Override public Loader<Cursor> onCreateLoader(int id,Bundle args){
  return new CursorLoader(getActivity(),LastReadContentProvider.CONTENT_URI,null,null,null,null);
}

Fixed version (ground truth):
@Override public Loader<Cursor> onCreateLoader(int id,Bundle args){
  Log.d(LOGTAG,"String_Node_Str");
  return new CursorLoader(getActivity(),LastReadContentProvider.CONTENT_URI,null,null,null,null);
}
Program: 134597
Project: 134597
Buggy source:
@Override public void onLoaderReset(Loader loader){
  objectsContainer=new ArrayList<MiniReadable>();
  adapter.updateAll(objectsContainer);
}

Fixed version (ground truth):
@Override public void onLoaderReset(Loader loader){
  Log.d(LOGTAG,"String_Node_Str");
  objectsContainer=new ArrayList<MiniReadable>();
  adapter.updateAll(objectsContainer);
}
Program: 134598
Project: 134598
Buggy source:
@Override public void onLoadFinished(Loader<Cursor> loader,Cursor data){
  objectsContainer=MiniReadable.getFromCursor(data);
  adapter.updateAll(objectsContainer);
}

Fixed version (ground truth):
@Override public void onLoadFinished(Loader<Cursor> loader,Cursor data){
  Log.d(LOGTAG,"String_Node_Str");
  objectsContainer=MiniReadable.getFromCursor(data);
  adapter.updateAll(objectsContainer);
}
Program: 134599
Project: 134599
Buggy source:
public static ArrayList<MiniReadable> getFromCursor(Cursor cursor){
  ArrayList<MiniReadable> result=new ArrayList<MiniReadable>();
  if (cursor != null) {
    while (cursor.moveToNext())     result.add(new MiniReadable(cursor.getString(LastReadDBHelper.COLUMN_PATH),cursor.getString(LastReadDBHelper.COLUMN_HEADER),cursor.getString(LastReadDBHelper.COLUMN_PERCENT),cursor.getInt(LastReadDBHelper.COLUMN_POSITION)));
  }
  return result;
}

Fixed version (ground truth):
public static ArrayList<MiniReadable> getFromCursor(Cursor cursor){
  ArrayList<MiniReadable> result=new ArrayList<MiniReadable>();
  if (cursor != null && cursor.getCount() > 0) {
    cursor.moveToFirst();
    do {
      result.add(new MiniReadable(cursor.getString(LastReadDBHelper.COLUMN_PATH),cursor.getString(LastReadDBHelper.COLUMN_HEADER),cursor.getString(LastReadDBHelper.COLUMN_PERCENT),cursor.getInt(LastReadDBHelper.COLUMN_POSITION)));
    }
 while (cursor.moveToNext());
  }
  return result;
}
Program: 134600
Project: 134600
Buggy source:
@Override public Cursor queryRoots(final String[] projection) throws FileNotFoundException {
  final MatrixCursor result=new MatrixCursor(projection != null ? projection : DEFAULT_ROOT_PROJECTION);
  File homeDir=Environment.getExternalStorageDirectory();
  final MatrixCursor.RowBuilder row=result.newRow();
  row.add(Root.COLUMN_ROOT_ID,homeDir.getAbsolutePath());
  row.add(Root.COLUMN_DOCUMENT_ID,homeDir.getAbsolutePath());
  row.add(Root.COLUMN_TITLE,getContext().getString(R.string.internal_storage));
  row.add(Root.COLUMN_FLAGS,Root.FLAG_LOCAL_ONLY | Root.FLAG_SUPPORTS_CREATE);
  row.add(Root.COLUMN_ICON,R.drawable.ic_provider);
  row.add(Root.COLUMN_AVAILABLE_BYTES,homeDir.getFreeSpace());
  return result;
}

Fixed version (ground truth):
@Override public Cursor queryRoots(final String[] projection) throws FileNotFoundException {
  final MatrixCursor result=new MatrixCursor(projection != null ? projection : DEFAULT_ROOT_PROJECTION);
  File homeDir=Environment.getExternalStorageDirectory();
  final MatrixCursor.RowBuilder row=result.newRow();
  row.add(Root.COLUMN_ROOT_ID,homeDir.getParent());
  row.add(Root.COLUMN_DOCUMENT_ID,homeDir.getParent());
  row.add(Root.COLUMN_TITLE,getContext().getString(R.string.all_storage));
  row.add(Root.COLUMN_FLAGS,Root.FLAG_LOCAL_ONLY | Root.FLAG_SUPPORTS_CREATE);
  row.add(Root.COLUMN_ICON,R.drawable.ic_provider);
  row.add(Root.COLUMN_AVAILABLE_BYTES,homeDir.getFreeSpace());
  return result;
}
Program: 134601
Project: 134601
Buggy source:
@Override protected void onActivityResult(int requestCode,int resultCode,Intent data){
switch (requestCode) {
case FILE_SELECT_CODE:
    if (resultCode == RESULT_OK)     ReceiverActivity.startReceiverActivity(this,Readable.TYPE_FILE,data.getData().toString());
  break;
}
super.onActivityResult(requestCode,resultCode,data);
}

Fixed version (ground truth):
@Override protected void onActivityResult(int requestCode,int resultCode,Intent data){
switch (requestCode) {
case FILE_SELECT_CODE:
    String relativePath=data.getData().toString();
  if (resultCode == RESULT_OK) {
    if (FileStorable.isExtensionValid(FileStorable.getExtension(relativePath)))     ReceiverActivity.startReceiverActivity(this,Readable.TYPE_FILE,relativePath);
 else     Toast.makeText(this,R.string.wrong_ext,Toast.LENGTH_SHORT).show();
  }
break;
}
super.onActivityResult(requestCode,resultCode,data);
}
Program: 134602
Project: 134602
Buggy source:
public void process(Context context){
  Log.d(LOGTAG,"String_Node_Str");
  try {
    path=FileStorable.takePath(context,path);
    if (path == null) {
      Log.d(LOGTAG,"String_Node_Str");
      return;
    }
    Book book=(new EpubReader()).readEpub(new FileInputStream(path));
    for (    Resource res : book.getContents())     text.append(new String(res.getData()));
    text=new StringBuilder(parseEpub(text.toString()));
    createRowData(context);
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
catch (  URISyntaxException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public void process(Context context){
  Log.d(LOGTAG,"String_Node_Str");
  try {
    path=FileStorable.takePath(context,path);
    if (path == null) {
      Log.d(LOGTAG,"String_Node_Str");
      return;
    }
    Book book=(new EpubReader()).readEpub(new FileInputStream(path));
    for (    Resource res : book.getContents())     text.append(new String(res.getData()));
    text=new StringBuilder(parseEpub(text.toString()));
    createRowData(context);
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}
Program: 134603
Project: 134603
Buggy source:
public static String takePath(Context context,String s) throws URISyntaxException {
  if ("String_Node_Str".equals(s.substring(0,7))) {
    return FileStorable.takePath(context,Uri.parse(s));
  }
 else   return s;
}

Fixed version (ground truth):
public static String takePath(Context context,String s){
  String candidate=FileStorable.takePath(context,Uri.parse(s));
  if (TextUtils.isEmpty(candidate))   return s;
  return candidate;
}
Program: 134604
Project: 134604
Buggy source:
public void process(Context context){
  Log.d(LOGTAG,"String_Node_Str");
  try {
    path=FileStorable.takePath(context,path);
    if (path == null) {
      Log.d(LOGTAG,"String_Node_Str");
      return;
    }
    FileReader fileReader=new FileReader(path);
    BufferedReader br=new BufferedReader(fileReader);
    String sCurrentLine;
    while ((sCurrentLine=br.readLine()) != null)     text.append(sCurrentLine).append('\n');
    br.close();
    createRowData(context);
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
catch (  URISyntaxException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public void process(Context context){
  Log.d(LOGTAG,"String_Node_Str");
  try {
    path=FileStorable.takePath(context,path);
    if (path == null) {
      Log.d(LOGTAG,"String_Node_Str");
      return;
    }
    FileReader fileReader=new FileReader(path);
    BufferedReader br=new BufferedReader(fileReader);
    String sCurrentLine;
    while ((sCurrentLine=br.readLine()) != null)     text.append(sCurrentLine).append('\n');
    br.close();
    createRowData(context);
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}
Program: 134605
Project: 134605
Buggy source:
@Override public void onStop(){
  Log.d(LOGTAG,"String_Node_Str");
  Activity activity=getActivity();
  if (isStorable()) {
    Storable storable=(Storable)readable;
    if (reader.isCompleted()) {
      activity.startService(createLastReadServiceIntent(activity,storable,Constants.DB_OPERATION_DELETE));
    }
 else {
      activity.startService(createLastReadServiceIntent(activity,storable,Constants.DB_OPERATION_INSERT));
    }
  }
  settingsBundle.updatePreferences();
  manager.unregisterReceiver(textParserListener);
  activity.finish();
  super.onStop();
}

Fixed version (ground truth):
@Override public void onStop(){
  Log.d(LOGTAG,"String_Node_Str");
  Activity activity=getActivity();
  if (isStorable() && reader != null) {
    Storable storable=(Storable)readable;
    int operation=(reader.isCompleted()) ? Constants.DB_OPERATION_DELETE : Constants.DB_OPERATION_INSERT;
    activity.startService(createLastReadServiceIntent(activity,storable,operation));
  }
  settingsBundle.updatePreferences();
  manager.unregisterReceiver(textParserListener);
  activity.finish();
  super.onStop();
}
Program: 134606
Project: 134606
Buggy source:
private Boolean isStorable(){
  return parserReceived && readable != null && settingsBundle != null && !TextUtils.isEmpty(readable.getPath()) && settingsBundle.isCachingEnabled();
}

Fixed version (ground truth):
private Boolean isStorable(){
  return parserReceived && readable != null && settingsBundle != null && settingsBundle.isCachingEnabled() && !TextUtils.isEmpty(readable.getPath());
}
Program: 134607
Project: 134607
Buggy source:
private void receiveParser(Context context,Intent intent){
  try {
    parser=TextParser.fromString(intent.getStringExtra(Constants.EXTRA_PARSER));
    parserReceived=true;
    readable=parser.getReadable();
    wordList=readable.getWordList();
    emphasisList=readable.getEmphasisList();
    delayList=readable.getDelayList();
    YoYo.with(Techniques.FadeOut).duration(Constants.SECOND / 2).playOn(parsingProgressBar);
    readerLayout.setVisibility(View.VISIBLE);
    YoYo.with(Techniques.BounceIn).duration(2 * Constants.SECOND).playOn(readerLayout);
    final Handler handler=new Handler();
    readable.setPosition(Math.max(readable.getPosition() - Constants.READER_START_OFFSET,0));
    reader=new Reader(handler,readable.getPosition());
    handler.postDelayed(reader,3 * Constants.SECOND);
    if (isStorable())     context.startService(createLastReadServiceIntent(context,(Storable)readable,Constants.DB_OPERATION_INSERT));
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
catch (  ClassNotFoundException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
private void receiveParser(Context context,Intent intent){
  try {
    int resultCode=intent.getIntExtra(Constants.EXTRA_PARSER_RESULT_CODE,TextParserService.RESULT_CODE_OK);
    if (resultCode == TextParserService.RESULT_CODE_OK) {
      parser=TextParser.fromString(intent.getStringExtra(Constants.EXTRA_PARSER));
      parserReceived=true;
      readable=parser.getReadable();
      wordList=readable.getWordList();
      emphasisList=readable.getEmphasisList();
      delayList=readable.getDelayList();
      YoYo.with(Techniques.FadeOut).duration(Constants.SECOND / 2).playOn(parsingProgressBar);
      readerLayout.setVisibility(View.VISIBLE);
      YoYo.with(Techniques.BounceIn).duration(2 * Constants.SECOND).playOn(readerLayout);
      final Handler handler=new Handler();
      readable.setPosition(Math.max(readable.getPosition() - Constants.READER_START_OFFSET,0));
      reader=new Reader(handler,readable.getPosition());
      handler.postDelayed(reader,3 * Constants.SECOND);
      if (isStorable()) {
        context.startService(createLastReadServiceIntent(context,(Storable)readable,Constants.DB_OPERATION_INSERT));
      }
    }
 else {
      int stringId;
switch (resultCode) {
case TextParserService.RESULT_CODE_WRONG_EXT:
        stringId=R.string.wrong_ext;
      break;
case TextParserService.RESULT_CODE_EMPTY_CLIPBOARD:
    stringId=R.string.clipboard_empty;
  break;
case TextParserService.RESULT_CODE_CANT_FETCH:
stringId=R.string.cant_fetch;
break;
default :
stringId=R.string.text_null;
break;
}
Toast.makeText(context,stringId,Toast.LENGTH_SHORT).show();
onStop();
}
}
 catch (IOException e) {
e.printStackTrace();
}
catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
Program: 134608
Project: 134608
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_receiver);
  getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
  Bundle bundle=bundleReceivedData();
  startReaderFragment(bundle);
  startService(createParserServiceIntent(bundle));
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_receiver);
  getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
  Bundle bundle=bundleReceivedData();
  startReaderFragment(bundle);
  startTextParserService(bundle);
}
Program: 134609
Project: 134609
Buggy source:
private void startReaderFragment(Bundle bundle){
  Fragment readerFragment=new ReaderFragment();
  readerFragment.setArguments(bundle);
  FragmentTransaction transaction=getFragmentManager().beginTransaction();
  transaction.replace(R.id.fragment_container,readerFragment);
  transaction.addToBackStack(null);
  transaction.commit();
}

Fixed version (ground truth):
private void startReaderFragment(Bundle bundle){
  if (bundle != null) {
    Fragment readerFragment=new ReaderFragment();
    readerFragment.setArguments(bundle);
    FragmentTransaction transaction=getFragmentManager().beginTransaction();
    transaction.replace(R.id.fragment_container,readerFragment);
    transaction.addToBackStack(null);
    transaction.commit();
  }
 else {
    Log.d(LOGTAG,"String_Node_Str");
  }
}
Program: 134610
Project: 134610
Buggy source:
private Bundle bundleReceivedData(){
  Bundle bundle=getIntent().getExtras();
  if (bundle != null && !bundle.containsKey(Intent.EXTRA_TEXT) && !bundle.containsKey(Constants.EXTRA_TYPE))   bundle.putInt(Constants.EXTRA_TYPE,Readable.TYPE_TEST);
  Log.d(LOGTAG,"String_Node_Str" + ((bundle == null) ? "String_Node_Str" : bundle.toString()));
  return bundle;
}

Fixed version (ground truth):
private Bundle bundleReceivedData(){
  Bundle bundle=getIntent().getExtras();
  Log.d(LOGTAG,"String_Node_Str" + ((bundle == null) ? "String_Node_Str" : bundle.toString()));
  return bundle;
}
Program: 134611
Project: 134611
Buggy source:
private Intent createParserServiceIntent(Bundle bundle){
  Intent intent=new Intent(this,TextParserService.class);
  if (bundle != null)   intent.putExtras(bundle);
  return intent;
}

Fixed version (ground truth):
private Intent createParserServiceIntent(Bundle bundle){
  if (bundle != null) {
    Intent intent=new Intent(this,TextParserService.class);
    intent.putExtras(bundle);
    return intent;
  }
 else {
    Log.d(LOGTAG,"String_Node_Str");
    return null;
  }
}
Program: 134612
Project: 134612
Buggy source:
public void process(Context context){
  ClipboardManager clipboard=(ClipboardManager)context.getSystemService(Context.CLIPBOARD_SERVICE);
  if (processFailed=!clipboard.hasText())   Toast.makeText(context,context.getResources().getString(R.string.clipboard_empty),Toast.LENGTH_SHORT).show();
 else   text.append(paste(clipboard));
}

Fixed version (ground truth):
public void process(Context context){
  ClipboardManager clipboard=(ClipboardManager)context.getSystemService(Context.CLIPBOARD_SERVICE);
  if (processFailed=!clipboard.hasText()) {
    Log.d(LOGTAG,"String_Node_Str");
  }
 else {
    text.append(paste(clipboard));
  }
}
Program: 134613
Project: 134613
Buggy source:
public EpubFileStorable(){
  extension="String_Node_Str";
  type=TYPE_EPUB;
}

Fixed version (ground truth):
public EpubFileStorable(String path){
  extension="String_Node_Str";
  type=TYPE_EPUB;
  this.path=path;
}
Program: 134614
Project: 134614
Buggy source:
public static FileStorable createFileStorable(String intentPath){
  FileStorable fileStorable;
switch (getIntentType(intentPath)) {
case Readable.TYPE_TXT:
    fileStorable=new TxtFileStorable();
  break;
case Readable.TYPE_EPUB:
fileStorable=new EpubFileStorable();
break;
default :
fileStorable=null;
}
return fileStorable;
}

Fixed version (ground truth):
public static FileStorable createFileStorable(String intentPath){
  FileStorable fileStorable;
switch (getIntentType(intentPath)) {
case Readable.TYPE_TXT:
    fileStorable=new TxtFileStorable(intentPath);
  break;
case Readable.TYPE_EPUB:
fileStorable=new EpubFileStorable(intentPath);
break;
default :
fileStorable=null;
}
return fileStorable;
}
Program: 134615
Project: 134615
Buggy source:
@Override public void process(Context context){
  if (!TextUtils.isEmpty(link)) {
    text=new StringBuilder(parseArticle(link));
  }
 else {
    throw new IllegalArgumentException("String_Node_Str");
  }
  path=context.getFilesDir() + "String_Node_Str" + cleanFileName(title)+ "String_Node_Str";
  rowData=takeRowData(context);
  if (rowData != null)   position=rowData.getPosition();
 else   createStorageFile(context,path,text.toString());
}

Fixed version (ground truth):
@Override public void process(Context context){
  if (!TextUtils.isEmpty(link)) {
    if (isNetworkAvailable(context)) {
      text=new StringBuilder(parseArticle(link));
    }
 else {
      processFailed=true;
      return;
    }
  }
 else {
    processFailed=true;
    return;
  }
  path=context.getFilesDir() + "String_Node_Str" + cleanFileName(title)+ "String_Node_Str";
  rowData=takeRowData(context);
  if (rowData != null)   position=rowData.getPosition();
 else   createStorageFile(context,path,text.toString());
}
Program: 134616
Project: 134616
Buggy source:
public Reader(Handler handler,int position){
  this.handler=handler;
  this.position=position;
}

Fixed version (ground truth):
public Reader(Handler handler,int position){
  this.handler=handler;
  this.position=position;
  completed=false;
}
Program: 134617
Project: 134617
Buggy source:
@Override public void run(){
  int wordLength=wordList.size();
  int i=position;
  if (i < wordLength) {
    completed=false;
    if (!isCancelled()) {
      updateView(i % wordLength);
      handler.postDelayed(this,calcDelay(wordLength));
    }
 else {
      handler.postDelayed(this,Constants.READER_SLEEP_IDLE);
    }
  }
 else {
    completed=true;
    cancelled=1;
  }
}

Fixed version (ground truth):
@Override public void run(){
  if (position < wordList.size()) {
    completed=false;
    if (!isCancelled()) {
      updateView(position);
      handler.postDelayed(this,calcDelay());
      position++;
    }
 else {
      handler.postDelayed(this,Constants.READER_SLEEP_IDLE);
    }
  }
 else {
    completed=true;
    cancelled=1;
  }
}