nus-yam/ex-repair huggingface dataset:
Program: 30886
Project: 30886
Buggy source:
private void parseInjectExtra(Element element,Map<TypeElement,IntentInjectionAdapterGenerator> targetClassMap,Set<String> erasedTargetNames) throws InvalidTypeException {
  TypeElement enclosingElement=(TypeElement)element.getEnclosingElement();
  TypeMirror type=element.asType();
  if (type instanceof TypeVariable) {
    TypeVariable typeVariable=(TypeVariable)type;
    type=typeVariable.getUpperBound();
  }
  validateNotRequiredArguments(element);
  validateForCodeGeneration(InjectExtra.class,element);
  validateBindingPackage(InjectExtra.class,element);
  String name=element.getSimpleName().toString();
  String intentType=typeUtil.getIntentType(type);
  String key=getKey(element);
  boolean required=element.getAnnotation(NotRequired.class) == null;
  boolean hasDefault=typeUtil.isPrimitive(type);
  boolean needsToBeCast=typeUtil.needToCastIntentType(type);
  IntentInjectionAdapterGenerator intentInjectionAdapterGenerator=getOrCreateTargetClass(targetClassMap,enclosingElement);
  IntentFieldBinding binding=new IntentFieldBinding(name,type,intentType,key,needsToBeCast,hasDefault,required);
  intentInjectionAdapterGenerator.addField(binding);
  erasedTargetNames.add(enclosingElement.toString());
}

Fixed version (ground truth):
private void parseInjectExtra(Element element,Map<TypeElement,IntentInjectionAdapterGenerator> targetClassMap,Set<String> erasedTargetNames) throws InvalidTypeException {
  TypeElement enclosingElement=(TypeElement)element.getEnclosingElement();
  TypeMirror type=element.asType();
  if (type instanceof TypeVariable) {
    TypeVariable typeVariable=(TypeVariable)type;
    type=typeVariable.getUpperBound();
  }
  validateNotRequiredArguments(element);
  validateForCodeGeneration(InjectExtra.class,element);
  validateBindingPackage(InjectExtra.class,element);
  String name=element.getSimpleName().toString();
  String intentType=typeUtil.getIntentType(type);
  KeySpec key=getKey(element);
  boolean required=element.getAnnotation(NotRequired.class) == null;
  boolean hasDefault=typeUtil.isPrimitive(type);
  boolean needsToBeCast=typeUtil.needToCastIntentType(type);
  IntentInjectionAdapterGenerator intentInjectionAdapterGenerator=getOrCreateTargetClass(targetClassMap,enclosingElement);
  IntentFieldBinding binding=new IntentFieldBinding(name,type,intentType,key,needsToBeCast,hasDefault,required);
  intentInjectionAdapterGenerator.addField(binding);
  erasedTargetNames.add(enclosingElement.toString());
}
Program: 30887
Project: 30887
Buggy source:
private String getKey(Element element){
  if (isDefaultAnnotationElement(element,InjectExtra.class.getName(),"String_Node_Str")) {
    return generateKey(IntentFieldBinding.KEY_PREFIX,element.getSimpleName().toString());
  }
  return element.getAnnotation(InjectExtra.class).value();
}

Fixed version (ground truth):
private KeySpec getKey(Element element){
  if (isDefaultAnnotationElement(element,InjectExtra.class.getName(),"String_Node_Str")) {
    return new KeySpec(null,generateKey(IntentFieldBinding.KEY_PREFIX,element.getSimpleName().toString()));
  }
  return new KeySpec(null,element.getAnnotation(InjectExtra.class).value());
}
Program: 30888
Project: 30888
Buggy source:
@IntentBuilder(action=Intent.ACTION_DEFAULT) Intent getIntent(int extra,@Key(Intent.EXTRA_TEXT) String text);

Fixed version (ground truth):
@IntentBuilder(action=Intent.ACTION_DEFAULT) Intent getIntent(String text);
Program: 30889
Project: 30889
Buggy source:
@FragmentBuilder ParentFragment getFragment(int parentArg);

Fixed version (ground truth):
@FragmentBuilder Fragment getFragment(@Key("String_Node_Str") int arg,int arg2);
Program: 30890
Project: 30890
Buggy source:
@BundleBuilder Bundle getBundle(int arg,@Key("String_Node_Str") int test);

Fixed version (ground truth):
@BundleBuilder Bundle getBundle(@Key("String_Node_Str") int arg);
Program: 30891
Project: 30891
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  if (savedInstanceState == null) {
    fragment=ChildFragment.newInstance();
    fragment.setArguments(args);
    getSupportFragmentManager().beginTransaction().replace(R.id.container,fragment).commit();
  }
 else {
    fragment=(ChildFragment)getSupportFragmentManager().findFragmentById(R.id.container);
  }
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  if (savedInstanceState == null) {
    fragment=GrandchildFragment.newInstance();
    fragment.setArguments(args);
    getSupportFragmentManager().beginTransaction().replace(R.id.container,fragment).commit();
  }
 else {
    fragment=(GrandchildFragment)getSupportFragmentManager().findFragmentById(R.id.container);
  }
}
Program: 30893
Project: 30893
Buggy source:
/** 
 * Restore annotated fields in the specified   {@code target} from the {@link Bundle}.
 * @param target Target class to restore fields
 * @param bundle Bundle to restore field values.
 */
public static <T>void restoreInstanceState(T target,Bundle bundle){
  @SuppressWarnings("String_Node_Str") BundleBinding<T> binding=(BundleBinding<T>)getBundleBinding(target.getClass().getClassLoader(),target.getClass().getName());
  if (binding != null) {
    binding.restoreInstanceState(target,bundle);
  }
}

Fixed version (ground truth):
/** 
 * Restore annotated fields in the specified   {@code target} from the {@link Bundle}.
 * @param target Target class to restore fields
 * @param bundle Bundle to restore field values.
 */
public static <T>void restoreInstanceState(T target,Bundle bundle){
  @SuppressWarnings("String_Node_Str") BundleBinding<T> binding=(BundleBinding<T>)getBundleBinding(target.getClass().getClassLoader(),target.getClass());
  if (binding != null) {
    binding.restoreInstanceState(target,bundle);
  }
}
Program: 30894
Project: 30894
Buggy source:
private static IntentBinding<?> getIntentBinding(ClassLoader classLoader,String className){
  Class<?> adapterClass=loadClass(classLoader,className.concat(INTENT_ADAPTER_SUFFIX));
  if (!adapterClass.equals(Void.class)) {
    if (debug) {
      Log.d(TAG,"String_Node_Str" + className);
    }
    try {
      @SuppressWarnings("String_Node_Str") Constructor<IntentBinding<?>> constructor=(Constructor<IntentBinding<?>>)adapterClass.getConstructor();
      return constructor.newInstance();
    }
 catch (    NoSuchMethodException e) {
      throw new IllegalStateException("String_Node_Str" + className);
    }
catch (    InvocationTargetException e) {
      throw new IllegalStateException("String_Node_Str" + className,e);
    }
catch (    InstantiationException e) {
      throw new IllegalStateException("String_Node_Str" + className,e);
    }
catch (    IllegalAccessException e) {
      throw new IllegalStateException("String_Node_Str" + className,e);
    }
  }
  if (debug) {
    Log.w(TAG,"String_Node_Str" + className);
  }
  return null;
}

Fixed version (ground truth):
private static IntentBinding<?> getIntentBinding(ClassLoader classLoader,Class cls){
  String clsName=cls.getName();
  if (clsName.startsWith(ANDROID_PREFIX) || clsName.startsWith(JAVA_PREFIX)) {
    if (debug) {
      Log.d(TAG,"String_Node_Str");
    }
    return null;
  }
  Class<?> adapterClass=loadClass(classLoader,clsName.concat(INTENT_ADAPTER_SUFFIX));
  if (!adapterClass.equals(Void.class)) {
    if (debug) {
      Log.d(TAG,"String_Node_Str" + clsName);
    }
    try {
      @SuppressWarnings("String_Node_Str") Constructor<IntentBinding<?>> constructor=(Constructor<IntentBinding<?>>)adapterClass.getConstructor();
      return constructor.newInstance();
    }
 catch (    NoSuchMethodException e) {
      throw new IllegalStateException("String_Node_Str" + clsName);
    }
catch (    InvocationTargetException e) {
      throw new IllegalStateException("String_Node_Str" + clsName,e);
    }
catch (    InstantiationException e) {
      throw new IllegalStateException("String_Node_Str" + clsName,e);
    }
catch (    IllegalAccessException e) {
      throw new IllegalStateException("String_Node_Str" + clsName,e);
    }
  }
  if (debug) {
    Log.d(TAG,String.format("String_Node_Str",clsName,cls.getSuperclass().getName()));
  }
  return getIntentBinding(classLoader,cls.getSuperclass());
}
Program: 30895
Project: 30895
Buggy source:
/** 
 * Inject annotated fields in the specified   {@code target} from the {@link android.content.Intent}.
 * @param target Target object to inject the extras.
 * @param intent Intent containing the extras.
 */
public static <T>void injectExtras(T target,Intent intent){
  @SuppressWarnings("String_Node_Str") IntentBinding<T> binding=(IntentBinding<T>)getIntentBinding(target.getClass().getClassLoader(),target.getClass().getName());
  if (binding != null) {
    binding.injectExtras(target,intent);
  }
}

Fixed version (ground truth):
/** 
 * Inject annotated fields in the specified   {@code target} from the {@link android.content.Intent}.
 * @param target Target object to inject the extras.
 * @param intent Intent containing the extras.
 */
public static <T>void injectExtras(T target,Intent intent){
  @SuppressWarnings("String_Node_Str") IntentBinding<T> binding=(IntentBinding<T>)getIntentBinding(target.getClass().getClassLoader(),target.getClass());
  if (binding != null) {
    binding.injectExtras(target,intent);
  }
}
Program: 30896
Project: 30896
Buggy source:
private static BundleBinding<?> getBundleBinding(ClassLoader classLoader,String className){
  Class<?> adapterClass=loadClass(classLoader,className.concat(BUNDLE_ADAPTER_SUFFIX));
  if (!adapterClass.equals(Void.class)) {
    if (debug) {
      Log.d(TAG,"String_Node_Str" + className);
    }
    try {
      @SuppressWarnings("String_Node_Str") Constructor<BundleBinding<?>> constructor=(Constructor<BundleBinding<?>>)adapterClass.getConstructor();
      return constructor.newInstance();
    }
 catch (    NoSuchMethodException e) {
      throw new IllegalStateException("String_Node_Str" + className);
    }
catch (    InvocationTargetException e) {
      throw new IllegalStateException("String_Node_Str" + className,e);
    }
catch (    InstantiationException e) {
      throw new IllegalStateException("String_Node_Str" + className,e);
    }
catch (    IllegalAccessException e) {
      throw new IllegalStateException("String_Node_Str" + className,e);
    }
  }
  if (debug) {
    Log.w(TAG,"String_Node_Str" + className);
  }
  return null;
}

Fixed version (ground truth):
private static BundleBinding<?> getBundleBinding(ClassLoader classLoader,Class<?> cls){
  String clsName=cls.getName();
  if (clsName.startsWith(ANDROID_PREFIX) || clsName.startsWith(JAVA_PREFIX)) {
    if (debug) {
      Log.d(TAG,"String_Node_Str");
    }
    return null;
  }
  Class<?> adapterClass=loadClass(classLoader,clsName.concat(BUNDLE_ADAPTER_SUFFIX));
  if (!adapterClass.equals(Void.class)) {
    if (debug) {
      Log.d(TAG,"String_Node_Str" + clsName);
    }
    try {
      @SuppressWarnings("String_Node_Str") Constructor<BundleBinding<?>> constructor=(Constructor<BundleBinding<?>>)adapterClass.getConstructor();
      return constructor.newInstance();
    }
 catch (    NoSuchMethodException e) {
      throw new IllegalStateException("String_Node_Str" + clsName);
    }
catch (    InvocationTargetException e) {
      throw new IllegalStateException("String_Node_Str" + clsName,e);
    }
catch (    InstantiationException e) {
      throw new IllegalStateException("String_Node_Str" + clsName,e);
    }
catch (    IllegalAccessException e) {
      throw new IllegalStateException("String_Node_Str" + clsName,e);
    }
  }
  if (debug) {
    Log.d(TAG,String.format("String_Node_Str",clsName,cls.getSuperclass().getName()));
  }
  return getBundleBinding(classLoader,cls.getSuperclass());
}
Program: 30897
Project: 30897
Buggy source:
/** 
 * Save annotated fields in the specified   {@code target} to the {@link Bundle}.
 * @param target Target class for field saving.
 * @param bundle Bundle to save the field values.
 */
public static <T>void saveInstanceState(T target,Bundle bundle){
  @SuppressWarnings("String_Node_Str") BundleBinding<T> binding=(BundleBinding<T>)getBundleBinding(target.getClass().getClassLoader(),target.getClass().getName());
  if (binding != null) {
    binding.saveInstanceState(target,bundle);
  }
}

