nus-yam/ex-repair huggingface dataset:
Program: 111047
Project: 111047
Buggy source:
@Override public void updateInputs(Iterable<Artifact> shadowedActionInputs){
  shadowedAction.updateInputs(shadowedActionInputs);
  Preconditions.checkArgument(shadowedAction.inputsKnown(),"String_Node_Str",this,shadowedAction);
synchronized (this) {
    setInputs(createInputs(shadowedActionInputs,extraActionInputs));
    inputsKnown=true;
  }
}

Fixed version (ground truth):
@Override public void updateInputs(Iterable<Artifact> discoveredInputs){
  shadowedAction.updateInputs(Iterables.filter(discoveredInputs,Predicates.not(Predicates.in(extraActionInputs))));
  Preconditions.checkArgument(shadowedAction.inputsKnown(),"String_Node_Str",this,shadowedAction);
  updateExtraActionInputs(discoveredInputs);
}
Program: 111048
Project: 111048
Buggy source:
/** 
 * Fetches all the given nodes. Returns a map   {@code m} such that {@code m.get(k).equals(e)} forall  {@code k} such that {@code get(k) == e} and {@code e != null}.
 */
Map<SkyKey,NodeEntry> getBatch(Iterable<SkyKey> keys);

Fixed version (ground truth):
/** 
 * Fetches all the given nodes. Returns a map   {@code m} such that, for all {@code k} in{@code keys},   {@code m.get(k).equals(e)} iff {@code get(k) == e} and {@code e != null}, and  {@code !m.containsKey(k)} iff {@code get(k) == null}.
 */
Map<SkyKey,NodeEntry> getBatch(Iterable<SkyKey> keys);
Program: 111050
Project: 111050
Buggy source:
/** 
 * Returns the name of the jar file from which the given class symbol was loaded, if available, and null otherwise. Implicitly filters out jars from the compilation bootclasspath.
 * @param platformJars jars on javac's bootclasspath
 */
static String getJarName(JavaFileManager fileManager,ClassSymbol classSymbol,Set<String> platformJars){
  if (classSymbol == null) {
    return null;
  }
  if (haveSourceForSymbol(classSymbol)) {
    return null;
  }
  JavaFileObject classfile=unwrapFileObject(classSymbol.classfile);
  String name=ImplicitDependencyExtractor.getJarName(fileManager,classfile);
  if (name == null) {
    return null;
  }
  if (platformJars.contains(classfile)) {
    return null;
  }
  return name;
}

Fixed version (ground truth):
/** 
 * Returns the name of the jar file from which the given class symbol was loaded, if available, and null otherwise. Implicitly filters out jars from the compilation bootclasspath.
 * @param platformJars jars on javac's bootclasspath
 */
static String getJarName(JavaFileManager fileManager,ClassSymbol classSymbol,Set<String> platformJars){
  if (classSymbol == null) {
    return null;
  }
  if (haveSourceForSymbol(classSymbol)) {
    return null;
  }
  JavaFileObject classfile=unwrapFileObject(classSymbol.classfile);
  String name=ImplicitDependencyExtractor.getJarName(fileManager,classfile);
  if (name == null) {
    return null;
  }
  if (platformJars.contains(name)) {
    return null;
  }
  return name;
}
Program: 111051
Project: 111051
Buggy source:
protected AnalysisResult update(List<String> targets,boolean keepGoing,int loadingPhaseThreads,boolean doAnalysis,EventBus eventBus) throws Exception {
  LoadingPhaseRunner.Options loadingOptions=Options.getDefaults(LoadingPhaseRunner.Options.class);
  loadingOptions.loadingPhaseThreads=loadingPhaseThreads;
  BuildView.Options viewOptions=Options.getDefaults(BuildView.Options.class);
  viewOptions.keepGoing=keepGoing;
  LoadingPhaseRunner runner=new LoadingPhaseRunner(getPackageManager(),Collections.unmodifiableSet(ruleClassProvider.getRuleClassMap().keySet()));
  LoadingResult loadingResult=runner.execute(reporter,eventBus,targets,loadingOptions,getTargetConfiguration().getAllLabels(),viewOptions.keepGoing,false,null);
  if (!doAnalysis) {
    return null;
  }
  return view.update(loadingResult,masterConfig,viewOptions,TopLevelArtifactContext.DEFAULT,reporter,eventBus);
}

Fixed version (ground truth):
protected AnalysisResult update(List<String> targets,boolean keepGoing,int loadingPhaseThreads,boolean doAnalysis,EventBus eventBus) throws Exception {
  LoadingPhaseRunner.Options loadingOptions=Options.getDefaults(LoadingPhaseRunner.Options.class);
  loadingOptions.loadingPhaseThreads=loadingPhaseThreads;
  BuildView.Options viewOptions=Options.getDefaults(BuildView.Options.class);
  viewOptions.keepGoing=keepGoing;
  LoadingPhaseRunner runner=new LoadingPhaseRunner(getPackageManager(),Collections.unmodifiableSet(ruleClassProvider.getRuleClassMap().keySet()));
  LoadingResult loadingResult=runner.execute(reporter,eventBus,targets,loadingOptions,getTargetConfiguration().getAllLabels(),viewOptions.keepGoing,false,null);
  if (!doAnalysis) {
    return null;
  }
  return view.update(loadingResult,masterConfig,viewOptions,AnalysisTestUtil.TOP_LEVEL_ARTIFACT_CONTEXT,reporter,eventBus);
}
Program: 111052
Project: 111052
Buggy source:
/** 
 * Creates a builder that is a copy of another builder.
 */
