Program: 165039
Project: 165039
Buggy source:
/** 
 * Create a PayPalPaymentResource on behalf of the merchant. To be used in the PayPal Checkout flows for Single Payment and Billing Agreement.
 * @param fragment A {@link BraintreeFragment} used to process the request.
 * @param checkout A {@link PayPalCheckout} used to customize the request.
 * @param isBillingAgreement A boolean. If true, this will use the Billing Agreement. Otherwise,PayPal will perform a Single Payment.
 * @param callback A callback on the http request.
 */
private static void createPayPalPaymentResource(BraintreeFragment fragment,PayPalCheckout checkout,boolean isBillingAgreement,HttpResponseCallback callback) throws JSONException, ErrorWithResponse, BraintreeException {
  Configuration configuration=fragment.getConfiguration();
  CheckoutRequest request=PayPal.buildPayPalCheckoutConfiguration(null,fragment.getContext(),configuration);
  String currencyCode=checkout.getCurrencyCode();
  if (currencyCode == null) {
    currencyCode=configuration.getPayPal().getCurrencyIsoCode();
  }
  JSONObject experienceProfile=new JSONObject();
  experienceProfile.put(NO_SHIPPING_KEY,!checkout.getEnableShippingAddress());
  experienceProfile.put(ADDRESS_OVERRIDE_KEY,checkout.getAddressOverride());
  if (checkout.getLocaleCode() != null) {
    experienceProfile.put(LOCALE_CODE_KEY,checkout.getLocaleCode());
  }
  String authorizationFingerprint=fragment.getClientToken().getAuthorizationFingerprint();
  JSONObject parameters=new JSONObject().put(AUTHORIZATION_FINGERPRINT_KEY,authorizationFingerprint).put(RETURN_URL_KEY,request.getSuccessUrl()).put(CANCEL_URL_KEY,request.getCancelUrl()).put(EXPERIENCE_PROFILE_KEY,experienceProfile);
  if (!isBillingAgreement) {
    parameters.put(AMOUNT_KEY,checkout.getAmount().toString()).put(CURRENCY_ISO_CODE_KEY,currencyCode);
  }
  if (checkout.getAddressOverride() && checkout.getShippingAddress() != null) {
    PostalAddress shippingAddress=checkout.getShippingAddress();
    parameters.put(PostalAddress.LINE_1_KEY,shippingAddress.getStreetAddress());
    parameters.put(PostalAddress.LINE_2_KEY,shippingAddress.getExtendedAddress());
    parameters.put(PostalAddress.LOCALITY_KEY,shippingAddress.getLocality());
    parameters.put(PostalAddress.REGION_KEY,shippingAddress.getRegion());
    parameters.put(PostalAddress.POSTAL_CODE_UNDERSCORE_KEY,shippingAddress.getPostalCode());
    parameters.put(PostalAddress.COUNTRY_CODE_UNDERSCORE_KEY,shippingAddress.getCountryCodeAlpha2());
    parameters.put(PostalAddress.RECIPIENT_NAME_UNDERSCORE_KEY,shippingAddress.getRecipientName());
  }
  String apiUrl=isBillingAgreement ? SETUP_BILLING_AGREEMENT_ENDPOINT : CREATE_SINGLE_PAYMENT_ENDPOINT;
  String versionedPath="String_Node_Str" + apiUrl;
  fragment.getHttpClient().post(versionedPath,parameters.toString(),callback);
}

Fixed version (ground truth):
/** 
 * Create a PayPalPaymentResource on behalf of the merchant. To be used in the PayPal Checkout flows for Single Payment and Billing Agreement.
 * @param fragment A {@link BraintreeFragment} used to process the request.
 * @param checkout A {@link PayPalCheckout} used to customize the request.
 * @param isBillingAgreement A boolean. If true, this will use the Billing Agreement. Otherwise,PayPal will perform a Single Payment.
 * @param callback A callback on the http request.
 */
private static void createPayPalPaymentResource(BraintreeFragment fragment,PayPalCheckout checkout,boolean isBillingAgreement,HttpResponseCallback callback) throws JSONException, ErrorWithResponse, BraintreeException {
  Configuration configuration=fragment.getConfiguration();
  CheckoutRequest request=PayPal.buildPayPalCheckoutConfiguration(null,fragment.getApplicationContext(),configuration);
  String currencyCode=checkout.getCurrencyCode();
  if (currencyCode == null) {
    currencyCode=configuration.getPayPal().getCurrencyIsoCode();
  }
  JSONObject experienceProfile=new JSONObject();
  experienceProfile.put(NO_SHIPPING_KEY,!checkout.getEnableShippingAddress());
  experienceProfile.put(ADDRESS_OVERRIDE_KEY,checkout.getAddressOverride());
  if (checkout.getLocaleCode() != null) {
    experienceProfile.put(LOCALE_CODE_KEY,checkout.getLocaleCode());
  }
  String authorizationFingerprint=fragment.getClientToken().getAuthorizationFingerprint();
  JSONObject parameters=new JSONObject().put(AUTHORIZATION_FINGERPRINT_KEY,authorizationFingerprint).put(RETURN_URL_KEY,request.getSuccessUrl()).put(CANCEL_URL_KEY,request.getCancelUrl()).put(EXPERIENCE_PROFILE_KEY,experienceProfile);
  if (!isBillingAgreement) {
    parameters.put(AMOUNT_KEY,checkout.getAmount().toString()).put(CURRENCY_ISO_CODE_KEY,currencyCode);
  }
  if (checkout.getAddressOverride() && checkout.getShippingAddress() != null) {
    PostalAddress shippingAddress=checkout.getShippingAddress();
    parameters.put(PostalAddress.LINE_1_KEY,shippingAddress.getStreetAddress());
    parameters.put(PostalAddress.LINE_2_KEY,shippingAddress.getExtendedAddress());
    parameters.put(PostalAddress.LOCALITY_KEY,shippingAddress.getLocality());
    parameters.put(PostalAddress.REGION_KEY,shippingAddress.getRegion());
    parameters.put(PostalAddress.POSTAL_CODE_UNDERSCORE_KEY,shippingAddress.getPostalCode());
    parameters.put(PostalAddress.COUNTRY_CODE_UNDERSCORE_KEY,shippingAddress.getCountryCodeAlpha2());
    parameters.put(PostalAddress.RECIPIENT_NAME_UNDERSCORE_KEY,shippingAddress.getRecipientName());
  }
  String apiUrl=isBillingAgreement ? SETUP_BILLING_AGREEMENT_ENDPOINT : CREATE_SINGLE_PAYMENT_ENDPOINT;
  String versionedPath="String_Node_Str" + apiUrl;
  fragment.getHttpClient().post(versionedPath,parameters.toString(),callback);
}