You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by ab...@apache.org on 2017/03/01 19:22:01 UTC

ranger git commit: RANGER-1413: Fix issues uncovered by static code analysis

Repository: ranger
Updated Branches:
  refs/heads/ranger-0.7 bbaf1e7df -> 9afb3eca8


RANGER-1413: Fix issues uncovered by static code analysis


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

Branch: refs/heads/ranger-0.7
Commit: 9afb3eca89e12f2c35c465a727ef498223c5ad86
Parents: bbaf1e7
Author: Abhay Kulkarni <ak...@hortonworks.com>
Authored: Mon Feb 27 12:32:27 2017 -0800
Committer: Abhay Kulkarni <ak...@hortonworks.com>
Committed: Wed Mar 1 11:21:45 2017 -0800

----------------------------------------------------------------------
 .../TestDefaultPolicyResourceMatcherForPolicy.java     | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ranger/blob/9afb3eca/agents-common/src/test/java/org/apache/ranger/plugin/resourcematcher/TestDefaultPolicyResourceMatcherForPolicy.java
----------------------------------------------------------------------
diff --git a/agents-common/src/test/java/org/apache/ranger/plugin/resourcematcher/TestDefaultPolicyResourceMatcherForPolicy.java b/agents-common/src/test/java/org/apache/ranger/plugin/resourcematcher/TestDefaultPolicyResourceMatcherForPolicy.java
index f4d76ad..3458c26 100644
--- a/agents-common/src/test/java/org/apache/ranger/plugin/resourcematcher/TestDefaultPolicyResourceMatcherForPolicy.java
+++ b/agents-common/src/test/java/org/apache/ranger/plugin/resourcematcher/TestDefaultPolicyResourceMatcherForPolicy.java
@@ -24,6 +24,7 @@ import static org.junit.Assert.*;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.lang.reflect.Type;
+import java.nio.charset.Charset;
 import java.util.List;
 import java.util.Map;
 
@@ -82,7 +83,7 @@ public class TestDefaultPolicyResourceMatcherForPolicy {
 	private void runTestsFromResourceFiles(String[] resourceNames) throws Exception {
 		for(String resourceName : resourceNames) {
 			InputStream       inStream = this.getClass().getResourceAsStream(resourceName);
-			InputStreamReader reader   = new InputStreamReader(inStream);
+			InputStreamReader reader   = new InputStreamReader(inStream, Charset.defaultCharset());
 
 			runTests(reader);
 		}
@@ -95,7 +96,7 @@ public class TestDefaultPolicyResourceMatcherForPolicy {
 			runTest(testCase, testCases.serviceDef);
 		}
 	}
-		private void runTest(DefaultPolicyResourceMatcherTestCases.TestCase testCase, RangerServiceDef serviceDef) throws Exception {
+	private void runTest(DefaultPolicyResourceMatcherTestCases.TestCase testCase, RangerServiceDef serviceDef) throws Exception {
 
 		assertTrue("invalid input: " , testCase != null && testCase.tests != null);
 
@@ -137,12 +138,12 @@ public class TestDefaultPolicyResourceMatcherForPolicy {
 
 		List<TestCase> testCases;
 
-		class TestCase {
-			public String name;
+		static class TestCase {
+			String name;
 			Map<String, RangerPolicyResource> policyResources;
-			public List<OneTest> tests;
+			List<OneTest> tests;
 
-			class OneTest {
+			static class OneTest {
 				String name;
 				String type;
 				RangerPolicy policy;