Fixed version (ground truth):
/** 
 * Save annotated fields in the specified   {@code target} to the {@link Bundle}.
 * @param target Target class for field saving.
 * @param bundle Bundle to save the field values.
 */
public static <T>void saveInstanceState(T target,Bundle bundle){
  @SuppressWarnings("String_Node_Str") BundleBinding<T> binding=(BundleBinding<T>)getBundleBinding(target.getClass().getClassLoader(),target.getClass());
  if (binding != null) {
    binding.saveInstanceState(target,bundle);
  }
}
Program: 30898
Project: 30898
Buggy source:
/** 
 * Inject annotated fields in the specified   {@code target} from the {@link android.os.Bundle}.
 * @param target Target object for inject arguments
 * @param bundle Bundle containing arguments;
 */
public static <T>void injectArguments(T target,Bundle bundle){
  @SuppressWarnings("String_Node_Str") BundleBinding<T> binding=(BundleBinding<T>)getBundleBinding(target.getClass().getClassLoader(),target.getClass().getName());
  if (binding != null) {
    binding.injectArguments(target,bundle);
  }
}

Fixed version (ground truth):
/** 
 * Inject annotated fields in the specified   {@code target} from the {@link android.os.Bundle}.
 * @param target Target object for inject arguments
 * @param bundle Bundle containing arguments;
 */
public static <T>void injectArguments(T target,Bundle bundle){
  @SuppressWarnings("String_Node_Str") BundleBinding<T> binding=(BundleBinding<T>)getBundleBinding(target.getClass().getClassLoader(),target.getClass());
  if (binding != null) {
    binding.injectArguments(target,bundle);
  }
}
Program: 30901
Project: 30901
Buggy source:
/** 
 * Remove an item from the stored list by index and observe the operation. <p> The   {@link Scheduler} used for this operation will be the one specified in{@link Builder#schedulingWith(Scheduler) schedulingWith()}.
 */
@NotNull public Single<List<T>> observeRemoveFromList(final int position){
  return Single.create(new Single.OnSubscribe<List<T>>(){
    @Override public void call(    SingleSubscriber<? super List<T>> subscriber){
      try {
        if (!file.exists())         throw new IOException("String_Node_Str");
        runInWriteLock(readWriteLock,new Runnable(){
          @Override public void run(){
            List<T> originalList=converter.read(file,type);
            if (originalList == null)             originalList=Collections.emptyList();
            List<T> modifiedList=new ArrayList<T>(originalList);
            modifiedList.remove(position);
            converter.write(modifiedList,type,file);
            updateSubject.onNext(modifiedList);
          }
        }
);
      }
 catch (      Exception e) {
        subscriber.onError(e);
      }
    }
  }
).subscribeOn(scheduler);
}

Fixed version (ground truth):
/** 
 * Remove an item from the stored list by index and observe the operation. <p> The   {@link Scheduler} used for this operation will be the one specified in{@link Builder#schedulingWith(Scheduler) schedulingWith()}.
 */
@NotNull public Single<List<T>> observeRemoveFromList(final int position){
  return Single.create(new Single.OnSubscribe<List<T>>(){
    @Override public void call(    final SingleSubscriber<? super List<T>> subscriber){
      try {
        if (!file.exists())         throw new IOException("String_Node_Str");
        runInWriteLock(readWriteLock,new Runnable(){
          @Override public void run(){
            List<T> originalList=converter.read(file,type);
            if (originalList == null)             originalList=Collections.emptyList();
            List<T> modifiedList=new ArrayList<T>(originalList);
            modifiedList.remove(position);
            converter.write(modifiedList,type,file);
            subscriber.onSuccess(modifiedList);
            updateSubject.onNext(modifiedList);
          }
        }
);
      }
 catch (      Exception e) {
        subscriber.onError(e);
      }
    }
  }
).subscribeOn(scheduler);
}
Program: 30904
Project: 30904
Buggy source:
private static void runInWriteLock(ReentrantReadWriteLock readWriteLock,Runnable runnable){
  Lock readLock=readWriteLock.readLock();
  int readCount=readWriteLock.getWriteHoldCount() == 0 ? readWriteLock.getReadHoldCount() : 0;
  for (int i=0; i < readCount; i++) {
    readLock.unlock();
  }
  Lock writeLock=readWriteLock.writeLock();
  writeLock.lock();
  try {
    runnable.run();
  }
 catch (  Exception e) {
    throw new RuntimeException(e);
  }
 finally {
    for (int i=0; i < readCount; i++) {
      readLock.lock();
      writeLock.unlock();
    }
  }
}

Fixed version (ground truth):
private static void runInWriteLock(ReentrantReadWriteLock readWriteLock,Runnable runnable){
  Lock readLock=readWriteLock.readLock();
  int readCount=readWriteLock.getWriteHoldCount() == 0 ? readWriteLock.getReadHoldCount() : 0;
  for (int i=0; i < readCount; i++) {
    readLock.unlock();
  }
  Lock writeLock=readWriteLock.writeLock();
  writeLock.lock();
  try {
    runnable.run();
  }
 catch (  Exception e) {
    throw new RuntimeException(e);
  }
 finally {
    for (int i=0; i < readCount; i++) {
      readLock.lock();
    }
    writeLock.unlock();
  }
}
Program: 30905
Project: 30905
Buggy source:
@Override public void run(){
  try {
    prepareInternal();
    if (mCurrentState == State.PREPARED) {
      mEventHandler.sendEmptyMessage(MEDIA_PREPARED);
    }
  }
 catch (  IOException e) {
    Log.e(TAG,"String_Node_Str",e);
    mEventHandler.sendMessage(mEventHandler.obtainMessage(MEDIA_ERROR,MEDIA_ERROR_UNKNOWN,MEDIA_ERROR_IO));
  }
catch (  IllegalStateException e) {
    Log.e(TAG,"String_Node_Str",e);
    mEventHandler.sendMessage(mEventHandler.obtainMessage(MEDIA_ERROR,MEDIA_ERROR_UNKNOWN,0));
  }
}

