nus-yam/ex-repair huggingface dataset:
Program: 170848
Project: 170848
Buggy source:
public static void navigateToAlbumDetail(Context context,ImageView view,String transName,String albumName,long id){
  Fragment fragment=AlbumDetailFragment.newInstance(transName,albumName,id);
  FragmentTransaction transaction=((AppCompatActivity)context).getSupportFragmentManager().beginTransaction();
  FragmentAnimUtil.setEnterExitAnim(fragment);
  if (view != null && transName != null)   transaction.addSharedElement(view,transName).hide(((AppCompatActivity)context).getSupportFragmentManager().findFragmentById(R.id.layout_main)).add(R.id.layout_main,fragment).addToBackStack(null).commit();
}

Fixed version (ground truth):
public static void navigateToAlbumDetail(Context context,ImageView view,String transName,String albumName,long id){
  Fragment fragment=AlbumDetailFragment.newInstance(transName,albumName,id);
  FragmentTransaction transaction=((AppCompatActivity)context).getSupportFragmentManager().beginTransaction();
  FragmentAnimUtil.setEnterExitAnim(fragment);
  if (view != null && transName != null && !"String_Node_Str".equals(transName)) {
    transaction.addSharedElement(view,transName);
  }
  transaction.hide(((AppCompatActivity)context).getSupportFragmentManager().findFragmentById(R.id.layout_main)).add(R.id.layout_main,fragment).addToBackStack(null).commit();
}
Program: 170849
Project: 170849
Buggy source:
public static void navigateToArtistDetail(Context context,ImageView view,String transName,String artistName,long artistId,int albumNum,int songNum){
  Fragment fragment=ArtistDetailFragment.newInstance(transName,artistName,artistId,albumNum,songNum);
  FragmentTransaction transaction=((AppCompatActivity)context).getSupportFragmentManager().beginTransaction();
  FragmentAnimUtil.setEnterExitAnim(fragment);
  transaction.addSharedElement(view,transName).hide(((AppCompatActivity)context).getSupportFragmentManager().findFragmentById(R.id.layout_main)).add(R.id.layout_main,fragment).addToBackStack(null).commit();
}

Fixed version (ground truth):
public static void navigateToArtistDetail(Context context,ImageView view,String transName,String artistName,long artistId,int albumNum,int songNum){
  Fragment fragment=ArtistDetailFragment.newInstance(transName,artistName,artistId,albumNum,songNum);
  FragmentTransaction transaction=((AppCompatActivity)context).getSupportFragmentManager().beginTransaction();
  FragmentAnimUtil.setEnterExitAnim(fragment);
  if (transName != null && !"String_Node_Str".equals(transName) && view != null) {
    transaction.addSharedElement(view,transName);
  }
  transaction.hide(((AppCompatActivity)context).getSupportFragmentManager().findFragmentById(R.id.layout_main)).add(R.id.layout_main,fragment).addToBackStack(null).commit();
}
Program: 170850
Project: 170850
Buggy source:
public static Observable<Bitmap> albumCoverObservable(Context context,SongEntity entity){
  return Observable.create(e -> {
    Bitmap bitmap;
    String coverUri=LocalUtil.getCoverUri(context,entity.albumId);
    if (coverUri != null && new File(coverUri).exists()) {
      bitmap=BitmapFactory.decodeFile(coverUri);
    }
 else {
      Drawable drawable=ContextCompat.getDrawable(context,R.drawable.ic_album_default);
      bitmap=((BitmapDrawable)drawable).getBitmap();
    }
    e.onNext(bitmap);
    e.onComplete();
  }
);
}

Fixed version (ground truth):
/** 
 * 专辑图片 Observable
 * @param context context
 * @param entity 音乐
 * @return Observable
 */
@SuppressWarnings("String_Node_Str") public static Observable<Bitmap> albumCoverObservable(Context context,SongEntity entity){
  return Observable.create(e -> {
    Bitmap bitmap;
    String coverUri=LocalUtil.getCoverUri(context,entity.albumId);
    if (coverUri != null && new File(coverUri).exists()) {
      bitmap=BitmapFactory.decodeFile(coverUri);
    }
 else {
      Drawable drawable=ContextCompat.getDrawable(context,R.drawable.ic_album_default);
      bitmap=((BitmapDrawable)drawable).getBitmap();
    }
    e.onNext(bitmap);
    e.onComplete();
  }
);
}
Program: 170851
Project: 170851
Buggy source:
@Override public Observable<List<QueueSongBean>> getQueueData(final String[] songIds){
  return Observable.create(new ObservableOnSubscribe<List<QueueSongBean>>(){
    @Override public void subscribe(    @NonNull ObservableEmitter<List<QueueSongBean>> e) throws Exception {
      List<QueueSongBean> songBeen=PlayQueueDao.getInstance(mContext).queryQueue(songIds);
      e.onNext(songBeen);
      e.onComplete();
    }
  }
);
}

