nus-yam/ex-repair huggingface dataset:
Program: 170160
Project: 170160
Buggy source:
private boolean startsWith(char[] buffer,char[] phrase){
  if (phrase.length >= buffer.length)   return false;
  for (int i=0; i < phrase.length; i++) {
    if (buffer[i] != phrase[i])     return false;
  }
  return true;
}

Fixed version (ground truth):
private boolean startsWith(char[] buffer,char[] phrase){
  if (phrase.length > buffer.length)   return false;
  for (int i=0; i < phrase.length; i++) {
    if (buffer[i] != phrase[i])     return false;
  }
  return true;
}
Program: 170162
Project: 170162
Buggy source:
public void prepareForTrack(){
  resetSoft();
  mCurrentPlayer.reset(false);
  mCurrentPosition=0;
  mState=PlaybackStateCompat.STATE_CONNECTING;
  notifyOnPlaybackStatusChanged(mState);
}

Fixed version (ground truth):
public void prepareForTrack(){
  resetSoft();
  mCurrentPlayer.reset(false);
  mCurrentPosition=0;
  mState=PlaybackStateCompat.STATE_BUFFERING;
  notifyOnPlaybackStatusChanged(mState);
}
Program: 170163
Project: 170163
Buggy source:
public void prepareForTrack(){
  reset();
  if (isConnected() && hasCurrent()) {
    mRemoteMediaPlayer.stop(mApiClient);
  }
  mState=STATE_CONNECTING;
  notifyOnPlaybackStatusChanged(mState);
}

Fixed version (ground truth):
public void prepareForTrack(){
  reset();
  if (isConnected() && hasCurrent()) {
    mRemoteMediaPlayer.stop(mApiClient);
  }
  mState=STATE_BUFFERING;
  notifyOnPlaybackStatusChanged(mState);
}
Program: 170166
Project: 170166
Buggy source:
@Override public TreeNode buildTree(Uri uri,Uri parentUri){
  final TreeNode tree=new TreeNode(uri,parentUri);
  long containerId=hasContainer(uri);
  if (containerId <= 0) {
    return tree;
  }
  addTracksUnderContainer(String.valueOf(containerId),tree);
  String[] containers=findChildrenUnder(uri,false);
  if (containers == null) {
    return tree;
  }
  Cursor c=null;
  final String[] selArgs=new String[1];
  for (  String id : containers) {
    selArgs[0]=id;
    c=query(IndexSchema.Containers.TABLE,buildTreeContainerCols,idSelection,selArgs,null,null,null);
    if (c != null && c.moveToFirst()) {
      TreeNode childTree=new TreeNode(Uri.parse(c.getString(0)),Uri.parse(c.getString(1)));
      addTracksUnderContainer(id,childTree);
      tree.children.add(childTree);
    }
    closeCursor(c);
  }
  return tree;
}

Fixed version (ground truth):
@Override public TreeNode buildTree(Uri uri,Uri parentUri){
  final TreeNode tree=new TreeNode(uri,parentUri);
  long containerId=hasContainer(uri);
  if (containerId <= 0) {
    return tree;
  }
  addTracksUnderContainer(String.valueOf(containerId),tree);
  String[] containers=findChildrenUnder(uri,false);
  if (containers == null || containers.length == 0) {
    return tree;
  }
  StringBuilder sb=new StringBuilder(BaseColumns._ID).append("String_Node_Str");
  for (int ii=1; ii < containers.length; ii++) {
    sb.append("String_Node_Str");
  }
  String sel=sb.append("String_Node_Str").toString();
  List<Uri> childrenUris=new ArrayList<>(containers.length);
  Cursor c=null;
  try {
    c=query(IndexSchema.Containers.TABLE,buildTreeContainerCols,sel,containers,null,null,null);
    if (c != null && c.moveToFirst()) {
      do {
        childrenUris.add(Uri.parse(c.getString(0)));
      }
 while (c.moveToNext());
    }
  }
  finally {
    closeCursor(c);
  }
  for (  Uri childUri : childrenUris) {
    tree.children.add(buildTree(childUri,uri));
  }
  return tree;
}
Program: 170167
Project: 170167
Buggy source:
Observable<String[]> availableLibrariesObservable(){
  return mLibraryLoader.makeObservable().flatMap(new Func1<LibraryProviderInfo,Observable<String>>(){
    @Override public Observable<String> call(    final LibraryProviderInfo libraryProviderInfo){
      return Observable.using(new Func0<LibraryClient>(){
        @Override public LibraryClient call(){
          return LibraryClient.create(getContext(),LibraryUris.call(libraryProviderInfo.getAuthority()));
        }
      }
,new Func1<LibraryClient,Observable<String>>(){
        @Override public Observable<String> call(        LibraryClient libraryClient){
          Bundle reply=libraryClient.makeCall(LibraryMethods.CHECK_AVAILABILITY,null);
          if (LibraryExtras.getOk(reply)) {
            return Observable.just(libraryProviderInfo.getAuthority());
          }
 else {
            return Observable.empty();
          }
        }
      }
,new Action1<LibraryClient>(){
        @Override public void call(        LibraryClient libraryClient){
          libraryClient.release();
        }
      }
,true);
    }
  }
).toList().map(new Func1<List<String>,String[]>(){
    @Override public String[] call(    List<String> strings){
      return strings.toArray(new String[strings.size()]);
    }
  }
);
}

Fixed version (ground truth):
Observable<String[]> availableLibrariesObservable(){
  return mLibraryLoader.makeObservable().flatMap(new Func1<LibraryProviderInfo,Observable<String>>(){
    @Override public Observable<String> call(    final LibraryProviderInfo libraryProviderInfo){
      return Observable.using(new Func0<LibraryClient>(){
        @Override public LibraryClient call(){
          return LibraryClient.create(getContext(),LibraryUris.call(libraryProviderInfo.getAuthority()));
        }
      }
,new Func1<LibraryClient,Observable<String>>(){
        @Override public Observable<String> call(        LibraryClient libraryClient){
          try {
            Bundle reply=libraryClient.makeCall(LibraryMethods.CHECK_AVAILABILITY,null);
            if (LibraryExtras.getOk(reply)) {
              return Observable.just(libraryProviderInfo.getAuthority());
            }
 else {
              return Observable.empty();
            }
          }
 catch (          Exception e) {
            Timber.e(e,"String_Node_Str",libraryProviderInfo.getAuthority());
            return Observable.empty();
          }
        }
      }
,new Action1<LibraryClient>(){
        @Override public void call(        LibraryClient libraryClient){
          libraryClient.release();
        }
      }
,true);
    }
  }
).toList().map(new Func1<List<String>,String[]>(){
    @Override public String[] call(    List<String> strings){
      return strings.toArray(new String[strings.size()]);
    }
  }
);
}
Program: 170168
Project: 170168
Buggy source:
void removeDifference(TreeNode currentTree,TreeNode newTree){
  for (  Track currentTrack : currentTree.tracks) {
    if (currentTrack == null) {
      Timber.e("String_Node_Str");
      continue;
    }
    boolean found=false;
    for (    Track newTrack : newTree.tracks) {
      if (currentTrack.getUri().equals(newTrack.getUri()) && currentTrack.getParentUri().equals(newTrack.getParentUri())) {
        found=true;
        break;
      }
    }
    if (!found) {
      Timber.d("String_Node_Str",currentTrack.getUri());
      mIndexDatabase.removeTrack(currentTrack.getUri(),currentTrack.getParentUri());
    }
  }
  for (  TreeNode currentNode : currentTree.children) {
    boolean found=false;
    for (    TreeNode newNode : newTree.children) {
      if (currentNode.self.equals(newNode.self) && currentNode.parent.equals(newNode.parent)) {
        found=true;
        removeDifference(currentNode,newNode);
        break;
      }
    }
    if (!found) {
      Timber.d("String_Node_Str",currentNode.self);
      mIndexDatabase.removeContainer(currentNode.self);
    }
  }
}

