sentry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vs...@apache.org
Subject sentry git commit: SENTRY-1993: StringIndexOutOfBoundsException in HMSPathsDumper.java (Misha Dmitriev, reviewed by Alexander Kolbasov, Sergio Pena, Vadim Spector)
Date Wed, 18 Oct 2017 18:08:49 GMT
Repository: sentry
Updated Branches:
  refs/heads/master 6e1651fab -> 09761c709


SENTRY-1993: StringIndexOutOfBoundsException in HMSPathsDumper.java (Misha Dmitriev, reviewed
by Alexander Kolbasov, Sergio Pena, Vadim Spector)


Project: http://git-wip-us.apache.org/repos/asf/sentry/repo
Commit: http://git-wip-us.apache.org/repos/asf/sentry/commit/09761c70
Tree: http://git-wip-us.apache.org/repos/asf/sentry/tree/09761c70
Diff: http://git-wip-us.apache.org/repos/asf/sentry/diff/09761c70

Branch: refs/heads/master
Commit: 09761c709a08473a2c34f054218d0c34bd192492
Parents: 6e1651f
Author: Vadim Spector <vspec@cloudera.com>
Authored: Wed Oct 18 11:04:26 2017 -0700
Committer: Vadim Spector <vspec@cloudera.com>
Committed: Wed Oct 18 11:04:26 2017 -0700

----------------------------------------------------------------------
 .../src/main/java/org/apache/sentry/hdfs/HMSPathsDumper.java     | 3 ++-
 .../test/java/org/apache/sentry/hdfs/TestHMSPathsFullDump.java   | 4 +++-
 2 files changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sentry/blob/09761c70/sentry-hdfs/sentry-hdfs-common/src/main/java/org/apache/sentry/hdfs/HMSPathsDumper.java
----------------------------------------------------------------------
diff --git a/sentry-hdfs/sentry-hdfs-common/src/main/java/org/apache/sentry/hdfs/HMSPathsDumper.java
b/sentry-hdfs/sentry-hdfs-common/src/main/java/org/apache/sentry/hdfs/HMSPathsDumper.java
index 1267093..8a7c8a2 100644
--- a/sentry-hdfs/sentry-hdfs-common/src/main/java/org/apache/sentry/hdfs/HMSPathsDumper.java
+++ b/sentry-hdfs/sentry-hdfs-common/src/main/java/org/apache/sentry/hdfs/HMSPathsDumper.java
@@ -129,7 +129,8 @@ public class HMSPathsDumper implements AuthzPathsDumper<HMSPaths>
{
       TPathEntry tChild = idMap.get(id);
 
       String tChildPathElement = tChild.getPathElement();
-      if (tChildPathElement.charAt(0) == DupDetector.REPLACEMENT_STRING_PREFIX) {
+      if (!tChildPathElement.isEmpty() &&
+          tChildPathElement.charAt(0) == DupDetector.REPLACEMENT_STRING_PREFIX) {
         int dupStrIdx = Integer.parseInt(tChildPathElement.substring(1), 16);
         tChildPathElement = dupStringValues.get(dupStrIdx);
       }

http://git-wip-us.apache.org/repos/asf/sentry/blob/09761c70/sentry-hdfs/sentry-hdfs-common/src/test/java/org/apache/sentry/hdfs/TestHMSPathsFullDump.java
----------------------------------------------------------------------
diff --git a/sentry-hdfs/sentry-hdfs-common/src/test/java/org/apache/sentry/hdfs/TestHMSPathsFullDump.java
b/sentry-hdfs/sentry-hdfs-common/src/test/java/org/apache/sentry/hdfs/TestHMSPathsFullDump.java
index 6a4e32f..73e1ce2 100644
--- a/sentry-hdfs/sentry-hdfs-common/src/test/java/org/apache/sentry/hdfs/TestHMSPathsFullDump.java
+++ b/sentry-hdfs/sentry-hdfs-common/src/test/java/org/apache/sentry/hdfs/TestHMSPathsFullDump.java
@@ -50,7 +50,8 @@ public class TestHMSPathsFullDump {
         "/user/hive/warehouse/db1/tbl11/part_duplicate1",
         "/user/hive/warehouse/db1/tbl11/part_duplicate1/part_duplicate2",
         "/user/hive/warehouse/db1/tbl11/part_duplicate2",
-        "/user/hive/warehouse/db1/tbl11/part_duplicate2/part_duplicate1"));
+        "/user/hive/warehouse/db1/tbl11/part_duplicate2/part_duplicate1",
+        "/user/hive/warehouse/db1/tbl11/part_duplicate2//after_double_slash"));
 
     // Not in Deserialized objects prefix paths
     hmsPaths._addAuthzObject("db2", Lists.newArrayList("/user/hive/w2/db2"));
@@ -107,6 +108,7 @@ public class TestHMSPathsFullDump {
     Assert.assertEquals(new HashSet<String>(Arrays.asList("db1.tbl11")), hmsPaths2.findAuthzObject(new
String[]{"user", "hive", "warehouse", "db1", "tbl11", "part_duplicate1", "part_duplicate2"},
false));
     Assert.assertEquals(new HashSet<String>(Arrays.asList("db1.tbl11")), hmsPaths2.findAuthzObject(new
String[]{"user", "hive", "warehouse", "db1", "tbl11", "part_duplicate2"}, false));
     Assert.assertEquals(new HashSet<String>(Arrays.asList("db1.tbl11")), hmsPaths2.findAuthzObject(new
String[]{"user", "hive", "warehouse", "db1", "tbl11", "part_duplicate2", "part_duplicate1"},
false));
+    Assert.assertEquals(new HashSet<String>(Arrays.asList("db1.tbl11")), hmsPaths2.findAuthzObject(new
String[]{"user", "hive", "warehouse", "db1", "tbl11", "part_duplicate2", "after_double_slash"},
false));
 
     // This path is not under prefix, so should not be deserialized..
     Assert.assertNull(hmsPaths2.findAuthzObject(new String[]{"user", "hive", "w2", "db2",
"tbl21", "p1=1"}, true));


Mime
View raw message