yx9o commented on a change in pull request #11641:
URL: https://github.com/apache/shardingsphere/pull/11641#discussion_r682528589
##########
File path:
shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/resultset/ResultSetUtil.java
##########
@@ -115,14 +115,14 @@ public static Object convertBigDecimalValue(final Object
value, final boolean ne
}
private static BigDecimal adjustBigDecimalResult(final BigDecimal value,
final boolean needScale, final int scale) {
- if (needScale) {
- try {
- return value.setScale(scale);
- } catch (final ArithmeticException ex) {
- return value.setScale(scale, BigDecimal.ROUND_HALF_UP);
- }
- }
- return value;
+ if (!needScale){
+ return value;
+ }
+ try {
+ return value.setScale(scale);
+ } catch (final ArithmeticException ex) {
+ return value.setScale(scale, BigDecimal.ROUND_HALF_UP);
+ }
Review comment:
Hi, the code has been rolled back, please review.
But I think the modified statement conforms to the guard clauses, and the
code is more concise.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]