public CppCompileActionBuilder(CppCompileActionBuilder other){
  this.owner=other.owner;
  this.features.addAll(other.features);
  this.featureConfiguration=other.featureConfiguration;
  this.sourceFile=other.sourceFile;
  this.sourceLabel=other.sourceLabel;
  this.mandatoryInputsBuilder=NestedSetBuilder.<Artifact>stableOrder().addTransitive(other.mandatoryInputsBuilder.build());
  this.pluginInputsBuilder=NestedSetBuilder.<Artifact>stableOrder().addTransitive(other.pluginInputsBuilder.build());
  this.optionalSourceFile=other.optionalSourceFile;
  this.outputFile=other.outputFile;
  this.tempOutputFile=other.tempOutputFile;
  this.dotdFile=other.dotdFile;
  this.gcnoFile=other.gcnoFile;
  this.configuration=other.configuration;
  this.context=other.context;
  this.copts.addAll(other.copts);
  this.pluginOpts.addAll(other.pluginOpts);
  this.nocopts.addAll(other.nocopts);
  this.analysisEnvironment=other.analysisEnvironment;
  this.extraSystemIncludePrefixes=ImmutableList.copyOf(other.extraSystemIncludePrefixes);
  this.enableLayeringCheck=other.enableLayeringCheck;
  this.compileHeaderModules=other.compileHeaderModules;
  this.includeResolver=other.includeResolver;
  this.actionClassId=other.actionClassId;
  this.actionContext=other.actionContext;
  this.cppConfiguration=other.cppConfiguration;
  this.lipoScannableMap=other.lipoScannableMap;
}

Fixed version (ground truth):
/** 
 * Creates a builder that is a copy of another builder.
 */
public CppCompileActionBuilder(CppCompileActionBuilder other){
  this.owner=other.owner;
  this.features.addAll(other.features);
  this.featureConfiguration=other.featureConfiguration;
  this.sourceFile=other.sourceFile;
  this.sourceLabel=other.sourceLabel;
  this.mandatoryInputsBuilder=NestedSetBuilder.<Artifact>stableOrder().addTransitive(other.mandatoryInputsBuilder.build());
  this.pluginInputsBuilder=NestedSetBuilder.<Artifact>stableOrder().addTransitive(other.pluginInputsBuilder.build());
  this.optionalSourceFile=other.optionalSourceFile;
  this.outputFile=other.outputFile;
  this.tempOutputFile=other.tempOutputFile;
  this.dotdFile=other.dotdFile;
  this.gcnoFile=other.gcnoFile;
  this.configuration=other.configuration;
  this.context=other.context;
  this.copts.addAll(other.copts);
  this.pluginOpts.addAll(other.pluginOpts);
  this.nocopts.addAll(other.nocopts);
  this.analysisEnvironment=other.analysisEnvironment;
  this.extraSystemIncludePrefixes=ImmutableList.copyOf(other.extraSystemIncludePrefixes);
  this.enableLayeringCheck=other.enableLayeringCheck;
  this.compileHeaderModules=other.compileHeaderModules;
  this.includeResolver=other.includeResolver;
  this.actionClassId=other.actionClassId;
  this.actionContext=other.actionContext;
  this.cppConfiguration=other.cppConfiguration;
  this.fdoBuildStamp=other.fdoBuildStamp;
  this.usePic=other.usePic;
  this.lipoScannableMap=other.lipoScannableMap;
}
Program: 111054
Project: 111054
Buggy source:
/** 
 * Parses an end-of-line sequence, handling statement indentation correctly. UNIX newlines are assumed (LF). Carriage returns are always ignored. ON ENTRY: 'pos' is the index of the char after '\n'. ON EXIT: 'pos' is the index of the next non-space char after '\n'.
 */
private void newline(){
  if (openParenStackDepth > 0) {
    newlineInsideExpression();
  }
 else {
    newlineOutsideExpression();
  }
}

Fixed version (ground truth):
/** 
 * Parses an end-of-line sequence, handling statement indentation correctly. <p>UNIX newlines are assumed (LF). Carriage returns are always ignored. <p>ON ENTRY: 'pos' is the index of the char after '\n'. ON EXIT: 'pos' is the index of the next non-space char after '\n'.
 */
private void newline(){
  if (openParenStackDepth > 0) {
    newlineInsideExpression();
  }
 else {
    newlineOutsideExpression();
  }
}
Program: 111055
Project: 111055
Buggy source:
/** 
 * Scans an identifier or keyword. ON ENTRY: 'pos' is 1 + the index of the first char in the identifier. ON EXIT: 'pos' is 1 + the index of the last char in the identifier.
 * @return the identifier or keyword token.
 */
private Token identifierOrKeyword(){
  int oldPos=pos - 1;
  String id=scanIdentifier();
  TokenKind kind=getTokenKindForIdentfier(id);
  return new Token(kind,oldPos,pos,(kind == TokenKind.IDENTIFIER) ? id : null);
}

Fixed version (ground truth):
/** 
 * Scans an identifier or keyword. <p>ON ENTRY: 'pos' is 1 + the index of the first char in the identifier. ON EXIT: 'pos' is 1 + the index of the last char in the identifier.
 * @return the identifier or keyword token.
 */
private Token identifierOrKeyword(){
  int oldPos=pos - 1;
  String id=scanIdentifier();
  TokenKind kind=getTokenKindForIdentfier(id);
  return new Token(kind,oldPos,pos,(kind == TokenKind.IDENTIFIER) ? id : null);
}
Program: 111056
Project: 111056
Buggy source:
/** 
 * Create an input source from the given input stream, and associate path with this source.  'path' will be used in error messages, etc, but will not (in general) be used to to read the content from path. (The exception is the case in which Python pre-processing is required; the path will be used to provide the input to the Python pre-processor. Arguably, we should just send the content as input to the subprocess instead of using the path, but it's not clear it's worth the effort.)
 */
public static ParserInputSource create(InputStream in,Path path) throws IOException {
  try {
    return create(new String(FileSystemUtils.readContentAsLatin1(in)),path);
  }
  finally {
    in.close();
  }
}

Fixed version (ground truth):
/** 
 * Create an input source from the given input stream, and associate path with this source.  'path' will be used in error messages, etc, but will not (in general) be used to to read the content from path. <p>(The exception is the case in which Python pre-processing is required; the path will be used to provide the input to the Python pre-processor. Arguably, we should just send the content as input to the subprocess instead of using the path, but it's not clear it's worth the effort.)
 */
public static ParserInputSource create(InputStream in,Path path) throws IOException {
  try {
    return create(new String(FileSystemUtils.readContentAsLatin1(in)),path);
  }
  finally {
    in.close();
  }
}
Program: 111057
Project: 111057
Buggy source:
public float getProgress(){
  return mProgress;
}