Fixed version (ground truth):
@Override public void run(){
  try {
    prepareInternal();
    if (mCurrentState == State.PREPARED) {
      mEventHandler.sendEmptyMessage(MEDIA_PREPARED);
    }
  }
 catch (  IOException e) {
    Log.e(TAG,"String_Node_Str",e);
    mEventHandler.sendMessage(mEventHandler.obtainMessage(MEDIA_ERROR,MEDIA_ERROR_UNKNOWN,MEDIA_ERROR_IO));
  }
catch (  IllegalStateException e) {
    Log.e(TAG,"String_Node_Str",e);
    mEventHandler.sendMessage(mEventHandler.obtainMessage(MEDIA_ERROR,MEDIA_ERROR_UNKNOWN,0));
  }
catch (  IllegalArgumentException e) {
    Log.e(TAG,"String_Node_Str",e);
    mEventHandler.sendMessage(mEventHandler.obtainMessage(MEDIA_ERROR,MEDIA_ERROR_UNKNOWN,0));
  }
}
Program: 30906
Project: 30906
Buggy source:
/** 
 * @see android.media.MediaPlayer#prepareAsync()
 */
public void prepareAsync() throws IllegalStateException {
  if (mCurrentState != State.INITIALIZED && mCurrentState != State.STOPPED) {
    throw new IllegalStateException();
  }
  mCurrentState=State.PREPARING;
  new Thread(new Runnable(){
    @Override public void run(){
      try {
        prepareInternal();
        if (mCurrentState == State.PREPARED) {
          mEventHandler.sendEmptyMessage(MEDIA_PREPARED);
        }
      }
 catch (      IOException e) {
        Log.e(TAG,"String_Node_Str",e);
        mEventHandler.sendMessage(mEventHandler.obtainMessage(MEDIA_ERROR,MEDIA_ERROR_UNKNOWN,MEDIA_ERROR_IO));
      }
catch (      IllegalStateException e) {
        Log.e(TAG,"String_Node_Str",e);
        mEventHandler.sendMessage(mEventHandler.obtainMessage(MEDIA_ERROR,MEDIA_ERROR_UNKNOWN,0));
      }
    }
  }
).start();
}

Fixed version (ground truth):
/** 
 * @see android.media.MediaPlayer#prepareAsync()
 */
public void prepareAsync() throws IllegalStateException {
  if (mCurrentState != State.INITIALIZED && mCurrentState != State.STOPPED) {
    throw new IllegalStateException();
  }
  mCurrentState=State.PREPARING;
  new Thread(new Runnable(){
    @Override public void run(){
      try {
        prepareInternal();
        if (mCurrentState == State.PREPARED) {
          mEventHandler.sendEmptyMessage(MEDIA_PREPARED);
        }
      }
 catch (      IOException e) {
        Log.e(TAG,"String_Node_Str",e);
        mEventHandler.sendMessage(mEventHandler.obtainMessage(MEDIA_ERROR,MEDIA_ERROR_UNKNOWN,MEDIA_ERROR_IO));
      }
catch (      IllegalStateException e) {
        Log.e(TAG,"String_Node_Str",e);
        mEventHandler.sendMessage(mEventHandler.obtainMessage(MEDIA_ERROR,MEDIA_ERROR_UNKNOWN,0));
      }
catch (      IllegalArgumentException e) {
        Log.e(TAG,"String_Node_Str",e);
        mEventHandler.sendMessage(mEventHandler.obtainMessage(MEDIA_ERROR,MEDIA_ERROR_UNKNOWN,0));
      }
    }
  }
).start();
}
Program: 30907
Project: 30907
Buggy source:
/** 
 * Sets the playback speed. Can be used for fast forward and slow motion. The speed must not be negative. speed 0.5 = half speed / slow motion speed 2.0 = double speed / fast forward speed 0.0 equals to pause
 * @param speed the playback speed to set
 * @throws IllegalArgumentException if the speed is < 0
 */
public void setPlaybackSpeed(float speed){
  if (speed < 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  mTimeBase.setSpeed(speed);
  mTimeBase.startAt(mCurrentPosition);
}

Fixed version (ground truth):
/** 
 * Sets the playback speed. Can be used for fast forward and slow motion. The speed must not be negative. speed 0.5 = half speed / slow motion speed 2.0 = double speed / fast forward speed 0.0 equals to pause
 * @param speed the playback speed to set
 * @throws IllegalArgumentException if the speed is negative
 */
public void setPlaybackSpeed(float speed){
  if (speed < 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  mTimeBase.setSpeed(speed);
  mTimeBase.startAt(mCurrentPosition);
}
Program: 30908
Project: 30908
Buggy source:
/** 
 * Sets the playback speed. Can be used for fast forward and slow motion. The speed must not be negative. speed 0.5 = half speed / slow motion speed 2.0 = double speed / fast forward speed 0.0 equals to pause
 * @param speed the playback speed to set
 * @throws IllegalArgumentException if the speed is < 0
 */
public void setPlaybackSpeed(float speed){
  if (speed < 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (isInPlaybackState()) {
    mPlayer.setPlaybackSpeed(speed);
  }
  mPlaybackSpeedWhenPrepared=speed;
}

Fixed version (ground truth):
/** 
 * Sets the playback speed. Can be used for fast forward and slow motion. The speed must not be negative. speed 0.5 = half speed / slow motion speed 2.0 = double speed / fast forward speed 0.0 equals to pause
 * @param speed the playback speed to set
 * @throws IllegalArgumentException if the speed is negative
 */
public void setPlaybackSpeed(float speed){
  if (speed < 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (isInPlaybackState()) {
    mPlayer.setPlaybackSpeed(speed);
  }
  mPlaybackSpeedWhenPrepared=speed;
}
Program: 30909
Project: 30909
Buggy source:
/** 
 * Sets the size of the segment cache. On Android < 21, the size must be set before setting the data source (which is when the cache is created), else an exception will be thrown. From Android 21 Lollipop onward, the cache can be dynamically resized at any time. Segments that are larger than the cache size will not be cached. Setting a very small cache size or zero cache size effectively disables caching.
 * @param sizeInBytes the size of the segment cache in bytes
 * @throws IllegalStateException on Android < 21 if the data source has already been set
 */
public void setCacheSize(int sizeInBytes){
  mUsedCacheSize=sizeInBytes;
  if (mUsedCache != null) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
      mUsedCache.resize(sizeInBytes == 0 ? 1 : sizeInBytes);
    }
 else {
      throw new IllegalStateException("String_Node_Str");
    }
  }
}

Fixed version (ground truth):
/** 
 * Sets the size of the segment cache. On Android before API 21, the size must be set before setting the data source (which is when the cache is created), else an exception will be thrown. From Android 21 Lollipop onward, the cache can be dynamically resized at any time. Segments that are larger than the cache size will not be cached. Setting a very small cache size or zero cache size effectively disables caching.
 * @param sizeInBytes the size of the segment cache in bytes
 * @throws IllegalStateException on Android before API 21 if the data source has already been set
 */
public void setCacheSize(int sizeInBytes){
  mUsedCacheSize=sizeInBytes;
  if (mUsedCache != null) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
      mUsedCache.resize(sizeInBytes == 0 ? 1 : sizeInBytes);
    }
 else {
      throw new IllegalStateException("String_Node_Str");
    }
  }
}
Program: 30911
Project: 30911
Buggy source:
private void seekInternal(long usec) throws IOException, InterruptedException {
  if (mAudioPlayback != null)   mAudioPlayback.pause(true);
  mDecoder.seekTo(mSeekMode,usec);
  mTimeBase.startAt(mDecoder.getCurrentDecodingPTS());
  boolean newSeekWaiting=mHandler.hasMessages(PLAYBACK_SEEK);
  if (newSeekWaiting) {
    mDecoder.dismissFrames();
  }
 else {
    mDecoder.renderFrames();
  }
  if (!newSeekWaiting) {
    mCurrentPosition=mDecoder.getCurrentDecodingPTS();
    mSeeking=false;
    mEventHandler.sendEmptyMessage(MEDIA_SEEK_COMPLETE);
    if (!mPaused) {
      playInternal();
    }
  }
}

