Program: 198732
Project: 198732
Buggy source:
@Override public boolean handleMessage(Message msg){
  if (mCleanup) {
    return true;
  }
  if (DEBUG) {
    Log.d(TAG,"String_Node_Str" + msg.what);
  }
  long startTime=0;
  if (DEBUG) {
    startTime=SystemClock.elapsedRealtimeNanos();
  }
switch (msg.what) {
case MSG_CONFIGURE_OUTPUTS:
    ConfigureHolder config=(ConfigureHolder)msg.obj;
  int sizes=config.surfaces != null ? config.surfaces.size() : 0;
Log.i(TAG,"String_Node_Str" + sizes + "String_Node_Str");
try {
boolean success=mCaptureCollector.waitForEmpty(JPEG_FRAME_TIMEOUT,TimeUnit.MILLISECONDS);
if (!success) {
  Log.e(TAG,"String_Node_Str");
}
}
 catch (InterruptedException e) {
Log.e(TAG,"String_Node_Str");
}
try {
configureOutputs(config.surfaces);
}
 catch (IOException e) {
throw new IOError(e);
}
config.condition.open();
if (DEBUG) {
long totalTime=SystemClock.elapsedRealtimeNanos() - startTime;
Log.d(TAG,"String_Node_Str" + totalTime + "String_Node_Str");
}
break;
case MSG_SUBMIT_CAPTURE_REQUEST:
Handler handler=RequestThreadManager.this.mRequestThread.getHandler();
Pair<BurstHolder,Long> nextBurst=mRequestQueue.getNext();
if (nextBurst == null) {
try {
boolean success=mCaptureCollector.waitForEmpty(JPEG_FRAME_TIMEOUT,TimeUnit.MILLISECONDS);
if (!success) {
Log.e(TAG,"String_Node_Str");
}
}
 catch (InterruptedException e) {
Log.e(TAG,"String_Node_Str");
}
mDeviceState.setIdle();
stopPreview();
break;
}
 else {
handler.sendEmptyMessage(MSG_SUBMIT_CAPTURE_REQUEST);
}
List<RequestHolder> requests=nextBurst.first.produceRequestHolders(nextBurst.second);
for (RequestHolder holder : requests) {
CaptureRequest request=holder.getRequest();
boolean paramsChanged=false;
if (mLastRequest == null || mLastRequest.captureRequest != request) {
Size previewSize=ParameterUtils.convertSize(mParams.getPreviewSize());
LegacyRequest legacyRequest=new LegacyRequest(mCharacteristics,request,previewSize,mParams);
mLastRequest=legacyRequest;
LegacyMetadataMapper.convertRequestMetadata(legacyRequest);
if (!mParams.same(legacyRequest.parameters)) {
mParams=legacyRequest.parameters;
mCamera.setParameters(mParams);
paramsChanged=true;
}
}
mFocusStateMapper.processRequestTriggers(request,mParams);
try {
boolean success=mCaptureCollector.queueRequest(holder,mLastRequest,JPEG_FRAME_TIMEOUT,TimeUnit.MILLISECONDS);
if (!success) {
Log.e(TAG,"String_Node_Str");
}
if (holder.hasPreviewTargets()) {
doPreviewCapture(holder);
}
if (holder.hasJpegTargets()) {
success=mCaptureCollector.waitForPreviewsEmpty(PREVIEW_FRAME_TIMEOUT * MAX_IN_FLIGHT_REQUESTS,TimeUnit.MILLISECONDS);
if (!success) {
Log.e(TAG,"String_Node_Str");
}
mReceivedJpeg.close();
doJpegCapture(holder);
if (!mReceivedJpeg.block(JPEG_FRAME_TIMEOUT)) {
Log.e(TAG,"String_Node_Str");
}
}
}
 catch (IOException e) {
throw new IOError(e);
}
catch (InterruptedException e) {
Log.e(TAG,"String_Node_Str",e);
}
if (paramsChanged) {
if (DEBUG) {
Log.d(TAG,"String_Node_Str");
}
mParams=mCamera.getParameters();
mLastRequest.setParameters(mParams);
}
MutableLong timestampMutable=new MutableLong(0L);
try {
boolean success=mCaptureCollector.waitForRequestCompleted(holder,REQUEST_COMPLETE_TIMEOUT,TimeUnit.MILLISECONDS,timestampMutable);
if (!success) {
Log.e(TAG,"String_Node_Str");
}
}
 catch (InterruptedException e) {
Log.e(TAG,"String_Node_Str",e);
}
CameraMetadataNative result=mMapper.cachedConvertResultMetadata(mLastRequest,timestampMutable.value);
mFocusStateMapper.mapResultTriggers(result);
mDeviceState.setCaptureResult(holder,result);
}
if (DEBUG) {
long totalTime=SystemClock.elapsedRealtimeNanos() - startTime;
Log.d(TAG,"String_Node_Str" + totalTime + "String_Node_Str");
mRequestCounter.countAndLog();
}
break;
case MSG_CLEANUP:
mCleanup=true;
try {
boolean success=mCaptureCollector.waitForEmpty(JPEG_FRAME_TIMEOUT,TimeUnit.MILLISECONDS);
if (!success) {
Log.e(TAG,"String_Node_Str");
}
}
 catch (InterruptedException e) {
Log.e(TAG,"String_Node_Str");
}
if (mGLThreadManager != null) {
mGLThreadManager.quit();
}
if (mCamera != null) {
mCamera.release();
}
break;
default :
throw new AssertionError("String_Node_Str" + msg.what + "String_Node_Str");
}
return true;
}