Fixed version (ground truth):
public int getProgress(){
  return mProgress;
}
Program: 111058
Project: 111058
Buggy source:
@Override public void writeToParcel(Parcel out,int flags){
  super.writeToParcel(out,flags);
  out.writeFloat(mProgress);
  out.writeInt(mIndeterminateProgressMode ? 1 : 0);
  out.writeInt(mConfigurationChanged ? 1 : 0);
}

Fixed version (ground truth):
@Override public void writeToParcel(Parcel out,int flags){
  super.writeToParcel(out,flags);
  out.writeInt(mProgress);
  out.writeInt(mIndeterminateProgressMode ? 1 : 0);
  out.writeInt(mConfigurationChanged ? 1 : 0);
}
Program: 111059
Project: 111059
Buggy source:
public void setProgress(float progress){
  mProgress=progress;
  if (mMorphingInProgress || getWidth() == 0) {
    return;
  }
  mStateManager.saveProgress(this);
  if (mProgress >= mMaxProgress) {
    if (mState == State.PROGRESS) {
      morphProgressToComplete();
    }
 else     if (mState == State.IDLE) {
      morphIdleToComplete();
    }
  }
 else   if (mProgress > IDLE_STATE_PROGRESS) {
    if (mState == State.IDLE) {
      morphToProgress();
    }
 else     if (mState == State.PROGRESS) {
      invalidate();
    }
  }
 else   if (mProgress == ERROR_STATE_PROGRESS) {
    if (mState == State.PROGRESS) {
      morphProgressToError();
    }
 else     if (mState == State.IDLE) {
      morphIdleToError();
    }
  }
 else   if (mProgress == IDLE_STATE_PROGRESS) {
    if (mState == State.COMPLETE) {
      morphCompleteToIdle();
    }
 else     if (mState == State.PROGRESS) {
      morphProgressToIdle();
    }
 else     if (mState == State.ERROR) {
      morphErrorToIdle();
    }
  }
}

Fixed version (ground truth):
public void setProgress(int progress){
  mProgress=progress;
  if (mMorphingInProgress || getWidth() == 0) {
    return;
  }
  mStateManager.saveProgress(this);
  if (mProgress >= mMaxProgress) {
    if (mState == State.PROGRESS) {
      morphProgressToComplete();
    }
 else     if (mState == State.IDLE) {
      morphIdleToComplete();
    }
  }
 else   if (mProgress > IDLE_STATE_PROGRESS) {
    if (mState == State.IDLE) {
      morphToProgress();
    }
 else     if (mState == State.PROGRESS) {
      invalidate();
    }
  }
 else   if (mProgress == ERROR_STATE_PROGRESS) {
    if (mState == State.PROGRESS) {
      morphProgressToError();
    }
 else     if (mState == State.IDLE) {
      morphIdleToError();
    }
  }
 else   if (mProgress == IDLE_STATE_PROGRESS) {
    if (mState == State.COMPLETE) {
      morphCompleteToIdle();
    }
 else     if (mState == State.PROGRESS) {
      morphProgressToIdle();
    }
 else     if (mState == State.ERROR) {
      morphErrorToIdle();
    }
  }
}
Program: 111060
Project: 111060
Buggy source:
public float getProgress(){
  return mProgress;
}

Fixed version (ground truth):
public int getProgress(){
  return mProgress;
}
Program: 111061
Project: 111061
Buggy source:
private void morphProgressToIdle(){
  background.getGradientDrawable().setStroke(mStrokeWidth,mColorIdle);
  background.getGradientDrawable().setColor(mColorIdle);
  removeIcon();
  setText(mIdleText);
  mMorphingInProgress=false;
  mState=State.IDLE;
}

Fixed version (ground truth):
private void morphProgressToIdle(){
  MorphingAnimation animation=createProgressMorphing(getHeight(),mCornerRadius,getHeight(),getWidth());
  animation.setFromColor(mColorProgress);
  animation.setToColor(mColorIdle);
  animation.setFromStrokeColor(mColorIndicator);
  animation.setToStrokeColor(mColorIdle);
  animation.setListener(new OnAnimationEndListener(){
    @Override public void onAnimationEnd(){
      removeIcon();
      setText(mIdleText);
      mMorphingInProgress=false;
      mState=State.IDLE;
    }
  }
);
  animation.start();
}
Program: 111062
Project: 111062
Buggy source:
public void setProgress(int progress){
  mProgress=progress;
  if (mMorphingInProgress || getWidth() == 0) {
    return;
  }
  if (mProgress >= mMaxProgress) {
    if (mState == State.PROGRESS) {
      morphProgressToComplete();
    }
 else     if (mState == State.IDLE) {
      morphIdleToComplete();
    }
  }
 else   if (mProgress > IDLE_STATE_PROGRESS) {
    if (mState == State.IDLE) {
      morphToProgress();
    }
 else     if (mState == State.PROGRESS) {
      invalidate();
    }
  }
 else   if (mProgress == ERROR_STATE_PROGRESS) {
    if (mState == State.PROGRESS) {
      morphProgressToError();
    }
 else     if (mState == State.IDLE) {
      morphIdleToError();
    }
  }
 else   if (mProgress == IDLE_STATE_PROGRESS) {
    if (mState == State.COMPLETE) {
      morphCompleteToIdle();
    }
 else     if (mState == State.PROGRESS) {
      morphProgressToIdle();
    }
 else     if (mState == State.ERROR) {
      morphErrorToIdle();
    }
  }
}

Fixed version (ground truth):
public void setProgress(int progress){
  mProgress=progress;
  if (mMorphingInProgress || getWidth() == 0) {
    return;
  }
  mStateManager.saveProgress(this);
  if (mProgress >= mMaxProgress) {
    if (mState == State.PROGRESS) {
      morphProgressToComplete();
    }
 else     if (mState == State.IDLE) {
      morphIdleToComplete();
    }
  }
 else   if (mProgress > IDLE_STATE_PROGRESS) {
    if (mState == State.IDLE) {
      morphToProgress();
    }
 else     if (mState == State.PROGRESS) {
      invalidate();
    }
  }
 else   if (mProgress == ERROR_STATE_PROGRESS) {
    if (mState == State.PROGRESS) {
      morphProgressToError();
    }
 else     if (mState == State.IDLE) {
      morphIdleToError();
    }
  }
 else   if (mProgress == IDLE_STATE_PROGRESS) {
    if (mState == State.COMPLETE) {
      morphCompleteToIdle();
    }
 else     if (mState == State.PROGRESS) {
      morphProgressToIdle();
    }
 else     if (mState == State.ERROR) {
      morphErrorToIdle();
    }
  }
}
Program: 111063
Project: 111063
Buggy source:
@Override public void onAnimationEnd(){
  removeIcon();
  setText(mIdleText);
  mMorphingInProgress=false;
  mState=State.IDLE;
}

