Skip to content

Commit fa1e580

Browse files
authored
Merge pull request tronprotocol#2666 from Starsakary/develop
Sonar catches combine
2 parents c739efc + 3074abc commit fa1e580

File tree

12 files changed

+12
-64
lines changed

12 files changed

+12
-64
lines changed

actuator/src/main/java/org/tron/core/actuator/CreateAccountActuator.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,7 @@ public boolean execute(Object result)
5252
Commons.adjustBalance(accountStore, accountStore.getBlackhole().createDbKey(), fee);
5353

5454
ret.setStatus(fee, code.SUCESS);
55-
} catch (BalanceInsufficientException e) {
56-
logger.debug(e.getMessage(), e);
57-
ret.setStatus(fee, code.FAILED);
58-
throw new ContractExeException(e.getMessage());
59-
} catch (InvalidProtocolBufferException e) {
55+
} catch (BalanceInsufficientException | InvalidProtocolBufferException e) {
6056
logger.debug(e.getMessage(), e);
6157
ret.setStatus(fee, code.FAILED);
6258
throw new ContractExeException(e.getMessage());

actuator/src/main/java/org/tron/core/actuator/ExchangeCreateActuator.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,7 @@ public boolean execute(Object object) throws ContractExeException {
120120

121121
ret.setExchangeId(id);
122122
ret.setStatus(fee, code.SUCESS);
123-
} catch (BalanceInsufficientException e) {
124-
logger.debug(e.getMessage(), e);
125-
ret.setStatus(fee, code.FAILED);
126-
throw new ContractExeException(e.getMessage());
127-
} catch (InvalidProtocolBufferException e) {
123+
} catch (BalanceInsufficientException| InvalidProtocolBufferException e) {
128124
logger.debug(e.getMessage(), e);
129125
ret.setStatus(fee, code.FAILED);
130126
throw new ContractExeException(e.getMessage());

actuator/src/main/java/org/tron/core/actuator/ExchangeTransactionActuator.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,7 @@ public boolean execute(Object object) throws ContractExeException {
9393

9494
ret.setExchangeReceivedAmount(anotherTokenQuant);
9595
ret.setStatus(fee, code.SUCESS);
96-
} catch (ItemNotFoundException e) {
97-
logger.debug(e.getMessage(), e);
98-
ret.setStatus(fee, code.FAILED);
99-
throw new ContractExeException(e.getMessage());
100-
} catch (InvalidProtocolBufferException e) {
96+
} catch (ItemNotFoundException | InvalidProtocolBufferException e) {
10197
logger.debug(e.getMessage(), e);
10298
ret.setStatus(fee, code.FAILED);
10399
throw new ContractExeException(e.getMessage());

actuator/src/main/java/org/tron/core/actuator/ExchangeWithdrawActuator.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,7 @@ public boolean execute(Object object) throws ContractExeException {
111111

112112
ret.setExchangeWithdrawAnotherAmount(anotherTokenQuant);
113113
ret.setStatus(fee, code.SUCESS);
114-
} catch (ItemNotFoundException e) {
115-
logger.debug(e.getMessage(), e);
116-
ret.setStatus(fee, code.FAILED);
117-
throw new ContractExeException(e.getMessage());
118-
} catch (InvalidProtocolBufferException e) {
114+
} catch (ItemNotFoundException | InvalidProtocolBufferException e) {
119115
logger.debug(e.getMessage(), e);
120116
ret.setStatus(fee, code.FAILED);
121117
throw new ContractExeException(e.getMessage());

actuator/src/main/java/org/tron/core/actuator/ParticipateAssetIssueActuator.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,7 @@ public boolean execute(Object object) throws ContractExeException {
9090
accountStore.put(ownerAddress, ownerAccount);
9191
accountStore.put(toAddress, toAccount);
9292
ret.setStatus(fee, Protocol.Transaction.Result.code.SUCESS);
93-
} catch (InvalidProtocolBufferException e) {
94-
logger.debug(e.getMessage(), e);
95-
ret.setStatus(fee, code.FAILED);
96-
throw new ContractExeException(e.getMessage());
97-
} catch (ArithmeticException e) {
93+
} catch (InvalidProtocolBufferException | ArithmeticException e) {
9894
logger.debug(e.getMessage(), e);
9995
ret.setStatus(fee, code.FAILED);
10096
throw new ContractExeException(e.getMessage());

actuator/src/main/java/org/tron/core/actuator/ProposalApproveActuator.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,7 @@ public boolean execute(Object result) throws ContractExeException {
5656
proposalStore.put(proposalCapsule.createDbKey(), proposalCapsule);
5757

5858
ret.setStatus(fee, code.SUCESS);
59-
} catch (ItemNotFoundException e) {
60-
logger.debug(e.getMessage(), e);
61-
ret.setStatus(fee, code.FAILED);
62-
throw new ContractExeException(e.getMessage());
63-
} catch (InvalidProtocolBufferException e) {
59+
} catch (ItemNotFoundException | InvalidProtocolBufferException e) {
6460
logger.debug(e.getMessage(), e);
6561
ret.setStatus(fee, code.FAILED);
6662
throw new ContractExeException(e.getMessage());

actuator/src/main/java/org/tron/core/actuator/ProposalDeleteActuator.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,7 @@ public boolean execute(Object result) throws ContractExeException {
4949
proposalStore.put(proposalCapsule.createDbKey(), proposalCapsule);
5050

5151
ret.setStatus(fee, code.SUCESS);
52-
} catch (InvalidProtocolBufferException e) {
53-
logger.debug(e.getMessage(), e);
54-
ret.setStatus(fee, code.FAILED);
55-
throw new ContractExeException(e.getMessage());
56-
} catch (ItemNotFoundException e) {
52+
} catch (InvalidProtocolBufferException | ItemNotFoundException e) {
5753
logger.debug(e.getMessage(), e);
5854
ret.setStatus(fee, code.FAILED);
5955
throw new ContractExeException(e.getMessage());

actuator/src/main/java/org/tron/core/actuator/TransferActuator.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,7 @@ public boolean execute(Object object) throws ContractExeException {
6060
ret.setStatus(fee, code.SUCESS);
6161
Commons.adjustBalance(accountStore, ownerAddress, -amount);
6262
Commons.adjustBalance(accountStore, toAddress, amount);
63-
} catch (BalanceInsufficientException e) {
64-
logger.debug(e.getMessage(), e);
65-
ret.setStatus(fee, code.FAILED);
66-
throw new ContractExeException(e.getMessage());
67-
} catch (ArithmeticException e) {
68-
logger.debug(e.getMessage(), e);
69-
ret.setStatus(fee, code.FAILED);
70-
throw new ContractExeException(e.getMessage());
71-
} catch (InvalidProtocolBufferException e) {
63+
} catch (BalanceInsufficientException | ArithmeticException | InvalidProtocolBufferException e) {
7264
logger.debug(e.getMessage(), e);
7365
ret.setStatus(fee, code.FAILED);
7466
throw new ContractExeException(e.getMessage());

actuator/src/main/java/org/tron/core/actuator/WitnessCreateActuator.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,7 @@ public boolean execute(Object object) throws ContractExeException {
4141
.unpack(WitnessCreateContract.class);
4242
this.createWitness(witnessCreateContract);
4343
ret.setStatus(fee, code.SUCESS);
44-
} catch (InvalidProtocolBufferException e) {
45-
logger.debug(e.getMessage(), e);
46-
ret.setStatus(fee, code.FAILED);
47-
throw new ContractExeException(e.getMessage());
48-
} catch (BalanceInsufficientException e) {
44+
} catch (InvalidProtocolBufferException | BalanceInsufficientException e) {
4945
logger.debug(e.getMessage(), e);
5046
ret.setStatus(fee, code.FAILED);
5147
throw new ContractExeException(e.getMessage());

chainbase/src/main/java/org/tron/core/capsule/TransactionCapsule.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -588,13 +588,7 @@ public boolean validatePubSignature(AccountStore accountStore,
588588
isVerified = false;
589589
throw new ValidateSignatureException("sig error");
590590
}
591-
} catch (SignatureException e) {
592-
isVerified = false;
593-
throw new ValidateSignatureException(e.getMessage());
594-
} catch (PermissionException e) {
595-
isVerified = false;
596-
throw new ValidateSignatureException(e.getMessage());
597-
} catch (SignatureFormatException e) {
591+
} catch (SignatureException | PermissionException | SignatureFormatException e) {
598592
isVerified = false;
599593
throw new ValidateSignatureException(e.getMessage());
600594
}

framework/src/main/java/org/tron/core/actuator/ActuatorFactory.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,7 @@ public static List<Actuator> createActuator(TransactionCapsule transactionCapsul
3939
try {
4040
actuatorList
4141
.add(getActuatorByContract(contract, manager, transactionCapsule));
42-
} catch (IllegalAccessException e) {
43-
e.printStackTrace();
44-
} catch (InstantiationException e) {
42+
} catch (IllegalAccessException | InstantiationException e) {
4543
e.printStackTrace();
4644
}
4745
});

framework/src/main/java/org/tron/core/config/args/Args.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -266,11 +266,7 @@ public static void setParam(final String[] args, final String confFileName) {
266266
ECKey ecKeyPair = credentials.getEcKeyPair();
267267
String prikey = ByteArray.toHexString(ecKeyPair.getPrivKeyBytes());
268268
privateKeys.add(prikey);
269-
} catch (IOException e) {
270-
logger.error(e.getMessage());
271-
logger.error("Witness node start faild!");
272-
exit(-1);
273-
} catch (CipherException e) {
269+
} catch (IOException | CipherException e) {
274270
logger.error(e.getMessage());
275271
logger.error("Witness node start faild!");
276272
exit(-1);

0 commit comments

Comments
 (0)