Fixed version (ground truth):
@Override public boolean handleMessage(Message msg){
  if (mCleanup) {
    return true;
  }
  if (DEBUG) {
    Log.d(TAG,"String_Node_Str" + msg.what);
  }
  long startTime=0;
  if (DEBUG) {
    startTime=SystemClock.elapsedRealtimeNanos();
  }
switch (msg.what) {
case MSG_CONFIGURE_OUTPUTS:
    ConfigureHolder config=(ConfigureHolder)msg.obj;
  int sizes=config.surfaces != null ? config.surfaces.size() : 0;
Log.i(TAG,"String_Node_Str" + sizes + "String_Node_Str");
try {
boolean success=mCaptureCollector.waitForEmpty(JPEG_FRAME_TIMEOUT,TimeUnit.MILLISECONDS);
if (!success) {
  Log.e(TAG,"String_Node_Str");
}
}
 catch (InterruptedException e) {
Log.e(TAG,"String_Node_Str");
}
try {
configureOutputs(config.surfaces);
}
 catch (IOException e) {
throw new IOError(e);
}
config.condition.open();
if (DEBUG) {
long totalTime=SystemClock.elapsedRealtimeNanos() - startTime;
Log.d(TAG,"String_Node_Str" + totalTime + "String_Node_Str");
}
break;
case MSG_SUBMIT_CAPTURE_REQUEST:
Handler handler=RequestThreadManager.this.mRequestThread.getHandler();
Pair<BurstHolder,Long> nextBurst=mRequestQueue.getNext();
if (nextBurst == null) {
try {
boolean success=mCaptureCollector.waitForEmpty(JPEG_FRAME_TIMEOUT,TimeUnit.MILLISECONDS);
if (!success) {
Log.e(TAG,"String_Node_Str");
}
}
 catch (InterruptedException e) {
Log.e(TAG,"String_Node_Str");
}
mDeviceState.setIdle();
stopPreview();
break;
}
 else {
handler.sendEmptyMessage(MSG_SUBMIT_CAPTURE_REQUEST);
}
List<RequestHolder> requests=nextBurst.first.produceRequestHolders(nextBurst.second);
for (RequestHolder holder : requests) {
CaptureRequest request=holder.getRequest();
boolean paramsChanged=false;
if (mLastRequest == null || mLastRequest.captureRequest != request) {
Size previewSize=ParameterUtils.convertSize(mParams.getPreviewSize());
LegacyRequest legacyRequest=new LegacyRequest(mCharacteristics,request,previewSize,mParams);
mLastRequest=legacyRequest;
LegacyMetadataMapper.convertRequestMetadata(legacyRequest);
if (!mParams.same(legacyRequest.parameters)) {
mParams=legacyRequest.parameters;
mCamera.setParameters(mParams);
paramsChanged=true;
}
}
mFocusStateMapper.processRequestTriggers(request,mParams);
try {
boolean success=mCaptureCollector.queueRequest(holder,mLastRequest,JPEG_FRAME_TIMEOUT,TimeUnit.MILLISECONDS);
if (!success) {
Log.e(TAG,"String_Node_Str");
}
if (holder.hasPreviewTargets()) {
doPreviewCapture(holder);
}
if (holder.hasJpegTargets()) {
success=mCaptureCollector.waitForPreviewsEmpty(PREVIEW_FRAME_TIMEOUT * MAX_IN_FLIGHT_REQUESTS,TimeUnit.MILLISECONDS);
if (!success) {
Log.e(TAG,"String_Node_Str");
}
mReceivedJpeg.close();
doJpegCapture(holder);
if (!mReceivedJpeg.block(JPEG_FRAME_TIMEOUT)) {
Log.e(TAG,"String_Node_Str");
}
}
}
 catch (IOException e) {
throw new IOError(e);
}
catch (InterruptedException e) {
Log.e(TAG,"String_Node_Str",e);
}
if (paramsChanged) {
if (DEBUG) {
Log.d(TAG,"String_Node_Str");
}
mParams=mCamera.getParameters();
mLastRequest.setParameters(mParams);
}
MutableLong timestampMutable=new MutableLong(0L);
try {
boolean success=mCaptureCollector.waitForRequestCompleted(holder,REQUEST_COMPLETE_TIMEOUT,TimeUnit.MILLISECONDS,timestampMutable);
if (!success) {
Log.e(TAG,"String_Node_Str");
}
}
 catch (InterruptedException e) {
Log.e(TAG,"String_Node_Str",e);
}
CameraMetadataNative result=mMapper.cachedConvertResultMetadata(mLastRequest,timestampMutable.value,holder.getFrameNumber());
mFocusStateMapper.mapResultTriggers(result);
mDeviceState.setCaptureResult(holder,result);
}
if (DEBUG) {
long totalTime=SystemClock.elapsedRealtimeNanos() - startTime;
Log.d(TAG,"String_Node_Str" + totalTime + "String_Node_Str");
mRequestCounter.countAndLog();
}
break;
case MSG_CLEANUP:
mCleanup=true;
try {
boolean success=mCaptureCollector.waitForEmpty(JPEG_FRAME_TIMEOUT,TimeUnit.MILLISECONDS);
if (!success) {
Log.e(TAG,"String_Node_Str");
}
}
 catch (InterruptedException e) {
Log.e(TAG,"String_Node_Str");
}
if (mGLThreadManager != null) {
mGLThreadManager.quit();
}
if (mCamera != null) {
mCamera.release();
}
break;
default :
throw new AssertionError("String_Node_Str" + msg.what + "String_Node_Str");
}
return true;
}