Fixed version (ground truth):
@Override public void onAnimationEnd(){
  removeIcon();
  setText(mIdleText);
  mMorphingInProgress=false;
  mState=State.IDLE;
  mStateManager.checkState(CircularProgressButton.this);
}
Program: 111064
Project: 111064
Buggy source:
private void morphProgressToIdle(){
  MorphingAnimation animation=createProgressMorphing(getHeight(),mCornerRadius,getHeight(),getWidth());
  animation.setFromColor(mColorProgress);
  animation.setToColor(mColorIdle);
  animation.setFromStrokeColor(mColorIndicator);
  animation.setToStrokeColor(mColorIdle);
  animation.setListener(new OnAnimationEndListener(){
    @Override public void onAnimationEnd(){
      removeIcon();
      setText(mIdleText);
      mMorphingInProgress=false;
      mState=State.IDLE;
    }
  }
);
  animation.start();
}

Fixed version (ground truth):
private void morphProgressToIdle(){
  MorphingAnimation animation=createProgressMorphing(getHeight(),mCornerRadius,getHeight(),getWidth());
  animation.setFromColor(mColorProgress);
  animation.setToColor(mColorIdle);
  animation.setFromStrokeColor(mColorIndicator);
  animation.setToStrokeColor(mColorIdle);
  animation.setListener(new OnAnimationEndListener(){
    @Override public void onAnimationEnd(){
      removeIcon();
      setText(mIdleText);
      mMorphingInProgress=false;
      mState=State.IDLE;
      mStateManager.checkState(CircularProgressButton.this);
    }
  }
);
  animation.start();
}
Program: 111065
Project: 111065
Buggy source:
private void init(Context context,AttributeSet attributeSet){
  mStrokeWidth=(int)getContext().getResources().getDimension(R.dimen.stroke_width);
  initAttributes(context,attributeSet);
  mMaxProgress=100;
  mState=State.IDLE;
  setText(mIdleText);
  GradientDrawable gradientDrawable=(GradientDrawable)context.getResources().getDrawable(R.drawable.background).mutate();
  gradientDrawable.setColor(mColorIdle);
  gradientDrawable.setCornerRadius(mCornerRadius);
  background=new StrokeGradientDrawable(gradientDrawable);
  background.setStrokeColor(mColorIdle);
  background.setStrokeWidth(mStrokeWidth);
  setBackgroundCompat(gradientDrawable);
}

Fixed version (ground truth):
private void init(Context context,AttributeSet attributeSet){
  mStrokeWidth=(int)getContext().getResources().getDimension(R.dimen.stroke_width);
  initAttributes(context,attributeSet);
  mMaxProgress=100;
  mState=State.IDLE;
  mStateManager=new StateManager(this);
  setText(mIdleText);
  GradientDrawable gradientDrawable=(GradientDrawable)context.getResources().getDrawable(R.drawable.background).mutate();
  gradientDrawable.setColor(mColorIdle);
  gradientDrawable.setCornerRadius(mCornerRadius);
  background=new StrokeGradientDrawable(gradientDrawable);
  background.setStrokeColor(mColorIdle);
  background.setStrokeWidth(mStrokeWidth);
  setBackgroundCompat(gradientDrawable);
}
Program: 111066
Project: 111066
Buggy source:
public void setProgress(int progress){
  mProgress=progress;
  if (mMorphingInProgress) {
    return;
  }
  if (mProgress >= mMaxProgress) {
    if (mState == State.PROGRESS) {
      morphProgressToComplete();
    }
 else     if (mState == State.IDLE) {
      morphIdleToComplete();
    }
  }
 else   if (mProgress > IDLE_STATE_PROGRESS) {
    if (mState == State.IDLE) {
      morphToProgress();
    }
 else     if (mState == State.PROGRESS) {
      invalidate();
    }
  }
 else   if (mProgress == ERROR_STATE_PROGRESS) {
    if (mState == State.PROGRESS) {
      morphProgressToError();
    }
 else     if (mState == State.IDLE) {
      morphIdleToError();
    }
  }
 else   if (mProgress == IDLE_STATE_PROGRESS) {
    if (mState == State.COMPLETE) {
      morphCompleteToIdle();
    }
 else     if (mState == State.PROGRESS) {
      morphProgressToIdle();
    }
 else     if (mState == State.ERROR) {
      morphErrorToIdle();
    }
  }
}

Fixed version (ground truth):
public void setProgress(int progress){
  mProgress=progress;
  if (mMorphingInProgress || getWidth() == 0) {
    return;
  }
  if (mProgress >= mMaxProgress) {
    if (mState == State.PROGRESS) {
      morphProgressToComplete();
    }
 else     if (mState == State.IDLE) {
      morphIdleToComplete();
    }
  }
 else   if (mProgress > IDLE_STATE_PROGRESS) {
    if (mState == State.IDLE) {
      morphToProgress();
    }
 else     if (mState == State.PROGRESS) {
      invalidate();
    }
  }
 else   if (mProgress == ERROR_STATE_PROGRESS) {
    if (mState == State.PROGRESS) {
      morphProgressToError();
    }
 else     if (mState == State.IDLE) {
      morphIdleToError();
    }
  }
 else   if (mProgress == IDLE_STATE_PROGRESS) {
    if (mState == State.COMPLETE) {
      morphCompleteToIdle();
    }
 else     if (mState == State.PROGRESS) {
      morphProgressToIdle();
    }
 else     if (mState == State.ERROR) {
      morphErrorToIdle();
    }
  }
}
Program: 111067
Project: 111067
Buggy source:
@Override public Float calculate(float t,float b,float c,float d){
  if ((t/=d / 2) < 1)   return c / 2 * (t * t * (((s*=(1.525)) + 1) * t - s)) + b;
  return c / 2 * ((t-=2) * t * (((s*=(1.525)) + 1) * t + s) + 2) + b;
}