Fixed version (ground truth):
void removeDifference(TreeNode currentTree,TreeNode newTree){
  if (!currentTree.self.equals(newTree.self)) {
    Timber.e("String_Node_Str",currentTree.self,newTree.self);
    return;
  }
  for (  Track currentTrack : currentTree.tracks) {
    if (currentTrack == null) {
      Timber.e("String_Node_Str");
      continue;
    }
    boolean found=false;
    for (    Track newTrack : newTree.tracks) {
      if (newTrack == null) {
        Timber.e("String_Node_Str");
        continue;
      }
      if (currentTrack.getUri().equals(newTrack.getUri()) && currentTrack.getParentUri().equals(newTrack.getParentUri())) {
        found=true;
        break;
      }
    }
    if (!found) {
      Timber.d("String_Node_Str",currentTrack.getUri());
      mIndexDatabase.removeTrack(currentTrack.getUri(),currentTrack.getParentUri());
    }
  }
  for (  TreeNode currentNode : currentTree.children) {
    boolean found=false;
    for (    TreeNode newNode : newTree.children) {
      if (currentNode.self.equals(newNode.self) && currentNode.parent.equals(newNode.parent)) {
        found=true;
        removeDifference(currentNode,newNode);
        break;
      }
    }
    if (!found) {
      Timber.d("String_Node_Str",currentNode.self);
      mIndexDatabase.removeContainer(currentNode.self);
    }
  }
}
Program: 170169
Project: 170169
Buggy source:
@TargetApi(21) void themeButtons(int color){
  previousBtn.getDrawable().setTint(color);
  playPause.getDrawable().setTint(color);
  nextButton.getDrawable().setTint(color);
}

Fixed version (ground truth):
@TargetApi(21) void themeButtons(int color){
  final int[][] states=new int[1][];
  final int[] colors=new int[1];
  states[0]=EMPTY_STATE_SET;
  colors[0]=color;
  final ColorStateList stateList=new ColorStateList(states,colors);
  previousBtn.setImageTintList(stateList);
  playPause.setImageTintList(stateList);
  nextButton.setImageTintList(stateList);
}
Program: 170170
Project: 170170
Buggy source:
@Inject public IndexDatabaseHelper(@ForApplication Context context){
  super(context,DB_NAME,null,DB_VERSION,null);
}

Fixed version (ground truth):
@Inject public IndexDatabaseHelper(@ForApplication Context context){
  super(context,DB_NAME,null,DB_VERSION,new ErrorHandler());
}
Program: 170171
Project: 170171
Buggy source:
public static long getLong2(Bundle b){
  return b.getInt(LONG_ARG2);
}

Fixed version (ground truth):
public static long getLong2(Bundle b){
  return b.getLong(LONG_ARG2);
}
Program: 170172
Project: 170172
Buggy source:
public static long getLong(Bundle b){
  return b.getInt(LONG_ARG);
}

Fixed version (ground truth):
public static long getLong(Bundle b){
  return b.getLong(LONG_ARG);
}
Program: 170173
Project: 170173
Buggy source:
protected void queryArtistsInternal(final String library,final Subscriber<List<Artist>> subscriber,final Bundle args){
  Observable.create(new Observable.OnSubscribe<Artist>(){
    @Override public void call(    Subscriber<? super Artist> subscriber){
      queryArtists(library,subscriber,args);
    }
  }
).subscribeOn(scheduler).compose(new BundleableListTransformer<Artist>(ArtistCompare.func(args.getString(SORTORDER)))).subscribe(subscriber);
}

Fixed version (ground truth):
protected void queryArtistsInternal(final String library,final Subscriber<List<Artist>> subscriber,final Bundle args){
  Observable.create(new Observable.OnSubscribe<Artist>(){
    @Override public void call(    Subscriber<? super Artist> subscriber){
      queryArtists(library,subscriber,args);
    }
  }
).subscribeOn(scheduler).compose(new BundleableListTransformer<Artist>(ArtistCompare.func(args.getString(Extras.SORTORDER)))).subscribe(subscriber);
}
Program: 170174
Project: 170174
Buggy source:
private IBinder getBinderCallbackFromBundle(Bundle b){
  if (Build.VERSION.SDK_INT >= 18) {
    return b.getBinder(CALLBACK);
  }
 else {
    try {
synchronized (this) {
        if (_getIBinder == null) {
          _getIBinder=Bundle.class.getDeclaredMethod("String_Node_Str",String.class);
        }
      }
      return (IBinder)_getIBinder.invoke(b,CALLBACK);
    }
 catch (    Exception e) {
      throw new RuntimeException(e);
    }
  }
}

Fixed version (ground truth):
private IBinder getBinderCallbackFromBundle(Bundle b){
  if (Build.VERSION.SDK_INT >= 18) {
    return b.getBinder(Extras.CALLBACK);
  }
 else {
    try {
synchronized (this) {
        if (_getIBinder == null) {
          _getIBinder=Bundle.class.getDeclaredMethod("String_Node_Str",String.class);
        }
      }
      return (IBinder)_getIBinder.invoke(b,Extras.CALLBACK);
    }
 catch (    Exception e) {
      throw new RuntimeException(e);
    }
  }
}
Program: 170175
Project: 170175
Buggy source:
protected void queryGenresInternal(final String library,final Subscriber<List<Genre>> subscriber,final Bundle args){
  Observable.create(new Observable.OnSubscribe<Genre>(){
    @Override public void call(    Subscriber<? super Genre> subscriber){
      queryGenres(library,subscriber,args);
    }
  }
).subscribeOn(scheduler).compose(new BundleableListTransformer<Genre>(BundleableCompare.<Genre>func(args.getString(SORTORDER)))).subscribe(subscriber);
}

