Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 8ba73e8

Browse files
[1.1.0]
SonarQube issues fixed README.md updated
1 parent 8c0754d commit 8ba73e8

File tree

19 files changed

+57
-43
lines changed

19 files changed

+57
-43
lines changed

‎README.md‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# java-etherscan-api
22

3+
[![GitHub Action](https://github.com/goodforgod/java-etherscan-api/workflows/Java%20CI/badge.svg)](https://github.com/GoodforGod/dummymaker/actions?query=workflow%3A%22Java+CI%22)
4+
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=GoodforGod_java-etherscan-api&metric=coverage)](https://sonarcloud.io/dashboard?id=GoodforGod_dummymaker)
5+
[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=GoodforGod_java-etherscan-api&metric=sqale_rating)](https://sonarcloud.io/dashboard?id=GoodforGod_dummymaker)
6+
[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=GoodforGod_java-etherscan-api&metric=ncloc)](https://sonarcloud.io/dashboard?id=GoodforGod_dummymaker)
37
[![Jitpack](https://jitpack.io/v/iSnow/java-etherscan-api.svg)](https://jitpack.io/#GoodforGod/java-etherscan-api)
48

59
[Etherscan](https://etherscan.io/apis) Java API implementation.
@@ -163,6 +167,8 @@ Token API methods migrated to [Account](#account-api) & [Stats](#stats-api) resp
163167

164168
## Version History
165169

170+
**1.1.0** - Improved error handling, QueueManager improved, Gradle 6.7 instead of Maven, GitHub CI, Sonarcloud analyzer, dependencies updated.
171+
166172
**1.0.2** - Minor http client improvements.
167173

168174
**1.0.1** - Gorli & TOBALABA networks support.
@@ -171,4 +177,4 @@ Token API methods migrated to [Account](#account-api) & [Stats](#stats-api) resp
171177

172178
## License
173179

174-
This project is licensed under the MIT - see the [LICENSE](LICENSE) file for details.
180+
This project licensed under the MIT - see the [LICENSE](LICENSE) file for details.

‎gradle.properties‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
groupId=com.github.goodforgod
22
artifactId=java-etherscan-api
3-
artifactVersion=1.1.0-SNAPSHOT
3+
artifactVersion=1.1.0
44
buildNumber=1
55

66

‎src/main/java/io/api/etherscan/core/impl/BasicProvider.java‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,8 @@ abstract class BasicProvider {
4646
<T> T convert(final String json, final Class<T> tClass) {
4747
try {
4848
final T t = gson.fromJson(json, tClass);
49-
if (t instanceof StringResponseTO) {
50-
if (((StringResponseTO) t).getResult().startsWith("Max rate limit reached")) {
51-
throw new RateLimitException(((StringResponseTO) t).getResult());
52-
}
49+
if (t instanceof StringResponseTO && ((StringResponseTO) t).getResult().startsWith("Max rate limit reached")) {
50+
throw new RateLimitException(((StringResponseTO) t).getResult());
5351
}
5452

5553
return t;

‎src/main/java/io/api/etherscan/manager/impl/FakeQueueManager.java‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,8 @@
1111
public class FakeQueueManager implements IQueueManager {
1212

1313
@Override
14-
public void takeTurn() {}
14+
public void takeTurn() {
15+
// no limit or await provided for fake impl so rate limit exception will be
16+
// thrown if too many calls
17+
}
1518
}

‎src/main/java/io/api/etherscan/model/Balance.java‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import io.api.etherscan.model.utility.BalanceTO;
44

55
import java.math.BigInteger;
6+
import java.util.Objects;
67

78
/**
89
* ! NO DESCRIPTION !
@@ -63,7 +64,7 @@ public boolean equals(Object o) {
6364

6465
if (!balance.equals(balance1.balance))
6566
return false;
66-
return address != null ? address.equals(balance1.address) : balance1.address == null;
67+
return Objects.equals(address, balance1.address);
6768
}
6869

6970
@Override

‎src/main/java/io/api/etherscan/model/BaseTx.java‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import java.math.BigInteger;
66
import java.time.LocalDateTime;
77
import java.time.ZoneOffset;
8+
import java.util.Objects;
89

910
/**
1011
* ! NO DESCRIPTION !
@@ -33,7 +34,7 @@ public long getBlockNumber() {
3334

3435
public LocalDateTime getTimeStamp() {
3536
if (_timeStamp == null && !BasicUtils.isEmpty(timeStamp))
36-
_timeStamp = LocalDateTime.ofEpochSecond(Long.valueOf(timeStamp), 0, ZoneOffset.UTC);
37+
_timeStamp = LocalDateTime.ofEpochSecond(Long.parseLong(timeStamp), 0, ZoneOffset.UTC);
3738
return _timeStamp;
3839
}
3940

@@ -81,15 +82,15 @@ public boolean equals(Object o) {
8182

8283
if (blockNumber != baseTx.blockNumber)
8384
return false;
84-
if (timeStamp != null ? !timeStamp.equals(baseTx.timeStamp) : baseTx.timeStamp != null)
85+
if (!Objects.equals(timeStamp, baseTx.timeStamp))
8586
return false;
86-
if (hash != null ? !hash.equals(baseTx.hash) : baseTx.hash != null)
87+
if (!Objects.equals(hash, baseTx.hash))
8788
return false;
88-
if (from != null ? !from.equals(baseTx.from) : baseTx.from != null)
89+
if (!Objects.equals(from, baseTx.from))
8990
return false;
90-
if (to != null ? !to.equals(baseTx.to) : baseTx.to != null)
91+
if (!Objects.equals(to, baseTx.to))
9192
return false;
92-
return value != null ? value.equals(baseTx.value) : baseTx.value == null;
93+
return Objects.equals(value, baseTx.value);
9394
}
9495

9596
@Override

‎src/main/java/io/api/etherscan/model/Block.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public long getBlockNumber() {
2626

2727
public LocalDateTime getTimeStamp() {
2828
if (_timeStamp == null && !BasicUtils.isEmpty(timeStamp))
29-
_timeStamp = LocalDateTime.ofEpochSecond(Long.valueOf(timeStamp), 0, ZoneOffset.UTC);
29+
_timeStamp = LocalDateTime.ofEpochSecond(Long.parseLong(timeStamp), 0, ZoneOffset.UTC);
3030
return _timeStamp;
3131
}
3232

‎src/main/java/io/api/etherscan/model/Log.java‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import java.time.LocalDateTime;
77
import java.time.ZoneOffset;
88
import java.util.List;
9+
import java.util.Objects;
910

1011
/**
1112
* ! NO DESCRIPTION !
@@ -124,15 +125,15 @@ public boolean equals(Object o) {
124125

125126
Log log = (Log) o;
126127

127-
if (blockNumber != null ? !blockNumber.equals(log.blockNumber) : log.blockNumber != null)
128+
if (!Objects.equals(blockNumber, log.blockNumber))
128129
return false;
129-
if (address != null ? !address.equals(log.address) : log.address != null)
130+
if (!Objects.equals(address, log.address))
130131
return false;
131-
if (transactionHash != null ? !transactionHash.equals(log.transactionHash) : log.transactionHash != null)
132+
if (!Objects.equals(transactionHash, log.transactionHash))
132133
return false;
133-
if (timeStamp != null ? !timeStamp.equals(log.timeStamp) : log.timeStamp != null)
134+
if (!Objects.equals(timeStamp, log.timeStamp))
134135
return false;
135-
return logIndex != null ? logIndex.equals(log.logIndex) : log.logIndex == null;
136+
return Objects.equals(logIndex, log.logIndex);
136137
}
137138

138139
@Override

‎src/main/java/io/api/etherscan/model/Price.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ public double inBtc() {
2828

2929
public LocalDateTime usdTimestamp() {
3030
if (_ethusd_timestamp == null)
31-
_ethusd_timestamp = LocalDateTime.ofEpochSecond(Long.valueOf(ethusd_timestamp), 0, ZoneOffset.UTC);
31+
_ethusd_timestamp = LocalDateTime.ofEpochSecond(Long.parseLong(ethusd_timestamp), 0, ZoneOffset.UTC);
3232
return _ethusd_timestamp;
3333
}
3434

3535
public LocalDateTime btcTimestamp() {
3636
if (_ethbtc_timestamp == null)
37-
_ethbtc_timestamp = LocalDateTime.ofEpochSecond(Long.valueOf(ethbtc_timestamp), 0, ZoneOffset.UTC);
37+
_ethbtc_timestamp = LocalDateTime.ofEpochSecond(Long.parseLong(ethbtc_timestamp), 0, ZoneOffset.UTC);
3838
return _ethbtc_timestamp;
3939
}
4040

‎src/main/java/io/api/etherscan/model/Status.java‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package io.api.etherscan.model;
22

3+
import java.util.Objects;
4+
35
/**
46
* Contract Execution Status
57
*
@@ -33,7 +35,7 @@ public boolean equals(Object o) {
3335

3436
if (isError != status.isError)
3537
return false;
36-
return errDescription != null ? errDescription.equals(status.errDescription) : status.errDescription == null;
38+
return Objects.equals(errDescription, status.errDescription);
3739
}
3840

3941
@Override

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /