Skip to content

Commit 70cee44

Browse files
committed
[2.0.0-SNAPSHOT]
LogQueryBuilderImpl address validation added
1 parent f095f0f commit 70cee44

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

src/main/java/io/goodforgod/api/etherscan/manager/impl/SemaphoreRequestQueueManager.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ public SemaphoreRequestQueueManager(int size, Duration resetIn, Duration delayIn
3131
public SemaphoreRequestQueueManager(int size, Duration queueResetTimeIn, Duration delayIn, int initialSize) {
3232
this.semaphore = new Semaphore(initialSize);
3333
this.queueResetTimeInMillis = queueResetTimeIn.toMillis();
34-
this.executorService.scheduleAtFixedRate(releaseLocks(size + 1), delayIn.toMillis(), queueResetTimeInMillis,
35-
TimeUnit.MILLISECONDS);
34+
this.executorService.scheduleAtFixedRate(releaseLocks(size + 1),
35+
delayIn.toMillis(), queueResetTimeInMillis, TimeUnit.MILLISECONDS);
3636
}
3737

3838
@SuppressWarnings("java:S899")

src/main/java/io/goodforgod/api/etherscan/model/query/LogQueryBuilderImpl.java

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ final class LogQueryBuilderImpl implements LogQuery.Builder {
2121
private final long startBlock, endBlock;
2222

2323
LogQueryBuilderImpl(String address, long startBlock, long endBlock) {
24+
BasicUtils.validateAddress(address);
2425
this.address = address;
2526
this.startBlock = startBlock;
2627
this.endBlock = endBlock;

src/test/java/io/goodforgod/api/etherscan/EtherScanAPITests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package io.goodforgod.api.etherscan;
22

3+
import io.goodforgod.api.etherscan.error.EtherScanConnectionException;
34
import io.goodforgod.api.etherscan.error.EtherScanKeyException;
4-
import io.goodforgod.api.etherscan.error.EtherScanTimeoutException;
55
import io.goodforgod.api.etherscan.http.EthHttpClient;
66
import io.goodforgod.api.etherscan.http.impl.UrlEthHttpClient;
77
import io.goodforgod.api.etherscan.model.Balance;
@@ -70,7 +70,7 @@ void timeout() throws InterruptedException {
7070
Supplier<EthHttpClient> supplier = () -> new UrlEthHttpClient(Duration.ofMillis(300), Duration.ofMillis(300));
7171
EtherScanAPI api = EtherScanAPI.builder().withApiKey(getApiKey()).withNetwork(EthNetworks.KOVAN).withHttpClient(supplier)
7272
.build();
73-
assertThrows(EtherScanTimeoutException.class,
73+
assertThrows(EtherScanConnectionException.class,
7474
() -> api.account().blocksMined("0x0010f94b296A852aAac52EA6c5Ac72e03afD032D"));
7575
}
7676
}

src/test/java/io/goodforgod/api/etherscan/logs/LogsApiTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ static Stream<Arguments> source() {
3838
.build();
3939

4040
return Stream.of(
41-
Arguments.of(single, 423),
41+
Arguments.of(single, 424),
4242
Arguments.of(singleInvalidAddr, 0),
4343
Arguments.of(tupleAnd, 1),
44-
Arguments.of(tupleOr, 425));
44+
Arguments.of(tupleOr, 426));
4545
}
4646

4747
@ParameterizedTest

0 commit comments

Comments
 (0)