Fixed version (ground truth):
protected void queryGenresInternal(final String library,final Subscriber<List<Genre>> subscriber,final Bundle args){
  Observable.create(new Observable.OnSubscribe<Genre>(){
    @Override public void call(    Subscriber<? super Genre> subscriber){
      queryGenres(library,subscriber,args);
    }
  }
).subscribeOn(scheduler).compose(new BundleableListTransformer<Genre>(BundleableCompare.<Genre>func(args.getString(Extras.SORTORDER)))).subscribe(subscriber);
}
Program: 170176
Project: 170176
Buggy source:
protected void queryAlbumsInternal(final String library,final Subscriber<List<Album>> subscriber,final Bundle args){
  Observable.create(new Observable.OnSubscribe<Album>(){
    @Override public void call(    Subscriber<? super Album> subscriber){
      queryAlbums(library,subscriber,args);
    }
  }
).subscribeOn(scheduler).compose(new BundleableListTransformer<Album>(AlbumCompare.func(args.getString(SORTORDER)))).subscribe(subscriber);
}

Fixed version (ground truth):
protected void queryAlbumsInternal(final String library,final Subscriber<List<Album>> subscriber,final Bundle args){
  Observable.create(new Observable.OnSubscribe<Album>(){
    @Override public void call(    Subscriber<? super Album> subscriber){
      queryAlbums(library,subscriber,args);
    }
  }
).subscribeOn(scheduler).compose(new BundleableListTransformer<Album>(AlbumCompare.func(args.getString(Extras.SORTORDER)))).subscribe(subscriber);
}
Program: 170177
Project: 170177
Buggy source:
protected void queryPlaylistsInternal(final String library,final Subscriber<List<Playlist>> subscriber,final Bundle args){
  Observable.create(new Observable.OnSubscribe<Playlist>(){
    @Override public void call(    Subscriber<? super Playlist> subscriber){
      queryPlaylists(library,subscriber,args);
    }
  }
).subscribeOn(scheduler).compose(new BundleableListTransformer<Playlist>(BundleableCompare.<Playlist>func(args.getString(SORTORDER)))).subscribe(subscriber);
}

Fixed version (ground truth):
protected void queryPlaylistsInternal(final String library,final Subscriber<List<Playlist>> subscriber,final Bundle args){
  Observable.create(new Observable.OnSubscribe<Playlist>(){
    @Override public void call(    Subscriber<? super Playlist> subscriber){
      queryPlaylists(library,subscriber,args);
    }
  }
).subscribeOn(scheduler).compose(new BundleableListTransformer<Playlist>(BundleableCompare.<Playlist>func(args.getString(Extras.SORTORDER)))).subscribe(subscriber);
}
Program: 170178
Project: 170178
Buggy source:
protected void queryTracksInternal(final String library,final Subscriber<List<Track>> subscriber,final Bundle args){
  Observable.create(new Observable.OnSubscribe<Track>(){
    @Override public void call(    Subscriber<? super Track> subscriber){
      queryTracks(library,subscriber,args);
    }
  }
).subscribeOn(scheduler).compose(new BundleableListTransformer<Track>(TrackCompare.func(args.getString(SORTORDER)))).subscribe(subscriber);
}

Fixed version (ground truth):
protected void queryTracksInternal(final String library,final Subscriber<List<Track>> subscriber,final Bundle args){
  Observable.create(new Observable.OnSubscribe<Track>(){
    @Override public void call(    Subscriber<? super Track> subscriber){
      queryTracks(library,subscriber,args);
    }
  }
).subscribeOn(scheduler).compose(new BundleableListTransformer<Track>(TrackCompare.func(args.getString(Extras.SORTORDER)))).subscribe(subscriber);
}
Program: 170179
Project: 170179
Buggy source:
@DebugLog protected void browseFoldersInternal(final String library,final String identity,final Subscriber<List<Bundleable>> subscriber,final Bundle args){
  Observable<Bundleable> o=Observable.create(new Observable.OnSubscribe<Bundleable>(){
    @Override public void call(    Subscriber<? super Bundleable> subscriber){
      browseFolders(library,identity,subscriber,args);
    }
  }
).subscribeOn(scheduler);
  final String q=args.<Uri>getParcelable(URI).getQueryParameter(Q.Q);
  if (StringUtils.equals(q,Q.FOLDERS_ONLY)) {
    o=o.filter(new Func1<Bundleable,Boolean>(){
      @Override public Boolean call(      Bundleable bundleable){
        return bundleable instanceof Folder;
      }
    }
);
  }
 else   if (StringUtils.equals(q,Q.TRACKS_ONLY)) {
    o=o.filter(new Func1<Bundleable,Boolean>(){
      @Override public Boolean call(      Bundleable bundleable){
        return bundleable instanceof Track;
      }
    }
);
  }
  o.compose(new BundleableListTransformer<Bundleable>(FolderTrackCompare.func(args.getString(SORTORDER)))).subscribe(subscriber);
}

Fixed version (ground truth):
@DebugLog protected void browseFoldersInternal(final String library,final String identity,final Subscriber<List<Bundleable>> subscriber,final Bundle args){
  Observable<Bundleable> o=Observable.create(new Observable.OnSubscribe<Bundleable>(){
    @Override public void call(    Subscriber<? super Bundleable> subscriber){
      browseFolders(library,identity,subscriber,args);
    }
  }
).subscribeOn(scheduler);
  final String q=args.<Uri>getParcelable(Extras.URI).getQueryParameter(Q.Q);
  if (StringUtils.equals(q,Q.FOLDERS_ONLY)) {
    o=o.filter(new Func1<Bundleable,Boolean>(){
      @Override public Boolean call(      Bundleable bundleable){
        return bundleable instanceof Folder;
      }
    }
);
  }
 else   if (StringUtils.equals(q,Q.TRACKS_ONLY)) {
    o=o.filter(new Func1<Bundleable,Boolean>(){
      @Override public Boolean call(      Bundleable bundleable){
        return bundleable instanceof Track;
      }
    }
);
  }
  o.compose(new BundleableListTransformer<Bundleable>(FolderTrackCompare.func(args.getString(Extras.SORTORDER)))).subscribe(subscriber);
}
Program: 170180
Project: 170180
Buggy source:
private void startTest(){
  ProgressFragment.newInstance().show(getFragmentManager(),"String_Node_Str");
  mAuthTestSubscription=AuthTest.create(mDriveHelper.getSession(mAccountName),new SimpleObserver<Boolean>(){
    @Override public void onNext(    Boolean aBoolean){
      finishSuccess();
    }
    @Override public void onError(    Throwable e){
      if (e instanceof UserRecoverableAuthIOException) {
        Intent intent=((UserRecoverableAuthIOException)e).getIntent();
        if (intent != null) {
          startActivityForResult(intent,REQUEST_AUTH_APPROVAL);
          return;
        }
      }
      finishFailure();
    }
  }
);
}

