ranger-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject incubator-ranger git commit: RANGER-851 PMD: Fix code that would violate EmptyFinallyBlock rule
Date Fri, 19 Feb 2016 21:39:59 GMT
Repository: incubator-ranger
Updated Branches:
  refs/heads/master 84ceac76a -> 073577dd7


RANGER-851 PMD: Fix code that would violate EmptyFinallyBlock rule


Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/073577dd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/073577dd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/073577dd

Branch: refs/heads/master
Commit: 073577dd786b105aa67d414f1e48b4e7d4aac1f4
Parents: 84ceac7
Author: Alok Lal <alok@apache.org>
Authored: Thu Feb 18 14:10:09 2016 -0800
Committer: Alok Lal <alok@apache.org>
Committed: Fri Feb 19 13:39:15 2016 -0800

----------------------------------------------------------------------
 .../audit/provider/hdfs/HdfsLogDestination.java |  2 +-
 .../utils/RangerCredentialProviderTest.java     |  2 --
 dev-support/ranger-pmd-ruleset.xml              |  1 -
 .../ranger/services/hdfs/client/HdfsClient.java |  2 --
 .../ranger/services/knox/client/KnoxClient.java | 32 ++++++++------------
 .../apache/ranger/hadoop/client/HadoopFS.java   |  2 --
 .../apache/ranger/knox/client/KnoxClient.java   | 31 ++++++++-----------
 .../org/apache/ranger/common/db/BaseDao.java    | 21 +++----------
 8 files changed, 31 insertions(+), 62 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/073577dd/agents-audit/src/main/java/org/apache/ranger/audit/provider/hdfs/HdfsLogDestination.java
----------------------------------------------------------------------
diff --git a/agents-audit/src/main/java/org/apache/ranger/audit/provider/hdfs/HdfsLogDestination.java
b/agents-audit/src/main/java/org/apache/ranger/audit/provider/hdfs/HdfsLogDestination.java
index a9aa8c1..61e8135 100644
--- a/agents-audit/src/main/java/org/apache/ranger/audit/provider/hdfs/HdfsLogDestination.java
+++ b/agents-audit/src/main/java/org/apache/ranger/audit/provider/hdfs/HdfsLogDestination.java
@@ -316,7 +316,7 @@ public class HdfsLogDestination<T> implements LogDestination<T>
{
 			}
 		} catch(Throwable ex) {
 			mLogger.warn("HdfsLogDestination.openFile() failed", ex);
-		} finally {
+//		} finally {
 			// TODO: unset the property set above to exclude auditing of logfile opening
 			//        System.setProperty(hdfsCurrentFilenameProperty, null);
 		}

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/073577dd/agents-cred/src/test/java/org/apache/ranger/authorization/hadoop/utils/RangerCredentialProviderTest.java
----------------------------------------------------------------------
diff --git a/agents-cred/src/test/java/org/apache/ranger/authorization/hadoop/utils/RangerCredentialProviderTest.java
b/agents-cred/src/test/java/org/apache/ranger/authorization/hadoop/utils/RangerCredentialProviderTest.java
index 7939ae5..686318b 100644
--- a/agents-cred/src/test/java/org/apache/ranger/authorization/hadoop/utils/RangerCredentialProviderTest.java
+++ b/agents-cred/src/test/java/org/apache/ranger/authorization/hadoop/utils/RangerCredentialProviderTest.java
@@ -84,8 +84,6 @@ public class RangerCredentialProviderTest {
 		} catch (Exception e) {
 			throw e;
 		}
-		finally {
-		}
 		assertEquals(0,ret);
 		System.out.println("(1) Number of active Threads : " + Thread.activeCount() ) ;
 		listThreads() ;

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/073577dd/dev-support/ranger-pmd-ruleset.xml
----------------------------------------------------------------------
diff --git a/dev-support/ranger-pmd-ruleset.xml b/dev-support/ranger-pmd-ruleset.xml
index 1f74845..5dd3851 100644
--- a/dev-support/ranger-pmd-ruleset.xml
+++ b/dev-support/ranger-pmd-ruleset.xml
@@ -56,7 +56,6 @@
   </rule>
   <rule ref="rulesets/java/empty.xml">
 	<exclude name="EmptyCatchBlock" />
