You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2021/08/04 09:35:07 UTC
[GitHub] [shardingsphere] terrymanu commented on a change in pull request #11641: Modify the conditional expression
terrymanu commented on a change in pull request #11641:
URL: https://github.com/apache/shardingsphere/pull/11641#discussion_r682453005
##########
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:
This is guard clauses, please keep the original codes
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org