nus-yam/ex-repair huggingface dataset:
Program: 38091
Project: 38091
Buggy source:
/** 
 * Returns payload of a JWT as a JSON object.
 * @param jwt REQUIRED: valid JSON Web Token as String.
 * @return payload as a JSONObject.
 */
static JSONObject getPayload(String jwt){
  try {
    validateJWT(jwt);
    final String payload=jwt.split("String_Node_Str")[PAYLOAD];
    final byte[] sectionDecoded=Base64.decode(payload);
    final String jwtSection=new String(sectionDecoded,"String_Node_Str");
    return new JSONObject(jwtSection);
  }
 catch (  final UnsupportedEncodingException e) {
    throw new InvalidParameterException(e.getMessage());
  }
catch (  final Exception e) {
    throw new InvalidParameterException("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Returns payload of a JWT as a JSON object.
 * @param jwt REQUIRED: valid JSON Web Token as String.
 * @return payload as a JSONObject.
 */
static JSONObject getPayload(String jwt){
  try {
    validateJWT(jwt);
    Base64.Decoder dec=Base64.getDecoder();
    final String payload=jwt.split("String_Node_Str")[PAYLOAD];
    final byte[] sectionDecoded=dec.decode(payload);
    final String jwtSection=new String(sectionDecoded,"String_Node_Str");
    return new JSONObject(jwtSection);
  }
 catch (  final UnsupportedEncodingException e) {
    throw new InvalidParameterException(e.getMessage());
  }
catch (  final Exception e) {
    System.out.println(e);
    throw new InvalidParameterException("String_Node_Str");
  }
}
Program: 38092
Project: 38092
Buggy source:
/** 
 * Returns signature of a JWT as a String.
 * @param jwt REQUIRED: valid JSON Web Token as String.
 * @return signature as a String.
 */
public static String getSignature(String jwt){
  try {
    validateJWT(jwt);
    final byte[] sectionDecoded=Base64.decode(jwt.split("String_Node_Str")[SIGNATURE]);
    return new String(sectionDecoded,"String_Node_Str");
  }
 catch (  final Exception e) {
    throw new InvalidParameterException("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Returns signature of a JWT as a String.
 * @param jwt REQUIRED: valid JSON Web Token as String.
 * @return signature as a String.
 */
public static String getSignature(String jwt){
  try {
    validateJWT(jwt);
    Base64.Decoder dec=Base64.getDecoder();
    final byte[] sectionDecoded=dec.decode(jwt.split("String_Node_Str")[SIGNATURE]);
    return new String(sectionDecoded,"String_Node_Str");
  }
 catch (  final Exception e) {
    throw new InvalidParameterException("String_Node_Str");
  }
}
Program: 38093
Project: 38093
Buggy source:
/** 
 * Returns header for a JWT as a JSON object.
 * @param jwt REQUIRED: valid JSON Web Token as String.
 * @return header as a JSONObject.
 */
static JSONObject getHeader(String jwt){
  try {
    validateJWT(jwt);
    final byte[] sectionDecoded=Base64.decode(jwt.split("String_Node_Str")[HEADER]);
    final String jwtSection=new String(sectionDecoded,"String_Node_Str");
    return new JSONObject(jwtSection);
  }
 catch (  final UnsupportedEncodingException e) {
    throw new InvalidParameterException(e.getMessage());
  }
catch (  final Exception e) {
    throw new InvalidParameterException("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Returns header for a JWT as a JSON object.
 * @param jwt REQUIRED: valid JSON Web Token as String.
 * @return header as a JSONObject.
 */
static JSONObject getHeader(String jwt){
  try {
    validateJWT(jwt);
    Base64.Decoder dec=Base64.getDecoder();
    final byte[] sectionDecoded=dec.decode(jwt.split("String_Node_Str")[HEADER]);
    final String jwtSection=new String(sectionDecoded,"String_Node_Str");
    return new JSONObject(jwtSection);
  }
 catch (  final UnsupportedEncodingException e) {
    throw new InvalidParameterException(e.getMessage());
  }
catch (  final Exception e) {
    throw new InvalidParameterException("String_Node_Str");
  }
}
Program: 38094
Project: 38094
Buggy source:
/** 
 * Returns payload of a JWT as a JSON object.
 * @param jwt REQUIRED: valid JSON Web Token as String.
 * @return payload as a JSONObject.
 */
static JSONObject getPayload(String jwt){
  try {
    validateJWT(jwt);
    Base64.Decoder dec=Base64.getDecoder();
    final String payload=jwt.split("String_Node_Str")[PAYLOAD];
    final byte[] sectionDecoded=dec.decode(payload);
    final String jwtSection=new String(sectionDecoded,"String_Node_Str");
    return new JSONObject(jwtSection);
  }
 catch (  final UnsupportedEncodingException e) {
    throw new InvalidParameterException(e.getMessage());
  }
catch (  final Exception e) {
    System.out.println(e);
    throw new InvalidParameterException("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Returns payload of a JWT as a JSON object.
 * @param jwt REQUIRED: valid JSON Web Token as String.
 * @return payload as a JSONObject.
 */
static JSONObject getPayload(String jwt){
  try {
    validateJWT(jwt);
    Base64.Decoder dec=Base64.getDecoder();
    final String payload=jwt.split("String_Node_Str")[PAYLOAD];
    final byte[] sectionDecoded=dec.decode(payload);
    final String jwtSection=new String(sectionDecoded,"String_Node_Str");
    return new JSONObject(jwtSection);
  }
 catch (  final UnsupportedEncodingException e) {
    throw new InvalidParameterException(e.getMessage());
  }
catch (  final Exception e) {
    throw new InvalidParameterException("String_Node_Str");
  }
}
Program: 38095
Project: 38095
Buggy source:
public void disconnect(){
  bleHandler.sendEmptyMessage(MSG_DISCONNECT);
}

Fixed version (ground truth):
public void disconnect(){
  bleHandler.obtainMessage(MSG_DISCONNECT,bluetoothDevice).sendToTarget();
}
Program: 38096
Project: 38096
Buggy source:
@Override public Indent getIndent(){
  if (formattingInfo.getCsvCodeStyleSettings().TABULARIZE && formattingInfo.getCsvCodeStyleSettings().LEADING_WHITE_SPACES && getNode().getElementType() == CsvTypes.RECORD) {
    CsvColumnInfo columnInfo=formattingInfo.getColumnInfo(0);
    Block fieldBlock=getSubBlocks().get(0);
    return Indent.getSpaceIndent(columnInfo.getMaxLength() - fieldBlock.getTextRange().getLength());
  }
  return null;
}

Fixed version (ground truth):
@Override public Indent getIndent(){
  if (formattingInfo.getCsvCodeStyleSettings().TABULARIZE && formattingInfo.getCsvCodeStyleSettings().LEADING_WHITE_SPACES && getNode().getElementType() == CsvTypes.RECORD && (formattingInfo.getCsvCodeStyleSettings().WHITE_SPACES_OUTSIDE_QUOTES || !CsvFormatHelper.isFirstFieldOfRecordQuoted(this))) {
    CsvColumnInfo columnInfo=formattingInfo.getColumnInfo(0);
    Block fieldBlock=getSubBlocks().get(0);
    return Indent.getSpaceIndent(columnInfo.getMaxLength() - fieldBlock.getTextRange().getLength());
  }
  return null;
}
Program: 38097
Project: 38097
Buggy source:
private Spacing getSpacingForRecords(@Nullable CsvBlock child1,@Nullable CsvBlock child2){
  Spacing spacing;
  Block fieldBlock=null;
  CsvColumnInfo columnInfo=null;
  if (child2 != null && child2.getNode().getElementType() == CsvTypes.RECORD) {
    columnInfo=formattingInfo.getColumnInfo(0);
    fieldBlock=child2.getSubBlocks().get(0);
  }
  int spaces=0;
  if (columnInfo != null) {
    spaces+=columnInfo.getMaxLength() - fieldBlock.getTextRange().getLength();
  }
  spacing=Spacing.createSpacing(spaces,spaces,0,true,formattingInfo.getCodeStyleSettings().KEEP_BLANK_LINES_IN_CODE);
  return spacing;
}

Fixed version (ground truth):
private Spacing getSpacingForRecords(@Nullable CsvBlock child1,@Nullable CsvBlock child2){
  Spacing spacing;
  Block fieldBlock=null;
  CsvColumnInfo columnInfo=null;
  List<Block> subBlocks=child2.getSubBlocks();
  if (child2 != null && child2.getNode().getElementType() == CsvTypes.RECORD) {
    columnInfo=formattingInfo.getColumnInfo(0);
    fieldBlock=subBlocks.get(0);
  }
  int spaces=0;
  if (columnInfo != null && subBlocks.size() > 1) {
    spaces+=columnInfo.getMaxLength() - fieldBlock.getTextRange().getLength();
  }
  spacing=Spacing.createSpacing(spaces,spaces,0,true,formattingInfo.getCodeStyleSettings().KEEP_BLANK_LINES_IN_CODE);
  return spacing;
}
Program: 38099
Project: 38099
Buggy source:
private void showDialogAfterDelay(FragmentManager fm,String tag){
  startedShowing=true;
  super.show(fm,tag);
}

Fixed version (ground truth):
private void showDialogAfterDelay(FragmentManager fm,String tag){
  startedShowing=true;
  FragmentTransaction ft=fm.beginTransaction();
  ft.add(this,tag);
  ft.commitAllowingStateLoss();
}
Program: 38100
Project: 38100
Buggy source:
private void init(Context context,AttributeSet attrs){
  this.mContext=context;
  mAttributeSet=attrs;
  getAttrs();
  setWillNotDraw(false);
  mBottomAnimation.setDuration(300);
  mBottomAnimation.setAnimationListener(new Animation.AnimationListener(){
    @Override public void onAnimationStart(    Animation animation){
      TextView textView=(TextView)getChildAt(selectLastIndex + itemCount);
      textView.setTextColor(textColor);
      TextView selectTextView=(TextView)getChildAt(selectIndex + itemCount);
      selectTextView.setTextColor(selectTextColor);
    }
    @Override public void onAnimationEnd(    Animation animation){
      clearAnimation();
      itemMoveLastLeft=itemMoveLeft;
      itemMoveLastRight=itemMoveRight;
      selectLastIndex=selectIndex;
      Log.d("String_Node_Str","String_Node_Str" + itemMoveLastRight);
    }
    @Override public void onAnimationRepeat(    Animation animation){
    }
  }
);
}

Fixed version (ground truth):
private void init(Context context,AttributeSet attrs){
  this.mContext=context;
  mAttributeSet=attrs;
  getAttrs();
  setWillNotDraw(false);
  mBottomAnimation.setDuration(300);
  mBottomAnimation.setAnimationListener(new Animation.AnimationListener(){
    @Override public void onAnimationStart(    Animation animation){
    }
    @Override public void onAnimationEnd(    Animation animation){
      clearAnimation();
      itemMoveLastLeft=itemMoveLeft;
      itemMoveLastRight=itemMoveRight;
      selectLastIndex=selectIndex;
      Log.d("String_Node_Str","String_Node_Str" + itemMoveLastRight);
    }
    @Override public void onAnimationRepeat(    Animation animation){
    }
  }
);
}
Program: 38101
Project: 38101
Buggy source:
@Override protected void onLayout(boolean changed,int l,int t,int r,int b){
  Log.d("String_Node_Str","String_Node_Str" + count++);
  for (int i=0; i < itemCount; i++) {
    itemCenterX[i]=(int)(itemWidth * (i + 0.5));
    View childImageView=getChildAt(i);
    childImageView.layout(itemWidth * i,0,itemWidth * (i + 1),100);
    View childTextView=getChildAt(itemCount + i);
    childTextView.layout(itemWidth * i + childTextView.getWidth() / 4,100,itemWidth * (i + 1),barHeight);
  }
}

Fixed version (ground truth):
@Override protected void onLayout(boolean changed,int l,int t,int r,int b){
  for (int i=0; i < itemCount; i++) {
    itemCenterX[i]=(int)(itemWidth * (i + 0.5));
    View childImageView=getChildAt(i);
    childImageView.layout(itemWidth * i,0,itemWidth * (i + 1),100);
    View childTextView=getChildAt(itemCount + i);
    childTextView.layout(itemWidth * i + childTextView.getWidth() / 4,100,itemWidth * (i + 1),barHeight);
  }
}
Program: 38102
Project: 38102
Buggy source:
@Override protected void onMeasure(int widthMeasureSpec,int heightMeasureSpec){
  Log.d("String_Node_Str","String_Node_Str" + count++);
  super.onMeasure(widthMeasureSpec,heightMeasureSpec);
  childCount=getChildCount();
  barWidth=getSize(300,widthMeasureSpec);
  barHeight=getSize(300,heightMeasureSpec);
  itemWidth=barWidth / itemCount;
  for (int i=0; i < childCount; i++) {
    View childView=getChildAt(i);
    measureChild(childView,widthMeasureSpec,heightMeasureSpec);
    childView.getLayoutParams().width=itemWidth;
  }
  Log.d("String_Node_Str","String_Node_Str" + barWidth);
  setSelectIndex(0);
}

Fixed version (ground truth):
@Override protected void onMeasure(int widthMeasureSpec,int heightMeasureSpec){
  super.onMeasure(widthMeasureSpec,heightMeasureSpec);
  childCount=getChildCount();
  barWidth=getSize(300,widthMeasureSpec);
  barHeight=getSize(300,heightMeasureSpec);
  itemWidth=barWidth / itemCount;
  for (int i=0; i < childCount; i++) {
    View childView=getChildAt(i);
    measureChild(childView,widthMeasureSpec,heightMeasureSpec);
    childView.getLayoutParams().width=itemWidth;
  }
  setSelectIndex(0);
}
Program: 38103
Project: 38103
Buggy source:
@Override public boolean dispatchTouchEvent(MotionEvent ev){
  int action=ev.getAction();
switch (action) {
case MotionEvent.ACTION_DOWN:
    touchDownX=ev.getX();
  break;
case MotionEvent.ACTION_UP:
if (ev.getX() / itemWidth == touchDownX / itemWidth) {
  selectIndex=(int)(ev.getX() / itemWidth);
  sendListenerPostion(selectIndex);
  startAnimation(mBottomAnimation);
}
break;
}
return true;
}

Fixed version (ground truth):
@Override public boolean dispatchTouchEvent(MotionEvent ev){
  int action=ev.getAction();
switch (action) {
case MotionEvent.ACTION_DOWN:
    touchDownX=ev.getX();
  break;
case MotionEvent.ACTION_UP:
if (ev.getX() / itemWidth == touchDownX / itemWidth) {
  selectIndex=(int)(ev.getX() / itemWidth);
  changeTitleColor();
  sendListenerPosition(selectIndex);
  startAnimation(mBottomAnimation);
}
break;
}
return true;
}
Program: 38104
Project: 38104
Buggy source:
private int getSize(int defaultsize,int measureSpec){
  int mySize=defaultsize;
  int mode=MeasureSpec.getMode(measureSpec);
  int size=MeasureSpec.getSize(measureSpec);
switch (mode) {
case MeasureSpec.UNSPECIFIED:
    mySize=defaultsize;
  break;
case MeasureSpec.AT_MOST:
mySize=size;
break;
case MeasureSpec.EXACTLY:
mySize=size;
break;
}
return mySize;
}

Fixed version (ground truth):
private int getSize(int defaultSize,int measureSpec){
  int mySize=defaultSize;
  int mode=MeasureSpec.getMode(measureSpec);
  int size=MeasureSpec.getSize(measureSpec);
switch (mode) {
case MeasureSpec.UNSPECIFIED:
    mySize=defaultSize;
  break;
case MeasureSpec.AT_MOST:
mySize=size;
break;
case MeasureSpec.EXACTLY:
mySize=size;
break;
}
return mySize;
}
Program: 38105
Project: 38105
Buggy source:
public void build() throws Exception {
  itemCount=mBottomItemArrayList.size();
  if (itemCount > CHILDCOUNTMAX) {
    throw new Exception("String_Node_Str");
  }
  Log.d("String_Node_Str","String_Node_Str" + getWidth());
  Log.d("String_Node_Str","String_Node_Str" + count++);
  itemWidth=getLayoutParams().width / itemCount;
  for (  BottomItem bottomItem : mBottomItemArrayList) {
    ImageView imageView=new ImageView(mContext);
    imageView.setImageResource(bottomItem.drawableRes);
    addView(imageView,itemWidth,20);
  }
  for (  BottomItem bottomItem : mBottomItemArrayList) {
    TextView textView=new TextView(mContext);
    textView.setTextSize(textSize);
    textView.setText(bottomItem.title);
    textView.setTextColor(textColor);
    textView.setGravity(Gravity.CENTER);
    addView(textView,itemWidth,20);
  }
  Log.d("String_Node_Str","String_Node_Str" + itemWidth);
}

Fixed version (ground truth):
public void build() throws Exception {
  itemCount=mBottomItemArrayList.size();
  if (itemCount > CHILDCOUNTMAX) {
    throw new Exception("String_Node_Str");
  }
  itemWidth=getLayoutParams().width / itemCount;
  for (  BottomItem bottomItem : mBottomItemArrayList) {
    ImageView imageView=new ImageView(mContext);
    imageView.setImageResource(bottomItem.drawableRes);
    mImageViews.add(imageView);
    addView(imageView,itemWidth,20);
  }
  for (  BottomItem bottomItem : mBottomItemArrayList) {
    TextView textView=new TextView(mContext);
    textView.setTextSize(textSize);
    textView.setText(bottomItem.title);
    textView.setTextColor(textColor);
    textView.setGravity(Gravity.CENTER);
    mTextViews.add(textView);
    addView(textView,itemWidth,20);
  }
  Log.d("String_Node_Str","String_Node_Str" + itemWidth);
}
Program: 38106
Project: 38106
Buggy source:
@Override protected void onDraw(Canvas canvas){
  for (int i=0; i < 5; i++) {
    mPaint.setColor(itemcolors[i]);
    canvas.drawRect(itemWidth * i,0,itemWidth * (i + 1),barHeight,mPaint);
    canvas.save();
  }
  mPaint.setColor(backGroundColor);
  canvas.drawRect(0,0,itemMoveLeft,barHeight,mPaint);
  canvas.drawRect(itemMoveRight,0,itemWidth * 5,barHeight,mPaint);
  canvas.save();
  for (int i=0; i < itemCount; i++) {
    int deltaX=Math.abs(itemMoveCenter - itemCenterX[i]);
    if (deltaX < itemWidth) {
      itemScale[i]=(float)(-0.5 * deltaX / itemWidth + 1);
    }
 else     itemScale[i]=0.5f;
    View childImageView=getChildAt(i);
    childImageView.setScaleX(itemScale[i]);
    childImageView.setScaleY(itemScale[i]);
    View childTextView=getChildAt(itemCount + i);
    childTextView.setScaleX(itemScale[i]);
    childTextView.setScaleY(itemScale[i]);
  }
  Log.d("String_Node_Str","String_Node_Str" + selectIndex + "String_Node_Str"+ itemScale[selectIndex]);
  super.onDraw(canvas);
}

Fixed version (ground truth):
@Override protected void onDraw(Canvas canvas){
  for (int i=0; i < 5; i++) {
    mPaint.setColor(itemcolors[i]);
    canvas.drawRect(itemWidth * i,0,itemWidth * (i + 1),barHeight,mPaint);
    canvas.save();
  }
  mPaint.setColor(backGroundColor);
  canvas.drawRect(0,0,itemMoveLeft,barHeight,mPaint);
  canvas.drawRect(itemMoveRight,0,itemWidth * 5,barHeight,mPaint);
  canvas.save();
  for (int i=0; i < itemCount; i++) {
    int deltaX=Math.abs(itemMoveCenter - itemCenterX[i]);
    if (deltaX < itemWidth) {
      itemScale[i]=(float)(-0.5 * deltaX / itemWidth + 1);
    }
 else     itemScale[i]=0.5f;
    mImageViews.get(i).setScaleX(itemScale[i]);
    mImageViews.get(i).setScaleY(itemScale[i]);
    mTextViews.get(i).setScaleX(itemScale[i]);
    mTextViews.get(i).setScaleY(itemScale[i]);
  }
  super.onDraw(canvas);
}
Program: 38107
Project: 38107
Buggy source:
@Override public void onAnimationStart(Animation animation){
  TextView textView=(TextView)getChildAt(selectLastIndex + itemCount);
  textView.setTextColor(textColor);
  TextView selectTextView=(TextView)getChildAt(selectIndex + itemCount);
  selectTextView.setTextColor(selectTextColor);
}

Fixed version (ground truth):
@Override public void onAnimationStart(Animation animation){
}
Program: 38108
Project: 38108
Buggy source:
@Override public void configure(HttpSecurity http) throws Exception {
  http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and().requestMatchers().antMatchers("String_Node_Str").and().authorizeRequests().antMatchers("String_Node_Str").permitAll().antMatchers("String_Node_Str").authenticated();
}

Fixed version (ground truth):
@Override public void configure(HttpSecurity http) throws Exception {
  http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and().requestMatchers().antMatchers("String_Node_Str").and().authorizeRequests().antMatchers("String_Node_Str").permitAll().antMatchers("String_Node_Str").permitAll().antMatchers("String_Node_Str").authenticated();
}
Program: 38109
Project: 38109
Buggy source:
@Override protected void configure(HttpSecurity http) throws Exception {
  http.httpBasic().and().csrf().ignoringAntMatchers("String_Node_Str","String_Node_Str","String_Node_Str").and().authorizeRequests().antMatchers("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str").permitAll().antMatchers("String_Node_Str").hasRole("String_Node_Str").antMatchers("String_Node_Str").hasRole("String_Node_Str").anyRequest().authenticated().and().formLogin().loginPage("String_Node_Str").successHandler(new SuccessHandler()).and().logout();
}

Fixed version (ground truth):
@Override protected void configure(HttpSecurity http) throws Exception {
  http.httpBasic().and().csrf().ignoringAntMatchers("String_Node_Str","String_Node_Str","String_Node_Str").and().authorizeRequests().antMatchers("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str").permitAll().antMatchers("String_Node_Str").hasRole("String_Node_Str").antMatchers("String_Node_Str").hasRole("String_Node_Str").antMatchers("String_Node_Str").permitAll().anyRequest().authenticated().and().formLogin().loginPage("String_Node_Str").successHandler(new SuccessHandler()).and().logout();
}
Program: 38110
Project: 38110
Buggy source:
@ApiOperation(value="String_Node_Str",httpMethod="String_Node_Str") @GetMapping("String_Node_Str") public UserResponse me(Principal principal){
  if (Objects.isNull(principal) || StringUtils.isBlank(principal.getName())) {
    throw new UnauthorizedException("String_Node_Str");
  }
  return userService.getResponse(principal.getName());
}

Fixed version (ground truth):
@ApiOperation(value="String_Node_Str",httpMethod="String_Node_Str") @PostMapping("String_Node_Str") public UserResponse me(Principal principal){
  if (Objects.isNull(principal) || StringUtils.isBlank(principal.getName())) {
    throw new UnauthorizedException("String_Node_Str");
  }
  return userService.getResponse(principal.getName());
}
Program: 38111
Project: 38111
Buggy source:
@Override public void configure(HttpSecurity http) throws Exception {
  http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and().requestMatchers().antMatchers("String_Node_Str").and().authorizeRequests().antMatchers("String_Node_Str").authenticated();
}

Fixed version (ground truth):
@Override public void configure(HttpSecurity http) throws Exception {
  http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and().requestMatchers().antMatchers("String_Node_Str","String_Node_Str").and().authorizeRequests().antMatchers("String_Node_Str","String_Node_Str").authenticated();
}
Program: 38112
Project: 38112
Buggy source:
@Override public void onFaceDetection(Face[] faces,CameraManager.CameraProxy camera){
  mFaceView.setFaces(faces);
}

Fixed version (ground truth):
@Override public void onFaceDetection(Face[] faces,CameraManager.CameraProxy camera){
  if (mIsBokehMode) {
    mFaceView.clear();
    return;
  }
  mFaceView.setFaces(faces);
}
Program: 38113
Project: 38113
Buggy source:
@Override public void showSuccess(boolean timeout){
  if (mState == STATE_FOCUSING) {
    startAnimation(SCALING_DOWN_TIME,timeout,mStartAnimationAngle);
    mState=STATE_FINISHING;
    mFocused=true;
  }
}

Fixed version (ground truth):
@Override public void showSuccess(boolean timeout){
  if (mIsBokehMode) {
    mOverlay.postDelayed(new Runnable(){
      @Override public void run(){
        if (mState == STATE_FOCUSING) {
          startAnimation(SCALING_DOWN_TIME,timeout,mStartAnimationAngle);
          mState=STATE_FINISHING;
          mFocused=true;
        }
      }
    }
,3000);
  }
 else {
    if (mState == STATE_FOCUSING) {
      startAnimation(SCALING_DOWN_TIME,timeout,mStartAnimationAngle);
      mState=STATE_FINISHING;
      mFocused=true;
    }
  }
}
Program: 38114
Project: 38114
Buggy source:
@Override public void onFaceDetection(Face[] faces,CameraManager.CameraProxy camera){
  mFaceView.setFaces(faces);
}

Fixed version (ground truth):
@Override public void onFaceDetection(Face[] faces,CameraManager.CameraProxy camera){
  if (mIsBokehMode) {
    mFaceView.clear();
    return;
  }
  mFaceView.setFaces(faces);
}
Program: 38115
Project: 38115
Buggy source:
@Override public void showSuccess(boolean timeout){
  if (mState == STATE_FOCUSING) {
    startAnimation(SCALING_DOWN_TIME,timeout,mStartAnimationAngle);
    mState=STATE_FINISHING;
    mFocused=true;
  }
}

Fixed version (ground truth):
@Override public void showSuccess(boolean timeout){
  if (mIsBokehMode) {
    mOverlay.postDelayed(new Runnable(){
      @Override public void run(){
        if (mState == STATE_FOCUSING) {
          startAnimation(SCALING_DOWN_TIME,timeout,mStartAnimationAngle);
          mState=STATE_FINISHING;
          mFocused=true;
        }
      }
    }
,3000);
  }
 else {
    if (mState == STATE_FOCUSING) {
      startAnimation(SCALING_DOWN_TIME,timeout,mStartAnimationAngle);
      mState=STATE_FINISHING;
      mFocused=true;
    }
  }
}
Program: 38118
Project: 38118
Buggy source:
@Override public void onConfigured(CameraCaptureSession cameraCaptureSession){
  Log.d(TAG,"String_Node_Str");
  mCurrentSession=cameraCaptureSession;
  mCaptureSession[cameraId]=cameraCaptureSession;
  try {
    setUpVideoCaptureRequestBuilder(mVideoRequestBuilder,cameraId);
    mCurrentSession.setRepeatingRequest(mVideoRequestBuilder.build(),mCaptureCallback,mCameraHandler);
  }
 catch (  CameraAccessException e) {
    e.printStackTrace();
  }
catch (  IllegalStateException e) {
    e.printStackTrace();
  }
  try {
    mMediaRecorder.start();
  }
 catch (  RuntimeException e) {
    Toast.makeText(mActivity,"String_Node_Str" + "String_Node_Str",Toast.LENGTH_LONG).show();
    releaseMediaRecorder();
    releaseAudioFocus();
    mStartRecPending=false;
    mIsRecordingVideo=false;
    return;
  }
  mUI.clearFocus();
  mUI.resetPauseButton();
  mRecordingTotalTime=0L;
  mRecordingStartTime=SystemClock.uptimeMillis();
  mUI.showRecordingUI(true,false);
  updateRecordingTime();
  keepScreenOn();
}

Fixed version (ground truth):
@Override public void onConfigured(CameraCaptureSession cameraCaptureSession){
  Log.d(TAG,"String_Node_Str");
  mCurrentSession=cameraCaptureSession;
  mCaptureSession[cameraId]=cameraCaptureSession;
  try {
    setUpVideoCaptureRequestBuilder(mVideoRequestBuilder,cameraId);
    mCurrentSession.setRepeatingRequest(mVideoRequestBuilder.build(),mCaptureCallback,mCameraHandler);
  }
 catch (  CameraAccessException e) {
    e.printStackTrace();
  }
catch (  IllegalStateException e) {
    e.printStackTrace();
  }
  mUI.clearFocus();
  mUI.resetPauseButton();
  mRecordingTotalTime=0L;
  mRecordingStartTime=SystemClock.uptimeMillis();
  mUI.showRecordingUI(true,false);
  updateRecordingTime();
  keepScreenOn();
}
Program: 38121
Project: 38121
Buggy source:
public void showCapturedReview(byte[] jpegData,int orientation,boolean mirror){
  mActivity.runOnUiThread(new Runnable(){
    @Override public void run(){
      mUI.showCapturedImageForReview(jpegData,orientation,mirror);
    }
  }
);
}

Fixed version (ground truth):
public void showCapturedReview(final byte[] jpegData,int orientation,boolean mirror){
  mActivity.runOnUiThread(new Runnable(){
    @Override public void run(){
      mUI.showCapturedImageForReview(jpegData,orientation,mirror);
    }
  }
);
}
Program: 38122
Project: 38122
Buggy source:
protected void showCapturedImageForReview(byte[] jpegData,int orientation,boolean mirror){
  mCameraControls.hideCameraSettings();
  mDecodeTaskForReview=new DecodeImageForReview(jpegData,orientation,mirror);
  mDecodeTaskForReview.execute();
  mOnScreenIndicators.setVisibility(View.GONE);
  mMenuButton.setVisibility(View.GONE);
  CameraUtil.fadeIn(mReviewDoneButton);
  mShutterButton.setVisibility(View.INVISIBLE);
  CameraUtil.fadeIn(mReviewRetakeButton);
  mMenu.hideTopMenu(true);
  pauseFaceDetection();
}

Fixed version (ground truth):
protected void showCapturedImageForReview(byte[] jpegData,int orientation,boolean mirror){
  mCameraControls.hideCameraSettings();
  mDecodeTaskForReview=new DecodeImageForReview(jpegData,orientation,mirror);
  mDecodeTaskForReview.execute();
  mOnScreenIndicators.setVisibility(View.GONE);
  mMenuButton.setVisibility(View.GONE);
  CameraUtil.fadeIn(mReviewDoneButton);
  mShutterButton.setVisibility(View.INVISIBLE);
  CameraUtil.fadeIn(mReviewRetakeButton);
  setOrientation(mOrientation,true);
  mMenu.hideTopMenu(true);
  pauseFaceDetection();
}
Program: 38123
Project: 38123
Buggy source:
protected void showCapturedImageForReview(byte[] jpegData,int orientation,boolean mirror){
  mCameraControls.hideCameraSettings();
  mDecodeTaskForReview=new DecodeImageForReview(jpegData,orientation,mirror);
  mDecodeTaskForReview.execute();
  mOnScreenIndicators.setVisibility(View.GONE);
  mMenuButton.setVisibility(View.GONE);
  CameraUtil.fadeIn(mReviewDoneButton);
  mShutterButton.setVisibility(View.INVISIBLE);
  CameraUtil.fadeIn(mReviewRetakeButton);
  mMenu.hideTopMenu(true);
  pauseFaceDetection();
}

Fixed version (ground truth):
protected void showCapturedImageForReview(byte[] jpegData,int orientation,boolean mirror){
  mCameraControls.hideCameraSettings();
  mDecodeTaskForReview=new DecodeImageForReview(jpegData,orientation,mirror);
  mDecodeTaskForReview.execute();
  mOnScreenIndicators.setVisibility(View.GONE);
  mMenuButton.setVisibility(View.GONE);
  CameraUtil.fadeIn(mReviewDoneButton);
  mShutterButton.setVisibility(View.INVISIBLE);
  CameraUtil.fadeIn(mReviewRetakeButton);
  setOrientation(mOrientation,true);
  mMenu.hideTopMenu(true);
  pauseFaceDetection();
}
Program: 38124
Project: 38124
Buggy source:
public void showCapturedReview(byte[] jpegData,int orientation,boolean mirror){
  mActivity.runOnUiThread(new Runnable(){
    @Override public void run(){
      mUI.showCapturedImageForReview(jpegData,orientation,mirror);
    }
  }
);
}

Fixed version (ground truth):
public void showCapturedReview(final byte[] jpegData,int orientation,boolean mirror){
  mActivity.runOnUiThread(new Runnable(){
    @Override public void run(){
      mUI.showCapturedImageForReview(jpegData,orientation,mirror);
    }
  }
);
}
Program: 38125
Project: 38125
Buggy source:
public void setProMode(boolean promode){
  mProModeOn=promode;
  initializeProMode(mProModeOn);
  resetProModeIcons();
}

Fixed version (ground truth):
public void setProMode(boolean promode){
  mProModeOn=promode;
  initializeProMode(mProModeOn);
  resetProModeIcons();
  mProMode.reinit();
}
Program: 38126
Project: 38126
Buggy source:
public void setProMode(boolean promode){
  mProModeOn=promode;
  initializeProMode(mProModeOn);
  resetProModeIcons();
}

Fixed version (ground truth):
public void setProMode(boolean promode){
  mProModeOn=promode;
  initializeProMode(mProModeOn);
  resetProModeIcons();
  mProMode.reinit();
}
Program: 38129
Project: 38129
Buggy source:
private void initializePreferences(){
  ListPreference pref=(ListPreference)findPreference(SettingsManager.KEY_EXPOSURE);
  pref.setEntries(mSettingsManager.getExposureCompensationEntries());
  pref.setEntryValues(mSettingsManager.getExposureCompensationEntryValues());
  Map<String,SettingsManager.Values> map=mSettingsManager.getValuesMap();
  Set<Map.Entry<String,SettingsManager.Values>> set=map.entrySet();
  for (  Map.Entry<String,SettingsManager.Values> entry : set) {
    String key=entry.getKey();
    Preference p=findPreference(key);
    if (p == null)     continue;
    SettingsManager.Values values=entry.getValue();
    boolean disabled=values.overriddenValue != null;
    String value=disabled ? values.overriddenValue : values.value;
    if (p instanceof SwitchPreference) {
      ((SwitchPreference)p).setChecked(isOn(value));
    }
 else     if (p instanceof ListPreference) {
      ((ListPreference)p).setValue(value);
    }
    if (disabled)     p.setEnabled(false);
  }
  try {
    String versionName=getPackageManager().getPackageInfo(getPackageName(),0).versionName;
    int index=versionName.indexOf(' ');
    versionName=versionName.substring(0,index);
    findPreference("String_Node_Str").setSummary(versionName);
  }
 catch (  PackageManager.NameNotFoundException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
private void initializePreferences(){
  updatePreference(SettingsManager.KEY_PICTURE_SIZE);
  updatePreference(SettingsManager.KEY_VIDEO_QUALITY);
  updatePreference(SettingsManager.KEY_EXPOSURE);
  updatePreference(SettingsManager.KEY_VIDEO_HIGH_FRAME_RATE);
  Map<String,SettingsManager.Values> map=mSettingsManager.getValuesMap();
  Set<Map.Entry<String,SettingsManager.Values>> set=map.entrySet();
  for (  Map.Entry<String,SettingsManager.Values> entry : set) {
    String key=entry.getKey();
    Preference p=findPreference(key);
    if (p == null)     continue;
    SettingsManager.Values values=entry.getValue();
    boolean disabled=values.overriddenValue != null;
    String value=disabled ? values.overriddenValue : values.value;
    if (p instanceof SwitchPreference) {
      ((SwitchPreference)p).setChecked(isOn(value));
    }
 else     if (p instanceof ListPreference) {
      ((ListPreference)p).setValue(value);
    }
    if (disabled)     p.setEnabled(false);
  }
  try {
    String versionName=getPackageManager().getPackageInfo(getPackageName(),0).versionName;
    int index=versionName.indexOf(' ');
    versionName=versionName.substring(0,index);
    findPreference("String_Node_Str").setSummary(versionName);
  }
 catch (  PackageManager.NameNotFoundException e) {
    e.printStackTrace();
  }
}
Program: 38130
Project: 38130
Buggy source:
private void filterPreferences(){
  String[] categories={"String_Node_Str","String_Node_Str","String_Node_Str"};
  Set<String> set=mSettingsManager.getFilteredKeys();
  if (!mDeveloperMenuEnabled) {
    set.add(SettingsManager.KEY_MONO_PREVIEW);
    set.add(SettingsManager.KEY_MONO_ONLY);
    set.add(SettingsManager.KEY_CLEARSIGHT);
  }
  for (  String key : set) {
    Preference p=findPreference(key);
    if (p == null)     continue;
    for (int i=0; i < categories.length; i++) {
      PreferenceGroup group=(PreferenceGroup)findPreference(categories[i]);
      if (group.removePreference(p))       break;
    }
  }
  ListPreference pictureSize=(ListPreference)findPreference(SettingsManager.KEY_PICTURE_SIZE);
  if (pictureSize != null) {
    pictureSize.setEntryValues(mSettingsManager.getEntryValues(SettingsManager.KEY_PICTURE_SIZE));
    pictureSize.setEntries(mSettingsManager.getEntries(SettingsManager.KEY_PICTURE_SIZE));
  }
}

Fixed version (ground truth):
private void filterPreferences(){
  String[] categories={"String_Node_Str","String_Node_Str","String_Node_Str"};
  Set<String> set=mSettingsManager.getFilteredKeys();
  if (!mDeveloperMenuEnabled) {
    set.add(SettingsManager.KEY_MONO_PREVIEW);
    set.add(SettingsManager.KEY_MONO_ONLY);
    set.add(SettingsManager.KEY_CLEARSIGHT);
  }
  for (  String key : set) {
    Preference p=findPreference(key);
    if (p == null)     continue;
    for (int i=0; i < categories.length; i++) {
      PreferenceGroup group=(PreferenceGroup)findPreference(categories[i]);
      if (group.removePreference(p))       break;
    }
  }
}
Program: 38131
Project: 38131
Buggy source:
@Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,String key){
  Preference p=findPreference(key);
  if (p == null)   return;
  String value;
  if (p instanceof SwitchPreference) {
    boolean checked=((SwitchPreference)p).isChecked();
    value=checked ? "String_Node_Str" : "String_Node_Str";
    mSettingsManager.setValue(key,value);
  }
 else   if (p instanceof ListPreference) {
    value=((ListPreference)p).getValue();
    mSettingsManager.setValue(key,value);
  }
}

Fixed version (ground truth):
@Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,String key){
  Preference p=findPreference(key);
  if (p == null)   return;
  String value;
  if (p instanceof SwitchPreference) {
    boolean checked=((SwitchPreference)p).isChecked();
    value=checked ? "String_Node_Str" : "String_Node_Str";
    mSettingsManager.setValue(key,value);
  }
 else   if (p instanceof ListPreference) {
    value=((ListPreference)p).getValue();
    mSettingsManager.setValue(key,value);
  }
  if (key.equals(SettingsManager.KEY_VIDEO_QUALITY)) {
    updatePreference(SettingsManager.KEY_VIDEO_HIGH_FRAME_RATE);
  }
}
Program: 38132
Project: 38132
Buggy source:
@Override public void onSettingChanged(ListPreference pref){
  String key=pref.getKey();
  if (pref.getKey().equals(KEY_VIDEO_QUALITY))   buildHFR();
  List changed=checkDependencyAndUpdate(key);
  if (changed == null)   return;
  notifyListeners(changed);
}

Fixed version (ground truth):
@Override public void onSettingChanged(ListPreference pref){
  String key=pref.getKey();
  List changed=checkDependencyAndUpdate(key);
  if (changed == null)   return;
  if (pref.getKey().equals(KEY_VIDEO_QUALITY))   buildHFR();
  notifyListeners(changed);
}
Program: 38134
Project: 38134
Buggy source:
private void updateMapAndNotify(ListPreference pref){
  String key=pref.getKey();
  List changed=checkDependencyAndUpdate(key);
  if (changed == null)   return;
  notifyListeners(changed);
}

Fixed version (ground truth):
private void updateMapAndNotify(ListPreference pref){
  String key=pref.getKey();
  List changed=checkDependencyAndUpdate(key);
  if (changed == null)   return;
  if (pref.getKey().equals(KEY_VIDEO_QUALITY))   buildHFR();
  notifyListeners(changed);
}
Program: 38136
Project: 38136
Buggy source:
@Override public void onZoomChanged(float requestedZoom){
  mZoomValue=requestedZoom;
  if (isBackCamera()) {
switch (getCameraMode()) {
case DUAL_MODE:
      applyZoomAndUpdate(BAYER_ID);
    applyZoomAndUpdate(MONO_ID);
  break;
case BAYER_MODE:
applyZoomAndUpdate(BAYER_ID);
break;
case MONO_MODE:
applyZoomAndUpdate(MONO_ID);
break;
}
}
 else {
applyZoomAndUpdate(FRONT_ID);
}
}

Fixed version (ground truth):
@Override public void onZoomChanged(float requestedZoom){
  mZoomValue=requestedZoom;
  if (isBackCamera()) {
switch (getCameraMode()) {
case DUAL_MODE:
      applyZoomAndUpdate(BAYER_ID);
    applyZoomAndUpdate(MONO_ID);
  break;
case BAYER_MODE:
applyZoomAndUpdate(BAYER_ID);
break;
case MONO_MODE:
applyZoomAndUpdate(MONO_ID);
break;
}
}
 else {
applyZoomAndUpdate(FRONT_ID);
}
mUI.updateFaceViewCameraBound(mCropRegion[getMainCameraId()]);
}
Program: 38138
Project: 38138
Buggy source:
private void checkSelfieFlashAndTakePicture(){
  String value=mSettingsManager.getValue(SettingsManager.KEY_SELFIE_FLASH);
  if (value == null) {
    takePicture();
    return;
  }
  if (value.equals("String_Node_Str") && getMainCameraId() == FRONT_ID) {
    mUI.startSelfieFlash();
    if (selfieThread == null) {
      selfieThread=new SelfieThread();
      selfieThread.start();
    }
  }
 else {
    takePicture();
  }
}

Fixed version (ground truth):
private void checkSelfieFlashAndTakePicture(){
  if (isSelfieFlash()) {
    mUI.startSelfieFlash();
    if (selfieThread == null) {
      selfieThread=new SelfieThread();
      selfieThread.start();
    }
  }
 else {
    takePicture();
  }
}
Program: 38139
Project: 38139
Buggy source:
public boolean takeZSLPicture(CameraDevice cameraDevice,CameraCaptureSession captureSession,ImageReader imageReader){
  if (mCameraDevice == null || mCaptureSession == null || mImageReader == null) {
    mCameraDevice=cameraDevice;
    mCaptureSession=captureSession;
    mImageReader=imageReader;
  }
  ZSLQueue.ImageItem imageItem=mZSLQueue.tryToGetMatchingItem();
  if (mController.getPreviewCaptureResult().get(CaptureResult.CONTROL_AE_STATE) == CameraMetadata.CONTROL_AE_STATE_FLASH_REQUIRED) {
    if (DEBUG_ZSL)     Log.d(TAG,"String_Node_Str");
    imageItem=null;
  }
  if (imageItem != null) {
    if (DEBUG_ZSL)     Log.d(TAG,"String_Node_Str");
    reprocessImage(imageItem);
    return true;
  }
 else {
    if (DEBUG_ZSL)     Log.d(TAG,"String_Node_Str");
    mZSLQueue.addPictureRequest();
    return false;
  }
}

Fixed version (ground truth):
public boolean takeZSLPicture(CameraDevice cameraDevice,CameraCaptureSession captureSession,ImageReader imageReader){
  if (mCameraDevice == null || mCaptureSession == null || mImageReader == null) {
    mCameraDevice=cameraDevice;
    mCaptureSession=captureSession;
    mImageReader=imageReader;
  }
  ZSLQueue.ImageItem imageItem=mZSLQueue.tryToGetMatchingItem();
  if (mController.getPreviewCaptureResult().get(CaptureResult.CONTROL_AE_STATE) == CameraMetadata.CONTROL_AE_STATE_FLASH_REQUIRED) {
    if (DEBUG_ZSL)     Log.d(TAG,"String_Node_Str");
    imageItem=null;
  }
  if (mController.isSelfieFlash()) {
    imageItem=null;
  }
  if (imageItem != null) {
    if (DEBUG_ZSL)     Log.d(TAG,"String_Node_Str");
    reprocessImage(imageItem);
    return true;
  }
 else {
    if (DEBUG_ZSL)     Log.d(TAG,"String_Node_Str");
    mZSLQueue.addPictureRequest();
    return false;
  }
}
Program: 38140
Project: 38140
Buggy source:
private void processFinalPair(){
  Log.d(TAG,"String_Node_Str");
  releaseBayerFrames();
  releaseMonoFrames();
  mImageProcessHandler.removeMessages(MSG_NEW_CAPTURE_RESULT);
  mImageProcessHandler.removeMessages(MSG_NEW_CAPTURE_FAIL);
  mCaptureDone=true;
}

Fixed version (ground truth):
private void processFinalPair(){
  Log.d(TAG,"String_Node_Str");
  releaseBayerFrames();
  releaseMonoFrames();
  mImageProcessHandler.removeMessages(MSG_NEW_CAPTURE_RESULT);
  mImageProcessHandler.removeMessages(MSG_NEW_CAPTURE_FAIL);
  mCaptureDone=true;
  if (mReprocessingPairCount == 0) {
    Log.w(TAG,"String_Node_Str");
    if (mCallback != null)     mCallback.onClearSightFailure(null);
  }
}
Program: 38142
Project: 38142
Buggy source:
private Rect getFinalCropRect(Rect rect){
  Rect finalRect=new Rect(rect);
  float rectRatio=(float)rect.width() / (float)rect.height();
  if (rectRatio > mFinalPictureRatio) {
    int newWidth=(int)(((float)rect.height() * mFinalPictureRatio) + .5f);
    int newXoffset=(rect.width() - newWidth) / 2;
    finalRect.left=newXoffset;
    finalRect.right=newXoffset + newWidth;
  }
 else   if (rectRatio < mFinalPictureRatio) {
    int newHeight=(int)(((float)rect.width() / mFinalPictureRatio) + .5f);
    int newYoffset=(rect.height() - newHeight) / 2;
    finalRect.top=newYoffset;
    finalRect.bottom=newYoffset + newHeight;
  }
  return finalRect;
}

Fixed version (ground truth):
private Rect getFinalCropRect(Rect rect){
  Rect finalRect=new Rect(rect);
  float rectRatio=(float)rect.width() / (float)rect.height();
  Log.d(TAG,"String_Node_Str" + rect.toString());
  Log.d(TAG,"String_Node_Str" + rectRatio + "String_Node_Str"+ mFinalPictureRatio);
  if (rectRatio > mFinalPictureRatio) {
    int newWidth=(int)(((float)rect.height() * mFinalPictureRatio) + .5f);
    int newXoffset=(rect.width() - newWidth) / 2 + rect.left;
    finalRect.left=newXoffset;
    finalRect.right=newXoffset + newWidth;
  }
 else   if (rectRatio < mFinalPictureRatio) {
    int newHeight=(int)(((float)rect.width() / mFinalPictureRatio) + .5f);
    int newYoffset=(rect.height() - newHeight) / 2 + rect.top;
    finalRect.top=newYoffset;
    finalRect.bottom=newYoffset + newHeight;
  }
  Log.d(TAG,"String_Node_Str" + finalRect.toString());
  return finalRect;
}
Program: 38143
Project: 38143
Buggy source:
/** 
 * Unlock the focus. This method should be called when still image capture sequence is finished.
 */
private void unlockFocus(int id){
  Log.d(TAG,"String_Node_Str" + id);
  try {
    CaptureRequest.Builder builder=mCameraDevice[id].createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);
    builder.setTag(id);
    addPreviewSurface(builder,null,id);
    applySettingsForUnlockFocus(builder,id);
    mCaptureSession[id].capture(builder.build(),mCaptureCallback,mCameraHandler);
    mState[id]=STATE_PREVIEW;
    mControlAFMode=CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE;
    applySettingsForUnlockExposure(mPreviewRequestBuilder[id],id);
    setAFModeToPreview(id,mControlAFMode);
    mTakingPicture[id]=false;
    mActivity.runOnUiThread(new Runnable(){
      @Override public void run(){
        mUI.stopSelfieFlash();
        mUI.enableShutter(true);
      }
    }
);
  }
 catch (  CameraAccessException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
/** 
 * Unlock the focus. This method should be called when still image capture sequence is finished.
 */
private void unlockFocus(int id){
  Log.d(TAG,"String_Node_Str" + id);
  try {
    CaptureRequest.Builder builder=mCameraDevice[id].createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);
    builder.setTag(id);
    addPreviewSurface(builder,null,id);
    applySettingsForUnlockFocus(builder,id);
    mCaptureSession[id].capture(builder.build(),mCaptureCallback,mCameraHandler);
    mState[id]=STATE_PREVIEW;
    if (id == getMainCameraId()) {
      mActivity.runOnUiThread(new Runnable(){
        @Override public void run(){
          mUI.clearFocus();
        }
      }
);
    }
    mControlAFMode=CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE;
    applySettingsForUnlockExposure(mPreviewRequestBuilder[id],id);
    setAFModeToPreview(id,mControlAFMode);
    mTakingPicture[id]=false;
    mActivity.runOnUiThread(new Runnable(){
      @Override public void run(){
        mUI.stopSelfieFlash();
        mUI.enableShutter(true);
      }
    }
);
  }
 catch (  CameraAccessException e) {
    e.printStackTrace();
  }
}
Program: 38144
Project: 38144
Buggy source:
private void handlePermissionsSuccess(){
  if (mIntent != null) {
    mIsReturnResult=true;
    mIntent.setClass(this,CameraActivity.class);
    startActivityForResult(mIntent,1);
  }
 else {
    mIsReturnResult=false;
    Intent intent=new Intent(this,CameraActivity.class);
    startActivity(intent);
    finish();
  }
}

Fixed version (ground truth):
private void handlePermissionsSuccess(){
  if (mIntent != null) {
    mIsReturnResult=true;
    mIntent.setClass(this,CameraActivity.class);
    mIntent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
    startActivity(mIntent);
    finish();
  }
 else {
    mIsReturnResult=false;
    Intent intent=new Intent(this,CameraActivity.class);
    startActivity(intent);
    finish();
  }
}
Program: 38145
Project: 38145
Buggy source:
private void doReturnToCaller(boolean valid){
  Intent resultIntent=new Intent();
  int resultCode;
  if (valid) {
    resultCode=Activity.RESULT_OK;
    resultIntent.setData(mCurrentVideoUri);
  }
 else {
    resultCode=Activity.RESULT_CANCELED;
  }
  mActivity.setResultEx(resultCode,resultIntent);
  mActivity.finish();
}

Fixed version (ground truth):
private void doReturnToCaller(boolean valid){
  Intent resultIntent=new Intent();
  int resultCode;
  if (valid) {
    resultCode=Activity.RESULT_OK;
    resultIntent.setData(mCurrentVideoUri);
    resultIntent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
  }
 else {
    resultCode=Activity.RESULT_CANCELED;
  }
  mActivity.setResultEx(resultCode,resultIntent);
  mActivity.finish();
}
Program: 38146
Project: 38146
Buggy source:
/** 
 * Unlock the focus. This method should be called when still image capture sequence is finished.
 */
private void unlockFocus(int id){
  Log.d(TAG,"String_Node_Str" + id);
  try {
    CaptureRequest.Builder builder=mCameraDevice[id].createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);
    builder.setTag(id);
    addPreviewSurface(builder,null,id);
    applySettingsForUnlockFocus(builder,id);
    mCaptureSession[id].capture(builder.build(),mCaptureCallback,mCameraHandler);
    mState[id]=STATE_PREVIEW;
    mControlAFMode=CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE;
    applySettingsForUnlockExposure(mPreviewRequestBuilder[id],id);
    setAFModeToPreview(id,mControlAFMode);
    mTakingPicture[id]=false;
    mActivity.runOnUiThread(new Runnable(){
      @Override public void run(){
        mUI.stopSelfieFlash();
        mUI.enableShutter(true);
      }
    }
);
  }
 catch (  CameraAccessException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
/** 
 * Unlock the focus. This method should be called when still image capture sequence is finished.
 */
private void unlockFocus(int id){
  Log.d(TAG,"String_Node_Str" + id);
  try {
    CaptureRequest.Builder builder=mCameraDevice[id].createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);
    builder.setTag(id);
    addPreviewSurface(builder,null,id);
    applySettingsForUnlockFocus(builder,id);
    mCaptureSession[id].capture(builder.build(),mCaptureCallback,mCameraHandler);
    mState[id]=STATE_PREVIEW;
    if (id == getMainCameraId()) {
      mActivity.runOnUiThread(new Runnable(){
        @Override public void run(){
          mUI.clearFocus();
        }
      }
);
    }
    mControlAFMode=CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE;
    applySettingsForUnlockExposure(mPreviewRequestBuilder[id],id);
    setAFModeToPreview(id,mControlAFMode);
    mTakingPicture[id]=false;
    mActivity.runOnUiThread(new Runnable(){
      @Override public void run(){
        mUI.stopSelfieFlash();
        mUI.enableShutter(true);
      }
    }
);
  }
 catch (  CameraAccessException e) {
    e.printStackTrace();
  }
}