Fixed version (ground truth):
@Override public Float calculate(float t,float b,float c,float d){
  if ((t/=d / 2) < 1)   return c / 2 * (t * t * ((s + 1) * t - s)) + b;
  return c / 2 * ((t-=2) * t * ((s + 1) * t + s) + 2) + b;
}
Program: 111068
Project: 111068
Buggy source:
public BaseUiController(){
  mUis=new HashSet<U>();
  mUnmodifiableUis=Collections.unmodifiableSet(mUis);
}

Fixed version (ground truth):
public BaseUiController(){
  mUis=new CopyOnWriteArraySet<U>();
  mUnmodifiableUis=Collections.unmodifiableSet(mUis);
}
Program: 111069
Project: 111069
Buggy source:
protected U findUi(final int id){
  for (  U ui : mUis) {
    if (getId(ui) == id) {
      return ui;
    }
  }
  return null;
}

Fixed version (ground truth):
protected synchronized U findUi(final int id){
  for (  U ui : mUis) {
    if (getId(ui) == id) {
      return ui;
    }
  }
  return null;
}
Program: 111070
Project: 111070
Buggy source:
public final void attachUi(U ui){
  Preconditions.checkArgument(ui != null,"String_Node_Str");
  Preconditions.checkState(!mUis.contains(ui),"String_Node_Str");
  mUis.add(ui);
  ui.setCallbacks(createUiCallbacks(ui));
  if (isInited()) {
    if (!ui.isModal() && !(ui instanceof SubUi)) {
      final String uiTitle=ui.getUiTitle();
      if (!TextUtils.isEmpty(uiTitle)) {
        updateDisplayTitle(ui.getUiTitle());
      }
    }
    onUiAttached(ui);
    populateUis();
  }
}

Fixed version (ground truth):
public synchronized final void attachUi(U ui){
  Preconditions.checkArgument(ui != null,"String_Node_Str");
  Preconditions.checkState(!mUis.contains(ui),"String_Node_Str");
  mUis.add(ui);
  ui.setCallbacks(createUiCallbacks(ui));
  if (isInited()) {
    if (!ui.isModal() && !(ui instanceof SubUi)) {
      final String uiTitle=ui.getUiTitle();
      if (!TextUtils.isEmpty(uiTitle)) {
        updateDisplayTitle(ui.getUiTitle());
      }
    }
    onUiAttached(ui);
    populateUis();
  }
}
Program: 111071
Project: 111071
Buggy source:
public final void detachUi(U ui){
  Preconditions.checkArgument(ui != null,"String_Node_Str");
  Preconditions.checkState(mUis.contains(ui),"String_Node_Str");
  onUiDetached(ui);
  ui.setCallbacks(null);
  mUis.remove(ui);
}

Fixed version (ground truth):
public synchronized final void detachUi(U ui){
  Preconditions.checkArgument(ui != null,"String_Node_Str");
  Preconditions.checkState(mUis.contains(ui),"String_Node_Str");
  onUiDetached(ui);
  ui.setCallbacks(null);
  mUis.remove(ui);
}
Program: 111072
Project: 111072
Buggy source:
protected void populateUis(){
  if (Constants.DEBUG) {
    mLogger.d(getClass().getSimpleName(),"String_Node_Str");
  }
  for (  U ui : mUis) {
    populateUi(ui);
  }
}

Fixed version (ground truth):
protected synchronized void populateUis(){
  if (Constants.DEBUG) {
    mLogger.d(getClass().getSimpleName(),"String_Node_Str");
  }
  for (  U ui : mUis) {
    populateUi(ui);
  }
}
Program: 111073
Project: 111073
Buggy source:
@Subscribe public void onMovieUserRatingChanged(MoviesState.MovieUserRatingChangedEvent event){
  populateUis();
}

Fixed version (ground truth):
@Subscribe public void onMovieUserRatingChanged(MoviesState.MovieUserRatingChangedEvent event){
  MovieUi ui=findUi(event.callingId);
  if (ui != null) {
    populateUi(ui);
  }
 else {
    populateUis();
  }
}
Program: 111074
Project: 111074
Buggy source:
@Subscribe public void onMovieFlagsChanged(MoviesState.MovieFlagsUpdatedEvent event){
  MovieUi ui=findUi(event.callingId);
  if (ui != null) {
    if (MovieQueryType.RECOMMENDED == ui.getMovieQueryType()) {
      fetchRecommended(event.callingId);
    }
    populateUi(ui);
  }
}

Fixed version (ground truth):
@Subscribe public void onMovieFlagsChanged(MoviesState.MovieFlagsUpdatedEvent event){
  MovieUi ui=findUi(event.callingId);
  if (ui != null) {
    if (MovieQueryType.RECOMMENDED == ui.getMovieQueryType()) {
      fetchRecommended(event.callingId);
    }
    populateUi(ui);
  }
 else {
    populateUis();
  }
}
Program: 111075
Project: 111075
Buggy source:
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  super.onLayout(changed,left,top,right,bottom);
  if (changed) {
    if (mOriginalHeaderViewHeight != mHeaderView.getHeight()) {
      mOriginalHeaderViewHeight=mHeaderView.getHeight();
    }
    final int targetHeaderHeight=mOriginalHeaderViewHeight + mHeaderViewHeightDiff;
    if (mHeaderView.getLayoutParams().height != targetHeaderHeight) {
      mHeaderView.getLayoutParams().height=targetHeaderHeight;
      post(new Runnable(){
        @Override public void run(){
          mHeaderView.requestLayout();
        }
      }
);
    }
    updateContentViewPaddingTop(targetHeaderHeight);
    updateOffset(mContentViewScrollView.getScrollY());
  }
}