Fixed version (ground truth):
private void seekInternal(long usec) throws IOException, InterruptedException {
  if (mVideoFrameInfo != null) {
    mDecoder.getVideoDecoder().dismissFrame(mVideoFrameInfo);
    mVideoFrameInfo=null;
  }
  if (mAudioPlayback != null)   mAudioPlayback.pause(true);
  mDecoder.seekTo(mSeekMode,usec);
  mTimeBase.startAt(mDecoder.getCurrentDecodingPTS());
  boolean newSeekWaiting=mHandler.hasMessages(PLAYBACK_SEEK);
  if (newSeekWaiting) {
    mDecoder.dismissFrames();
  }
 else {
    mDecoder.renderFrames();
  }
  if (!newSeekWaiting) {
    mCurrentPosition=mDecoder.getCurrentDecodingPTS();
    mSeeking=false;
    mEventHandler.sendEmptyMessage(MEDIA_SEEK_COMPLETE);
    if (!mPaused) {
      playInternal();
    }
  }
}
Program: 30912
Project: 30912
Buggy source:
/** 
 * Dismisses the current frame. This only works if the decoder holds a current frame, e.g. after a seek.
 */
public void dismissFrame(){
  dismissFrame(mCurrentFrameInfo);
}

Fixed version (ground truth):
/** 
 * Dismisses the current frame. This only works if the decoder holds a current frame, e.g. after a seek.
 */
public void dismissFrame(){
  if (mCurrentFrameInfo != null)   dismissFrame(mCurrentFrameInfo);
}
Program: 30913
Project: 30913
Buggy source:
private void openVideo(){
  if (mSource == null || mVideoSurface == null) {
    return;
  }
  release();
  mPlayer=new MediaPlayer();
  mPlayer.setSurface(mVideoSurface);
  mPlayer.setOnPreparedListener(mPreparedListener);
  mPlayer.setOnVideoSizeChangedListener(mSizeChangedListener);
  mPlayer.setOnSeekListener(mSeekListener);
  mPlayer.setOnSeekCompleteListener(mSeekCompleteListener);
  mPlayer.setOnCompletionListener(mCompletionListener);
  mPlayer.setOnErrorListener(mErrorListener);
  mPlayer.setOnInfoListener(mInfoListener);
  new AsyncTask<Void,Void,Void>(){
    private IOException mException;
    @Override protected Void doInBackground(    Void... params){
      try {
        mPlayer.setDataSource(mSource);
        mPlayer.prepareAsync();
        Log.d(TAG,"String_Node_Str");
      }
 catch (      IOException e) {
        Log.e(TAG,"String_Node_Str",e);
        mException=e;
      }
      return null;
    }
    @Override protected void onPostExecute(    Void aVoid){
      if (mException != null) {
        mErrorListener.onError(mPlayer,MediaPlayer.MEDIA_ERROR_UNKNOWN,0);
      }
    }
  }
.execute();
}

Fixed version (ground truth):
private void openVideo(){
  if (mSource == null || mVideoSurface == null) {
    return;
  }
  release();
  mPlayer=new MediaPlayer();
  mPlayer.setSurface(mVideoSurface);
  mPlayer.setOnPreparedListener(mPreparedListener);
  mPlayer.setOnVideoSizeChangedListener(mSizeChangedListener);
  mPlayer.setOnSeekListener(mSeekListener);
  mPlayer.setOnSeekCompleteListener(mSeekCompleteListener);
  mPlayer.setOnCompletionListener(mCompletionListener);
  mPlayer.setOnErrorListener(mErrorListener);
  mPlayer.setOnInfoListener(mInfoListener);
  final Handler exceptionHandler=new Handler(new Handler.Callback(){
    @Override public boolean handleMessage(    Message msg){
      mErrorListener.onError(mPlayer,MediaPlayer.MEDIA_ERROR_UNKNOWN,0);
      return true;
    }
  }
);
  new Thread(new Runnable(){
    @Override public void run(){
      try {
        mPlayer.setDataSource(mSource);
        mPlayer.prepareAsync();
        Log.d(TAG,"String_Node_Str");
      }
 catch (      IOException e) {
        Log.e(TAG,"String_Node_Str",e);
        exceptionHandler.sendEmptyMessage(0);
      }
    }
  }
).start();
}
Program: 30914
Project: 30914
Buggy source:
/** 
 * @see android.media.MediaPlayer#prepareAsync()
 */
public void prepareAsync() throws IllegalStateException {
  new AsyncTask<Void,Void,Void>(){
    @Override protected Void doInBackground(    Void... params){
      try {
        prepare();
        mEventHandler.sendEmptyMessage(MEDIA_PREPARED);
      }
 catch (      IOException e) {
        Log.e(TAG,"String_Node_Str",e);
        mEventHandler.sendMessage(mEventHandler.obtainMessage(MEDIA_ERROR,MEDIA_ERROR_UNKNOWN,MEDIA_ERROR_IO));
      }
      return null;
    }
  }
.execute();
}

Fixed version (ground truth):
/** 
 * @see android.media.MediaPlayer#prepareAsync()
 */