-	<exclude name="EmptyFinallyBlock" />
 	<exclude name="EmptyIfStmt" />
 	<exclude name="EmptyStatementNotInLoop" />
 	<exclude name="EmptyWhileStmt" />

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/073577dd/hdfs-agent/src/main/java/org/apache/ranger/services/hdfs/client/HdfsClient.java
----------------------------------------------------------------------
diff --git a/hdfs-agent/src/main/java/org/apache/ranger/services/hdfs/client/HdfsClient.java
b/hdfs-agent/src/main/java/org/apache/ranger/services/hdfs/client/HdfsClient.java
index 779133f..7bfb016 100644
--- a/hdfs-agent/src/main/java/org/apache/ranger/services/hdfs/client/HdfsClient.java
+++ b/hdfs-agent/src/main/java/org/apache/ranger/services/hdfs/client/HdfsClient.java
@@ -125,8 +125,6 @@ public class HdfsClient extends BaseClient {
 				
 				throw hdpException;
 			}
-			finally {
-			}
 		} catch (IOException ioe) {
 			String msgDesc = "listFilesInternal: Unable to get listing of files for directory "
 					+ baseDir + fileMatching 

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/073577dd/knox-agent/src/main/java/org/apache/ranger/services/knox/client/KnoxClient.java
----------------------------------------------------------------------
diff --git a/knox-agent/src/main/java/org/apache/ranger/services/knox/client/KnoxClient.java
b/knox-agent/src/main/java/org/apache/ranger/services/knox/client/KnoxClient.java
index 6859492..2b6c92c 100644
--- a/knox-agent/src/main/java/org/apache/ranger/services/knox/client/KnoxClient.java
+++ b/knox-agent/src/main/java/org/apache/ranger/services/knox/client/KnoxClient.java
@@ -148,7 +148,6 @@ public class KnoxClient {
 			hdpException.generateResponseDataMap(false,
 					BaseClient.getMessage(t), msgDesc + errMsg, null, null);
 			throw hdpException;
-		} finally {
 		}
 		return topologyList;
 	}
@@ -243,8 +242,6 @@ public class KnoxClient {
 			hdpException.generateResponseDataMap(false,
 					BaseClient.getMessage(t), msgDesc + errMsg, null, null);
 			throw hdpException;
-
-		} finally {
 		}
 		return serviceList;
 	}
@@ -259,25 +256,22 @@ public class KnoxClient {
 			System.exit(1);
 		}
 
-		try {
-			knoxClient = new KnoxClient(args[0], args[1], args[2]);
-			List<String> topologyList = knoxClient.getTopologyList("",null);
-			if ((topologyList == null) || topologyList.isEmpty()) {
-				System.out.println("No knox topologies found");
-			} else {
-				for (String topology : topologyList) {
-					System.out.println("Found Topology: " + topology);
-					List<String> serviceList = knoxClient.getServiceList(topology, "",null);
-					if ((serviceList == null) || serviceList.isEmpty()) {
-						System.out.println("No services found for knox topology: " + topology);
-					} else {
-						for (String service : serviceList) {
-							System.out.println("	Found service for topology: " + service +", " + topology);
-						}
+		knoxClient = new KnoxClient(args[0], args[1], args[2]);
+		List<String> topologyList = knoxClient.getTopologyList("",null);
+		if ((topologyList == null) || topologyList.isEmpty()) {
+			System.out.println("No knox topologies found");
+		} else {
+			for (String topology : topologyList) {
+				System.out.println("Found Topology: " + topology);
+				List<String> serviceList = knoxClient.getServiceList(topology, "",null);
+				if ((serviceList == null) || serviceList.isEmpty()) {
+					System.out.println("No services found for knox topology: " + topology);
+				} else {
+					for (String service : serviceList) {
+						System.out.println("	Found service for topology: " + service +", " + topology);
 					}
 				}
 			}
-		} finally {
 		}
 	}
 	

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/073577dd/lookup-client/src/main/java/org/apache/ranger/hadoop/client/HadoopFS.java
----------------------------------------------------------------------
diff --git a/lookup-client/src/main/java/org/apache/ranger/hadoop/client/HadoopFS.java b/lookup-client/src/main/java/org/apache/ranger/hadoop/client/HadoopFS.java
index 10a83c3..e744a1d 100644
--- a/lookup-client/src/main/java/org/apache/ranger/hadoop/client/HadoopFS.java
+++ b/lookup-client/src/main/java/org/apache/ranger/hadoop/client/HadoopFS.java
@@ -101,8 +101,6 @@ public class HadoopFS extends BaseClient {
 						msgDesc + errMsg, null, null);
 				throw hdpException;
 			}
-			finally {
-			}
 		} catch (IOException ioe) {
 			String msgDesc = "listFilesInternal: Unable to get listing of files for directory "
 					+ baseDir

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/073577dd/lookup-client/src/main/java/org/apache/ranger/knox/client/KnoxClient.java
----------------------------------------------------------------------
diff --git a/lookup-client/src/main/java/org/apache/ranger/knox/client/KnoxClient.java b/lookup-client/src/main/java/org/apache/ranger/knox/client/KnoxClient.java
index 6441ec3..9137706 100644
--- a/lookup-client/src/main/java/org/apache/ranger/knox/client/KnoxClient.java
+++ b/lookup-client/src/main/java/org/apache/ranger/knox/client/KnoxClient.java
@@ -143,7 +143,6 @@ public class KnoxClient {
 			hdpException.generateResponseDataMap(false,
 					BaseClient.getMessage(t), msgDesc + errMsg, null, null);
 			throw hdpException;
-		} finally {
 		}
 		return topologyList;
 	}
@@ -231,7 +230,6 @@ public class KnoxClient {
 					BaseClient.getMessage(t), msgDesc + errMsg, null, null);
 			throw hdpException;
 
-		} finally {
 		}
 		return serviceList;
 	}
