You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2024/08/18 12:38:29 UTC

(commons-beanutils) 08/34: Remove redundant parentheses

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-beanutils.git

commit 39929537e4f33fcb46c66e04034f04d1a8a9be7f
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Aug 18 08:22:51 2024 -0400

    Remove redundant parentheses
    
    Use final
---
 .../commons/beanutils2/converters/DateTimeConverter.java       | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/main/java/org/apache/commons/beanutils2/converters/DateTimeConverter.java b/src/main/java/org/apache/commons/beanutils2/converters/DateTimeConverter.java
index 788e8b21..d3cd30d4 100644
--- a/src/main/java/org/apache/commons/beanutils2/converters/DateTimeConverter.java
+++ b/src/main/java/org/apache/commons/beanutils2/converters/DateTimeConverter.java
@@ -142,16 +142,16 @@ public abstract class DateTimeConverter<D> extends AbstractConverter<D> {
         } else if (value instanceof Long) {
             date = new Date(((Long) value).longValue());
         } else if (value instanceof LocalDateTime) {
-            date = java.sql.Timestamp.valueOf(((LocalDateTime) value));
+            date = java.sql.Timestamp.valueOf((LocalDateTime) value);
         } else if (value instanceof LocalDate) {
-            date = java.sql.Date.valueOf(((LocalDate) value));
+            date = java.sql.Date.valueOf((LocalDate) value);
         } else if (value instanceof ZonedDateTime) {
             date = Date.from(((ZonedDateTime) value).toInstant());
         } else if (value instanceof OffsetDateTime) {
             date = Date.from(((OffsetDateTime) value).toInstant());
         } else if (value instanceof TemporalAccessor) {
             // Backstop for other TemporalAccessor implementations.
-            date = Date.from(Instant.from(((TemporalAccessor) value)));
+            date = Date.from(Instant.from((TemporalAccessor) value));
         }
 
         String result = null;
@@ -221,7 +221,7 @@ public abstract class DateTimeConverter<D> extends AbstractConverter<D> {
             //      didn't include the milliseconds. The following code
             //      ensures it works consistently across JDK versions
             final java.sql.Timestamp timestamp = (java.sql.Timestamp)value;
-            long timeInMillis = ((timestamp.getTime() / 1000) * 1000);
+            long timeInMillis = timestamp.getTime() / 1000 * 1000;
             timeInMillis += timestamp.getNanos() / 1000000;
 
             return toDate(targetType, timeInMillis);
@@ -449,7 +449,7 @@ public abstract class DateTimeConverter<D> extends AbstractConverter<D> {
         format.setLenient(false);
         final ParsePosition pos = new ParsePosition(0);
         final Date parsedDate = format.parse(value, pos); // ignore the result (use the Calendar)
-        int errorIndex = pos.getErrorIndex();
+        final int errorIndex = pos.getErrorIndex();
         if (errorIndex >= 0 || pos.getIndex() != value.length() || parsedDate == null) {
             String msg = "Error converting '" + toString(sourceType) + "' to '" + toString(targetType) + "'";
             if (format instanceof SimpleDateFormat) {