diff --git a/wallets/bitcoind/bitcoind/src/integrationTest/java/bisq/wallets/bitcoind/BitcoindSendAndListTxsIntegrationTests.java b/wallets/bitcoind/bitcoind/src/integrationTest/java/bisq/wallets/bitcoind/BitcoindSendAndListTxsIntegrationTests.java index 85ca058343..38b011fba8 100644 --- a/wallets/bitcoind/bitcoind/src/integrationTest/java/bisq/wallets/bitcoind/BitcoindSendAndListTxsIntegrationTests.java +++ b/wallets/bitcoind/bitcoind/src/integrationTest/java/bisq/wallets/bitcoind/BitcoindSendAndListTxsIntegrationTests.java @@ -60,7 +60,7 @@ public void sendBtcAndListTxs() throws MalformedURLException, InterruptedExcepti List txs = receiverBackend.listTransactions(10); assertEquals(3, txs.size()); - BitcoindListTransactionsResponse.Entry firstTx = txs.getFirst(); + BitcoindListTransactionsResponse.Entry firstTx = txs.stream().findFirst().orElseThrow(); assertEquals(firstTxReceiverAddress, firstTx.getAddress()); assertEquals("receive", firstTx.getCategory()); assertEquals(100000000, firstTx.getAmount()); diff --git a/wallets/bitcoind/bitcoind/src/main/java/bisq/wallets/bitcoind/zmq/BitcoindZmqTopic.java b/wallets/bitcoind/bitcoind/src/main/java/bisq/wallets/bitcoind/zmq/BitcoindZmqTopic.java index c1a2e0b569..5e854d358f 100644 --- a/wallets/bitcoind/bitcoind/src/main/java/bisq/wallets/bitcoind/zmq/BitcoindZmqTopic.java +++ b/wallets/bitcoind/bitcoind/src/main/java/bisq/wallets/bitcoind/zmq/BitcoindZmqTopic.java @@ -34,10 +34,12 @@ public enum BitcoindZmqTopic { } public static BitcoindZmqTopic parse(String topicName) { - return switch (topicName) { - case BitcoindZmqTopic.HASHBLOCK_TOPIC_NAME -> TOPIC_HASHBLOCK; - case BitcoindZmqTopic.RAWTX_TOPIC_NAME -> TOPIC_RAWTX; - default -> throw new IllegalStateException("Unknown ZMQ topic: " + topicName); - }; + if (topicName.equals(BitcoindZmqTopic.HASHBLOCK_TOPIC_NAME)) { + return TOPIC_HASHBLOCK; + } else if (topicName.equals(BitcoindZmqTopic.RAWTX_TOPIC_NAME)) { + return TOPIC_RAWTX; + } else { + throw new IllegalStateException("Unknown ZMQ topic: " + topicName); + } } } diff --git a/wallets/bitcoind/bitcoind/src/main/java/bisq/wallets/bitcoind/zmq/ZmqConnection.java b/wallets/bitcoind/bitcoind/src/main/java/bisq/wallets/bitcoind/zmq/ZmqConnection.java index ec45ba8eb5..dd3c709ce6 100644 --- a/wallets/bitcoind/bitcoind/src/main/java/bisq/wallets/bitcoind/zmq/ZmqConnection.java +++ b/wallets/bitcoind/bitcoind/src/main/java/bisq/wallets/bitcoind/zmq/ZmqConnection.java @@ -123,7 +123,7 @@ private String findZmqAddress(List zm throw new CannotFindZmqAddressException("ZeroMQ: All topics need to published on the same address."); } - return zmqNotifications.getFirst().getAddress(); + return zmqNotifications.stream().findFirst().orElseThrow().getAddress(); } private boolean canSubscribeToAllTopics(List zmqNotifications) {