Program: 34103
Project: 34103
Buggy source:
/** 
 * Read and validate user input for edit camera.
 */
private PatchCameraBuilder buildPatchCameraWithLocalCheck(){
  PatchCameraBuilder patchCameraBuilder=null;
  try {
    patchCameraBuilder=new PatchCameraBuilder(cameraEdit.getCameraId());
  }
 catch (  EvercamException e) {
    Log.e(TAG,e.toString());
  }
  String cameraName=cameraNameEdit.getText().toString();
  if (cameraName.isEmpty()) {
    CustomToast.showInCenter(this,getString(R.string.name_required));
    return null;
  }
 else   if (!cameraName.equals(cameraEdit.getName())) {
    patchCameraBuilder.setName(cameraName);
  }
  String vendorId=getVendorIdFromSpinner();
  patchCameraBuilder.setVendor(vendorId);
  String modelName=getModelNameFromSpinner();
  patchCameraBuilder.setModel(modelName);
  String username=usernameEdit.getText().toString();
  String password=passwordEdit.getText().toString();
  if (!username.equals(cameraEdit.getUsername()) || !password.equals(cameraEdit.getPassword())) {
    patchCameraBuilder.setCameraUsername(username);
    patchCameraBuilder.setCameraPassword(password);
  }
  String externalHost=externalHostEdit.getText().toString();
  String internalHost=internalHostEdit.getText().toString();
  if (externalHost.isEmpty() && internalHost.isEmpty()) {
    CustomToast.showInCenter(this,getString(R.string.host_required));
    return null;
  }
 else {
    patchCameraBuilder.setInternalHost(internalHost);
    String internalHttp=internalHttpEdit.getText().toString();
    if (!internalHttp.isEmpty()) {
      int internalHttpInt=Integer.valueOf(internalHttp);
      patchCameraBuilder.setInternalHttpPort(internalHttpInt);
    }
    String internalRtsp=internalRtspEdit.getText().toString();
    if (!internalRtsp.isEmpty()) {
      int internalRtspInt=Integer.valueOf(internalRtsp);
      patchCameraBuilder.setInternalRtspPort(internalRtspInt);
    }
    patchCameraBuilder.setExternalHost(externalHost);
    String externalHttp=externalHttpEdit.getText().toString();
    if (!externalHttp.isEmpty()) {
      int externalHttpInt=Integer.valueOf(externalHttp);
      patchCameraBuilder.setExternalHttpPort(externalHttpInt);
    }
    String externalRtsp=externalRtspEdit.getText().toString();
    if (!externalRtsp.isEmpty()) {
      int externalRtspInt=Integer.valueOf(externalRtsp);
      patchCameraBuilder.setExternalRtspPort(externalRtspInt);
    }
  }
  String jpgUrl=buildJpgUrlWithSlash(jpgUrlEdit.getText().toString());
  if (jpgUrl.equals(cameraEdit.getJpgPath())) {
    patchCameraBuilder.setJpgUrl(jpgUrl);
  }
  return patchCameraBuilder;
}

Fixed version (ground truth):
/** 
 * Read and validate user input for edit camera.
 */
private PatchCameraBuilder buildPatchCameraWithLocalCheck(){
  PatchCameraBuilder patchCameraBuilder=null;
  try {
    patchCameraBuilder=new PatchCameraBuilder(cameraEdit.getCameraId());
  }
 catch (  EvercamException e) {
    Log.e(TAG,e.toString());
  }
  String cameraName=cameraNameEdit.getText().toString();
  if (cameraName.isEmpty()) {
    CustomToast.showInCenter(this,getString(R.string.name_required));
    return null;
  }
 else   if (!cameraName.equals(cameraEdit.getName())) {
    patchCameraBuilder.setName(cameraName);
  }
  String vendorId=getVendorIdFromSpinner();
  patchCameraBuilder.setVendor(vendorId);
  String modelName=getModelIdFromSpinner();
  patchCameraBuilder.setModel(modelName);
  String username=usernameEdit.getText().toString();
  String password=passwordEdit.getText().toString();
  if (!username.equals(cameraEdit.getUsername()) || !password.equals(cameraEdit.getPassword())) {
    patchCameraBuilder.setCameraUsername(username);
    patchCameraBuilder.setCameraPassword(password);
  }
  String externalHost=externalHostEdit.getText().toString();
  String internalHost=internalHostEdit.getText().toString();
  if (externalHost.isEmpty() && internalHost.isEmpty()) {
    CustomToast.showInCenter(this,getString(R.string.host_required));
    return null;
  }
 else {
    patchCameraBuilder.setInternalHost(internalHost);
    String internalHttp=internalHttpEdit.getText().toString();
    if (!internalHttp.isEmpty()) {
      int internalHttpInt=Integer.valueOf(internalHttp);
      patchCameraBuilder.setInternalHttpPort(internalHttpInt);
    }
    String internalRtsp=internalRtspEdit.getText().toString();
    if (!internalRtsp.isEmpty()) {
      int internalRtspInt=Integer.valueOf(internalRtsp);
      patchCameraBuilder.setInternalRtspPort(internalRtspInt);
    }
    patchCameraBuilder.setExternalHost(externalHost);
    String externalHttp=externalHttpEdit.getText().toString();
    if (!externalHttp.isEmpty()) {
      int externalHttpInt=Integer.valueOf(externalHttp);
      patchCameraBuilder.setExternalHttpPort(externalHttpInt);
    }
    String externalRtsp=externalRtspEdit.getText().toString();
    if (!externalRtsp.isEmpty()) {
      int externalRtspInt=Integer.valueOf(externalRtsp);
      patchCameraBuilder.setExternalRtspPort(externalRtspInt);
    }
  }
  String jpgUrl=buildJpgUrlWithSlash(jpgUrlEdit.getText().toString());
  if (jpgUrl.equals(cameraEdit.getJpgPath())) {
    patchCameraBuilder.setJpgUrl(jpgUrl);
  }
  return patchCameraBuilder;
}