Program: 194756
Project: 194756
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);
  Surface[] surfaces=(Surface[])outputSurfaces.toArray();
  if (outputSurfaces.size() == 1 && SurfaceUtils.isSurfaceForHwVideoEncoder(surfaces[0])) {
    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(surfaces[0]);
    doubleTargetRequestBuilder.addTarget(surfaces[1]);
    doubleTargetRequestBuilder.setPartOfCHSRequestList(true);
    Surface recordingSurface=surfaces[0];
    if (!SurfaceUtils.isSurfaceForHwVideoEncoder(recordingSurface)) {
      recordingSurface=surfaces[1];
    }
    singleTargetRequestBuilder.addTarget(recordingSurface);
  }
 else {
    singleTargetRequestBuilder.addTarget(surfaces[0]);
  }
  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) {
    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);
}