cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbros...@apache.org
Subject cassandra git commit: FBUtilities.getProtectedField never returns null
Date Wed, 18 Mar 2015 02:24:44 GMT
Repository: cassandra
Updated Branches:
  refs/heads/trunk 45259f095 -> 201004d9a


FBUtilities.getProtectedField never returns null


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/201004d9
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/201004d9
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/201004d9

Branch: refs/heads/trunk
Commit: 201004d9a62307af1a0a419caadbfe99d8b72c66
Parents: 45259f0
Author: Dave Brosius <dbrosius@mebigfatguy.com>
Authored: Tue Mar 17 22:24:33 2015 -0400
Committer: Dave Brosius <dbrosius@mebigfatguy.com>
Committed: Tue Mar 17 22:24:33 2015 -0400

----------------------------------------------------------------------
 src/java/org/apache/cassandra/utils/CLibrary.java        | 6 ------
 src/java/org/apache/cassandra/utils/FBUtilities.java     | 7 ++-----
 test/unit/org/apache/cassandra/auth/RoleOptionsTest.java | 1 -
 3 files changed, 2 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/201004d9/src/java/org/apache/cassandra/utils/CLibrary.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/utils/CLibrary.java b/src/java/org/apache/cassandra/utils/CLibrary.java
index 4dbd904..25f7e5a 100644
--- a/src/java/org/apache/cassandra/utils/CLibrary.java
+++ b/src/java/org/apache/cassandra/utils/CLibrary.java
@@ -281,9 +281,6 @@ public final class CLibrary
     {
         Field field = FBUtilities.getProtectedField(channel.getClass(), "fd");
 
-        if (field == null)
-            return -1;
-
         try
         {
             return getfd((FileDescriptor)field.get(channel));
@@ -304,9 +301,6 @@ public final class CLibrary
     {
         Field field = FBUtilities.getProtectedField(descriptor.getClass(), "fd");
 
-        if (field == null)
-            return -1;
-
         try
         {
             return field.getInt(descriptor);

http://git-wip-us.apache.org/repos/asf/cassandra/blob/201004d9/src/java/org/apache/cassandra/utils/FBUtilities.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/utils/FBUtilities.java b/src/java/org/apache/cassandra/utils/FBUtilities.java
index 2263e46..be7cbd8 100644
--- a/src/java/org/apache/cassandra/utils/FBUtilities.java
+++ b/src/java/org/apache/cassandra/utils/FBUtilities.java
@@ -532,19 +532,16 @@ public class FBUtilities
      */
     public static Field getProtectedField(Class klass, String fieldName)
     {
-        Field field;
-
         try
         {
-            field = klass.getDeclaredField(fieldName);
+            Field field = klass.getDeclaredField(fieldName);
             field.setAccessible(true);
+            return field;
         }
         catch (Exception e)
         {
             throw new AssertionError(e);
         }
-
-        return field;
     }
 
     public static <T> CloseableIterator<T> closeableIterator(Iterator<T>
iterator)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/201004d9/test/unit/org/apache/cassandra/auth/RoleOptionsTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/auth/RoleOptionsTest.java b/test/unit/org/apache/cassandra/auth/RoleOptionsTest.java
index 71f0c97..6dea2b5 100644
--- a/test/unit/org/apache/cassandra/auth/RoleOptionsTest.java
+++ b/test/unit/org/apache/cassandra/auth/RoleOptionsTest.java
@@ -118,7 +118,6 @@ public class RoleOptionsTest
     private void setupRoleManager(IRoleManager manager)
     {
         Field field = FBUtilities.getProtectedField(DatabaseDescriptor.class, "roleManager");
-        field.setAccessible(true);
         try
         {
             field.set(null, manager);


Mime
View raw message