[ 
https://issues.apache.org/jira/browse/HIVE-10637?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14531625#comment-14531625
 ] 

Sushanth Sowmyan commented on HIVE-10637:
-----------------------------------------

InvocationTargetException..getTargetException() is apparently a dispreferred 
old use, so the 
((InvocationTargetException)e.getCause().getCause().getCause()).getTargetException().getMessage()
 can be simplified to a continuous chain of getCause if not null

To wit, we could have something like this:

{code}
boolean exceptionChainContainsMessage(Exception e, String msg){
  if (e == null){ return false; }
  if (e.getMessage() != null){
    if (e.getMessage().contains(msg) { return true; }
  }
  return exceptionChainContainsMessage(e.getCause(),msg);
}
{code}

And we could put that in a common TestUtil area for use in other tests if need 
be, because I think this sort of chained exception testing is likely to become 
common.

> Cleanup TestPassProperties changes introduced due to HIVE-8696
> --------------------------------------------------------------
>
>                 Key: HIVE-10637
>                 URL: https://issues.apache.org/jira/browse/HIVE-10637
>             Project: Hive
>          Issue Type: Test
>          Components: HCatalog, Tests
>            Reporter: Thiruvel Thirumoolan
>            Assignee: Thiruvel Thirumoolan
>            Priority: Trivial
>
> Follow up JIRA to cleanup the test case as per recommendations from Sushanth.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to