Fixed version (ground truth):
private void startTest(){
  ProgressFragment.newInstance().show(getFragmentManager(),ProgressFragment.TAG);
  mAuthTestFragment=AuthTestFragment.newInstance(mAccountName);
  mAuthTestFragment.setListener(this);
  getFragmentManager().beginTransaction().add(mAuthTestFragment,AuthTestFragment.TAG).commit();
}
Program: 170181
Project: 170181
Buggy source:
@Override protected void onDestroy(){
  super.onDestroy();
  if (isSubscribed(mAuthTestSubscription))   mAuthTestSubscription.unsubscribe();
}

Fixed version (ground truth):
@Override protected void onDestroy(){
  super.onDestroy();
  if (mAuthTestFragment != null) {
    mAuthTestFragment.setListener(null);
  }
}
Program: 170182
Project: 170182
Buggy source:
@Override @DebugLog protected void onActivityResult(int requestCode,int resultCode,Intent data){
switch (requestCode) {
case REQUEST_ACCOUNT_PICKER:
    if (resultCode == RESULT_OK) {
      mAccountName=data.getStringExtra(AccountManager.KEY_ACCOUNT_NAME);
      startTest();
    }
 else {
      finishFailure();
    }
  break;
case REQUEST_AUTH_APPROVAL:
if (resultCode == RESULT_OK) {
  finishSuccess();
}
 else {
  finishFailure();
}
default :
super.onActivityResult(requestCode,resultCode,data);
}
}

Fixed version (ground truth):
@Override @DebugLog protected void onActivityResult(int requestCode,int resultCode,Intent data){
switch (requestCode) {
case REQUEST_ACCOUNT_PICKER:
    if (resultCode == RESULT_OK) {
      mAccountName=data.getStringExtra(AccountManager.KEY_ACCOUNT_NAME);
      startTest();
    }
 else {
      finishFailure();
    }
  break;
case REQUEST_AUTH_APPROVAL:
if (resultCode == RESULT_OK) {
  finishSuccess();
}
 else {
  finishFailure();
}
break;
default :
super.onActivityResult(requestCode,resultCode,data);
}
}
Program: 170183
Project: 170183
Buggy source:
@Override protected void onSizeChanged(int w,int h,int oldw,int oldh){
  super.onSizeChanged(w,h,oldw,oldh);
  radius=Math.min(w,h) * 2;
  Drawable d=getDrawable();
  if (d != null) {
    if (d instanceof RoundedBitmapDrawable) {
      ((RoundedBitmapDrawable)d).setCornerRadius(radius);
      d.invalidateSelf();
    }
 else     if (d instanceof TransitionDrawable) {
      Drawable d1=((TransitionDrawable)d).getDrawable(1);
      if (d1 instanceof RoundedBitmapDrawable) {
        ((RoundedBitmapDrawable)d1).setCornerRadius(radius);
        d.invalidateSelf();
      }
    }
  }
}

Fixed version (ground truth):
@Override protected void onSizeChanged(int w,int h,int oldw,int oldh){
  super.onSizeChanged(w,h,oldw,oldh);
  radius=Math.max(w,h) * 2;
  Drawable d=getDrawable();
  if (d != null) {
    if (d instanceof RoundedBitmapDrawable) {
      ((RoundedBitmapDrawable)d).setCornerRadius(radius);
      d.invalidateSelf();
    }
 else     if (d instanceof TransitionDrawable) {
      Drawable d1=((TransitionDrawable)d).getDrawable(1);
      if (d1 instanceof RoundedBitmapDrawable) {
        ((RoundedBitmapDrawable)d1).setCornerRadius(radius);
        d.invalidateSelf();
      }
    }
  }
}
Program: 170185
Project: 170185
Buggy source:
@Override public void onLoadingFailure(boolean relaunchPicker){
  if (relaunchPicker) {
    ((LibraryFragment)getParentFragment()).relaunchLibraryFragment();
  }
}

Fixed version (ground truth):
@Override public void onLoadingFailure(boolean relaunchPicker){
  if (relaunchPicker) {
    ((LibraryFragment)getParentFragment()).relaunchLibraryFragment();
  }
 else {
    setListShown(true);
  }
}
Program: 170186
Project: 170186
Buggy source:
/** 
 * Loads the image for the view if it isn't already loaded.
 * @param isInLayoutPass True if this was invoked from a layout pass, false otherwise.
 */
private void loadImageIfNecessary(final boolean isInLayoutPass){
  int width=getWidth();
  int height=getHeight();
  boolean isFullyWrapContent=getLayoutParams() != null && getLayoutParams().height == LayoutParams.WRAP_CONTENT && getLayoutParams().width == LayoutParams.WRAP_CONTENT;
  if (width == 0 && height == 0 && !isFullyWrapContent) {
    return;
  }
  if (mArtInfo == null || TextUtils.isEmpty(mArtInfo.artistName)) {
    if (mImageContainer != null) {
      mImageContainer.cancelRequest();
      mImageContainer=null;
    }
    setDefaultImageOrNull();
    return;
  }
  if (mImageContainer != null && mImageContainer.getCacheKey() != null) {
    if (mImageContainer.getCacheKey().equals(ArtworkLoader.getCacheKey(mArtInfo,mImageType))) {
      return;
    }
 else {
      mImageContainer.cancelRequest();
      setDefaultImageOrNull();
    }
  }
  ImageContainer newContainer=mImageLoader.get(mArtInfo,new ResponseListener(this,isInLayoutPass),mImageType);
  mImageContainer=newContainer;
}

Fixed version (ground truth):
/** 
 * Loads the image for the view if it isn't already loaded.
 * @param isInLayoutPass True if this was invoked from a layout pass, false otherwise.
 */
