commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1227598 - in /commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils: BeanProcessor.java wrappers/StringTrimmedResultSet.java
Date Thu, 05 Jan 2012 14:04:48 GMT
Author: simonetripodi
Date: Thu Jan  5 14:04:47 2012
New Revision: 1227598

URL: http://svn.apache.org/viewvc?rev=1227598&view=rev
Log:
fixed PMD violation: if statements can be nested

Modified:
    commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/BeanProcessor.java
    commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/wrappers/StringTrimmedResultSet.java

Modified: commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/BeanProcessor.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/BeanProcessor.java?rev=1227598&r1=1227597&r2=1227598&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/BeanProcessor.java
(original)
+++ commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/BeanProcessor.java
Thu Jan  5 14:04:47 2012
@@ -234,17 +234,15 @@ public class BeanProcessor {
         Class<?>[] params = setter.getParameterTypes();
         try {
             // convert types for some popular ones
-            if (value != null) {
-                if (value instanceof java.util.Date) {
-                    if (params[0].getName().equals("java.sql.Date")) {
-                        value = new java.sql.Date(((java.util.Date) value).getTime());
-                    } else
-                    if (params[0].getName().equals("java.sql.Time")) {
-                        value = new java.sql.Time(((java.util.Date) value).getTime());
-                    } else
-                    if (params[0].getName().equals("java.sql.Timestamp")) {
-                        value = new java.sql.Timestamp(((java.util.Date) value).getTime());
-                    }
+            if (value != null && value instanceof java.util.Date) {
+                if (params[0].getName().equals("java.sql.Date")) {
+                    value = new java.sql.Date(((java.util.Date) value).getTime());
+                } else
+                if (params[0].getName().equals("java.sql.Time")) {
+                    value = new java.sql.Time(((java.util.Date) value).getTime());
+                } else
+                if (params[0].getName().equals("java.sql.Timestamp")) {
+                    value = new java.sql.Timestamp(((java.util.Date) value).getTime());
                 }
             }
 

Modified: commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/wrappers/StringTrimmedResultSet.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/wrappers/StringTrimmedResultSet.java?rev=1227598&r1=1227597&r2=1227598&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/wrappers/StringTrimmedResultSet.java
(original)
+++ commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/wrappers/StringTrimmedResultSet.java
Thu Jan  5 14:04:47 2012
@@ -96,12 +96,10 @@ public class StringTrimmedResultSet impl
 
         Object result = method.invoke(this.rs, args);
 
-        if (method.getName().equals("getObject")
-            || method.getName().equals("getString")) {
-
-            if (result instanceof String) {
-                result = ((String) result).trim();
-            }
+        if ((method.getName().equals("getObject")
+            || method.getName().equals("getString"))
+                && result instanceof String) {
+            result = ((String) result).trim();
         }
 
         return result;



Mime
View raw message