Program: 194718
Project: 194718
Buggy source:
@Override public List<CaptureRequest> createConstrainedHighSpeedRequestList(CaptureRequest request) throws CameraAccessException {
  if (request == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  Collection<Surface> outputSurfaces=request.getTargets();
  Range<Integer> fpsRange=request.get(CaptureRequest.CONTROL_AE_TARGET_FPS_RANGE);
  checkConstrainedHighSpeedSurfaces(outputSurfaces,fpsRange);
  int requestListSize=fpsRange.getUpper() / 30;
  List<CaptureRequest> requestList=new ArrayList<CaptureRequest>();
  CameraMetadataNative requestMetadata=new CameraMetadataNative(request.getNativeCopy());
  CaptureRequest.Builder singleTargetRequestBuilder=new CaptureRequest.Builder(requestMetadata,false,CameraCaptureSession.SESSION_ID_NONE);
  Iterator<Surface> iterator=outputSurfaces.iterator();
  Surface firstSurface=iterator.next();
  Surface secondSurface=null;
  if (outputSurfaces.size() == 1 && SurfaceUtils.isSurfaceForHwVideoEncoder(firstSurface)) {
    singleTargetRequestBuilder.set(CaptureRequest.CONTROL_CAPTURE_INTENT,CaptureRequest.CONTROL_CAPTURE_INTENT_PREVIEW);
  }
 else {
    singleTargetRequestBuilder.set(CaptureRequest.CONTROL_CAPTURE_INTENT,CaptureRequest.CONTROL_CAPTURE_INTENT_VIDEO_RECORD);
  }
  singleTargetRequestBuilder.setPartOfCHSRequestList(true);
  CaptureRequest.Builder doubleTargetRequestBuilder=null;
  if (outputSurfaces.size() == 2) {
    doubleTargetRequestBuilder=new CaptureRequest.Builder(requestMetadata,false,CameraCaptureSession.SESSION_ID_NONE);
    doubleTargetRequestBuilder.set(CaptureRequest.CONTROL_CAPTURE_INTENT,CaptureRequest.CONTROL_CAPTURE_INTENT_VIDEO_RECORD);
    doubleTargetRequestBuilder.addTarget(firstSurface);
    secondSurface=iterator.next();
    doubleTargetRequestBuilder.addTarget(secondSurface);
    doubleTargetRequestBuilder.setPartOfCHSRequestList(true);
    Surface recordingSurface=firstSurface;
    if (!SurfaceUtils.isSurfaceForHwVideoEncoder(recordingSurface)) {
      recordingSurface=secondSurface;
    }
    singleTargetRequestBuilder.addTarget(recordingSurface);
  }
 else {
    singleTargetRequestBuilder.addTarget(firstSurface);
  }
  for (int i=0; i < requestListSize; i++) {
    if (i == 0 && doubleTargetRequestBuilder != null) {
      requestList.add(doubleTargetRequestBuilder.build());
    }
 else {
      requestList.add(singleTargetRequestBuilder.build());
    }
  }
  return Collections.unmodifiableList(requestList);
}

Fixed version (ground truth):
@Override public List<CaptureRequest> createConstrainedHighSpeedRequestList(CaptureRequest request) throws CameraAccessException {
  if (request == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  Collection<Surface> outputSurfaces=request.getTargets();
  Range<Integer> fpsRange=request.get(CaptureRequest.CONTROL_AE_TARGET_FPS_RANGE);
  checkConstrainedHighSpeedSurfaces(outputSurfaces,fpsRange);
  int requestListSize=fpsRange.getUpper() / 30;
  List<CaptureRequest> requestList=new ArrayList<CaptureRequest>();
  CameraMetadataNative requestMetadata=new CameraMetadataNative(request.getNativeCopy());
  CaptureRequest.Builder singleTargetRequestBuilder=new CaptureRequest.Builder(requestMetadata,false,CameraCaptureSession.SESSION_ID_NONE);
  Iterator<Surface> iterator=outputSurfaces.iterator();
  Surface firstSurface=iterator.next();
  Surface secondSurface=null;
  if (outputSurfaces.size() == 1 && SurfaceUtils.isSurfaceForHwVideoEncoder(firstSurface)) {
    singleTargetRequestBuilder.set(CaptureRequest.CONTROL_CAPTURE_INTENT,CaptureRequest.CONTROL_CAPTURE_INTENT_PREVIEW);
  }
 else {
    singleTargetRequestBuilder.set(CaptureRequest.CONTROL_CAPTURE_INTENT,CaptureRequest.CONTROL_CAPTURE_INTENT_VIDEO_RECORD);
  }
  singleTargetRequestBuilder.setPartOfCHSRequestList(true);
  CaptureRequest.Builder doubleTargetRequestBuilder=null;
  if (outputSurfaces.size() == 2) {
    requestMetadata=new CameraMetadataNative(request.getNativeCopy());
    doubleTargetRequestBuilder=new CaptureRequest.Builder(requestMetadata,false,CameraCaptureSession.SESSION_ID_NONE);
    doubleTargetRequestBuilder.set(CaptureRequest.CONTROL_CAPTURE_INTENT,CaptureRequest.CONTROL_CAPTURE_INTENT_VIDEO_RECORD);
    doubleTargetRequestBuilder.addTarget(firstSurface);
    secondSurface=iterator.next();
    doubleTargetRequestBuilder.addTarget(secondSurface);
    doubleTargetRequestBuilder.setPartOfCHSRequestList(true);
    Surface recordingSurface=firstSurface;
    if (!SurfaceUtils.isSurfaceForHwVideoEncoder(recordingSurface)) {
      recordingSurface=secondSurface;
    }
    singleTargetRequestBuilder.addTarget(recordingSurface);
  }
 else {
    singleTargetRequestBuilder.addTarget(firstSurface);
  }
  for (int i=0; i < requestListSize; i++) {
    if (i == 0 && doubleTargetRequestBuilder != null) {
      requestList.add(doubleTargetRequestBuilder.build());
    }
 else {
      requestList.add(singleTargetRequestBuilder.build());
    }
  }
  return Collections.unmodifiableList(requestList);
}