private void loadImageIfNecessary(final boolean isInLayoutPass){
  int width=getWidth();
  int height=getHeight();
  boolean isFullyWrapContent=getLayoutParams() != null && getLayoutParams().height == LayoutParams.WRAP_CONTENT && getLayoutParams().width == LayoutParams.WRAP_CONTENT;
  if (width == 0 && height == 0 && !isFullyWrapContent) {
    return;
  }
  if (mArtInfo == null || (TextUtils.isEmpty(mArtInfo.artistName) && TextUtils.isEmpty(mArtInfo.albumName) && mArtInfo.artworkUri == null)) {
    if (mImageContainer != null) {
      mImageContainer.cancelRequest();
      mImageContainer=null;
    }
    setDefaultImageOrNull();
    return;
  }
  if (mImageContainer != null && mImageContainer.getCacheKey() != null) {
    if (mImageContainer.getCacheKey().equals(ArtworkLoader.getCacheKey(mArtInfo,mImageType))) {
      return;
    }
 else {
      mImageContainer.cancelRequest();
      resetImage();
    }
  }
  ImageContainer newContainer=mImageLoader.get(mArtInfo,new ResponseListener(this,isInLayoutPass),mImageType);
  mImageContainer=newContainer;
}
Program: 170187
Project: 170187
Buggy source:
private void setDefaultImageOrNull(){
  setImageBitmap(null);
}

Fixed version (ground truth):
private void setDefaultImageOrNull(){
  if (mDefaultImageId != 0) {
    setImageResource(mDefaultImageId);
  }
 else {
    resetImage();
  }
}
Program: 170188
Project: 170188
Buggy source:
@Override public void onResponse(final ImageContainer response,final boolean isImmediate){
  ArtworkImageView v=reference.get();
  if (v == null) {
    if (D)     Log.d(TAG,"String_Node_Str");
    return;
  }
  if (isImmediate && isInLayoutPass) {
    isInLayoutPass=false;
    v.post(new Runnable(){
      @Override public void run(){
        onResponse(response,isImmediate);
      }
    }
);
    return;
  }
  if (response.getBitmap() != null) {
    if (isImmediate) {
      v.setImageBitmap(response.getBitmap());
    }
 else {
      v.mDrawables[1]=new BitmapDrawable(v.getResources(),response.getBitmap());
      final TransitionDrawable transitionDrawable=new TransitionDrawable(v.mDrawables);
      transitionDrawable.setCrossFadeEnabled(true);
      v.setImageDrawable(transitionDrawable);
      transitionDrawable.startTransition(340);
    }
  }
 else   if (v.mDefaultImageId != 0) {
    v.mDrawables[0]=v.getResources().getDrawable(v.mDefaultImageId);
    if (isImmediate) {
      v.setImageResource(v.mDefaultImageId);
    }
 else {
      Drawable[] drawables=new Drawable[2];
      drawables[0]=new ColorDrawable(v.getResources().getColor(R.color.transparent));
      drawables[1]=v.mDrawables[0];
      TransitionDrawable transitionDrawable=new TransitionDrawable(drawables);
      transitionDrawable.setCrossFadeEnabled(true);
      v.setImageDrawable(transitionDrawable);
      transitionDrawable.startTransition(280);
    }
  }
}

Fixed version (ground truth):
@Override public void onResponse(final ImageContainer response,final boolean isImmediate){
  ArtworkImageView v=reference.get();
  if (v == null) {
    Timber.w("String_Node_Str");
    return;
  }
  if (isImmediate && isInLayoutPass) {
    isInLayoutPass=false;
    v.post(new Runnable(){
      @Override public void run(){
        onResponse(response,isImmediate);
      }
    }
);
    return;
  }
  if (response.getBitmap() != null) {
    if (isImmediate) {
      v.setImageBitmap(response.getBitmap());
    }
 else {
      v.mDrawables[1]=new BitmapDrawable(v.getResources(),response.getBitmap());
      final TransitionDrawable transitionDrawable=new TransitionDrawable(v.mDrawables);
      transitionDrawable.setCrossFadeEnabled(true);
      v.setImageDrawable(transitionDrawable);
      transitionDrawable.startTransition(340);
    }
  }
 else   if (v.mDefaultImageId != 0) {
    v.mDrawables[0]=v.getResources().getDrawable(v.mDefaultImageId);
    if (isImmediate) {
      v.setImageResource(v.mDefaultImageId);
    }
 else {
      Drawable[] drawables=new Drawable[2];
      drawables[0]=new ColorDrawable(v.getResources().getColor(R.color.transparent));
      drawables[1]=v.mDrawables[0];
      TransitionDrawable transitionDrawable=new TransitionDrawable(drawables);
      transitionDrawable.setCrossFadeEnabled(true);
      v.setImageDrawable(transitionDrawable);
      transitionDrawable.startTransition(280);
    }
  }
}
Program: 170189
Project: 170189
Buggy source:
@Override public void onErrorResponse(VolleyError error){
  ArtworkImageView v=reference.get();
  if (v == null) {
    if (D)     Log.d(TAG,"String_Node_Str");
    return;
  }
  if (v.mErrorImageId != 0) {
    v.setImageResource(v.mErrorImageId);
  }
}

Fixed version (ground truth):
@Override public void onErrorResponse(VolleyError error){
  ArtworkImageView v=reference.get();
  if (v == null) {
    Timber.w("String_Node_Str");
    return;
  }
  if (v.mErrorImageId != 0) {
    v.setImageResource(v.mErrorImageId);
  }
}
Program: 170190
Project: 170190
Buggy source:
@Override protected void onDetachedFromWindow(){
  if (mImageContainer != null) {
    mImageContainer.cancelRequest();
    setImageBitmap(null);
    mImageContainer=null;
  }
  super.onDetachedFromWindow();
}

Fixed version (ground truth):
@Override protected void onDetachedFromWindow(){
  if (mImageContainer != null) {
    mImageContainer.cancelRequest();
    resetImage();
    mImageContainer=null;
  }
  super.onDetachedFromWindow();
}
Program: 170191
Project: 170191
Buggy source:
/** 
 * Creates a cache key for use with the L1 cache.
 */
public static String getCacheKey(ArtInfo artInfo,ArtworkType imageType){
  return new StringBuilder(artInfo.artistName.length() + (artInfo.albumName != null ? artInfo.albumName.length() : 4) + 12).append("String_Node_Str").append(imageType).append("String_Node_Str").append(artInfo.artistName).append("String_Node_Str").append(artInfo.albumName).toString();
}

Fixed version (ground truth):
/** 
 * Creates a cache key for use with the L1 cache. if both artist and album are null we must use the uri or all requests will return the same cache key, to maintain backwards compat with orpheus versions < 0.5 we use artist,album when we can. if all fields in artinfo are null we cannot fetch any art so an npe will be thrown
 */
