Program: 30903
Project: 30903
Buggy source:
/** 
 * Replace the first item in the list that the provided predicate returns true for. <p> The   {@link Scheduler} used for this operation will be the one specified in{@link Builder#schedulingWith(Scheduler) schedulingWith()}.
 */
@NotNull public Single<List<T>> observeReplace(@NotNull final T value,@NotNull final ReplacePredicateFunc<T> predicateFunc){
  return Single.create(new Single.OnSubscribe<List<T>>(){
    @Override public void call(    SingleSubscriber<? super List<T>> subscriber){
      try {
        if (!file.exists())         throw new IOException("String_Node_Str");
        runInWriteLock(readWriteLock,new Runnable(){
          @Override public void run(){
            List<T> originalList=converter.read(file,type);
            if (originalList == null)             originalList=Collections.emptyList();
            int indexOfItemToReplace=-1;
            for (int i=0; i < originalList.size(); i++) {
              if (predicateFunc.shouldReplace(originalList.get(i))) {
                indexOfItemToReplace=i;
                break;
              }
            }
            List<T> modifiedList=new ArrayList<T>(originalList);
            if (indexOfItemToReplace != -1) {
              modifiedList.remove(indexOfItemToReplace);
              modifiedList.add(indexOfItemToReplace,value);
            }
            converter.write(modifiedList,type,file);
            subscriber.onSuccess(modifiedList);
            updateSubject.onNext(modifiedList);
          }
        }
);
      }
 catch (      Exception e) {
        subscriber.onError(e);
      }
    }
  }
).subscribeOn(scheduler);
}

Fixed version (ground truth):
/** 
 * Replace the first item in the list that the provided predicate returns true for. <p> The   {@link Scheduler} used for this operation will be the one specified in{@link Builder#schedulingWith(Scheduler) schedulingWith()}.
 */
@NotNull public Single<List<T>> observeReplace(@NotNull final T value,@NotNull final ReplacePredicateFunc<T> predicateFunc){
  return Single.create(new Single.OnSubscribe<List<T>>(){
    @Override public void call(    final SingleSubscriber<? super List<T>> subscriber){
      try {
        if (!file.exists())         throw new IOException("String_Node_Str");
        runInWriteLock(readWriteLock,new Runnable(){
          @Override public void run(){
            List<T> originalList=converter.read(file,type);
            if (originalList == null)             originalList=Collections.emptyList();
            int indexOfItemToReplace=-1;
            for (int i=0; i < originalList.size(); i++) {
              if (predicateFunc.shouldReplace(originalList.get(i))) {
                indexOfItemToReplace=i;
                break;
              }
            }
            List<T> modifiedList=new ArrayList<T>(originalList);
            if (indexOfItemToReplace != -1) {
              modifiedList.remove(indexOfItemToReplace);
              modifiedList.add(indexOfItemToReplace,value);
            }
            converter.write(modifiedList,type,file);
            subscriber.onSuccess(modifiedList);
            updateSubject.onNext(modifiedList);
          }
        }
);
      }
 catch (      Exception e) {
        subscriber.onError(e);
      }
    }
  }
).subscribeOn(scheduler);
}