Fixed version (ground truth):
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  super.onLayout(changed,left,top,right,bottom);
  if (mOriginalHeaderViewHeight <= 0) {
    mOriginalHeaderViewHeight=mHeaderView.getHeight();
  }
  final int targetHeaderHeight=mOriginalHeaderViewHeight + mHeaderViewHeightDiff;
  mHeaderView.layout(left,0,right,targetHeaderHeight);
  updateContentViewPaddingTop();
  updateOffset(mContentViewScrollView.getScrollY());
}
Program: 111076
Project: 111076
Buggy source:
void updateOffset(int y){
  if (y <= mHeaderView.getHeight()) {
    mHeaderView.setVisibility(View.VISIBLE);
    int newTop=Math.round(-y * PARALLAX_FRICTION);
    mHeaderView.offsetTopAndBottom(newTop - mHeaderView.getTop());
    if (mContentViewScrollListener != null) {
      mContentViewScrollListener.onContentViewScrolled(y / (float)mHeaderView.getHeight());
    }
  }
 else {
    mHeaderView.setVisibility(View.INVISIBLE);
  }
}

Fixed version (ground truth):
void updateOffset(int y){
  if (y <= mHeaderView.getHeight()) {
    mHeaderView.setVisibility(View.VISIBLE);
    final int newTop=Math.round(-y * PARALLAX_FRICTION);
    mHeaderView.offsetTopAndBottom(newTop - mHeaderView.getTop());
    if (mContentViewScrollListener != null) {
      mContentViewScrollListener.onContentViewScrolled(y / (float)mHeaderView.getHeight());
    }
  }
 else {
    mHeaderView.setVisibility(View.INVISIBLE);
  }
}
Program: 111077
Project: 111077
Buggy source:
void updateContentViewPaddingTop(int headerHeight){
  final int targetPaddingTop=headerHeight - mContentOverlaySize;
  if (mContentViewWrapper.getPaddingTop() != targetPaddingTop) {
    mContentViewWrapper.post(new Runnable(){
      @Override public void run(){
        mContentViewWrapper.setPadding(0,targetPaddingTop,0,0);
      }
    }
);
  }
}

Fixed version (ground truth):
void updateContentViewPaddingTop(){
  final int targetPaddingTop=mHeaderView.getHeight() - mContentOverlaySize;
  if (mContentViewWrapper.getPaddingTop() != targetPaddingTop) {
    mContentViewWrapper.post(new Runnable(){
      @Override public void run(){
        mContentViewWrapper.setPadding(0,targetPaddingTop,0,0);
      }
    }
);
  }
}
Program: 111078
Project: 111078
Buggy source:
private void loadUrlImmediate(){
  Preconditions.checkNotNull(mPicassoHandler,"String_Node_Str");
  final String url=mPicassoHandler.getUrl(mImageHelper,this);
  if (url != null) {
    Picasso.with(getContext()).load(url).into(mPicassoTarget);
    if (Constants.DEBUG) {
      Log.d("String_Node_Str","String_Node_Str" + url);
    }
  }
}

Fixed version (ground truth):
private void loadUrlImmediate(){
  Preconditions.checkNotNull(mPicassoHandler,"String_Node_Str");
  final String url=mPicassoHandler.getUrl(mImageHelper,this);
  if (url != null) {
    mPicassoHandler.markAsStarted();
    Picasso.with(getContext()).load(url).into(mPicassoTarget);
    if (Constants.DEBUG) {
      Log.d("String_Node_Str","String_Node_Str" + url);
    }
  }
}
Program: 111079
Project: 111079
Buggy source:
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  super.onLayout(changed,left,top,right,bottom);
  if (changed && canLoadImage() && mPicassoHandler != null) {
    loadUrlImmediate();
  }
}

Fixed version (ground truth):
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  super.onLayout(changed,left,top,right,bottom);
  if (changed && canLoadImage() && mPicassoHandler != null && !mPicassoHandler.isStarted()) {
    loadUrlImmediate();
  }
}
Program: 111080
Project: 111080
Buggy source:
void markAsFinished(){
  mIsFinished=true;
}

Fixed version (ground truth):
void markAsFinished(){
  mIsStarted=false;
}
Program: 111081
Project: 111081
Buggy source:
private String getTitle(){
switch (getMovieQueryType()) {
case POPULAR:
    return getString(R.string.popular_title);
case LIBRARY:
  return getString(R.string.library_title);
case TRENDING:
return getString(R.string.trending_title);
case WATCHLIST:
return getString(R.string.watchlist_title);
}
return null;
}

Fixed version (ground truth):
private String getTitle(){
  MovieController.MovieQueryType queryType=getMovieQueryType();
  if (queryType != null) {
    return getString(StringManager.getStringResId(queryType));
  }
  return null;
}
Program: 111082
Project: 111082
Buggy source:
public void setFromMovie(Movie movie){
  Preconditions.checkNotNull(movie,"String_Node_Str");
  _id=Long.parseLong(movie.tmdbId);
  traktId=getTraktId(movie);
  title=movie.title;
  sortTitle=getSortTitle(title);
  if (!TextUtils.isEmpty(movie.overview)) {
    overview=movie.overview;
  }
  year=unbox(year,movie.year);
  inCollection=unbox(inCollection,movie.inCollection);
  inWatchlist=unbox(inWatchlist,movie.inWatchlist);
  watched=unbox(inWatchlist,movie.watched);
  plays=unbox(plays,movie.plays);
  releasedTime=unbox(releasedTime,movie.released);
  Ratings ratings=movie.ratings;
  if (ratings != null) {
    ratingPercent=unbox(ratingPercent,ratings.percentage);
    ratingVotes=unbox(ratingVotes,ratings.votes);
  }
  userRating=unbox(userRating,movie.rating);
  userRatingAdvanced=unbox(userRatingAdvanced,movie.rating_advanced);
  Images images=movie.images;
  if (images != null) {
    fanartUrl=images.fanart;
    posterUrl=images.poster;
  }
  lastFetched=System.currentTimeMillis();
}