public static String getCacheKey(ArtInfo artInfo,ArtworkType imageType){
  int size=0;
  if (artInfo.artistName == null && artInfo.albumName == null) {
    if (artInfo.artworkUri == null) {
      throw new NullPointerException("String_Node_Str");
    }
    size+=artInfo.artworkUri.toString().length();
    return new StringBuilder(size + 12).append("String_Node_Str").append(imageType).append("String_Node_Str").append(artInfo.artworkUri.toString()).toString();
  }
 else {
    size+=artInfo.artistName != null ? artInfo.artistName.length() : 4;
    size+=artInfo.albumName != null ? artInfo.albumName.length() : 4;
    return new StringBuilder(size + 12).append("String_Node_Str").append(imageType).append("String_Node_Str").append(artInfo.artistName).append("String_Node_Str").append(artInfo.albumName).toString();
  }
}
Program: 170192
Project: 170192
Buggy source:
protected void onCreatePopupMenu(PopupMenu m){
  m.inflate(R.menu.popup_play_all);
  m.inflate(R.menu.popup_shuffle_all);
  m.inflate(R.menu.popup_add_to_queue);
  m.inflate(R.menu.popup_add_to_playlist);
  m.inflate(R.menu.card_genre);
  m.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener(){
    @Override public boolean onMenuItemClick(    MenuItem item){
switch (item.getItemId()) {
case R.id.popup_play_all:
        mBus.post(new GenreCardClick(Event.PLAY_ALL,mData));
      return true;
case R.id.popup_shuffle_all:
    mBus.post(new GenreCardClick(Event.SHUFFLE_ALL,mData));
  return true;
case R.id.popup_add_to_queue:
mBus.post(new GenreCardClick(Event.ADD_TO_QUEUE,mData));
return true;
case R.id.popup_add_to_playlist:
mBus.post(new GenreCardClick(Event.ADD_TO_QUEUE,mData));
return true;
}
return false;
}
}
);
}

Fixed version (ground truth):
protected void onCreatePopupMenu(PopupMenu m){
  m.inflate(R.menu.popup_play_all);
  m.inflate(R.menu.popup_shuffle_all);
  m.inflate(R.menu.popup_add_to_queue);
  m.inflate(R.menu.popup_add_to_playlist);
  m.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener(){
    @Override public boolean onMenuItemClick(    MenuItem item){
switch (item.getItemId()) {
case R.id.popup_play_all:
        mBus.post(new GenreCardClick(Event.PLAY_ALL,mData));
      return true;
case R.id.popup_shuffle_all:
    mBus.post(new GenreCardClick(Event.SHUFFLE_ALL,mData));
  return true;
case R.id.popup_add_to_queue:
mBus.post(new GenreCardClick(Event.ADD_TO_QUEUE,mData));
return true;
case R.id.popup_add_to_playlist:
mBus.post(new GenreCardClick(Event.ADD_TO_QUEUE,mData));
return true;
}
return false;
}
}
);
}
Program: 170193
Project: 170193
Buggy source:
public SongCard(Context context,Song song,int innerLayout){
  super(context,song,innerLayout);
}

Fixed version (ground truth):
public SongCard(Context context,Song song){
  super(context,song,R.layout.library_listcard_artwork_inner);
}
Program: 170194
Project: 170194
Buggy source:
@Override protected void onInnerViewSetup(){
  mCardTitle.setText(mData.name);
  mCardSubTitle.setText(mData.artistName);
  ArtworkManager.loadImage(new ArtInfo(mData.albumArtistName,mData.albumName,mData.artworkUri),mArtwork);
}

Fixed version (ground truth):
@Override protected void onInnerViewSetup(){
  mCardTitle.setText(mData.name);
  mCardSubTitle.setText(mData.artistName);
  String artist=mData.albumArtistName;
  if (TextUtils.isEmpty(artist)) {
    artist=mData.artistName;
  }
  ArtworkManager.loadImage(new ArtInfo(artist,mData.albumName,mData.artworkUri),mArtwork);
}
Program: 170195
Project: 170195
Buggy source:
/** 
 * Performs the web-service call. If the <code>session</code> parameter is <code>non-null</code> then an authenticated call is made. If it's <code>null</code> then an unauthenticated call is made.<br/> The <code>apiKey</code> parameter is always required, even when a valid session is passed to this method.
 * @param method The method to call
 * @param apiKey A Last.fm API key
 * @param params Parameters
 * @param session A Session instance or <code>null</code>
 * @return the result of the operation
 */
