From a34f41e287d250b7d24f6c381d67682e4b9f9776 Mon Sep 17 00:00:00 2001 From: Andreas Schildbach Date: Thu, 29 Sep 2016 11:54:03 +0200 Subject: [PATCH] ECKey: If deriving the private keys fails in toString(), print the exception to the message rather than throwing. --- core/src/main/java/org/bitcoinj/core/ECKey.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/src/main/java/org/bitcoinj/core/ECKey.java b/core/src/main/java/org/bitcoinj/core/ECKey.java index 7334a208..fbf3c525 100644 --- a/core/src/main/java/org/bitcoinj/core/ECKey.java +++ b/core/src/main/java/org/bitcoinj/core/ECKey.java @@ -1259,6 +1259,9 @@ public class ECKey implements EncryptableItem { helper.add("priv WIF", getPrivateKeyAsWiF(params)); } catch (IllegalStateException e) { // TODO: Make hasPrivKey() work for deterministic keys and fix this. + } catch (Exception e) { + final String message = e.getMessage(); + helper.add("priv EXCEPTION", e.getClass().getName() + (message != null ? ": " + message : "")); } } if (creationTimeSeconds > 0)