incubator-hcatalog-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r1297246 - in /incubator/hcatalog/trunk: CHANGES.txt src/java/org/apache/hcatalog/security/HdfsAuthorizationProvider.java src/java/org/apache/hcatalog/security/StorageDelegationAuthorizationProvider.java src/test/e2e/hcatalog/tests/hcat.conf
Date Mon, 05 Mar 2012 22:01:38 GMT
Author: gates
Date: Mon Mar  5 22:01:37 2012
New Revision: 1297246

URL: http://svn.apache.org/viewvc?rev=1297246&view=rev
Log:
HCATALOG-286 NPE in HdfsAuthorizationProvider

Modified:
    incubator/hcatalog/trunk/CHANGES.txt
    incubator/hcatalog/trunk/src/java/org/apache/hcatalog/security/HdfsAuthorizationProvider.java
    incubator/hcatalog/trunk/src/java/org/apache/hcatalog/security/StorageDelegationAuthorizationProvider.java
    incubator/hcatalog/trunk/src/test/e2e/hcatalog/tests/hcat.conf

Modified: incubator/hcatalog/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/CHANGES.txt?rev=1297246&r1=1297245&r2=1297246&view=diff
==============================================================================
--- incubator/hcatalog/trunk/CHANGES.txt (original)
+++ incubator/hcatalog/trunk/CHANGES.txt Mon Mar  5 22:01:37 2012
@@ -76,6 +76,8 @@ Release 0.4.0 - Unreleased
   OPTIMIZATIONS
 
   BUG FIXES
+  HCAT-286 NPE in HdfsAuthorizationProvider (enis via gates)
+
   HCAT-290 Changes in HBase maven objects breaks hcat build (gates)
 
   HCAT-280 part file name prefix with attempxxxx (daijy via gates)

Modified: incubator/hcatalog/trunk/src/java/org/apache/hcatalog/security/HdfsAuthorizationProvider.java
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/src/java/org/apache/hcatalog/security/HdfsAuthorizationProvider.java?rev=1297246&r1=1297245&r2=1297246&view=diff
==============================================================================
--- incubator/hcatalog/trunk/src/java/org/apache/hcatalog/security/HdfsAuthorizationProvider.java
(original)
+++ incubator/hcatalog/trunk/src/java/org/apache/hcatalog/security/HdfsAuthorizationProvider.java
Mon Mar  5 22:01:37 2012
@@ -143,7 +143,10 @@ public class HdfsAuthorizationProvider e
   @Override
   public void authorize(Database db, Privilege[] readRequiredPriv, Privilege[] writeRequiredPriv)
       throws HiveException, AuthorizationException {
-   
+    if (db == null) {
+      return;
+    }
+
     Path path = getDbLocation(db);
     
     authorize(path, readRequiredPriv, writeRequiredPriv);
@@ -152,6 +155,9 @@ public class HdfsAuthorizationProvider e
   @Override
   public void authorize(Table table, Privilege[] readRequiredPriv, Privilege[] writeRequiredPriv)
       throws HiveException, AuthorizationException {
+    if (table == null) {
+      return;
+    }
     
     //unlike Hive's model, this can be called at CREATE TABLE as well, since we should authorize

     //against the table's declared location
@@ -170,23 +176,32 @@ public class HdfsAuthorizationProvider e
     authorize(path, readRequiredPriv, writeRequiredPriv);
   }
 
-  @Override
-  public void authorize(Partition part, Privilege[] readRequiredPriv, Privilege[] writeRequiredPriv)
+  //TODO: HiveAuthorizationProvider should expose this interface instead of #authorize(Partition,
Privilege[], Privilege[])
+  public void authorize(Table table, Partition part, Privilege[] readRequiredPriv, Privilege[]
writeRequiredPriv)
       throws HiveException, AuthorizationException {
     
-    if (part.getLocation() == null) { 
-      authorize(part.getTable(), readRequiredPriv, writeRequiredPriv);
+    if (part == null || part.getLocation() == null) {
+      authorize(table, readRequiredPriv, writeRequiredPriv);
     } else {
       authorize(part.getPartitionPath(), readRequiredPriv, writeRequiredPriv);
     }
   }
 
   @Override
+  public void authorize(Partition part, Privilege[] readRequiredPriv, Privilege[] writeRequiredPriv)
+      throws HiveException, AuthorizationException {
+    if (part == null) {
+      return;
+    }
+    authorize(part.getTable(), part, readRequiredPriv, writeRequiredPriv);
+  }
+
+  @Override
   public void authorize(Table table, Partition part, List<String> columns,
       Privilege[] readRequiredPriv, Privilege[] writeRequiredPriv) throws HiveException,
       AuthorizationException {
     //columns cannot live in different files, just check for partition level permissions
-    authorize(table, part, columns, readRequiredPriv, writeRequiredPriv);
+    authorize(table, part, readRequiredPriv, writeRequiredPriv);
   }
   
   /** 

Modified: incubator/hcatalog/trunk/src/java/org/apache/hcatalog/security/StorageDelegationAuthorizationProvider.java
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/src/java/org/apache/hcatalog/security/StorageDelegationAuthorizationProvider.java?rev=1297246&r1=1297245&r2=1297246&view=diff
==============================================================================
--- incubator/hcatalog/trunk/src/java/org/apache/hcatalog/security/StorageDelegationAuthorizationProvider.java
(original)
+++ incubator/hcatalog/trunk/src/java/org/apache/hcatalog/security/StorageDelegationAuthorizationProvider.java
Mon Mar  5 22:01:37 2012
@@ -129,6 +129,6 @@ public class StorageDelegationAuthorizat
   public void authorize(Table table, Partition part, List<String> columns,
       Privilege[] readRequiredPriv, Privilege[] writeRequiredPriv) throws HiveException,
       AuthorizationException {
-    getDelegate(table).authorize(part, readRequiredPriv, writeRequiredPriv);
+    getDelegate(table).authorize(table, part, columns, readRequiredPriv, writeRequiredPriv);
   }
 }

Modified: incubator/hcatalog/trunk/src/test/e2e/hcatalog/tests/hcat.conf
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/src/test/e2e/hcatalog/tests/hcat.conf?rev=1297246&r1=1297245&r2=1297246&view=diff
==============================================================================
--- incubator/hcatalog/trunk/src/test/e2e/hcatalog/tests/hcat.conf (original)
+++ incubator/hcatalog/trunk/src/test/e2e/hcatalog/tests/hcat.conf Mon Mar  5 22:01:37 2012
@@ -174,8 +174,8 @@ drop database hcat_database_1;\
                                  'num' => 1
                                 ,'hcat' => q"
 drop table if exists hcat_view_1;
-drop table if exists hcat_view_1_1;
-drop table if exists hcat_view_1_2;
+drop view if exists hcat_view_1_1;
+drop view if exists hcat_view_1_2;
 create external table hcat_view_1 (name string, age int, gpa double) row format delimited
fields terminated by '\t' stored as TEXTFILE location '/user/hcat/tests/data/studenttab10k';
 create view hcat_view_1_1 as select name, gpa, age from studenttab10k;
 create view hcat_view_1_2 partitioned on (age) as select name, gpa, age from studenttab10k;
@@ -183,7 +183,6 @@ alter view hcat_view_1_1 set tblproperti
 show tables;
 describe hcat_view_1_1;
 describe hcat_view_1_2;
-alter view hcat_view_1_2 rename to hcat_view_1_3;
 drop view hcat_view_1_1;
 drop view hcat_view_1_3;"
                                 ,'rc'   => 0



Mime
View raw message