@@ -246,25 +244,22 @@ public class KnoxClient {
 			System.exit(1);
 		}
 
-		try {
-			knoxClient = new KnoxClient(args[0], args[1], args[2]);
-			List<String> topologyList = knoxClient.getTopologyList("");
-			if ((topologyList == null) || topologyList.isEmpty()) {
-				System.out.println("No knox topologies found");
-			} else {
-				for (String topology : topologyList) {
-					System.out.println("Found Topology: " + topology);
-					List<String> serviceList = knoxClient.getServiceList(topology, "");
-					if ((serviceList == null) || serviceList.isEmpty()) {
-						System.out.println("No services found for knox topology: " + topology);
-					} else {
-						for (String service : serviceList) {
-							System.out.println("	Found service for topology: " + service +", " + topology);
-						}
+		knoxClient = new KnoxClient(args[0], args[1], args[2]);
+		List<String> topologyList = knoxClient.getTopologyList("");
+		if ((topologyList == null) || topologyList.isEmpty()) {
+			System.out.println("No knox topologies found");
+		} else {
+			for (String topology : topologyList) {
+				System.out.println("Found Topology: " + topology);
+				List<String> serviceList = knoxClient.getServiceList(topology, "");
+				if ((serviceList == null) || serviceList.isEmpty()) {
+					System.out.println("No services found for knox topology: " + topology);
+				} else {
+					for (String service : serviceList) {
+						System.out.println("	Found service for topology: " + service +", " + topology);
 					}
 				}
 			}
-		} finally {
 		}
 	}
 	

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/073577dd/security-admin/src/main/java/org/apache/ranger/common/db/BaseDao.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/common/db/BaseDao.java b/security-admin/src/main/java/org/apache/ranger/common/db/BaseDao.java
index 514a63e..665d85c 100644
--- a/security-admin/src/main/java/org/apache/ranger/common/db/BaseDao.java
+++ b/security-admin/src/main/java/org/apache/ranger/common/db/BaseDao.java
@@ -158,16 +158,9 @@ public abstract class BaseDao<T> {
 			boolean userPrefFilter) {
 		// boolean filterEnabled = false;
 		List<T> rtrnList = null;
-		try {
-			// filterEnabled = enableVisiblityFilters(clazz, userPrefFilter);
-
-			rtrnList = query.getResultList();
-		} finally {
-			// if (filterEnabled) {
-			// disableVisiblityFilters(clazz);
-			// }
+		// filterEnabled = enableVisiblityFilters(clazz, userPrefFilter);
 
-		}
+		rtrnList = query.getResultList();
 
 		return rtrnList;
 	}
@@ -182,14 +175,8 @@ public abstract class BaseDao<T> {
 			Query query, boolean userPrefFilter) {
 		// boolean filterEnabled = false;
 		Long rtrnObj = null;
-		try {
-			// filterEnabled = enableVisiblityFilters(clazz, userPrefFilter);
-			rtrnObj = (Long) query.getSingleResult();
-		} finally {
-			// if (filterEnabled) {
-			// disableVisiblityFilters(clazz);
-			// }
-		}
+		// filterEnabled = enableVisiblityFilters(clazz, userPrefFilter);
+		rtrnObj = (Long) query.getSingleResult();
 
 		return rtrnObj;
 	}


Mime
View raw message