From 1a5af67b73d4074cc621ff7d5a3e0662ed9f1492 Mon Sep 17 00:00:00 2001 From: Andreas Schildbach Date: Wed, 10 Aug 2022 10:41:42 +0200 Subject: [PATCH] BitcoinURI: strip some whitespace from end of lines --- .../java/org/bitcoinj/uri/BitcoinURI.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/core/src/main/java/org/bitcoinj/uri/BitcoinURI.java b/core/src/main/java/org/bitcoinj/uri/BitcoinURI.java index 464694611..0bb8e40bb 100644 --- a/core/src/main/java/org/bitcoinj/uri/BitcoinURI.java +++ b/core/src/main/java/org/bitcoinj/uri/BitcoinURI.java @@ -1,6 +1,6 @@ /* * Copyright 2012, 2014 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -152,7 +152,7 @@ public class BitcoinURI { // URI is formed as bitcoin:
? // blockchain.info generates URIs of non-BIP compliant form bitcoin://address?.... // We support both until Ben fixes his code. - + // Remove the bitcoin scheme. // (Note: getSchemeSpecificPart() is not used as it unescapes the label and parse then fails. // For instance with : bitcoin:129mVqKUmJ9uwPxKJBnNdABbuaaNfho4Ha?amount=0.06&label=Tom%20%26%20Jerry @@ -403,29 +403,29 @@ public class BitcoinURI { if (amount != null && amount.signum() < 0) { throw new IllegalArgumentException("Coin must be positive"); } - + StringBuilder builder = new StringBuilder(); String scheme = network.uriScheme(); builder.append(scheme).append(":").append(address); - + boolean questionMarkHasBeenOutput = false; - + if (amount != null) { builder.append(QUESTION_MARK_SEPARATOR).append(FIELD_AMOUNT).append("="); builder.append(amount.toPlainString()); questionMarkHasBeenOutput = true; } - + if (label != null && !"".equals(label)) { if (questionMarkHasBeenOutput) { builder.append(AMPERSAND_SEPARATOR); } else { - builder.append(QUESTION_MARK_SEPARATOR); + builder.append(QUESTION_MARK_SEPARATOR); questionMarkHasBeenOutput = true; } builder.append(FIELD_LABEL).append("=").append(encodeURLString(label)); } - + if (message != null && !"".equals(message)) { if (questionMarkHasBeenOutput) { builder.append(AMPERSAND_SEPARATOR); @@ -434,13 +434,13 @@ public class BitcoinURI { } builder.append(FIELD_MESSAGE).append("=").append(encodeURLString(message)); } - + return builder.toString(); } /** * Encode a string using URL encoding - * + * * @param stringToEncode The string to URL encode */ static String encodeURLString(String stringToEncode) {