public Result call(final String method,final String apiKey,Map<String,String> params){
  params=new WeakHashMap<String,String>(params);
  InputStream inputStream=null;
  if (inputStream == null) {
    params.put(PARAM_API_KEY,apiKey);
    try {
      final HttpURLConnection urlConnection=openPostConnection(method,params);
      inputStream=getInputStreamFromConnection(urlConnection);
      if (inputStream == null) {
        lastResult=Result.createHttpErrorResult(urlConnection.getResponseCode(),urlConnection.getResponseMessage());
        return lastResult;
      }
    }
 catch (    final IOException ignored) {
    }
  }
  try {
    final Result result=createResultFromInputStream(inputStream);
    lastResult=result;
    return result;
  }
 catch (  final IOException ignored) {
  }
catch (  final SAXException ignored) {
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Performs the web-service call. If the <code>session</code> parameter is <code>non-null</code> then an authenticated call is made. If it's <code>null</code> then an unauthenticated call is made.<br/> The <code>apiKey</code> parameter is always required, even when a valid session is passed to this method.
 * @param method The method to call
 * @param apiKey A Last.fm API key
 * @param params Parameters
 * @param session A Session instance or <code>null</code>
 * @return the result of the operation
 */
public Result call(final String method,final String apiKey,Map<String,String> params){
  params=new WeakHashMap<String,String>(params);
  InputStream inputStream=null;
  if (inputStream == null) {
    params.put(PARAM_API_KEY,apiKey);
    try {
      final HttpURLConnection urlConnection=openPostConnection(method,params);
      inputStream=getInputStreamFromConnection(urlConnection);
      if (inputStream == null) {
        lastResult=Result.createHttpErrorResult(urlConnection.getResponseCode(),urlConnection.getResponseMessage());
        return lastResult;
      }
    }
 catch (    final IOException ioEx) {
      Log.e(TAG,"String_Node_Str",ioEx);
      lastResult=Result.createHttpErrorResult(HttpStatus.SC_SERVICE_UNAVAILABLE,ioEx.getLocalizedMessage());
      return lastResult;
    }
  }
  try {
    final Result result=createResultFromInputStream(inputStream);
    lastResult=result;
  }
 catch (  final IOException ioEx) {
    Log.e(TAG,"String_Node_Str",ioEx);
    lastResult=new Result(ioEx.getLocalizedMessage());
  }
catch (  final SAXException saxEx) {
    Log.e(TAG,"String_Node_Str",saxEx);
    lastResult=new Result(saxEx.getLocalizedMessage());
  }
  return lastResult;
}
Program: 170196
Project: 170196
Buggy source:
/** 
 * Fetches artwork from the ArtworkProvider, attempts to get fullscreen artwork first, on failure tries to get a thumbnail
 * @param artistName
 * @param albumName
 * @return Bitmap if found else null
 */
@DebugLog public Bitmap getArtwork(String artistName,String albumName){
  final String cacheKey=makeCacheKey(artistName,albumName,"String_Node_Str");
  final Uri artworkUri=ArtworkProvider.createArtworkUri(artistName,albumName);
  Bitmap bitmap=queryArtworkProvider(artworkUri,cacheKey);
  if (bitmap == null) {
    bitmap=getArtworkThumbnail(artistName,albumName);
  }
  return bitmap;
}

Fixed version (ground truth):
/** 
 * Fetches artwork from the ArtworkProvider, attempts to get fullscreen artwork first, on failure tries to get a thumbnail
 * @param artistName
 * @param albumName
 * @return Bitmap if found else null
 */
@DebugLog public Bitmap getArtwork(String artistName,String albumName){
  if (artistName == null || albumName == null) {
    return null;
  }
  final String cacheKey=makeCacheKey(artistName,albumName,"String_Node_Str");
  final Uri artworkUri=ArtworkProvider.createArtworkUri(artistName,albumName);
  Bitmap bitmap=queryArtworkProvider(artworkUri,cacheKey);
  if (bitmap == null) {
    bitmap=getArtworkThumbnail(artistName,albumName);
  }
  return bitmap;
}
Program: 170197
Project: 170197
Buggy source:
/** 
 * Fetches thumbnail from the ArtworkProvider
 * @param artistName
 * @param albumName
 * @return
 */
@DebugLog public Bitmap getArtworkThumbnail(String artistName,String albumName){
  final String cacheKey=makeCacheKey(artistName,albumName,"String_Node_Str");
  final Uri artworkUri=ArtworkProvider.createArtworkThumbnailUri(artistName,albumName);
  return queryArtworkProvider(artworkUri,cacheKey);
}

Fixed version (ground truth):
/** 
 * Fetches thumbnail from the ArtworkProvider
 * @param artistName
 * @param albumName
 * @return
 */
@DebugLog public Bitmap getArtworkThumbnail(String artistName,String albumName){
  if (artistName == null || albumName == null) {
    return null;
  }
  final String cacheKey=makeCacheKey(artistName,albumName,"String_Node_Str");
  final Uri artworkUri=ArtworkProvider.createArtworkThumbnailUri(artistName,albumName);
  return queryArtworkProvider(artworkUri,cacheKey);
}
Program: 170198
Project: 170198
Buggy source:
public static String buildArtUrl(String host,Song song){
  String artist=song.albumArtistName != null ? song.albumArtistName : song.artistName;
  return "String_Node_Str" + host + "String_Node_Str"+ CastWebServer.PORT+ "String_Node_Str"+ artist+ "String_Node_Str"+ song.albumName;
}

Fixed version (ground truth):
public static String buildArtUrl(String host,Song song){
  String artist=song.albumArtistName != null ? song.albumArtistName : song.artistName;
  String album=song.albumName;
  if (artist == null || album == null) {
    return null;
  }
  return "String_Node_Str" + host + "String_Node_Str"+ CastWebServer.PORT+ "String_Node_Str"+ artist+ "String_Node_Str"+ album;
}
Program: 170199
Project: 170199
Buggy source:
@Override public void onViewCreated(View view,Bundle savedInstanceState){
  super.onViewCreated(view,savedInstanceState);
  setListAdapter(mAdapter);
  if (savedInstanceState == null) {
    setListShown(false);
  }
}

Fixed version (ground truth):
@Override public void onViewCreated(View view,Bundle savedInstanceState){
  super.onViewCreated(view,savedInstanceState);
  setListAdapter(mAdapter);
  if (mAdapter.isOnFirstLoad()) {
    setListShown(false);
  }
}
Program: 170200
Project: 170200
Buggy source:
@Override public void onViewCreated(View view,Bundle savedInstanceState){
  super.onViewCreated(view,savedInstanceState);
  setListAdapter(mAdapter);
  if (savedInstanceState == null) {
    setListShown(false);
  }
}

Fixed version (ground truth):
@Override public void onViewCreated(View view,Bundle savedInstanceState){
  super.onViewCreated(view,savedInstanceState);
  setListAdapter(mAdapter);
  if (mAdapter.isOnFirstLoad()) {
    setListShown(false);
  }
}
Program: 170201
Project: 170201
Buggy source:
@Override public void onViewCreated(View view,Bundle savedInstanceState){
  super.onViewCreated(view,savedInstanceState);
  setListAdapter(mAdapter);
  if (savedInstanceState == null) {
    setListShown(false);
  }
}

Fixed version (ground truth):
@Override public void onViewCreated(View view,Bundle savedInstanceState){
  super.onViewCreated(view,savedInstanceState);
  setListAdapter(mAdapter);
  if (mAdapter.isOnFirstLoad()) {
    setListShown(false);
  }
}
Program: 170202
Project: 170202
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mPluginInfo=getArguments().getParcelable("String_Node_Str");
  RemoteLibraryUtil.bindToService(getActivity(),mPluginInfo.componentName);
  EventBus.getInstance().register(this);
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mPluginInfo=getArguments().getParcelable("String_Node_Str");
  RemoteLibraryUtil.bindToService(getActivity(),mPluginInfo.componentName);
  EventBus.getInstance().register(this);
  mPagerAdapter=new HomePagerAdapter(getActivity(),getChildFragmentManager());
  if (savedInstanceState != null) {
    mLibraryIdentity=savedInstanceState.getString("String_Node_Str");
    mPreviousPagerPage=savedInstanceState.getInt("String_Node_Str");
  }
 else {
  }
}
Program: 170203
Project: 170203
Buggy source:
@Override public void onViewCreated(View view,Bundle savedInstanceState){
  super.onViewCreated(view,savedInstanceState);
  mPagerAdapter=new HomePagerAdapter(getActivity(),getChildFragmentManager());
  mPager.setAdapter(mPagerAdapter);
  if (savedInstanceState != null) {
    mLibraryIdentity=savedInstanceState.getString("String_Node_Str");
    mPreviousPagerPage=savedInstanceState.getInt("String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void onViewCreated(View view,Bundle savedInstanceState){
  super.onViewCreated(view,savedInstanceState);
  mPager.setAdapter(mPagerAdapter);
}
Program: 170204
Project: 170204
Buggy source:
@Override public void onViewCreated(View view,Bundle savedInstanceState){
  super.onViewCreated(view,savedInstanceState);
  setListAdapter(mAdapter);
  if (savedInstanceState == null) {
    setListShown(false);
  }
}

Fixed version (ground truth):
@Override public void onViewCreated(View view,Bundle savedInstanceState){
  super.onViewCreated(view,savedInstanceState);
  setListAdapter(mAdapter);
  if (mAdapter.isOnFirstLoad()) {
    setListShown(false);
  }
}
Program: 170205
Project: 170205
Buggy source:
/** 
 * Called when we disconnect or think we are disconnectetd from the cast device
 */
private void restoreLocalState(){
  updatePlaybackLocation(PlaybackLocation.LOCAL);
  stopCastServer();
synchronized (this) {
    scheduleDelayedShutdown();
    mIsSupposedToBePlaying=false;
    notifyChange(PLAYSTATE_CHANGED);
  }
}

Fixed version (ground truth):
/** 
 * Called when we disconnect or think we are disconnectetd from the cast device
 */
private void restoreLocalState(){
  if (mPlaybackLocation == PlaybackLocation.LOCAL) {
    return;
  }
  updatePlaybackLocation(PlaybackLocation.LOCAL);
  stopCastServer();
synchronized (this) {
    scheduleDelayedShutdown();
    mIsSupposedToBePlaying=false;
    notifyChange(PLAYSTATE_CHANGED);
  }
}
Program: 170206
Project: 170206
Buggy source:
@DebugLog public void maybeClosePanel(){
  if (mSlidingPanel.isExpanded()) {
    mSlidingPanel.collapsePane();
  }
}

Fixed version (ground truth):
public void maybeClosePanel(){
  if (mSlidingPanel.isExpanded()) {
    mSlidingPanel.collapsePane();
  }
}
Program: 170207
Project: 170207
Buggy source:
@DebugLog public void maybeOpenPanel(){
  if (!mSlidingPanel.isExpanded()) {
    mSlidingPanel.expandPane();
  }
}

Fixed version (ground truth):
public void maybeOpenPanel(){
  if (!mSlidingPanel.isExpanded()) {
    mSlidingPanel.expandPane();
  }
}
Program: 170208
Project: 170208
Buggy source:
@Override @DebugLog public void onPanelExpanded(View panel){
  mNowPlayingFragment.onPanelExpanded();
}

Fixed version (ground truth):
@Override public void onPanelExpanded(View panel){
  mNowPlayingFragment.onPanelExpanded();
}
Program: 170209
Project: 170209
Buggy source:
@Override @DebugLog public void onPanelCollapsed(View panel){
  mNowPlayingFragment.onPanelCollapsed();
}

Fixed version (ground truth):
@Override public void onPanelCollapsed(View panel){
  mNowPlayingFragment.onPanelCollapsed();
}
Program: 170210
Project: 170210
Buggy source:
@Override protected void onCreate(final Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mIsLargeLandscape=findViewById(R.id.landscape_dummy) != null;
  if (mIsLargeLandscape) {
    mSlidingPanel.setSlidingEnabled(false);
    mSlidingPanel.setInitialState(SlideState.EXPANDED);
    onPanelExpanded(null);
  }
  if (savedInstanceState == null) {
    getSupportFragmentManager().beginTransaction().replace(R.id.main,new HomeFragment()).commit();
  }
}

Fixed version (ground truth):
@Override protected void onCreate(final Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mIsLargeLandscape=findViewById(R.id.landscape_dummy) != null;
  if (mIsLargeLandscape && savedInstanceState == null) {
    mSlidingPanel.setSlidingEnabled(false);
    mSlidingPanel.setInitialState(SlideState.EXPANDED);
    onPanelExpanded(null);
  }
  if (savedInstanceState == null) {
    getSupportFragmentManager().beginTransaction().replace(R.id.main,new HomeFragment()).commit();
  }
}
Program: 170211
Project: 170211
Buggy source:
@Override protected void onRestoreInstanceState(Bundle savedInstanceState){
  super.onRestoreInstanceState(savedInstanceState);
  if (savedInstanceState != null) {
    if (mIsLargeLandscape) {
      mSlidingPanel.setInitialState(SlideState.EXPANDED);
      onPanelExpanded(null);
    }
 else     if (savedInstanceState.getBoolean("String_Node_Str",false)) {
      mSlidingPanel.setInitialState(SlideState.COLLAPSED);
      onPanelCollapsed(null);
    }
  }
}

Fixed version (ground truth):
@Override protected void onRestoreInstanceState(Bundle savedInstanceState){
  super.onRestoreInstanceState(savedInstanceState);
  if (savedInstanceState != null) {
    if (mIsLargeLandscape) {
      mSlidingPanel.setSlidingEnabled(false);
      mSlidingPanel.setInitialState(SlideState.EXPANDED);
      setPanelExpanded();
      if (savedInstanceState.getBoolean("String_Node_Str",false)) {
        mNowPlayingFragment.onQueueVisibilityChanged(true);
      }
    }
 else     if (savedInstanceState.getBoolean("String_Node_Str",false)) {
      mSlidingPanel.setInitialState(SlideState.COLLAPSED);
      setPanelCollapsed();
      if (savedInstanceState.getBoolean("String_Node_Str",false)) {
        mNowPlayingFragment.popQueueFragment();
      }
    }
 else     if (savedInstanceState.getBoolean("String_Node_Str",false)) {
      setPanelExpanded();
      if (savedInstanceState.getBoolean("String_Node_Str",false)) {
        mNowPlayingFragment.onQueueVisibilityChanged(true);
      }
    }
  }
}
Program: 170212
Project: 170212
Buggy source:
@Override protected void onSaveInstanceState(Bundle outState){
  super.onSaveInstanceState(outState);
  outState.putBoolean("String_Node_Str",mIsLargeLandscape);
}

Fixed version (ground truth):
@Override protected void onSaveInstanceState(Bundle outState){
  super.onSaveInstanceState(outState);
  outState.putBoolean("String_Node_Str",mSlidingPanel.isExpanded());
  outState.putBoolean("String_Node_Str",mNowPlayingFragment.isQueueShowing());
  outState.putBoolean("String_Node_Str",mIsLargeLandscape);
}
Program: 170213
Project: 170213
Buggy source:
private void pushQueueFragment(){
  mActivity.getSupportFragmentManager().beginTransaction().add(R.id.panel_middle_content,new QueueFragment(),"String_Node_Str").setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN).commit();
  onQueueVisibilityChanged(true);
}

Fixed version (ground truth):
public void pushQueueFragment(){
  mActivity.getSupportFragmentManager().beginTransaction().add(R.id.panel_middle_content,new QueueFragment(),"String_Node_Str").setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN).commit();
  onQueueVisibilityChanged(true);
}