Fixed version (ground truth):
@Override public Observable<List<QueueSongBean>> getQueueData(final String[] songIds){
  return Observable.create(new ObservableOnSubscribe<List<QueueSongBean>>(){
    @Override public void subscribe(    @NonNull ObservableEmitter<List<QueueSongBean>> e) throws Exception {
      List<QueueSongBean> songBeen=PlayQueueDao.getInstance(mContext).queryQueue(songIds);
      e.onNext(songBeen != null ? songBeen : Collections.<QueueSongBean>emptyList());
      e.onComplete();
    }
  }
);
}
Program: 170852
Project: 170852
Buggy source:
@SuppressWarnings("String_Node_Str") public static <T>ResponseWrapper<T> errorReturn(Status status,String... msgs){
  String msg;
  if (msgs.length == 0) {
    msg=String.format(status.getMsg(),msgs);
  }
 else {
    msg=status.getMsg();
  }
  return new ResponseWrapper<T>(status.getCode(),msg);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public static <T>ResponseWrapper<T> errorReturn(Status status,String... msgs){
  String msg;
  if (msgs.length > 0) {
    msg=String.format(status.getMsg(),msgs);
  }
 else {
    msg=status.getMsg();
  }
  return new ResponseWrapper<T>(status.getCode(),msg);
}
Program: 170853
Project: 170853
Buggy source:
@RequestMapping(value="String_Node_Str") public String notFound404(Map<String,Object> map){
  map.put(HEAD_BANNER_KEY,HeadBannerConstants.getInstance()._404VO);
  return "String_Node_Str";
}

Fixed version (ground truth):
@RequestMapping(value={"String_Node_Str","String_Node_Str"}) public String notFound404(Map<String,Object> map){
  map.put(HEAD_BANNER_KEY,HeadBannerConstants.getInstance()._404VO);
  return "String_Node_Str";
}
Program: 170854
Project: 170854
Buggy source:
@RequestMapping(value="String_Node_Str") public String interError500(Map<String,Object> map){
  map.put(HEAD_BANNER_KEY,HeadBannerConstants.getInstance()._500VO);
  return "String_Node_Str";
}

Fixed version (ground truth):
@RequestMapping(value={"String_Node_Str","String_Node_Str"}) public String interError500(Map<String,Object> map){
  map.put(HEAD_BANNER_KEY,HeadBannerConstants.getInstance()._500VO);
  return "String_Node_Str";
}
Program: 170855
Project: 170855
Buggy source:
/** 
 * {@inheritDoc}NOTE: Not presently supported, will throw an UnsupportedOperationException
 */
@Override @RequiresApi(api=Build.VERSION_CODES.JELLY_BEAN) public void setWriteAheadLoggingEnabled(boolean enabled){
  throw new UnsupportedOperationException("String_Node_Str");
}

Fixed version (ground truth):
void setWriteAheadLoggingEnabled(boolean writeAheadLoggingEnabled){
  walEnabled=writeAheadLoggingEnabled;
  if (wrappedDb != null) {
    setupWAL(wrappedDb);
  }
}
Program: 170856
Project: 170856
Buggy source:
Database getWrappedDb(SQLiteDatabase db){
  if (wrappedDb == null) {
    wrappedDb=new Database(db);
  }
  return (wrappedDb);
}

Fixed version (ground truth):
Database getWrappedDb(SQLiteDatabase db){
  if (wrappedDb == null) {
    wrappedDb=new Database(db);
    if (walEnabled != null) {
      setupWAL(wrappedDb);
    }
  }
  return (wrappedDb);
}
Program: 170857
Project: 170857
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public int update(String table,int conflictAlgorithm,ContentValues values,String whereClause,Object[] whereArgs){
  if (values == null || values.size() == 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  StringBuilder sql=new StringBuilder(120);
  sql.append("String_Node_Str");
  sql.append(CONFLICT_VALUES[conflictAlgorithm]);
  sql.append(table);
  sql.append("String_Node_Str");
  int setValuesSize=values.size();
  int bindArgsSize=(whereArgs == null) ? setValuesSize : (setValuesSize + whereArgs.length);
  Object[] bindArgs=new Object[bindArgsSize];
  int i=0;
  for (  String colName : values.keySet()) {
    sql.append((i > 0) ? "String_Node_Str" : "String_Node_Str");
    sql.append(colName);
    bindArgs[i++]=values.get(colName);
    sql.append("String_Node_Str");
  }
  if (whereArgs != null) {
    for (i=setValuesSize; i < bindArgsSize; i++) {
      bindArgs[i]=whereArgs[i - setValuesSize];
    }
  }
  if (!isEmpty(whereClause)) {
    sql.append("String_Node_Str");
    sql.append(whereClause);
  }
  SupportSQLiteStatement stmt=compileStatement(sql.toString());
  SimpleSQLiteQuery.bind(stmt,bindArgs);
  return stmt.executeUpdateDelete();
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public int update(String table,int conflictAlgorithm,ContentValues values,String whereClause,Object[] whereArgs){
  if (values == null || values.size() == 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  StringBuilder sql=new StringBuilder(120);
  sql.append("String_Node_Str");
  sql.append(CONFLICT_VALUES[conflictAlgorithm]);
  sql.append(table);
  sql.append("String_Node_Str");
  int setValuesSize=values.size();
  int bindArgsSize=(whereArgs == null) ? setValuesSize : (setValuesSize + whereArgs.length);
  Object[] bindArgs=new Object[bindArgsSize];
  int i=0;
  for (  String colName : values.keySet()) {
    sql.append((i > 0) ? "String_Node_Str" : "String_Node_Str");
    sql.append(colName);
    bindArgs[i++]=values.get(colName);
    sql.append("String_Node_Str");
  }
  if (whereArgs != null) {
    for (i=setValuesSize; i < bindArgsSize; i++) {
      bindArgs[i]=whereArgs[i - setValuesSize];
    }
  }
  if (!isEmpty(whereClause)) {
    sql.append("String_Node_Str");
    sql.append(whereClause);
  }
  SupportSQLiteStatement statement=compileStatement(sql.toString());
  try {
    SimpleSQLiteQuery.bind(statement,bindArgs);
    return statement.executeUpdateDelete();
  }
  finally {
    try {
      statement.close();
    }
 catch (    Exception e) {
      throw new RuntimeException("String_Node_Str",e);
    }
  }
}
Program: 170858
Project: 170858
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public int delete(String table,String whereClause,Object[] whereArgs){
  String query="String_Node_Str" + table + (isEmpty(whereClause) ? "String_Node_Str" : "String_Node_Str" + whereClause);
  SupportSQLiteStatement statement=compileStatement(query);
  SimpleSQLiteQuery.bind(statement,whereArgs);
  return statement.executeUpdateDelete();
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@SuppressWarnings("String_Node_Str") @Override public int delete(String table,String whereClause,Object[] whereArgs){
  String query="String_Node_Str" + table + (isEmpty(whereClause) ? "String_Node_Str" : "String_Node_Str" + whereClause);
  SupportSQLiteStatement statement=compileStatement(query);
  try {
    SimpleSQLiteQuery.bind(statement,whereArgs);
    return statement.executeUpdateDelete();
  }
  finally {
    try {
      statement.close();
    }
 catch (    Exception e) {
      throw new RuntimeException("String_Node_Str",e);
    }
  }
}
Program: 170859
Project: 170859
Buggy source:
@Override public void onAttach(Context context){
  AndroidInjection.inject(this);
  super.onAttach(context);
}

Fixed version (ground truth):
@Override public void onAttach(Context context){
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
    AndroidInjection.inject(this);
  }
  super.onAttach(context);
}
Program: 170860
Project: 170860
Buggy source:
@Override public void appendOut(final byte[] chars,final int start,final int end){
  mHandler.post(new Runnable(){
    @Override public void run(){
      CharSequence charSequence=new String(chars).subSequence(start,end);
      SpannableString spannableString=new SpannableString(charSequence);
      Matcher matcher=PatternFactory.JAVA_FILE.matcher(spannableString);
      int color=ContextCompat.getColor(getContext(),R.color.dark_color_file_java);
      while (matcher.find()) {
        spannableString.setSpan(new ForegroundColorSpan(color),matcher.start(),matcher.end(),Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
      }
      matcher=PatternFactory.JAVA_FILE_LINE_COL.matcher(spannableString);
      while (matcher.find()) {
        spannableString.setSpan(new ForegroundColorSpan(color),matcher.start(),matcher.end(),Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
      }
      mCompileMsg.append(spannableString);
      mScrollView.fullScroll(View.FOCUS_DOWN);
    }
  }
);
}

Fixed version (ground truth):
@Override public void appendOut(final byte[] chars,final int start,final int end){
  append(new String(chars,start,end));
}
Program: 170861
Project: 170861
Buggy source:
@Override public void removePage(int position){
  Fragment existingFragment=mPageAdapter.getExistingFragment(position);
  if (existingFragment == null) {
    if (DLog.DEBUG)     DLog.d(TAG,"String_Node_Str" + "String_Node_Str" + position);
    return;
  }
  String filePath=existingFragment.getTag();
  mFileManager.removeTabFile(filePath);
  mPageAdapter.remove(position);
  invalidateTab();
  Toast.makeText(mContext,mContext.getString(R.string.closed) + "String_Node_Str" + new File(filePath).getName(),Toast.LENGTH_SHORT).show();
}

Fixed version (ground truth):
@Override public void removePage(int position){
  if (position >= mPageAdapter.getCount()) {
    return;
  }
  Fragment existingFragment=mPageAdapter.getExistingFragment(position);
  if (existingFragment == null) {
    if (DLog.DEBUG)     DLog.d(TAG,"String_Node_Str" + "String_Node_Str" + position);
    return;
  }
  String filePath=existingFragment.getTag();
  mFileManager.removeTabFile(filePath);
  mPageAdapter.remove(position);
  invalidateTab();
  Toast.makeText(mContext,mContext.getString(R.string.closed) + "String_Node_Str" + new File(filePath).getName(),Toast.LENGTH_SHORT).show();
}
Program: 170862
Project: 170862
Buggy source:
public void display(List<Diagnostic> diagnostics){
  view.display(diagnostics);
}

Fixed version (ground truth):
public void display(List<Diagnostic> diagnostics){
  this.view=(DiagnosticContract.View)adapter.getExistingFragment(1);
  if (view != null) {
    view.setPresenter(this);
    view.display(diagnostics);
  }
}
Program: 170863
Project: 170863
Buggy source:
@Override public void clear(){
  this.view=(DiagnosticContract.View)adapter.getExistingFragment(1);
  if (view != null) {
    view.clear();
  }
}

Fixed version (ground truth):
@Override public void clear(){
  this.view=(DiagnosticContract.View)adapter.getExistingFragment(1);
  if (view != null) {
    view.setPresenter(this);
    view.clear();
  }
}
Program: 170864
Project: 170864
Buggy source:
@Override protected void onCreate(@Nullable Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  if (savedInstanceState != null) {
    this.mProjectFile=(JavaProjectFile)savedInstanceState.getSerializable(KEY_PROJECT_FILE);
  }
 else {
    this.mProjectFile=ProjectManager.getLastProject(this);
  }
  bindView();
  setupToolbar();
  setupFileView(savedInstanceState);
  setupEditor();
  FragmentManager fm=getSupportFragmentManager();
  List<PageDescriptor> pageDescriptors=new ArrayList<>();
  pageDescriptors.add(new SimplePageDescriptor(MessageFragment.TAG,"String_Node_Str"));
  pageDescriptors.add(new SimplePageDescriptor(DiagnosticFragment.TAG,"String_Node_Str"));
  BottomPageAdapter bottomAdapter=new BottomPageAdapter(fm,pageDescriptors);
  mMessagePresenter=new MessagePresenter(this,bottomAdapter);
  mDiagnosticPresenter=new DiagnosticPresenter(this,bottomAdapter,mPagePresenter);
  mBottomPage=(ViewPager)findViewById(R.id.bottom_page);
  mBottomPage.setAdapter(bottomAdapter);
  mBottomPage.setOffscreenPageLimit(bottomAdapter.getCount());
  TabLayout bottomTab=(TabLayout)findViewById(R.id.bottom_tab);
  bottomTab.setupWithViewPager(mBottomPage);
  createProjectIfNeed();
}

Fixed version (ground truth):
@Override protected void onCreate(@Nullable Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  if (savedInstanceState != null) {
    this.mProjectFile=(JavaProjectFile)savedInstanceState.getSerializable(KEY_PROJECT_FILE);
  }
 else {
    this.mProjectFile=ProjectManager.getLastProject(this);
  }
  bindView();
  setupToolbar();
  setupFileView(savedInstanceState);
  setupEditor();
  FragmentManager fm=getSupportFragmentManager();
  List<PageDescriptor> pageDescriptors=new ArrayList<>();
  pageDescriptors.add(new SimplePageDescriptor(MessageFragment.TAG,"String_Node_Str"));
  pageDescriptors.add(new SimplePageDescriptor(DiagnosticFragment.TAG,"String_Node_Str"));
  BottomPageAdapter bottomAdapter=new BottomPageAdapter(fm,pageDescriptors);
  mBottomPage=(ViewPager)findViewById(R.id.bottom_page);
  mBottomPage.setAdapter(bottomAdapter);
  mBottomPage.setOffscreenPageLimit(bottomAdapter.getCount());
  mMessagePresenter=new MessagePresenter(this,bottomAdapter);
  mDiagnosticPresenter=new DiagnosticPresenter(this,bottomAdapter,mPagePresenter);
  TabLayout bottomTab=(TabLayout)findViewById(R.id.bottom_tab);
  bottomTab.setupWithViewPager(mBottomPage);
  createProjectIfNeed();
}
Program: 170865
Project: 170865
Buggy source:
@Override public void click(Diagnostic diagnostic){
  Log.d(TAG,"String_Node_Str" + diagnostic + "String_Node_Str");
  Object source=diagnostic.getSource();
  if (source instanceof JavaFileObject) {
    String path=((JavaFileObject)source).getName();
    int i=mPagePresenter.gotoPage(path);
    if (i == -1) {
      mPagePresenter.addPage(path,true);
    }
    EditPageContract.View editor=mPagePresenter.getCurrentPage();
    if (editor == null) {
      Log.d(TAG,"String_Node_Str");
      return;
    }
    long startPosition=diagnostic.getStartPosition();
    long endPosition=diagnostic.getEndPosition();
    editor.highlightError(startPosition,endPosition);
  }
 else {
  }
}

Fixed version (ground truth):
@Override public void click(Diagnostic diagnostic){
  Log.d(TAG,"String_Node_Str" + diagnostic + "String_Node_Str");
  Object source=diagnostic.getSource();
  if (source instanceof JavaFileObject) {
    String path=((JavaFileObject)source).getName();
    int i=mPagePresenter.gotoPage(path);
    if (i == -1) {
      mPagePresenter.addPage(path,true);
    }
    EditPageContract.View editor=mPagePresenter.getCurrentPage();
    if (editor == null) {
      Log.d(TAG,"String_Node_Str");
      return;
    }
    int startPosition=(int)diagnostic.getStartPosition();
    int endPosition=(int)diagnostic.getEndPosition();
    editor.highlightError(startPosition,endPosition);
    editor.setCursorPosition(endPosition);
  }
 else {
  }
}
Program: 170866
Project: 170866
Buggy source:
@Override public boolean hasPage(String path){
  return false;
}

Fixed version (ground truth):
@Override public boolean hasPage(String path){
  return mPageAdapter.getPositionForTag(path) > -1;
}
Program: 170867
Project: 170867
Buggy source:
@Override public int getPagePosition(String path){
  return 0;
}

Fixed version (ground truth):
@Override public int getPagePosition(String path){
  return mPageAdapter.getPositionForTag(path);
}
Program: 170868
Project: 170868
Buggy source:
@Override public void highlightError(long startPosition,long endPosition){
  mCodeEditor.highlightError(startPosition,endPosition);
}

Fixed version (ground truth):
@Override public void highlightError(long startPosition,long endPosition){
  if (mCodeEditor != null) {
    mCodeEditor.highlightError(startPosition,endPosition);
  }
}
Program: 170869
Project: 170869
Buggy source:
@Override public void click(Diagnostic diagnostic){
  Log.d(TAG,"String_Node_Str" + diagnostic + "String_Node_Str");
  Object source=diagnostic.getSource();
  if (source instanceof JavaFileObject) {
    String path=((JavaFileObject)source).getName();
    int i=mPagePresenter.gotoPage(path);
    if (i == -1) {
      mPagePresenter.addPage(path,true);
    }
    EditPageContract.View editor=mPagePresenter.getCurrentPage();
    if (editor == null)     return;
    long startPosition=diagnostic.getStartPosition();
    long endPosition=diagnostic.getEndPosition();
    editor.highlightError(startPosition,endPosition);
  }
 else {
  }
}

Fixed version (ground truth):
@Override public void click(Diagnostic diagnostic){
  Log.d(TAG,"String_Node_Str" + diagnostic + "String_Node_Str");
  Object source=diagnostic.getSource();
  if (source instanceof JavaFileObject) {
    String path=((JavaFileObject)source).getName();
    int i=mPagePresenter.gotoPage(path);
    if (i == -1) {
      mPagePresenter.addPage(path,true);
    }
    EditPageContract.View editor=mPagePresenter.getCurrentPage();
    if (editor == null) {
      Log.d(TAG,"String_Node_Str");
      return;
    }
    long startPosition=diagnostic.getStartPosition();
    long endPosition=diagnostic.getEndPosition();
    editor.highlightError(startPosition,endPosition);
  }
 else {
  }
}
Program: 170870
Project: 170870
Buggy source:
@Override public EditPageContract.View getCurrentPage(){
  return null;
}

Fixed version (ground truth):
@Override public EditPageContract.View getCurrentPage(){
  return mPageAdapter.getCurrentFragment();
}
Program: 170871
Project: 170871
Buggy source:
protected void bindView(){
  mDrawerLayout=(DrawerLayout)findViewById(R.id.drawer_layout);
  mKeyList=(SymbolListView)findViewById(R.id.recycler_view);
  mFileManager=new FileManager(this);
  navigationView=(NavigationView)findViewById(R.id.navigation_view);
  mTabLayout=(TabLayout)findViewById(R.id.tab_layout);
  mContainerSymbol=findViewById(R.id.container_symbol);
  mViewPager=(ViewPager)findViewById(R.id.view_pager);
  mContainerOutput=(SlidingUpPanelLayout)findViewById(R.id.sliding_layout);
}

Fixed version (ground truth):
protected void bindView(){
  mDrawerLayout=(DrawerLayout)findViewById(R.id.drawer_layout);
  mKeyList=(SymbolListView)findViewById(R.id.recycler_view);
  mFileManager=new FileManager(this);
  navigationView=(NavigationView)findViewById(R.id.navigation_view);
  mTabLayout=(TabLayout)findViewById(R.id.tab_layout);
  mContainerSymbol=findViewById(R.id.container_symbol);
  mViewPager=(ViewPager)findViewById(R.id.view_pager);
  mContainerOutput=(SlidingUpPanelLayout)findViewById(R.id.sliding_layout);
  View toggle=findViewById(R.id.img_toggle);
  toggle.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      if (mContainerOutput.getPanelState() == PanelState.EXPANDED) {
        mContainerOutput.setPanelState(PanelState.COLLAPSED);
      }
 else       if (mContainerOutput.getPanelState() == PanelState.COLLAPSED) {
        mContainerOutput.setPanelState(PanelState.EXPANDED);
      }
    }
  }
);
}
Program: 170872
Project: 170872
Buggy source:
protected void onShowKeyboard(){
  mTabLayout.setVisibility(View.GONE);
  mHandler.postDelayed(new Runnable(){
    @Override public void run(){
      if (mContainerOutput != null) {
        if (mContainerOutput.getPanelState() == SlidingUpPanelLayout.PanelState.EXPANDED) {
          mContainerOutput.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
          mContainerOutput.setTouchEnabled(false);
          mContainerOutput.setEnabled(false);
        }
      }
    }
  }
,100);
}

Fixed version (ground truth):
protected void onShowKeyboard(){
  mTabLayout.setVisibility(View.GONE);
  mHandler.postDelayed(new Runnable(){
    @Override public void run(){
      if (mContainerOutput != null) {
        if (mContainerOutput.getPanelState() == PanelState.EXPANDED) {
          mContainerOutput.setPanelState(PanelState.COLLAPSED);
          mContainerOutput.setTouchEnabled(false);
          mContainerOutput.setEnabled(false);
        }
      }
    }
  }
,100);
}
Program: 170873
Project: 170873
Buggy source:
@Override public void run(){
  for (int i=0; i < mPageAdapter.getCount(); i++) {
    final TabLayout.Tab tab=mTabLayout.getTabAt(i);
    View view=null;
    if (tab != null) {
      tab.setCustomView(R.layout.item_tab_file);
      view=tab.getCustomView();
    }
    if (view != null) {
      View close=view.findViewById(R.id.img_close);
      final int position=i;
      close.setOnClickListener(new View.OnClickListener(){
        @Override public void onClick(        View v){
          removePage(position);
        }
      }
);
      TextView txtTitle=view.findViewById(R.id.txt_title);
      txtTitle.setText(mPageAdapter.getPageTitle(i));
      txtTitle.setOnClickListener(new View.OnClickListener(){
        @Override public void onClick(        View v){
          mViewPager.setCurrentItem(position);
        }
      }
);
      if (i == mViewPager.getCurrentItem()) {
        tab.select();
      }
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  showDialogCreateProject();
}
Program: 170874
Project: 170874
Buggy source:
@Override protected void onPause(){
  super.onPause();
  JavaPreferences preferences=getPreferences();
  if (preferences != null) {
    preferences.put(JavaPreferences.TAB_POSITION_FILE,mTabLayout.getSelectedTabPosition());
  }
  ProjectManager.saveProject(this,mProjectFile);
}

Fixed version (ground truth):
@Override protected void onPause(){
  super.onPause();
  mPagePresenter.pause();
  ProjectManager.saveProject(this,mProjectFile);
}
Program: 170875
Project: 170875
Buggy source:
@Override protected void onResume(){
  super.onResume();
  Intent intent=getIntent();
  if (intent != null) {
    if (intent.getStringExtra(CompileManager.FILE_PATH) != null) {
      String filePath=intent.getStringExtra(CompileManager.FILE_PATH);
      addNewPageEditor(new File(filePath),SELECT);
      intent.removeExtra(CompileManager.FILE_PATH);
    }
  }
}

Fixed version (ground truth):
@Override protected void onResume(){
  super.onResume();
}
Program: 170876
Project: 170876
Buggy source:
@Override protected void onNewIntent(Intent intent){
  super.onNewIntent(intent);
  if (intent.getStringExtra(CompileManager.FILE_PATH) != null) {
    String filePath=intent.getStringExtra(CompileManager.FILE_PATH);
    File file=new File(filePath);
    if (!file.exists()) {
      Toast.makeText(this,"String_Node_Str",Toast.LENGTH_SHORT).show();
      return;
    }
    addNewPageEditor(file,SELECT);
    intent.removeExtra(CompileManager.FILE_PATH);
  }
}

Fixed version (ground truth):
@Override protected void onNewIntent(Intent intent){
  super.onNewIntent(intent);
}
Program: 170877
Project: 170877
Buggy source:
@Override protected void onCreate(@Nullable Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  clientId=AppUtils.getMetaDataValue(this,getString(R.string.com_jaychang_sa_instagramClientId));
  clientSecret=AppUtils.getMetaDataValue(this,getString(R.string.com_jaychang_sa_instagramClientSecret));
  redirectUrl=AppUtils.getMetaDataValue(this,getString(R.string.com_jaychang_sa_instagramRedirectUrl));
  loadingDialog=DialogFactory.createLoadingDialog(this);
  String scopes=TextUtils.join("String_Node_Str",getAuthData().getScopes());
  String url=String.format(AUTH_URL,clientId,redirectUrl,scopes);
  WebView webView=new WebView(this);
  webView.loadUrl(url);
  webView.setWebViewClient(new WebViewClient(){
    @Override public void onPageStarted(    WebView view,    String url,    Bitmap favicon){
      super.onPageStarted(view,url,favicon);
      loadingDialog.show();
    }
    @Override public void onPageFinished(    WebView view,    String url){
      super.onPageFinished(view,url);
      loadingDialog.dismiss();
    }
    @Override public boolean shouldOverrideUrlLoading(    WebView view,    String url){
      if (url.startsWith(redirectUrl)) {
        getCode(Uri.parse(url));
        return true;
      }
      return false;
    }
  }
);
  setContentView(webView);
}

Fixed version (ground truth):
@Override protected void onCreate(@Nullable Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  clientId=AppUtils.getMetaDataValue(this,getString(R.string.com_jaychang_sa_instagramClientId));
  clientSecret=AppUtils.getMetaDataValue(this,getString(R.string.com_jaychang_sa_instagramClientSecret));
  redirectUrl=AppUtils.getMetaDataValue(this,getString(R.string.com_jaychang_sa_instagramRedirectUrl));
  loadingDialog=DialogFactory.createLoadingDialog(this);
  String scopes=TextUtils.join("String_Node_Str",getAuthData().getScopes());
  String url=String.format(AUTH_URL,clientId,redirectUrl,scopes);
  WebView webView=new WebView(this);
  webView.getSettings().setJavaScriptEnabled(true);
  webView.loadUrl(url);
  webView.setWebViewClient(new WebViewClient(){
    @Override public void onPageStarted(    WebView view,    String url,    Bitmap favicon){
      super.onPageStarted(view,url,favicon);
      loadingDialog.show();
    }
    @Override public void onPageFinished(    WebView view,    String url){
      super.onPageFinished(view,url);
      loadingDialog.dismiss();
    }
    @Override public boolean shouldOverrideUrlLoading(    WebView view,    String url){
      if (url.startsWith(redirectUrl)) {
        getCode(Uri.parse(url));
        return true;
      }
      return false;
    }
  }
);
  setContentView(webView);
}
Program: 170878
Project: 170878
Buggy source:
@Override protected void onActivityResult(int requestCode,int resultCode,Intent data){
  super.onActivityResult(requestCode,resultCode,data);
  if (requestCode != RC_SIGN_IN || resultCode != RESULT_OK) {
    return;
  }
  GoogleSignInResult signInResult=Auth.GoogleSignInApi.getSignInResultFromIntent(data);
  if ((!isGoogleDisconnectRequested(this) && !isGoogleRevokeRequested(this)) || retrySignIn) {
    retrySignIn=false;
    handleSignInResult(signInResult);
  }
}

Fixed version (ground truth):
@Override protected void onActivityResult(int requestCode,int resultCode,Intent data){
  super.onActivityResult(requestCode,resultCode,data);
  if (requestCode != RC_SIGN_IN || resultCode != RESULT_OK) {
    handCancel();
    return;
  }
  GoogleSignInResult signInResult=Auth.GoogleSignInApi.getSignInResultFromIntent(data);
  if ((!isGoogleDisconnectRequested(this) && !isGoogleRevokeRequested(this)) || retrySignIn) {
    retrySignIn=false;
    handleSignInResult(signInResult);
  }
}
Program: 170879
Project: 170879
Buggy source:
@Override public void onCompleted(JSONObject object,GraphResponse response){
  try {
    SocialUser user=new SocialUser();
    user.userId=object.getString("String_Node_Str");
    user.accessToken=AccessToken.getCurrentAccessToken().getToken();
    user.profilePictureUrl=String.format(PROFILE_PIC_URL,user.userId);
    user.email=object.getString("String_Node_Str");
    user.fullName=object.getString("String_Node_Str");
    user.pageLink=object.getString("String_Node_Str");
    loadingDialog.dismiss();
    handleSuccess(user);
  }
 catch (  JSONException e) {
    loadingDialog.dismiss();
    handleError(e);
  }
}

Fixed version (ground truth):
@Override public void onCompleted(JSONObject object,GraphResponse response){
  try {
    SocialUser user=new SocialUser();
    user.userId=getValue("String_Node_Str",object);
    user.accessToken=AccessToken.getCurrentAccessToken().getToken();
    user.profilePictureUrl=String.format(PROFILE_PIC_URL,user.userId);
    user.email=getValue("String_Node_Str",object);
    user.fullName=getValue("String_Node_Str",object);
    user.pageLink=getValue("String_Node_Str",object);
    loadingDialog.dismiss();
    handleSuccess(user);
  }
 catch (  JSONException e) {
    loadingDialog.dismiss();
    handleError(e);
  }
}
Program: 170880
Project: 170880
Buggy source:
public AuthCallback getCallback(){
  return callback;
}

Fixed version (ground truth):
AuthCallback getCallback(){
  return callback;
}
Program: 170881
Project: 170881
Buggy source:
@Override protected void onCreate(@Nullable Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  loadingDialog=DialogUtils.createLoadingDialog(this);
  callbackManager=CallbackManager.Factory.create();
  LoginManager.getInstance().registerCallback(callbackManager,this);
  LoginManager.getInstance().logInWithReadPermissions(this,getScopes());
}

Fixed version (ground truth):
@Override protected void onCreate(@Nullable Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  loadingDialog=DialogUtils.createLoadingDialog(this);
  callbackManager=CallbackManager.Factory.create();
  if (DeviceUtils.isFacebookInstalled(this)) {
    LoginManager.getInstance().logOut();
  }
  LoginManager.getInstance().registerCallback(callbackManager,this);
  LoginManager.getInstance().logInWithReadPermissions(this,getScopes());
}
Program: 170882
Project: 170882
Buggy source:
private void clearCookies(){
  if (Build.VERSION.SDK_INT >= 21) {
    CookieManager.getInstance().removeAllCookies(null);
  }
 else {
    CookieManager.getInstance().removeAllCookie();
  }
}

Fixed version (ground truth):
private void clearCookies(){
  if (Build.VERSION.SDK_INT >= 21) {
    CookieManager.getInstance().removeAllCookies(null);
  }
 else {
    CookieSyncManager.createInstance(appContext);
    CookieManager.getInstance().removeAllCookie();
  }
}
Program: 170883
Project: 170883
Buggy source:
@Override protected void onCreate(@Nullable Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  getTwitterAuthClient().authorize(this,callback);
}

Fixed version (ground truth):
@Override protected void onCreate(@Nullable Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  TwitterSession activeSession=TwitterCore.getInstance().getSessionManager().getActiveSession();
  if (activeSession != null) {
    handleSuccess(activeSession);
  }
 else {
    getTwitterAuthClient().authorize(this,callback);
  }
}
Program: 170884
Project: 170884
Buggy source:
@Override public void success(Result<User> userResult){
  loadingDialog.dismiss();
  SocialUser user=new SocialUser();
  User data=userResult.data;
  user.userId=String.valueOf(data.getId());
  user.accessToken=sessionResult.data.getAuthToken().token;
  user.profilePictureUrl=String.format(PROFILE_PIC_URL,data.screenName);
  user.email=data.email != null ? data.email : "String_Node_Str";
  user.fullName=data.name;
  user.username=data.screenName;
  user.pageLink=String.format(PAGE_LINK,data.screenName);
  handleSuccess(user);
}

Fixed version (ground truth):
@Override public void success(Result<User> userResult){
  loadingDialog.dismiss();
  SocialUser user=new SocialUser();
  User data=userResult.data;
  user.userId=String.valueOf(data.getId());
  user.accessToken=session.getAuthToken().token;
  user.profilePictureUrl=String.format(PROFILE_PIC_URL,data.screenName);
  user.email=data.email != null ? data.email : "String_Node_Str";
  user.fullName=data.name;
  user.username=data.screenName;
  user.pageLink=String.format(PAGE_LINK,data.screenName);
  handleSuccess(user);
}
Program: 170885
Project: 170885
Buggy source:
private void handleSuccess(Result<TwitterSession> sessionResult){
  final ProgressDialog loadingDialog=DialogUtils.createLoadingDialog(this);
  loadingDialog.show();
  TwitterApiClient twitterApiClient=TwitterCore.getInstance().getApiClient();
  AccountService accountService=twitterApiClient.getAccountService();
  Call<User> call=accountService.verifyCredentials(false,true,true);
  call.enqueue(new Callback<User>(){
    @Override public void success(    Result<User> userResult){
      loadingDialog.dismiss();
      SocialUser user=new SocialUser();
      User data=userResult.data;
      user.userId=String.valueOf(data.getId());
      user.accessToken=sessionResult.data.getAuthToken().token;
      user.profilePictureUrl=String.format(PROFILE_PIC_URL,data.screenName);
      user.email=data.email != null ? data.email : "String_Node_Str";
      user.fullName=data.name;
      user.username=data.screenName;
      user.pageLink=String.format(PAGE_LINK,data.screenName);
      handleSuccess(user);
    }
    public void failure(    TwitterException error){
      loadingDialog.dismiss();
      handleError(error);
    }
  }
);
}

Fixed version (ground truth):
private void handleSuccess(TwitterSession session){
  final ProgressDialog loadingDialog=DialogUtils.createLoadingDialog(this);
  loadingDialog.show();
  TwitterApiClient twitterApiClient=TwitterCore.getInstance().getApiClient();
  AccountService accountService=twitterApiClient.getAccountService();
  Call<User> call=accountService.verifyCredentials(false,true,true);
  call.enqueue(new Callback<User>(){
    @Override public void success(    Result<User> userResult){
      loadingDialog.dismiss();
      SocialUser user=new SocialUser();
      User data=userResult.data;
      user.userId=String.valueOf(data.getId());
      user.accessToken=session.getAuthToken().token;
      user.profilePictureUrl=String.format(PROFILE_PIC_URL,data.screenName);
      user.email=data.email != null ? data.email : "String_Node_Str";
      user.fullName=data.name;
      user.username=data.screenName;
      user.pageLink=String.format(PAGE_LINK,data.screenName);
      handleSuccess(user);
    }
    public void failure(    TwitterException error){
      loadingDialog.dismiss();
      handleError(error);
    }
  }
);
}
Program: 170886
Project: 170886
Buggy source:
private void init(Context context,AttributeSet attrs){
  this.context=context;
  TypedArray typedArray=context.obtainStyledAttributes(attrs,R.styleable.CustomizableCalendar);
  if (typedArray != null) {
    monthResId=typedArray.getResourceId(R.styleable.CustomizableCalendar_month_layout,R.layout.calendar_view);
    monthCellResId=typedArray.getResourceId(R.styleable.CustomizableCalendar_cell_layout,R.layout.calendar_cell);
    typedArray.recycle();
  }
  linearLayoutManager=new LinearLayoutManager(getContext());
  linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
  setLayoutManager(linearLayoutManager);
  this.calendar=AUCalendar.getInstance();
}

Fixed version (ground truth):
private void init(Context context,AttributeSet attrs){
  this.context=context;
  TypedArray typedArray=context.obtainStyledAttributes(attrs,R.styleable.CustomizableCalendar);
  if (typedArray != null) {
    monthResId=typedArray.getResourceId(R.styleable.CustomizableCalendar_month_layout,R.layout.calendar_view);
    monthCellResId=typedArray.getResourceId(R.styleable.CustomizableCalendar_cell_layout,R.layout.calendar_cell);
    typedArray.recycle();
  }
  LinearLayoutManager linearLayoutManager=new LinearLayoutManager(getContext());
  linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
  setLayoutManager(linearLayoutManager);
  this.calendar=AUCalendar.getInstance();
}
Program: 170887
Project: 170887
Buggy source:
private void setupCalendarScroll(){
  PagerSnapHelper snapHelper=new PagerSnapHelper();
  snapHelper.attachToRecyclerView(this);
  addOnChildAttachStateChangeListener(new OnChildAttachStateChangeListener(){
    @Override public void onChildViewAttachedToWindow(    View view){
      MonthGridView monthGridView=(MonthGridView)view;
      monthGridView.subscribe();
    }
    @Override public void onChildViewDetachedFromWindow(    View view){
      MonthGridView monthGridView=(MonthGridView)view;
      monthGridView.unsubscribe();
    }
  }
);
  addOnScrollListener(new OnScrollListener(){
    @Override public void onScrollStateChanged(    RecyclerView recyclerView,    int newState){
      super.onScrollStateChanged(recyclerView,newState);
switch (newState) {
case SCROLL_STATE_IDLE:
{
          View view=snapHelper.findSnapView(linearLayoutManager);
          if (view != null) {
            int currentPosition=getChildAdapterPosition(view);
            DateTime currentMonth=calendar.getMonths().get(currentPosition);
            calendar.setCurrentMonth(currentMonth);
          }
        }
    }
  }
}
);
}

Fixed version (ground truth):
private void setupCalendarScroll(){
  PagerSnapHelper snapHelper=new PagerSnapHelper();
  snapHelper.attachToRecyclerView(this);
  addOnChildAttachStateChangeListener(new OnChildAttachStateChangeListener(){
    @Override public void onChildViewAttachedToWindow(    View view){
      MonthGridView monthGridView=(MonthGridView)view;
      monthGridView.subscribe();
    }
    @Override public void onChildViewDetachedFromWindow(    View view){
      MonthGridView monthGridView=(MonthGridView)view;
      monthGridView.unsubscribe();
    }
  }
);
  addOnScrollListener(new OnScrollListener(){
    @Override public void onScrollStateChanged(    RecyclerView recyclerView,    int newState){
      super.onScrollStateChanged(recyclerView,newState);
switch (newState) {
case SCROLL_STATE_IDLE:
{
          View view=snapHelper.findSnapView(getLayoutManager());
          if (view != null) {
            int currentPosition=getChildAdapterPosition(view);
            DateTime currentMonth=calendar.getMonths().get(currentPosition);
            calendar.setCurrentMonth(currentMonth);
          }
        }
    }
  }
}
);
}
Program: 170888
Project: 170888
Buggy source:
@Override public void onScrollStateChanged(RecyclerView recyclerView,int newState){
  super.onScrollStateChanged(recyclerView,newState);
switch (newState) {
case SCROLL_STATE_IDLE:
{
      View view=snapHelper.findSnapView(linearLayoutManager);
      if (view != null) {
        int currentPosition=getChildAdapterPosition(view);
        DateTime currentMonth=calendar.getMonths().get(currentPosition);
        calendar.setCurrentMonth(currentMonth);
      }
    }
}
}

Fixed version (ground truth):
@Override public void onScrollStateChanged(RecyclerView recyclerView,int newState){
  super.onScrollStateChanged(recyclerView,newState);
switch (newState) {
case SCROLL_STATE_IDLE:
{
      View view=snapHelper.findSnapView(getLayoutManager());
      if (view != null) {
        int currentPosition=getChildAdapterPosition(view);
        DateTime currentMonth=calendar.getMonths().get(currentPosition);
        calendar.setCurrentMonth(currentMonth);
      }
    }
}
}
Program: 170889
Project: 170889
Buggy source:
public void search(String subdomainof,String domainlike){
  IHttpRequestResponse[] response=callbacks.getSiteMap("String_Node_Str");
  for (  IHttpRequestResponse x : response) {
    IRequestInfo analyzeRequest=helpers.analyzeRequest(x);
    List<String> headers=analyzeRequest.getHeaders();
    for (    String header : headers) {
      String key=header.split("String_Node_Str")[0];
      String value=header.split("String_Node_Str")[1];
      if (subdomainof.equals("String_Node_Str")) {
      }
 else       if (key.equals("String_Node_Str") && value.endsWith("String_Node_Str" + subdomainof)) {
        subdomainofset.add(value);
      }
 else       if (domainlike.equals("String_Node_Str")) {
      }
 else       if (key.equals("String_Node_Str") && value.contains(domainlike)) {
        domainlikeset.add(value);
      }
    }
  }
}

Fixed version (ground truth):
public void search(String subdomainof,String domainlike){
  subdomainofset.clear();
  domainlikeset.clear();
  IHttpRequestResponse[] response=callbacks.getSiteMap("String_Node_Str");
  for (  IHttpRequestResponse x : response) {
    IRequestInfo analyzeRequest=helpers.analyzeRequest(x);
    List<String> headers=analyzeRequest.getHeaders();
    for (    String header : headers) {
      String key=header.split("String_Node_Str")[0];
      String value=header.split("String_Node_Str")[1];
      if (subdomainof.equals("String_Node_Str")) {
      }
 else       if (key.equals("String_Node_Str") && value.endsWith("String_Node_Str" + subdomainof)) {
        subdomainofset.add(value);
      }
 else       if (domainlike.equals("String_Node_Str")) {
      }
 else       if (key.equals("String_Node_Str") && value.contains(domainlike)) {
        domainlikeset.add(value);
      }
    }
  }
}
Program: 170890
Project: 170890
Buggy source:
@Override public LiveData<List<ZhihuStory>> getLastZhihuList(){
  mApiZhihu.getLatestNews().enqueue(new Callback<ZhihuData>(){
    @Override public void onResponse(    Call<ZhihuData> call,    Response<ZhihuData> response){
      if (response.isSuccessful()) {
        mZhihuList.setValue(response.body().getStories());
        refreshLocalZhihuList(response.body().getStories());
        mZhihuPageDate=response.body().getDate();
      }
      mIsLoadingZhihuList.setValue(false);
    }
    @Override public void onFailure(    Call<ZhihuData> call,    Throwable t){
      mIsLoadingZhihuList.setValue(false);
    }
  }
);
  return mZhihuList;
}

Fixed version (ground truth):
@Override public LiveData<List<ZhihuStory>> getLastZhihuList(){
  mIsLoadingZhihuList.setValue(true);
  mApiZhihu.getLatestNews().enqueue(new Callback<ZhihuData>(){
    @Override public void onResponse(    Call<ZhihuData> call,    Response<ZhihuData> response){
      if (response.isSuccessful()) {
        mZhihuList.setValue(response.body().getStories());
        refreshLocalZhihuList(response.body().getStories());
        mZhihuPageDate=response.body().getDate();
      }
      mIsLoadingZhihuList.setValue(false);
    }
    @Override public void onFailure(    Call<ZhihuData> call,    Throwable t){
      mIsLoadingZhihuList.setValue(false);
    }
  }
);
  return mZhihuList;
}
Program: 170891
Project: 170891
Buggy source:
@Override public LiveData<List<ZhihuStory>> getMoreZhihuList(String date){
  mApiZhihu.getTheDaily(mZhihuPageDate).enqueue(new Callback<ZhihuData>(){
    @Override public void onResponse(    Call<ZhihuData> call,    Response<ZhihuData> response){
      if (response.isSuccessful()) {
        mZhihuList.setValue(response.body().getStories());
        refreshLocalZhihuList(response.body().getStories());
        mZhihuPageDate=response.body().getDate();
      }
      mIsLoadingZhihuList.setValue(false);
    }
    @Override public void onFailure(    Call<ZhihuData> call,    Throwable t){
      mIsLoadingZhihuList.setValue(false);
    }
  }
);
  return mZhihuList;
}

Fixed version (ground truth):
@Override public LiveData<List<ZhihuStory>> getMoreZhihuList(String date){
  mIsLoadingZhihuList.setValue(true);
  mApiZhihu.getTheDaily(mZhihuPageDate).enqueue(new Callback<ZhihuData>(){
    @Override public void onResponse(    Call<ZhihuData> call,    Response<ZhihuData> response){
      if (response.isSuccessful()) {
        mZhihuList.setValue(response.body().getStories());
        refreshLocalZhihuList(response.body().getStories());
        mZhihuPageDate=response.body().getDate();
      }
      mIsLoadingZhihuList.setValue(false);
    }
    @Override public void onFailure(    Call<ZhihuData> call,    Throwable t){
      mIsLoadingZhihuList.setValue(false);
    }
  }
);
  return mZhihuList;
}
Program: 170892
Project: 170892
Buggy source:
private void subscribeUI(){
  ZhihuListViewModel.Factory factory=new ZhihuListViewModel.Factory(MyApplication.getInstance(),Injection.getDataRepository(MyApplication.getInstance()));
  mListViewModel=ViewModelProviders.of(this,factory).get(ZhihuListViewModel.class);
  mListViewModel.getZhihuList().observe(this,new Observer<List<ZhihuStory>>(){
    @Override public void onChanged(    @Nullable List<ZhihuStory> stories){
      if (stories == null || stories.size() <= 0) {
        return;
      }
      L.i("String_Node_Str" + stories.size());
      mAdapter.setStoryList(stories);
    }
  }
);
  mListViewModel.isLoadingZhihuList().observe(this,new Observer<Boolean>(){
    @Override public void onChanged(    @Nullable Boolean aBoolean){
      if (aBoolean == null) {
        return;
      }
      L.i("String_Node_Str" + aBoolean);
      mRefreshLayout.setRefreshing(false);
      mLoadMorebar.setVisibility(aBoolean ? View.VISIBLE : View.INVISIBLE);
    }
  }
);
  mListViewModel.refreshZhihusData();
}

Fixed version (ground truth):
/** 
 * 将 ZhihuListFragment 对应的 ZhihuListViewModel 类中的 LiveData 添加注册监听到 此 ZhihuListFragment
 */
private void subscribeUI(){
  ZhihuListViewModel.Factory factory=new ZhihuListViewModel.Factory(MyApplication.getInstance(),Injection.getDataRepository(MyApplication.getInstance()));
  mListViewModel=ViewModelProviders.of(this,factory).get(ZhihuListViewModel.class);
  mListViewModel.getZhihuList().observe(this,new Observer<List<ZhihuStory>>(){
    @Override public void onChanged(    @Nullable List<ZhihuStory> stories){
      if (stories == null || stories.size() <= 0) {
        return;
      }
      L.i("String_Node_Str" + stories.size());
      mAdapter.setStoryList(stories);
    }
  }
);
  mListViewModel.isLoadingZhihuList().observe(this,new Observer<Boolean>(){
    @Override public void onChanged(    @Nullable Boolean aBoolean){
      if (aBoolean == null) {
        return;
      }
      L.i("String_Node_Str" + aBoolean);
      mRefreshLayout.setRefreshing(false);
      mLoadMorebar.setVisibility(aBoolean ? View.VISIBLE : View.INVISIBLE);
    }
  }
);
  mListViewModel.refreshZhihusData();
}