public void prepareAsync() throws IllegalStateException {
  new Thread(new Runnable(){
    @Override public void run(){
      try {
        prepare();
        mEventHandler.sendEmptyMessage(MEDIA_PREPARED);
      }
 catch (      IOException e) {
        Log.e(TAG,"String_Node_Str",e);
        mEventHandler.sendMessage(mEventHandler.obtainMessage(MEDIA_ERROR,MEDIA_ERROR_UNKNOWN,MEDIA_ERROR_IO));
      }
    }
  }
).start();
}
Program: 30915
Project: 30915
Buggy source:
private void openVideo(){
  if (mSource == null || mSurfaceHolder == null) {
    return;
  }
  release();
  mPlayer=new MediaPlayer();
  mPlayer.setDisplay(mSurfaceHolder);
  mPlayer.setScreenOnWhilePlaying(true);
  mPlayer.setOnPreparedListener(mPreparedListener);
  mPlayer.setOnSeekListener(mSeekListener);
  mPlayer.setOnSeekCompleteListener(mSeekCompleteListener);
  mPlayer.setOnCompletionListener(mCompletionListener);
  mPlayer.setOnVideoSizeChangedListener(mSizeChangedListener);
  mPlayer.setOnErrorListener(mErrorListener);
  mPlayer.setOnInfoListener(mInfoListener);
  mPlayer.setOnBufferingUpdateListener(mBufferingUpdateListener);
  new AsyncTask<Void,Void,Void>(){
    private IOException mException;
    @Override protected Void doInBackground(    Void... params){
      try {
        mPlayer.setDataSource(mSource);
        mPlayer.prepareAsync();
        Log.d(TAG,"String_Node_Str");
      }
 catch (      IOException e) {
        Log.e(TAG,"String_Node_Str",e);
        mException=e;
      }
      return null;
    }
    @Override protected void onPostExecute(    Void aVoid){
      if (mException != null) {
        mErrorListener.onError(mPlayer,MediaPlayer.MEDIA_ERROR_UNKNOWN,0);
      }
    }
  }
.execute();
}

Fixed version (ground truth):
private void openVideo(){
  if (mSource == null || mSurfaceHolder == null) {
    return;
  }
  release();
  mPlayer=new MediaPlayer();
  mPlayer.setDisplay(mSurfaceHolder);
  mPlayer.setScreenOnWhilePlaying(true);
  mPlayer.setOnPreparedListener(mPreparedListener);
  mPlayer.setOnSeekListener(mSeekListener);
  mPlayer.setOnSeekCompleteListener(mSeekCompleteListener);
  mPlayer.setOnCompletionListener(mCompletionListener);
  mPlayer.setOnVideoSizeChangedListener(mSizeChangedListener);
  mPlayer.setOnErrorListener(mErrorListener);
  mPlayer.setOnInfoListener(mInfoListener);
  mPlayer.setOnBufferingUpdateListener(mBufferingUpdateListener);
  final Handler exceptionHandler=new Handler(new Handler.Callback(){
    @Override public boolean handleMessage(    Message msg){
      mErrorListener.onError(mPlayer,MediaPlayer.MEDIA_ERROR_UNKNOWN,0);
      return true;
    }
  }
);
  new Thread(new Runnable(){
    @Override public void run(){
      try {
        mPlayer.setDataSource(mSource);
        mPlayer.prepareAsync();
        Log.d(TAG,"String_Node_Str");
      }
 catch (      IOException e) {
        Log.e(TAG,"String_Node_Str",e);
        exceptionHandler.sendEmptyMessage(0);
      }
    }
  }
).start();
}
Program: 30916
Project: 30916
Buggy source:
/** 
 * This API method in the Android MediaPlayer is hidden, but may be unhidden in the future. Here it can already be used.
 * @see android.media.MediaPlayer#setVolume(float)
 */
public void setVolume(float volume){
  setVolume(volume,volume);
}

Fixed version (ground truth):
/** 
 * This API method in the Android MediaPlayer is hidden, but may be unhidden in the future. Here it can already be used. see android.media.MediaPlayer#setVolume(float)
 */
public void setVolume(float volume){
  setVolume(volume,volume);
}
Program: 30917
Project: 30917
Buggy source:
private boolean isPlaying(){
  return mAudioTrack.getPlayState() == AudioTrack.PLAYSTATE_PLAYING;
}

Fixed version (ground truth):
public boolean isPlaying(){
  return mAudioTrack.getPlayState() == AudioTrack.PLAYSTATE_PLAYING;
}
Program: 30919
Project: 30919
Buggy source:
public void stop(){
  if (mPlaybackThread != null) {
    mPlaybackThread.release();
    mPlaybackThread.quitSafely();
    mPlaybackThread=null;
  }
  stayAwake(false);
}

Fixed version (ground truth):
public void stop(){
  if (mPlaybackThread != null) {
    mPlaybackThread.release();
    mPlaybackThread.quitSafelyCompat();
    mPlaybackThread=null;
  }
  stayAwake(false);
}
Program: 30921
Project: 30921
Buggy source:
/** 
 * This method is a VERY UGLY HACK. The QRMarker shaders have their sampler width & height hardcoded as constants, and for the preprocessFragmentShaderCode function to replace them correctly, they need to be known in advance. Passing them in the constructor does not work because the super() call, which in turn calls preprocessFragmentShaderCode, needs to come first, before class variables can be set.
 */
public static void setTextureSizeHack(int width,int height){
  sSamplerWidth=width;
  sSamplerHeight=height;
}

Fixed version (ground truth):
/** 
 * This method is a VERY UGLY HACK. The QRMarker shaders have their sampler width and height hardcoded as constants, and for the preprocessFragmentShaderCode function to replace them correctly, they need to be known in advance. Passing them in the constructor does not work because the super() call, which in turn calls preprocessFragmentShaderCode, needs to come first, before class variables can be set.
 */
public static void setTextureSizeHack(int width,int height){
  sSamplerWidth=width;
  sSamplerHeight=height;
}
Program: 30922
Project: 30922
Buggy source:
/** 
 * @see android.widget.VideoView#setVideoURI(android.net.Uri, Map<String, String>)
 * @param uri
 * @param headers
 * @deprecated only for compatibility with Android API
 */
@Deprecated public void setVideoURI(Uri uri,Map<String,String> headers){
  setVideoSource(new UriSource(getContext(),uri,headers));
}

Fixed version (ground truth):
/** 
 * @see android.widget.VideoView#setVideoURI(android.net.Uri,Map)
 * @param uri
 * @param headers
 * @deprecated only for compatibility with Android API
 */
@Deprecated public void setVideoURI(Uri uri,Map<String,String> headers){
  setVideoSource(new UriSource(getContext(),uri,headers));
}
Program: 30923
Project: 30923
Buggy source:
/** 
 * @see android.widget.VideoView#setVideoURI(android.net.Uri, Map<String, String>)
 * @param uri
 * @param headers
 * @deprecated only for compatibility with Android API
 */
@Deprecated public void setVideoURI(Uri uri,Map<String,String> headers){
  setVideoSource(new UriSource(getContext(),uri,headers));
}

