----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/69987/#review212873 -----------------------------------------------------------
Haley I think we can simplify this a lot without any refactoring by using PathUtils#parseLocalURI method. Since the method is isLocalUri => It is looking to check for a local URI. If uri.getScheme() throws null we can set uri = PathUtils.parseLocalURI(path). If that is still null we return false. Let me know your thoughts - Arjun Mishra On Feb. 14, 2019, 4:36 p.m., Haley Reeve wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/69987/ > ----------------------------------------------------------- > > (Updated Feb. 14, 2019, 4:36 p.m.) > > > Review request for sentry, Arjun Mishra, kalyan kumar kalvagadda, and Na Li. > > > Repository: sentry > > > Description > ------- > > The "show grant role" logic tries to use a URI's scheme to tell whether it's > a local URI or a DFS URI. However, it's valid for the scheme to be undefined. > In that case Sentry throws a NPE because it's trying to access a null scheme. > > The logic has been updated to instead use the default filesystem set in the > "fs.defaultFS" property if the scheme is not defined. > > > Diffs > ----- > > > sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/hive/authz/DefaultSentryAccessController.java > 94783fa > > sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/util/SentryAuthorizerUtil.java > 5996b6c > > sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/dbprovider/TestDatabaseProvider.java > 6a7c1f3 > > > Diff: https://reviews.apache.org/r/69987/diff/1/ > > > Testing > ------- > > Created and ran testShowGrantWithNullScheme() unit test. Checked that test > fails without code change, and succeeds with code change. > > > Thanks, > > Haley Reeve > >