Fixed version (ground truth):
public void setFromMovie(Movie movie){
  Preconditions.checkNotNull(movie,"String_Node_Str");
  tmdbId=movie.tmdbId;
  imdbId=movie.imdb_id;
  traktId=getTraktId(movie);
  if (!TextUtils.isEmpty(imdbId)) {
    _id=new Long(imdbId.hashCode());
    idType=ID_TYPE_IMDB;
  }
 else   if (!TextUtils.isEmpty(tmdbId)) {
    _id=new Long(tmdbId.hashCode());
    idType=ID_TYPE_TMDB;
  }
 else {
    idType=NOT_SET;
  }
  title=movie.title;
  sortTitle=getSortTitle(title);
  if (!TextUtils.isEmpty(movie.overview)) {
    overview=movie.overview;
  }
  year=unbox(year,movie.year);
  inCollection=unbox(inCollection,movie.inCollection);
  inWatchlist=unbox(inWatchlist,movie.inWatchlist);
  watched=unbox(inWatchlist,movie.watched);
  plays=unbox(plays,movie.plays);
  releasedTime=unbox(releasedTime,movie.released);
  Ratings ratings=movie.ratings;
  if (ratings != null) {
    ratingPercent=unbox(ratingPercent,ratings.percentage);
    ratingVotes=unbox(ratingVotes,ratings.votes);
  }
  userRating=unbox(userRating,movie.rating);
  userRatingAdvanced=unbox(userRatingAdvanced,movie.rating_advanced);
  Images images=movie.images;
  if (images != null) {
    fanartUrl=images.fanart;
    posterUrl=images.poster;
  }
  lastFetched=System.currentTimeMillis();
}
Program: 111083
Project: 111083
Buggy source:
@Override public final void onUpgrade(SQLiteDatabase db,int oldVersion,int newVersion){
  cupboard().withDatabase(db).upgradeTables();
}

Fixed version (ground truth):
@Override public final void onUpgrade(SQLiteDatabase db,int oldVersion,int newVersion){
  cupboard().withDatabase(db).upgradeTables();
  if (oldVersion <= 9) {
    deleteAllPhilmMovies();
  }
}
Program: 111085
Project: 111085
Buggy source:
@Override protected void onItemDrop(RecyclerView recyclerView,int position){
  Logs.d("String_Node_Str");
  ultimateRecyclerView.enableSwipeRefresh(true);
}

Fixed version (ground truth):
@Override protected void onItemDrop(RecyclerView recyclerView,int position){
  Logs.d("String_Node_Str");
  ultimateRecyclerView.enableDefaultSwipeRefresh(true);
}
Program: 111086
Project: 111086
Buggy source:
@Override public void onItemLongClick(RecyclerView parent,View clickedView,int position){
  Logs.d("String_Node_Str" + isDrag);
  if (isDrag) {
    Logs.d("String_Node_Str" + isDrag);
    toolbar.startActionMode(UltimateRecyclerViewActivity.this);
    toggleSelection(position);
    dragDropTouchListener.startDrag();
    ultimateRecyclerView.enableSwipeRefresh(false);
  }
}

Fixed version (ground truth):
@Override public void onItemLongClick(RecyclerView parent,View clickedView,int position){
  Logs.d("String_Node_Str" + isDrag);
  if (isDrag) {
    Logs.d("String_Node_Str" + isDrag);
    toolbar.startActionMode(UltimateRecyclerViewActivity.this);
    toggleSelection(position);
    dragDropTouchListener.startDrag();
    ultimateRecyclerView.enableDefaultSwipeRefresh(false);
  }
}
Program: 111087
Project: 111087
Buggy source:
/** 
 * get file name from path, not include suffix <p/> <pre> getFileNameWithoutExtension(null)               =   null getFileNameWithoutExtension("")                 =   "" getFileNameWithoutExtension("   ")              =   "   " getFileNameWithoutExtension("abc")              =   "abc" getFileNameWithoutExtension("a.mp3")            =   "a" getFileNameWithoutExtension("a.b.rmvb")         =   "a.b" getFileNameWithoutExtension("c:\\")              =   "" getFileNameWithoutExtension("c:\\a")             =   "a" getFileNameWithoutExtension("c:\\a.b")           =   "a" getFileNameWithoutExtension("c:a.txt\\a")        =   "a" getFileNameWithoutExtension("/home/admin")      =   "admin" getFileNameWithoutExtension("/home/admin/a.txt/b.mp3")  =   "b" </pre>
 * @param filePath
 * @return file name from path, not include suffix
 * @see
 */
public static String getFileNameWithoutExtension(String filePath){
  if (BasicUtils.judgeNotNull(filePath)) {
    return filePath;
  }
  int extenPosi=filePath.lastIndexOf(FILE_EXTENSION_SEPARATOR);
  int filePosi=filePath.lastIndexOf(File.separator);
  if (filePosi == -1) {
    return (extenPosi == -1 ? filePath : filePath.substring(0,extenPosi));
  }
  if (extenPosi == -1) {
    return filePath.substring(filePosi + 1);
  }
  return (filePosi < extenPosi ? filePath.substring(filePosi + 1,extenPosi) : filePath.substring(filePosi + 1));
}

Fixed version (ground truth):
/** 
 * get file name from path, not include suffix <p/> <pre> getFileNameWithoutExtension(null)               =   null getFileNameWithoutExtension("")                 =   "" getFileNameWithoutExtension("   ")              =   "   " getFileNameWithoutExtension("abc")              =   "abc" getFileNameWithoutExtension("a.mp3")            =   "a" getFileNameWithoutExtension("a.b.rmvb")         =   "a.b" getFileNameWithoutExtension("c:\\")              =   "" getFileNameWithoutExtension("c:\\a")             =   "a" getFileNameWithoutExtension("c:\\a.b")           =   "a" getFileNameWithoutExtension("c:a.txt\\a")        =   "a" getFileNameWithoutExtension("/home/admin")      =   "admin" getFileNameWithoutExtension("/home/admin/a.txt/b.mp3")  =   "b" </pre>
 * @param filePath
 * @return file name from path, not include suffix
 * @see
 */
public static String getFileNameWithoutExtension(String filePath){
  if (isFileExist(filePath)) {
    return filePath;
  }
  int extenPosi=filePath.lastIndexOf(FILE_EXTENSION_SEPARATOR);
  int filePosi=filePath.lastIndexOf(File.separator);
  if (filePosi == -1) {
    return (extenPosi == -1 ? filePath : filePath.substring(0,extenPosi));
  }
  if (extenPosi == -1) {
    return filePath.substring(filePosi + 1);
  }
  return (filePosi < extenPosi ? filePath.substring(filePosi + 1,extenPosi) : filePath.substring(filePosi + 1));
}
Program: 111088
Project: 111088
Buggy source:
/** 
 * @deprecated
 * @param fileName
 * @param content
 * @throws IOException
 */
public static void writeFileFromStringBuffers(String fileName,String content) throws IOException {
  String s=new String();
  String s1=new String();
  try {
    File f=new File(fileName);
    if (f.exists()) {
      Logs.d("String_Node_Str");
    }
 else {
      Logs.d("String_Node_Str");
      if (f.createNewFile()) {
        Logs.d("String_Node_Str");
      }
 else {
        Logs.d("String_Node_Str");
      }
    }
    BufferedReader input=new BufferedReader(new FileReader(f));
    while ((s=input.readLine()) != null) {
      s1+=s + "String_Node_Str";
    }
    System.out.println("String_Node_Str" + s1);
    input.close();
    s1+=content;
    BufferedWriter output=new BufferedWriter(new FileWriter(f));
    output.write(s1);
    output.close();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
/** 
 * @param fileName
 * @param content
 * @throws IOException
 * @deprecated
 */
public static void writeFileFromStringBuffers(String fileName,String content) throws IOException {
  String s=new String();
  String s1=new String();
  try {
    File f=new File(fileName);
    if (f.exists()) {
      Logs.d("String_Node_Str");
    }
 else {
      Logs.d("String_Node_Str");
      if (f.createNewFile()) {
        Logs.d("String_Node_Str");
      }
 else {
        Logs.d("String_Node_Str");
      }
    }
    BufferedReader input=new BufferedReader(new FileReader(f));
    while ((s=input.readLine()) != null) {
      s1+=s + "String_Node_Str";
    }
    System.out.println("String_Node_Str" + s1);
    input.close();
    s1+=content;
    BufferedWriter output=new BufferedWriter(new FileWriter(f));
    output.write(s1);
    output.close();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 111089
Project: 111089
Buggy source:
/** 
 * get file name from path, include suffix <p/> <pre> getFileName(null)               =   null getFileName("")                 =   "" getFileName("   ")              =   "   " getFileName("a.mp3")            =   "a.mp3" getFileName("a.b.rmvb")         =   "a.b.rmvb" getFileName("abc")              =   "abc" getFileName("c:\\")              =   "" getFileName("c:\\a")             =   "a" getFileName("c:\\a.b")           =   "a.b" getFileName("c:a.txt\\a")        =   "a" getFileName("/home/admin")      =   "admin" getFileName("/home/admin/a.txt/b.mp3")  =   "b.mp3" </pre>
 * @param filePath
 * @return file name from path, include suffix
 */
public static String getFileName(String filePath){
  if (BasicUtils.judgeNotNull(filePath)) {
    return filePath;
  }
  int filePosi=filePath.lastIndexOf(File.separator);
  return (filePosi == -1) ? filePath : filePath.substring(filePosi + 1);
}

Fixed version (ground truth):
/** 
 * get file name from path, include suffix <p/> <pre> getFileName(null)               =   null getFileName("")                 =   "" getFileName("   ")              =   "   " getFileName("a.mp3")            =   "a.mp3" getFileName("a.b.rmvb")         =   "a.b.rmvb" getFileName("abc")              =   "abc" getFileName("c:\\")              =   "" getFileName("c:\\a")             =   "a" getFileName("c:\\a.b")           =   "a.b" getFileName("c:a.txt\\a")        =   "a" getFileName("/home/admin")      =   "admin" getFileName("/home/admin/a.txt/b.mp3")  =   "b.mp3" </pre>
 * @param filePath
 * @return file name from path, include suffix
 */
public static String getFileName(String filePath){
  if (isFileExist(filePath)) {
    return filePath;
  }
  int filePosi=filePath.lastIndexOf(File.separator);
  return (filePosi == -1) ? filePath : filePath.substring(filePosi + 1);
}
Program: 111090
Project: 111090
Buggy source:
/** 
 * @deprecated Copy all the files in folder
 * @param oldPath String
 * @param newPath String
 * @return boolean
 */
public void copyFolder(String oldPath,String newPath) throws IOException {
  try {
    (new File(newPath)).mkdirs();
    File a=new File(oldPath);
    String[] file=a.list();
    File temp=null;
    for (int i=0; i < file.length; i++) {
      if (oldPath.endsWith(File.separator)) {
        temp=new File(oldPath + file[i]);
      }
 else {
        temp=new File(oldPath + File.separator + file[i]);
      }
      if (temp.isFile()) {
        FileInputStream input=new FileInputStream(temp);
        FileOutputStream output=new FileOutputStream(newPath + "String_Node_Str" + (temp.getName()).toString());
        byte[] b=new byte[1024 * 5];
        int len;
        while ((len=input.read(b)) != -1) {
          output.write(b,0,len);
        }
        output.flush();
        output.close();
        input.close();
      }
      if (temp.isDirectory()) {
        copyFolder(oldPath + "String_Node_Str" + file[i],newPath + "String_Node_Str" + file[i]);
      }
    }
  }
 catch (  Exception e) {
    System.out.println("String_Node_Str");
    e.printStackTrace();
  }
}

Fixed version (ground truth):
/** 
 * @param oldPath String
 * @param newPath String
 * @return boolean
 * @deprecated Copy all the files in folder
 */
public void copyFolder(String oldPath,String newPath) throws IOException {
  try {
    (new File(newPath)).mkdirs();
    File a=new File(oldPath);
    String[] file=a.list();
    File temp=null;
    for (int i=0; i < file.length; i++) {
      if (oldPath.endsWith(File.separator)) {
        temp=new File(oldPath + file[i]);
      }
 else {
        temp=new File(oldPath + File.separator + file[i]);
      }
      if (temp.isFile()) {
        FileInputStream input=new FileInputStream(temp);
        FileOutputStream output=new FileOutputStream(newPath + "String_Node_Str" + (temp.getName()).toString());
        byte[] b=new byte[1024 * 5];
        int len;
        while ((len=input.read(b)) != -1) {
          output.write(b,0,len);
        }
        output.flush();
        output.close();
        input.close();
      }
      if (temp.isDirectory()) {
        copyFolder(oldPath + "String_Node_Str" + file[i],newPath + "String_Node_Str" + file[i]);
      }
    }
  }
 catch (  Exception e) {
    System.out.println("String_Node_Str");
    e.printStackTrace();
  }
}