Index: src/java/org/apache/hcatalog/common/AuthUtils.java =================================================================== --- src/java/org/apache/hcatalog/common/AuthUtils.java (revision 1222880) +++ src/java/org/apache/hcatalog/common/AuthUtils.java (working copy) @@ -63,10 +63,10 @@ return; } catch (AccessControlException ace) { - throw new HCatException(ErrorType.ERROR_ACCESS_CONTROL, ace); + throw new HCatException(ErrorType.ERROR_ACCESS_CONTROL, "for path " + path, ace); } catch (org.apache.hadoop.fs.permission.AccessControlException ace){ // Older hadoop version will throw this @deprecated Exception. - throw new HCatException(ErrorType.ERROR_ACCESS_CONTROL, ace); + throw new HCatException(ErrorType.ERROR_ACCESS_CONTROL, "for path " + path, ace); } catch (IOException ioe){ throw new SemanticException(ioe); } @@ -75,7 +75,7 @@ try { ugi = ShimLoader.getHadoopShims().getUGIForConf(conf); } catch (LoginException le) { - throw new HCatException(ErrorType.ERROR_ACCESS_CONTROL,le); + throw new HCatException(ErrorType.ERROR_ACCESS_CONTROL, "for path " + path, le); } catch (IOException ioe) { throw new SemanticException(ioe); } @@ -89,19 +89,18 @@ if(dirPerms.getUserAction().implies(action)){ return; } - throw new HCatException(ErrorType.ERROR_ACCESS_CONTROL); + throw new HCatException(ErrorType.ERROR_ACCESS_CONTROL, "action " + action + " not permitted on path " + path + " for user " + user); } if(ArrayUtils.contains(ugi.getGroupNames(), grp)){ if(dirPerms.getGroupAction().implies(action)){ return; } - throw new HCatException(ErrorType.ERROR_ACCESS_CONTROL); - + throw new HCatException(ErrorType.ERROR_ACCESS_CONTROL, "action " + action + " not permitted on path " + path + " for group " + grp); } if(dirPerms.getOtherAction().implies(action)){ return; } - throw new HCatException(ErrorType.ERROR_ACCESS_CONTROL); + throw new HCatException(ErrorType.ERROR_ACCESS_CONTROL, "action " + action + " not permitted on path " + path + " for others"); } Index: src/java/org/apache/hcatalog/common/HCatException.java =================================================================== --- src/java/org/apache/hcatalog/common/HCatException.java (revision 1222880) +++ src/java/org/apache/hcatalog/common/HCatException.java (working copy) @@ -112,7 +112,7 @@ } if( type.appendCauseMessage() ) { - if( cause != null && cause.getMessage() != null ) { + if( cause != null ) { //Add the cause message to buffer message.append(". Cause : " + cause.toString()); } Index: src/test/org/apache/hcatalog/cli/TestEximSemanticAnalysis.java =================================================================== --- src/test/org/apache/hcatalog/cli/TestEximSemanticAnalysis.java (revision 1222880) +++ src/test/org/apache/hcatalog/cli/TestEximSemanticAnalysis.java (working copy) @@ -87,9 +87,9 @@ .run("export table junit_sem_analysis to 'pfile://local:9080/tmp/hcat/exports/junit_sem_analysis'"); assertEquals(10, response.getResponseCode()); - assertEquals( - "FAILED: Error in semantic analysis: org.apache.hcatalog.common.HCatException : 3000 : Permission denied", - response.getErrorMessage()); + assertTrue("Permission denied expected : "+response.getErrorMessage(), + response.getErrorMessage().startsWith( + "FAILED: Error in semantic analysis: org.apache.hcatalog.common.HCatException : 3000 : Permission denied")); Runtime.getRuntime().exec("rm -rf /tmp/hcat"); response = hcatDriver.run("drop table junit_sem_analysis"); if (response.getResponseCode() != 0) { @@ -121,9 +121,10 @@ .run("import table junit_sem_analysis from 'pfile://local:9080/tmp/hcat/exports/junit_sem_analysis'"); assertEquals(10, response.getResponseCode()); - assertEquals( - "FAILED: Error in semantic analysis: org.apache.hcatalog.common.HCatException : 3000 : Permission denied", - response.getErrorMessage()); + assertTrue( + "Permission denied expected: "+response.getErrorMessage() , + response.getErrorMessage().startsWith( + "FAILED: Error in semantic analysis: org.apache.hcatalog.common.HCatException : 3000 : Permission denied")); Runtime.getRuntime().exec("rm -rf /tmp/hcat"); cluster.getFileSystem().setPermission(whPath, FsPermission.valueOf("-rwxrwxrwx"));