diff --git a/checkstyle.xml b/checkstyle.xml
index efb060454b..6397b0f864 100644
--- a/checkstyle.xml
+++ b/checkstyle.xml
@@ -18,5 +18,14 @@ IOTA checkstyle draft
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/com/iota/iri/Iota.java b/src/main/java/com/iota/iri/Iota.java
index f0e350fdd9..feb18de35a 100644
--- a/src/main/java/com/iota/iri/Iota.java
+++ b/src/main/java/com/iota/iri/Iota.java
@@ -68,7 +68,7 @@ public void init() throws Exception {
tangle.init();
if (configuration.isRescanDb()){
- rescan_db();
+ rescanDb();
}
if (configuration.isRevalidate()) {
@@ -85,7 +85,7 @@ public void init() throws Exception {
node.init();
}
- private void rescan_db() throws Exception {
+ private void rescanDb() throws Exception {
//delete all transaction indexes
tangle.clearColumn(com.iota.iri.model.Address.class);
tangle.clearColumn(com.iota.iri.model.Bundle.class);
diff --git a/src/main/java/com/iota/iri/MilestoneTracker.java b/src/main/java/com/iota/iri/MilestoneTracker.java
index 7606f87fdb..2ab99f68ec 100644
--- a/src/main/java/com/iota/iri/MilestoneTracker.java
+++ b/src/main/java/com/iota/iri/MilestoneTracker.java
@@ -77,7 +77,7 @@ public MilestoneTracker(Tangle tangle,
}
private boolean shuttingDown;
- private static int RESCAN_INTERVAL = 5000;
+ private static final int RESCAN_INTERVAL = 5000;
public void init (SpongeFactory.Mode mode, LedgerValidator ledgerValidator) {
this.ledgerValidator = ledgerValidator;
diff --git a/src/main/java/com/iota/iri/TransactionValidator.java b/src/main/java/com/iota/iri/TransactionValidator.java
index f6b8313381..f0b3af7e5b 100644
--- a/src/main/java/com/iota/iri/TransactionValidator.java
+++ b/src/main/java/com/iota/iri/TransactionValidator.java
@@ -31,8 +31,8 @@ public class TransactionValidator {
private int MIN_WEIGHT_MAGNITUDE = 81;
private static long snapshotTimestamp;
private static long snapshotTimestampMs;
- private static long MAX_TIMESTAMP_FUTURE = 2 * 60 * 60;
- private static long MAX_TIMESTAMP_FUTURE_MS = MAX_TIMESTAMP_FUTURE * 1000;
+ private static final long MAX_TIMESTAMP_FUTURE = 2 * 60 * 60;
+ private static final long MAX_TIMESTAMP_FUTURE_MS = MAX_TIMESTAMP_FUTURE * 1000;
private Thread newSolidThread;
diff --git a/src/main/java/com/iota/iri/hash/Curl.java b/src/main/java/com/iota/iri/hash/Curl.java
index 6cc51188f1..cba69695d3 100644
--- a/src/main/java/com/iota/iri/hash/Curl.java
+++ b/src/main/java/com/iota/iri/hash/Curl.java
@@ -98,17 +98,17 @@ public void squeeze(final byte[] trits, int offset, int length) {
private void transform() {
int scratchpadIndex = 0;
- int prev_scratchpadIndex = 0;
+ int prevScratchpadIndex = 0;
for (int round = 0; round < numberOfRounds; round++) {
System.arraycopy(state, 0, scratchpad, 0, STATE_LENGTH);
for (int stateIndex = 0; stateIndex < STATE_LENGTH; stateIndex++) {
- prev_scratchpadIndex = scratchpadIndex;
+ prevScratchpadIndex = scratchpadIndex;
if (scratchpadIndex < 365) {
scratchpadIndex += 364;
} else {
scratchpadIndex += -365;
}
- state[stateIndex] = TRUTH_TABLE[scratchpad[prev_scratchpadIndex] + (scratchpad[scratchpadIndex] << 2) + 5];
+ state[stateIndex] = TRUTH_TABLE[scratchpad[prevScratchpadIndex] + (scratchpad[scratchpadIndex] << 2) + 5];
}
}
}
diff --git a/src/main/java/com/iota/iri/network/TransactionRequester.java b/src/main/java/com/iota/iri/network/TransactionRequester.java
index 14cb0179e7..edfb391cc7 100644
--- a/src/main/java/com/iota/iri/network/TransactionRequester.java
+++ b/src/main/java/com/iota/iri/network/TransactionRequester.java
@@ -35,10 +35,10 @@ public TransactionRequester(Tangle tangle, MessageQ messageQ) {
this.messageQ = messageQ;
}
- public void init(double p_REMOVE_REQUEST) {
+ public void init(double pRemoveRequest) {
if(!initialized) {
initialized = true;
- P_REMOVE_REQUEST = p_REMOVE_REQUEST;
+ P_REMOVE_REQUEST = pRemoveRequest;
}
}
diff --git a/src/main/java/com/iota/iri/network/replicator/ReplicatorSinkProcessor.java b/src/main/java/com/iota/iri/network/replicator/ReplicatorSinkProcessor.java
index 8084f243b8..f64f9267f3 100644
--- a/src/main/java/com/iota/iri/network/replicator/ReplicatorSinkProcessor.java
+++ b/src/main/java/com/iota/iri/network/replicator/ReplicatorSinkProcessor.java
@@ -91,12 +91,12 @@ public void run() {
try {
CRC32 crc32 = new CRC32();
crc32.update(message.array());
- String crc32_string = Long.toHexString(crc32.getValue());
- while (crc32_string.length() < CRC32_BYTES) {
- crc32_string = "0"+crc32_string;
+ String crc32String = Long.toHexString(crc32.getValue());
+ while (crc32String.length() < CRC32_BYTES) {
+ crc32String = "0"+crc32String;
}
out.write(message.array());
- out.write(crc32_string.getBytes());
+ out.write(crc32String.getBytes());
out.flush();
neighbor.incSentTransactions();
} catch (IOException e2) {
diff --git a/src/main/java/com/iota/iri/network/replicator/ReplicatorSourceProcessor.java b/src/main/java/com/iota/iri/network/replicator/ReplicatorSourceProcessor.java
index c12ca3e628..64053da736 100644
--- a/src/main/java/com/iota/iri/network/replicator/ReplicatorSourceProcessor.java
+++ b/src/main/java/com/iota/iri/network/replicator/ReplicatorSourceProcessor.java
@@ -57,16 +57,15 @@ public void run() {
boolean finallyClose = true;
try {
-
SocketAddress address = connection.getRemoteSocketAddress();
- InetSocketAddress inet_socket_address = (InetSocketAddress) address;
+ InetSocketAddress inetSocketAddress = (InetSocketAddress) address;
existingNeighbor = false;
List neighbors = node.getNeighbors();
neighbors.stream().filter(n -> n instanceof TCPNeighbor)
.map(n -> ((TCPNeighbor) n))
.forEach(n -> {
- String hisAddress = inet_socket_address.getAddress().getHostAddress();
+ String hisAddress = inetSocketAddress.getAddress().getHostAddress();
if (n.getHostAddress().equals(hisAddress)) {
existingNeighbor = true;
neighbor = n;
@@ -76,11 +75,11 @@ public void run() {
if (!existingNeighbor) {
int maxPeersAllowed = maxPeers;
if (!testnet || Neighbor.getNumPeers() >= maxPeersAllowed) {
- String hostAndPort = inet_socket_address.getHostName() + ":" + String.valueOf(inet_socket_address.getPort());
- if (Node.rejectedAddresses.add(inet_socket_address.getHostName())) {
+ String hostAndPort = inetSocketAddress.getHostName() + ":" + String.valueOf(inetSocketAddress.getPort());
+ if (Node.rejectedAddresses.add(inetSocketAddress.getHostName())) {
String sb = "***** NETWORK ALERT ***** Got connected from unknown neighbor tcp://"
+ hostAndPort
- + " (" + inet_socket_address.getAddress().getHostAddress() + ") - closing connection";
+ + " (" + inetSocketAddress.getAddress().getHostAddress() + ") - closing connection";
if (testnet && Neighbor.getNumPeers() >= maxPeersAllowed) {
sb = sb + (" (max-peers allowed is "+String.valueOf(maxPeersAllowed)+")");
}
@@ -92,15 +91,15 @@ public void run() {
connection.close();
return;
} else {
- final TCPNeighbor fresh_neighbor = new TCPNeighbor(inet_socket_address, false);
- node.getNeighbors().add(fresh_neighbor);
- neighbor = fresh_neighbor;
+ final TCPNeighbor freshNeighbor = new TCPNeighbor(inetSocketAddress, false);
+ node.getNeighbors().add(freshNeighbor);
+ neighbor = freshNeighbor;
Neighbor.incNumPeers();
}
}
if ( neighbor.getSource() != null ) {
- log.info("Source {} already connected", inet_socket_address.getAddress().getHostAddress());
+ log.info("Source {} already connected", inetSocketAddress.getAddress().getHostAddress());
finallyClose = false;
return;
}
@@ -128,7 +127,7 @@ public void run() {
}
if (connection.isConnected()) {
- log.info("----- NETWORK INFO ----- Source {} is connected", inet_socket_address.getAddress().getHostAddress());
+ log.info("----- NETWORK INFO ----- Source {} is connected", inetSocketAddress.getAddress().getHostAddress());
}
connection.setSoTimeout(0); // infinite timeout - blocking read
@@ -152,15 +151,15 @@ public void run() {
for (int i=0; i addresses) throws Exception {
final List addressesHash = addresses.stream().map(Hash::new).collect(Collectors.toList());
@@ -377,7 +377,7 @@ private AbstractResponse wereAddressesSpentFromStatement(List addresses)
for (Hash address : addressesHash) {
states[index++] = wasAddressSpentFrom(address);
}
- return wereAddressesSpentFrom.create(states);
+ return WereAddressesSpentFrom.create(states);
}
private boolean wasAddressSpentFrom(Hash address) throws Exception {
@@ -602,19 +602,19 @@ private synchronized AbstractResponse getTrytesStatement(List hashes) th
return GetTrytesResponse.create(elements);
}
- private static int counter_getTxToApprove = 0;
- public static int getCounter_getTxToApprove() {
- return counter_getTxToApprove;
+ private static int counterGetTxToApprove = 0;
+ public static int getCounterGetTxToApprove() {
+ return counterGetTxToApprove;
}
- public static void incCounter_getTxToApprove() {
- counter_getTxToApprove++;
+ public static void incCounteGetTxToApprove() {
+ counterGetTxToApprove++;
}
private static long ellapsedTime_getTxToApprove = 0L;
- public static long getEllapsedTime_getTxToApprove() {
+ public static long getEllapsedTimeGetTxToApprove() {
return ellapsedTime_getTxToApprove;
}
- public static void incEllapsedTime_getTxToApprove(long ellapsedTime) {
+ public static void incEllapsedTimeGetTxToApprove(long ellapsedTime) {
ellapsedTime_getTxToApprove += ellapsedTime;
}
@@ -646,11 +646,11 @@ public synchronized List getTransactionsToApproveStatement(int depth, Opti
}
private void gatherStatisticsOnTipSelection() {
- API.incCounter_getTxToApprove();
- if ((getCounter_getTxToApprove() % 100) == 0) {
- String sb = "Last 100 getTxToApprove consumed " + API.getEllapsedTime_getTxToApprove() / 1000000000L + " seconds processing time.";
+ API.incCounteGetTxToApprove();
+ if ((getCounterGetTxToApprove() % 100) == 0) {
+ String sb = "Last 100 getTxToApprove consumed " + API.getEllapsedTimeGetTxToApprove() / 1000000000L + " seconds processing time.";
log.debug(sb);
- counter_getTxToApprove = 0;
+ counterGetTxToApprove = 0;
ellapsedTime_getTxToApprove = 0L;
}
}
@@ -1033,18 +1033,18 @@ private AbstractResponse getBalancesStatement(final List addresses, fina
}
private static int counter_PoW = 0;
- public static int getCounter_PoW() {
+ public static int getCounterPoW() {
return counter_PoW;
}
- public static void incCounter_PoW() {
+ public static void incCounterPoW() {
API.counter_PoW++;
}
private static long ellapsedTime_PoW = 0L;
- public static long getEllapsedTime_PoW() {
+ public static long getEllapsedTimePoW() {
return ellapsedTime_PoW;
}
- public static void incEllapsedTime_PoW(long ellapsedTime) {
+ public static void incEllapsedTimePoW(long ellapsedTime) {
ellapsedTime_PoW += ellapsedTime;
}
@@ -1109,11 +1109,11 @@ public synchronized List attachToTangleStatement(final Hash trunkTransac
transactionViewModels.add(transactionViewModel);
prevTransaction = transactionViewModel.getHash();
} finally {
- API.incEllapsedTime_PoW(System.nanoTime() - startTime);
- API.incCounter_PoW();
- if ( ( API.getCounter_PoW() % 100) == 0 ) {
+ API.incEllapsedTimePoW(System.nanoTime() - startTime);
+ API.incCounterPoW();
+ if ( ( API.getCounterPoW() % 100) == 0 ) {
String sb = "Last 100 PoW consumed " +
- API.getEllapsedTime_PoW() / 1000000000L +
+ API.getEllapsedTimePoW() / 1000000000L +
" seconds processing time.";
log.info(sb);
counter_PoW = 0;
diff --git a/src/main/java/com/iota/iri/service/dto/wereAddressesSpentFrom.java b/src/main/java/com/iota/iri/service/dto/WereAddressesSpentFrom.java
similarity index 74%
rename from src/main/java/com/iota/iri/service/dto/wereAddressesSpentFrom.java
rename to src/main/java/com/iota/iri/service/dto/WereAddressesSpentFrom.java
index d25adbc36c..61dc5b987a 100644
--- a/src/main/java/com/iota/iri/service/dto/wereAddressesSpentFrom.java
+++ b/src/main/java/com/iota/iri/service/dto/WereAddressesSpentFrom.java
@@ -1,11 +1,11 @@
package com.iota.iri.service.dto;
-public class wereAddressesSpentFrom extends AbstractResponse {
+public class WereAddressesSpentFrom extends AbstractResponse {
private boolean [] states;
public static AbstractResponse create(boolean[] inclusionStates) {
- wereAddressesSpentFrom res = new wereAddressesSpentFrom();
+ WereAddressesSpentFrom res = new WereAddressesSpentFrom();
res.states = inclusionStates;
return res;
}
diff --git a/src/main/java/com/iota/iri/utils/MapIdentityManager.java b/src/main/java/com/iota/iri/utils/MapIdentityManager.java
index 4f7bb10c37..f8ce3e0e6b 100644
--- a/src/main/java/com/iota/iri/utils/MapIdentityManager.java
+++ b/src/main/java/com/iota/iri/utils/MapIdentityManager.java
@@ -49,20 +49,20 @@ private boolean verifyCredential(Account account, Credential credential) {
if (credential instanceof PasswordCredential) {
char[] givenPassword = ((PasswordCredential) credential).getPassword();
String trytes = Converter.asciiToTrytes(new String(givenPassword));
- byte[] in_trits = Converter.allocateTritsForTrytes(trytes.length());
- Converter.trits(trytes, in_trits, 0);
- byte[] hash_trits = new byte[Curl.HASH_LENGTH];
+ byte[] inTrits = Converter.allocateTritsForTrytes(trytes.length());
+ Converter.trits(trytes, inTrits, 0);
+ byte[] hashTrits = new byte[Curl.HASH_LENGTH];
Sponge curl;
curl = SpongeFactory.create(SpongeFactory.Mode.CURLP81);
- curl.absorb(in_trits, 0, in_trits.length);
- curl.squeeze(hash_trits, 0, Curl.HASH_LENGTH);
- String out_trytes = Converter.trytes(hash_trits);
- char[] char_out_trytes = out_trytes.toCharArray();
+ curl.absorb(inTrits, 0, inTrits.length);
+ curl.squeeze(hashTrits, 0, Curl.HASH_LENGTH);
+ String outTrytes = Converter.trytes(hashTrits);
+ char[] charOutTrytes = outTrytes.toCharArray();
char[] expectedPassword = users.get(account.getPrincipal().getName());
boolean verified = Arrays.equals(givenPassword, expectedPassword);
// Password can either be clear text or the hash of the password
if (!verified) {
- verified = Arrays.equals(char_out_trytes, expectedPassword);
+ verified = Arrays.equals(charOutTrytes, expectedPassword);
}
return verified;
}