Program: 53343
Project: 53343
Buggy source:
public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  this.setContentView(R.layout.activity_camera);
  iv_flash=(ImageView)findViewById(R.id.iv_flash);
  iv_flash.setOnClickListener(new RLOnClickListener(){
    @Override public void onClickX(    View view){
      isFlashEnabled=!isFlashEnabled;
      Parameters parameters=camera.getParameters();
      parameters.setFlashMode(isFlashEnabled ? Parameters.FLASH_MODE_TORCH : Parameters.FLASH_MODE_OFF);
      camera.setParameters(parameters);
      iv_flash.setImageDrawable(getResources().getDrawable(isFlashEnabled ? R.drawable.btn_camera_flash_off : R.drawable.btn_camera_flash_on));
    }
  }
);
  iv_yes=(ImageView)findViewById(R.id.iv_yes);
  iv_yes.setOnClickListener(new RLOnClickListener(){
    @Override public void onClickX(    View arg0){
      try {
        Bitmap bMap=BitmapFactory.decodeByteArray(data,0,data.length);
        Bitmap bMapRotate;
        float degrees=0f;
switch (rotation) {
case Surface.ROTATION_0:
          degrees=90f;
        break;
case Surface.ROTATION_90:
      degrees=0f;
    break;
case Surface.ROTATION_180:
  degrees=270f;
break;
case Surface.ROTATION_270:
degrees=180f;
break;
}
Matrix matrix=new Matrix();
matrix.reset();
matrix.postRotate(degrees);
bMapRotate=Bitmap.createBitmap(bMap,0,0,bMap.getWidth(),bMap.getHeight(),matrix,true);
bMap=bMapRotate;
String savePath=getIntent().getStringExtra("String_Node_Str");
BufferedOutputStream bos=new BufferedOutputStream(new FileOutputStream(savePath));
bMap.compress(Bitmap.CompressFormat.JPEG,100,bos);
bos.flush();
bos.close();
setResult(RESULT_OK,getIntent());
finish();
overridePendingTransition(R.anim.reload,R.anim.reload);
}
 catch (Exception e) {
e.printStackTrace();
}
iv_yes.setVisibility(View.GONE);
iv_no.setVisibility(View.GONE);
}
}
);
iv_no=(ImageView)findViewById(R.id.iv_no);
iv_no.setOnClickListener(new RLOnClickListener(){
@Override public void onClickX(View arg0){
camera.startPreview();
iv_yes.setVisibility(View.GONE);
iv_no.setVisibility(View.GONE);
}
}
);
SurfaceView surfaceView=(SurfaceView)this.findViewById(R.id.sv_camera);
surfaceView.setFocusable(true);
surfaceView.setFocusableInTouchMode(true);
findViewById(R.id.iv_camera).setOnClickListener(new View.OnClickListener(){
@Override public void onClick(View v){
if (!isReady) {
camera.autoFocus(RLCameraActivity.this);
isReady=true;
}
 else {
camera.startPreview();
isReady=false;
}
}
}
);
SurfaceHolder holder=surfaceView.getHolder();
holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
holder.addCallback(this);
}

Fixed version (ground truth):
public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_camera);
  rotation=getWindowManager().getDefaultDisplay().getRotation();
  iv_flash=(ImageView)findViewById(R.id.iv_flash);
  iv_flash.setOnClickListener(new RLOnClickListener(){
    @Override public void onClickX(    View view){
      isFlashEnabled=!isFlashEnabled;
      Parameters parameters=camera.getParameters();
      parameters.setFlashMode(isFlashEnabled ? Parameters.FLASH_MODE_TORCH : Parameters.FLASH_MODE_OFF);
      camera.setParameters(parameters);
      iv_flash.setImageDrawable(getResources().getDrawable(isFlashEnabled ? R.drawable.btn_camera_flash_off : R.drawable.btn_camera_flash_on));
    }
  }
);
  iv_yes=(ImageView)findViewById(R.id.iv_yes);
  iv_yes.setOnClickListener(new RLOnClickListener(){
    @Override public void onClickX(    View arg0){
      try {
        Bitmap bMap=BitmapFactory.decodeByteArray(data,0,data.length);
        Bitmap bMapRotate;
        float degrees=0f;
switch (rotation) {
case Surface.ROTATION_0:
          degrees=90f;
        break;
case Surface.ROTATION_90:
      degrees=0f;
    break;
case Surface.ROTATION_180:
  degrees=270f;
break;
case Surface.ROTATION_270:
degrees=180f;
break;
}
Matrix matrix=new Matrix();
matrix.reset();
matrix.postRotate(degrees);
bMapRotate=Bitmap.createBitmap(bMap,0,0,bMap.getWidth(),bMap.getHeight(),matrix,true);
bMap=bMapRotate;
String savePath=getIntent().getStringExtra("String_Node_Str");
BufferedOutputStream bos=new BufferedOutputStream(new FileOutputStream(savePath));
bMap.compress(Bitmap.CompressFormat.JPEG,100,bos);
bos.flush();
bos.close();
setResult(RESULT_OK,getIntent());
finish();
overridePendingTransition(R.anim.reload,R.anim.reload);
}
 catch (Exception e) {
e.printStackTrace();
}
iv_yes.setVisibility(View.GONE);
iv_no.setVisibility(View.GONE);
}
}
);
iv_no=(ImageView)findViewById(R.id.iv_no);
iv_no.setOnClickListener(new RLOnClickListener(){
@Override public void onClickX(View arg0){
camera.startPreview();
iv_yes.setVisibility(View.GONE);
iv_no.setVisibility(View.GONE);
}
}
);
SurfaceView surfaceView=(SurfaceView)this.findViewById(R.id.sv_camera);
surfaceView.setFocusable(true);
surfaceView.setFocusableInTouchMode(true);
findViewById(R.id.iv_camera).setOnClickListener(new View.OnClickListener(){
@Override public void onClick(View v){
if (!isReady) {
camera.autoFocus(RLCameraActivity.this);
isReady=true;
}
 else {
camera.startPreview();
isReady=false;
}
}
}
);
SurfaceHolder holder=surfaceView.getHolder();
holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
holder.addCallback(this);
}