From cbd2e92850dbfa5b96854256f3aaf12ecf44651f Mon Sep 17 00:00:00 2001 From: Sally MacFarlane Date: Wed, 13 Dec 2023 20:34:50 +1000 Subject: [PATCH] [MINOR] Include Enode URL in error message if parsing exception (#6288) * include the actual Enode URL in the error message if IP can't be resolved --------- Signed-off-by: Sally MacFarlane --- besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java | 2 +- .../util/LocalPermissioningConfigurationValidatorTest.java | 3 +-- .../org/hyperledger/besu/ethereum/p2p/peers/EnodeURLImpl.java | 4 +++- .../besu/ethereum/referencetests/ReferenceTestBlockchain.java | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java b/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java index b8b7efca3ab..abd9ac90cf5 100644 --- a/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java +++ b/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java @@ -3246,7 +3246,7 @@ private List buildEnodes( } /** - * Besu CLI Paramaters exception handler used by VertX. Visible for testing. + * Besu CLI Parameters exception handler used by VertX. Visible for testing. * * @return instance of BesuParameterExceptionHandler */ diff --git a/besu/src/test/java/org/hyperledger/besu/util/LocalPermissioningConfigurationValidatorTest.java b/besu/src/test/java/org/hyperledger/besu/util/LocalPermissioningConfigurationValidatorTest.java index a5b3bb90d99..84344c24918 100644 --- a/besu/src/test/java/org/hyperledger/besu/util/LocalPermissioningConfigurationValidatorTest.java +++ b/besu/src/test/java/org/hyperledger/besu/util/LocalPermissioningConfigurationValidatorTest.java @@ -232,7 +232,6 @@ public void nodeAllowlistCheckShouldNotWorkWithUnknownHostnameWhenOnlyDnsEnabled true, toml.toAbsolutePath().toString())) .isInstanceOf(IllegalArgumentException.class) - .hasMessageContaining( - "Invalid IP address (or DNS query resolved an invalid IP). --Xdns-enabled is true but --Xdns-update-enabled flag is false."); + .hasMessageContaining("Invalid IP address"); } } diff --git a/ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/peers/EnodeURLImpl.java b/ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/peers/EnodeURLImpl.java index 747a06efdf6..55ca94a1ac3 100644 --- a/ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/peers/EnodeURLImpl.java +++ b/ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/peers/EnodeURLImpl.java @@ -83,7 +83,9 @@ public static EnodeURL fromString( String message = ""; if (enodeDnsConfiguration.dnsEnabled() && !enodeDnsConfiguration.updateEnabled()) { message = - "Invalid IP address (or DNS query resolved an invalid IP). --Xdns-enabled is true but --Xdns-update-enabled flag is false."; + String.format( + "Invalid IP address '%s' (or DNS query resolved an invalid IP). --Xdns-enabled is true but --Xdns-update-enabled flag is false.", + value); } else { message = String.format( diff --git a/ethereum/referencetests/src/main/java/org/hyperledger/besu/ethereum/referencetests/ReferenceTestBlockchain.java b/ethereum/referencetests/src/main/java/org/hyperledger/besu/ethereum/referencetests/ReferenceTestBlockchain.java index 7e84ccbaf87..cfe577bf7af 100644 --- a/ethereum/referencetests/src/main/java/org/hyperledger/besu/ethereum/referencetests/ReferenceTestBlockchain.java +++ b/ethereum/referencetests/src/main/java/org/hyperledger/besu/ethereum/referencetests/ReferenceTestBlockchain.java @@ -191,7 +191,7 @@ public static class NonDeterministicOperationException extends RuntimeException public Comparator getBlockChoiceRule() { return (a, b) -> { throw new NonDeterministicOperationException( - "ReferenceTestBlockchian for VMTest Chains do not support fork choice rules"); + "ReferenceTestBlockchain for VMTest Chains do not support fork choice rules"); }; }