Fixed version (ground truth):
/** 
 * @see android.widget.VideoView#setVideoURI(android.net.Uri,Map)
 * @param uri
 * @param headers
 * @deprecated only for compatibility with Android API
 */
@Deprecated public void setVideoURI(Uri uri,Map<String,String> headers){
  setVideoSource(new UriSource(getContext(),uri,headers));
}
Program: 30924
Project: 30924
Buggy source:
private boolean doMenuActionEffect(MenuItem item){
  if (item.getGroupId() == R.id.action_list_effects) {
    selectEffect(item.getItemId());
    return true;
  }
  return false;
}

Fixed version (ground truth):
private boolean doMenuActionEffect(MenuItem item){
  if (item.getGroupId() == R.id.action_list_effects) {
    return selectEffect(item.getItemId());
  }
  return false;
}
Program: 30925
Project: 30925
Buggy source:
public void selectEffect(int index){
  Effect effect=mEffects.get(index);
  if (!GLUtils.HAS_FLOAT_FRAMEBUFFER_SUPPORT && (effect instanceof FlowAbsEffect || effect instanceof FlowAbsSubEffect)) {
    Toast.makeText(mActivity,"String_Node_Str",Toast.LENGTH_SHORT).show();
  }
 else {
    mSelectedEffect=effect;
    mGLView.selectEffect(index);
  }
}

Fixed version (ground truth):
public boolean selectEffect(int index){
  Effect effect=mEffects.get(index);
  if (!GLUtils.HAS_FLOAT_FRAMEBUFFER_SUPPORT && (effect instanceof FlowAbsEffect || effect instanceof FlowAbsSubEffect)) {
    Toast.makeText(mActivity,"String_Node_Str",Toast.LENGTH_SHORT).show();
    return false;
  }
 else {
    mSelectedEffect=effect;
    mGLView.selectEffect(index);
    return true;
  }
}
Program: 30926
Project: 30926
Buggy source:
@Provides @ApplicationScope OkHttpClient provideOkHttpClient(Application app){
  return DataModule.createOkHttpClient(app);
}

Fixed version (ground truth):
@Provides @ApplicationScope OkHttpClient provideOkHttpClient(Application app){
  return DataModule.createOkHttpClient(app).build();
}
Program: 30927
Project: 30927
Buggy source:
@Provides @ApplicationScope Picasso providePicasso(Application app,OkHttpClient client){
  return new Picasso.Builder(app).downloader(new OkHttpDownloader(client)).listener(new Picasso.Listener(){
    @Override public void onImageLoadFailed(    Picasso picasso,    Uri uri,    Exception e){
      Timber.e(e,"String_Node_Str",uri);
    }
  }
).build();
}

Fixed version (ground truth):
@Provides @ApplicationScope Picasso providePicasso(Application app,OkHttpClient client){
  return new Picasso.Builder(app).downloader(new OkHttp3Downloader(client)).listener(new Picasso.Listener(){
    @Override public void onImageLoadFailed(    Picasso picasso,    Uri uri,    Exception e){
      Timber.e(e,"String_Node_Str",uri);
    }
  }
).build();
}
Program: 30928
Project: 30928
Buggy source:
@Provides @ApplicationScope @Named("String_Node_Str") OkHttpClient provideApiClient(OkHttpClient client,ApiHeaders apiHeaders){
  client=ApiModule.createApiClient(client,apiHeaders);
  return client;
}

Fixed version (ground truth):
@Provides @ApplicationScope @Named("String_Node_Str") OkHttpClient provideApiClient(OkHttpClient client,ApiHeaders apiHeaders){
  return ApiModule.createApiClient(client,apiHeaders).build();
}
Program: 30929
Project: 30929
Buggy source:
@Provides @ApplicationScope HttpUrl provideHttpUrl(){
  return HttpUrl.parse(ApiModule.PRODUCTION_API_URL);
}

Fixed version (ground truth):
@Provides @ApplicationScope HttpUrl provideHttpUrl(){
  return HttpUrl.parse(ApiModule.PRODUCTION_API_URL.toString());
}
Program: 30930
Project: 30930
Buggy source:
@Override public void colorButton(int id,int bgColor,int tintColor){
  ImageButton buttonView=(ImageButton)findViewById(id);
  GradientDrawable bgShape=(GradientDrawable)buttonView.getBackground();
  bgShape.setColor(bgColor);
}

Fixed version (ground truth):
@Override public void colorButton(int id,int bgColor,int tintColor){
  ImageButton buttonView=(ImageButton)findViewById(id);
  StateListDrawable bg=new StateListDrawable();
  ShapeDrawable normal=new ShapeDrawable(new OvalShape());
  normal.getPaint().setColor(bgColor);
  ShapeDrawable pressed=new ShapeDrawable(new OvalShape());
  pressed.getPaint().setColor(tintColor);
  bg.addState(new int[]{android.R.attr.state_pressed},pressed);
  bg.addState(new int[]{},normal);
  Utils.setBackgroundCompat(buttonView,bg);
}
Program: 30931
Project: 30931
Buggy source:
@Override public void setupEnterAnimation(){
  spotlight.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener(){
    @SuppressWarnings("String_Node_Str") @Override public void onGlobalLayout(){
      View button=findViewById(R.id.info);
      spotlight.setMaskX(button.getRight() - (button.getWidth() / 2));
      spotlight.setMaskY(button.getBottom() - (button.getHeight() / 2));
      runEnterAnimation();
      Utils.removeOnGlobalLayoutListener(spotlight,this);
    }
  }
);
}

