Movatterモバイル変換


[0]ホーム

URL:


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

Commit63beec4

Browse files
committed
Minor improvements and code style checks
1 parent00cff5f commit63beec4

File tree

5 files changed

+11
-13
lines changed

5 files changed

+11
-13
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public EtherScanApi(final String apiKey,
6565
thrownewApiException("Ethereum Network is set to NULL value");
6666

6767
// EtherScan 5request\sec limit support by queue manager
68-
finalIQueueManagermasterQueue =(apiKey.equals("YourApiKeyToken"))
68+
finalIQueueManagermasterQueue ="YourApiKeyToken".equals(apiKey)
6969
?newFakeQueueManager()
7070
:newQueueManager(5,1);
7171

‎src/main/java/io/api/etherscan/error/ConnectionException.java‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
packageio.api.etherscan.error;
22

33
/**
4-
* ! NO DESCRIPTION !
5-
*
64
* @author GoodforGod
75
* @since 29.10.2018
86
*/

‎src/main/java/io/api/etherscan/executor/impl/HttpExecutor.java‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public String get(final String urlAsString) {
9696
}catch (SocketTimeoutExceptione) {
9797
thrownewApiTimeoutException("Timeout: Could not establish connection for " +connectTimeout +" millis",e);
9898
}catch (Exceptione) {
99-
thrownewConnectionException(e.getLocalizedMessage(),e);
99+
thrownewConnectionException(e.getMessage(),e);
100100
}
101101
}
102102

@@ -126,7 +126,7 @@ public String post(final String urlAsString, final String dataToPost) {
126126
}catch (SocketTimeoutExceptione) {
127127
thrownewApiTimeoutException("Timeout: Could not establish connection for " +connectTimeout +" millis",e);
128128
}catch (Exceptione) {
129-
thrownewConnectionException(e.getLocalizedMessage(),e);
129+
thrownewConnectionException(e.getMessage(),e);
130130
}
131131
}
132132

@@ -136,8 +136,6 @@ private String readData(final HttpURLConnection connection) throws IOException {
136136
StringinputLine;
137137
while ((inputLine =in.readLine()) !=null)
138138
content.append(inputLine);
139-
140-
in.close();
141139
}
142140

143141
returncontent.toString();
@@ -146,11 +144,11 @@ private String readData(final HttpURLConnection connection) throws IOException {
146144
privateInputStreamReadergetStreamReader(finalHttpURLConnectionconnection)throwsIOException {
147145
switch (String.valueOf(connection.getContentEncoding())) {
148146
case"gzip":
149-
returnnewInputStreamReader(newGZIPInputStream(connection.getInputStream()),"utf-8");
147+
returnnewInputStreamReader(newGZIPInputStream(connection.getInputStream()),StandardCharsets.UTF_8);
150148
case"deflate":
151-
returnnewInputStreamReader(newInflaterInputStream(connection.getInputStream()),"utf-8");
149+
returnnewInputStreamReader(newInflaterInputStream(connection.getInputStream()),StandardCharsets.UTF_8);
152150
default:
153-
returnnewInputStreamReader(connection.getInputStream(),"utf-8");
151+
returnnewInputStreamReader(connection.getInputStream(),StandardCharsets.UTF_8);
154152
}
155153
}
156154
}

‎src/test/java/io/api/etherscan/account/AccountBalanceListTest.java‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
importorg.junit.Assert;
88
importorg.junit.Test;
99

10+
importjava.math.BigInteger;
1011
importjava.util.ArrayList;
1112
importjava.util.List;
1213

@@ -18,7 +19,7 @@
1819
*/
1920
publicclassAccountBalanceListTestextendsAssert {
2021

21-
privateEtherScanApiapi =newEtherScanApi();
22+
privatefinalEtherScanApiapi =newEtherScanApi();
2223

2324
@Test
2425
publicvoidcorrect() {
@@ -40,7 +41,7 @@ public void correct() {
4041
assertNotNull(balance.getEther());
4142
assertNotNull(balance.getGwei());
4243
assertNotNull(balance.getAddress());
43-
assertNotEquals(0,balance.getWei());
44+
assertNotEquals(BigInteger.ZERO,balance.getWei());
4445
assertNotNull(balance.toString());
4546
}
4647
}

‎src/test/java/io/api/etherscan/account/AccountBalanceTest.java‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
importorg.junit.runners.Parameterized;
1111
importorg.junit.runners.Parameterized.Parameters;
1212

13+
importjava.math.BigInteger;
1314
importjava.util.Arrays;
1415
importjava.util.Collection;
1516

@@ -74,7 +75,7 @@ public void correct() {
7475
assertNotNull(balance.getGwei());
7576
assertNotNull(balance.getEther());
7677
assertNotNull(balance.getAddress());
77-
assertNotEquals(0,balance.getWei());
78+
assertNotEquals(BigInteger.ZERO,balance.getWei());
7879
assertNotNull(balance.toString());
7980
}
8081

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp