commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1155559 - in /commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator: IsEquivalent.java IsGreaterThan.java IsGreaterThanOrEqual.java IsLessThan.java IsLessThanOrEqual.java IsNotEquivalent.java
Date Tue, 09 Aug 2011 20:51:26 GMT
Author: simonetripodi
Date: Tue Aug  9 20:51:26 2011
New Revision: 1155559

URL: http://svn.apache.org/viewvc?rev=1155559&view=rev
Log:
fixed checkstyle NP_NULL_ON_SOME_PATH violation: There is a branch of statement that, if executed,
guarantees that a null value will be dereferenced, which would generate a NullPointerException
when the code is executed.

Modified:
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsEquivalent.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsGreaterThan.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsGreaterThanOrEqual.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsLessThan.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsLessThanOrEqual.java
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsNotEquivalent.java

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsEquivalent.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsEquivalent.java?rev=1155559&r1=1155558&r2=1155559&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsEquivalent.java
(original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsEquivalent.java
Tue Aug  9 20:51:26 2011
@@ -90,7 +90,13 @@ public final class IsEquivalent<T> imple
      * @return boolean
      */
     public boolean equals(IsEquivalent<?> that) {
-        return null != that && null == comparator ? null == that.comparator : comparator.equals(that.comparator);
+        if (null != that) {
+            if (null == comparator) {
+                return null == that.comparator;
+            }
+            return comparator.equals(that.comparator);
+        }
+        return false;
     }
 
     /**

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsGreaterThan.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsGreaterThan.java?rev=1155559&r1=1155558&r2=1155559&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsGreaterThan.java
(original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsGreaterThan.java
Tue Aug  9 20:51:26 2011
@@ -88,7 +88,13 @@ public final class IsGreaterThan<T> impl
      * @return boolean
      */
     public boolean equals(IsGreaterThan<?> that) {
-        return null != that && null == comparator ? null == that.comparator : comparator.equals(that.comparator);
+        if (null != that) {
+            if (null == comparator) {
+                return null == that.comparator;
+            }
+            return comparator.equals(that.comparator);
+        }
+        return false;
     }
 
     /**

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsGreaterThanOrEqual.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsGreaterThanOrEqual.java?rev=1155559&r1=1155558&r2=1155559&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsGreaterThanOrEqual.java
(original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsGreaterThanOrEqual.java
Tue Aug  9 20:51:26 2011
@@ -89,7 +89,13 @@ public final class IsGreaterThanOrEqual<
      * @return boolean
      */
     public boolean equals(IsGreaterThanOrEqual<?> that) {
-        return null != that && null == comparator ? null == that.comparator : comparator.equals(that.comparator);
+        if (null != that) {
+            if (null == comparator) {
+                return null == that.comparator;
+            }
+            return comparator.equals(that.comparator);
+        }
+        return false;
     }
 
     /**

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsLessThan.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsLessThan.java?rev=1155559&r1=1155558&r2=1155559&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsLessThan.java
(original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsLessThan.java
Tue Aug  9 20:51:26 2011
@@ -88,7 +88,13 @@ public final class IsLessThan<T> impleme
      * @return boolean
      */
     public boolean equals(IsLessThan<?> that) {
-        return null != that && null == comparator ? null == that.comparator : comparator.equals(that.comparator);
+        if (null != that) {
+            if (null == comparator) {
+                return null == that.comparator;
+            }
+            return comparator.equals(that.comparator);
+        }
+        return false;
     }
 
     /**

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsLessThanOrEqual.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsLessThanOrEqual.java?rev=1155559&r1=1155558&r2=1155559&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsLessThanOrEqual.java
(original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsLessThanOrEqual.java
Tue Aug  9 20:51:26 2011
@@ -88,7 +88,13 @@ public final class IsLessThanOrEqual<T> 
      * @return boolean
      */
     public boolean equals(IsLessThanOrEqual<?> that) {
-        return null != that && null == comparator ? null == that.comparator : comparator.equals(that.comparator);
+        if (null != that) {
+            if (null == comparator) {
+                return null == that.comparator;
+            }
+            return comparator.equals(that.comparator);
+        }
+        return false;
     }
 
     /**

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsNotEquivalent.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsNotEquivalent.java?rev=1155559&r1=1155558&r2=1155559&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsNotEquivalent.java
(original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsNotEquivalent.java
Tue Aug  9 20:51:26 2011
@@ -90,7 +90,13 @@ public final class IsNotEquivalent<T> im
      * @return boolean
      */
     public boolean equals(IsNotEquivalent<?> that) {
-        return null != that && null == comparator ? null == that.comparator : comparator.equals(that.comparator);
+        if (null != that) {
+            if (null == comparator) {
+                return null == that.comparator;
+            }
+            return comparator.equals(that.comparator);
+        }
+        return false;
     }
 
     /**



Mime
View raw message