Fixed version (ground truth):
@Override public void setupEnterAnimation(){
  spotlight.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener(){
    @SuppressWarnings("String_Node_Str") @Override public void onGlobalLayout(){
      View button=findViewById(R.id.info);
      spotlight.setMaskX(button.getRight() - (button.getWidth() / 2));
      spotlight.setMaskY(button.getBottom() - (button.getHeight() / 2));
      runEnterAnimation();
      Utils.removeOnGlobalLayoutListenerCompat(spotlight,this);
    }
  }
);
}
Program: 30932
Project: 30932
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public void onGlobalLayout(){
  View button=findViewById(R.id.info);
  spotlight.setMaskX(button.getRight() - (button.getWidth() / 2));
  spotlight.setMaskY(button.getBottom() - (button.getHeight() / 2));
  runEnterAnimation();
  Utils.removeOnGlobalLayoutListener(spotlight,this);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public void onGlobalLayout(){
  View button=findViewById(R.id.info);
  spotlight.setMaskX(button.getRight() - (button.getWidth() / 2));
  spotlight.setMaskY(button.getBottom() - (button.getHeight() / 2));
  runEnterAnimation();
  Utils.removeOnGlobalLayoutListenerCompat(spotlight,this);
}
Program: 30933
Project: 30933
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  getSupportActionBar().setHomeButtonEnabled(false);
  final View parent=findViewById(R.id.parent);
  parent.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener(){
    @Override public void onGlobalLayout(){
      Utils.removeOnGlobalLayoutListener(parent,this);
      setImageBitmap((ImageView)findViewById(R.id.card_photo_1).findViewById(R.id.photo),R.drawable.photo1);
      setImageBitmap((ImageView)findViewById(R.id.card_photo_2).findViewById(R.id.photo),R.drawable.photo2);
      setImageBitmap((ImageView)findViewById(R.id.card_photo_3).findViewById(R.id.photo),R.drawable.photo3);
      setImageBitmap((ImageView)findViewById(R.id.card_photo_4).findViewById(R.id.photo),R.drawable.photo4);
    }
  }
);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  getSupportActionBar().setHomeButtonEnabled(false);
  final View parent=findViewById(R.id.parent);
  parent.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener(){
    @Override public void onGlobalLayout(){
      Utils.removeOnGlobalLayoutListenerCompat(parent,this);
      setImageBitmap((ImageView)findViewById(R.id.card_photo_1).findViewById(R.id.photo),R.drawable.photo1);
      setImageBitmap((ImageView)findViewById(R.id.card_photo_2).findViewById(R.id.photo),R.drawable.photo2);
      setImageBitmap((ImageView)findViewById(R.id.card_photo_3).findViewById(R.id.photo),R.drawable.photo3);
      setImageBitmap((ImageView)findViewById(R.id.card_photo_4).findViewById(R.id.photo),R.drawable.photo4);
    }
  }
);
}
Program: 30934
Project: 30934
Buggy source:
@Override public void onGlobalLayout(){
  Utils.removeOnGlobalLayoutListener(parent,this);
  setImageBitmap((ImageView)findViewById(R.id.card_photo_1).findViewById(R.id.photo),R.drawable.photo1);
  setImageBitmap((ImageView)findViewById(R.id.card_photo_2).findViewById(R.id.photo),R.drawable.photo2);
  setImageBitmap((ImageView)findViewById(R.id.card_photo_3).findViewById(R.id.photo),R.drawable.photo3);
  setImageBitmap((ImageView)findViewById(R.id.card_photo_4).findViewById(R.id.photo),R.drawable.photo4);
}

Fixed version (ground truth):
@Override public void onGlobalLayout(){
  Utils.removeOnGlobalLayoutListenerCompat(parent,this);
  setImageBitmap((ImageView)findViewById(R.id.card_photo_1).findViewById(R.id.photo),R.drawable.photo1);
  setImageBitmap((ImageView)findViewById(R.id.card_photo_2).findViewById(R.id.photo),R.drawable.photo2);
  setImageBitmap((ImageView)findViewById(R.id.card_photo_3).findViewById(R.id.photo),R.drawable.photo3);
  setImageBitmap((ImageView)findViewById(R.id.card_photo_4).findViewById(R.id.photo),R.drawable.photo4);
}
Program: 30935
Project: 30935
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public void onGlobalLayout(){
  createShader();
  setMaskScale(1.0f);
  if (mCallback != null) {
    mCallback.onSetupAnimation(SpotlightView.this);
  }
  Utils.removeOnGlobalLayoutListener(SpotlightView.this,this);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public void onGlobalLayout(){
  createShader();
  setMaskScale(1.0f);
  if (mCallback != null) {
    mCallback.onSetupAnimation(SpotlightView.this);
  }
  Utils.removeOnGlobalLayoutListenerCompat(SpotlightView.this,this);
}
Program: 30936
Project: 30936
Buggy source:
@Override protected void onAttachedToWindow(){
  super.onAttachedToWindow();
  getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener(){
    @SuppressWarnings("String_Node_Str") @Override public void onGlobalLayout(){
      createShader();
      setMaskScale(1.0f);
      if (mCallback != null) {
        mCallback.onSetupAnimation(SpotlightView.this);
      }
      Utils.removeOnGlobalLayoutListener(SpotlightView.this,this);
    }
  }
);
}

Fixed version (ground truth):
@Override protected void onAttachedToWindow(){
  super.onAttachedToWindow();
  getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener(){
    @SuppressWarnings("String_Node_Str") @Override public void onGlobalLayout(){
      createShader();
      setMaskScale(1.0f);
      if (mCallback != null) {
        mCallback.onSetupAnimation(SpotlightView.this);
      }
      Utils.removeOnGlobalLayoutListenerCompat(SpotlightView.this,this);
    }
  }
);
}
Program: 30937
Project: 30937
Buggy source:
public String infoClass(int id){
  Course course=courses.get(id);
  if (course == null) {
    return "String_Node_Str" + id + "String_Node_Str";
  }
  if (course.students.isEmpty()) {
    return "String_Node_Str" + id + "String_Node_Str";
  }
  StringBuilder studList=new StringBuilder();
  for (  Integer student : course.students) {
    studList.append(student + "String_Node_Str");
  }
  studList.deleteCharAt(studList.length() - 1);
  return "String_Node_Str" + id + "String_Node_Str"+ studList.toString();
}

Fixed version (ground truth):
public static String infoClass(int id){
  Course course=courses.get(id);
  if (course == null) {
    return "String_Node_Str" + id + "String_Node_Str";
  }
  if (course.students.isEmpty()) {
    return "String_Node_Str" + id + "String_Node_Str";
  }
  StringBuilder studList=new StringBuilder();
  for (  Integer student : course.students) {
    studList.append(student + "String_Node_Str");
  }
  studList.deleteCharAt(studList.length() - 1);
  return "String_Node_Str" + id + "String_Node_Str"+ studList.toString();
}
Program: 30938
Project: 30938
Buggy source:
public String addStudent(int id,int capacity,int start,int end){
  if (students.containsKey(id)) {
    return "String_Node_Str" + id;
  }
  Student student=new Student();
  HashSet<Integer> timeSlots=student.timeSlots;
  for (int i=start; i <= end; i++) {
    timeSlots.add(i);
  }
  return "String_Node_Str" + id;
}

Fixed version (ground truth):
public static String addStudent(int id,int capacity,int start,int end){
  if (students.containsKey(id)) {
    return "String_Node_Str" + id;
  }
  Student student=new Student(capacity,start,end);
  students.put(id,student);
  return "String_Node_Str" + id;
}