Hive
  1. Hive
  2. HIVE-5603

several classes call initCause which masks lower level exceptions

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Not a Problem
    • Affects Version/s: 0.12.0
    • Fix Version/s: None
    • Component/s: Authorization
    • Labels:
      None

      Description

      AuthorizationPreEventListener has following code that will result in "Can't overwrite exception" being thrown, and also mask the lower level exception.

        private InvalidOperationException invalidOperationException(Exception e) {
          InvalidOperationException ex = new InvalidOperationException();
          ex.initCause(e.getCause());
          return ex;
        }
      
        private MetaException metaException(HiveException e) {
          MetaException ex =  new MetaException(e.getMessage());
          ex.initCause(e);
          return ex;
        }
      

        Issue Links

          Activity

          Hide
          Thejas M Nair added a comment -

          Similar to AuthorizationPreEventListener class, there are other places where initCause is being called, that need to be reviewed -.

           git grep initCause
          hcatalog/server-extensions/src/main/java/org/apache/hcatalog/listener/NotificationListener.java:        me.initCause(e);
          hcatalog/server-extensions/src/main/java/org/apache/hcatalog/listener/NotificationListener.java:        me.initCause(e);
          hcatalog/server-extensions/src/main/java/org/apache/hive/hcatalog/listener/NotificationListener.java:        me.initCause(e);
          hcatalog/server-extensions/src/main/java/org/apache/hive/hcatalog/listener/NotificationListener.java:        me.initCause(e);
          hcatalog/storage-handlers/hbase/src/java/org/apache/hcatalog/hbase/snapshot/lock/WriteLock.java:          initCause(e);
          hwi/src/java/org/apache/hadoop/hive/hwi/HWIServer.java:      ie.initCause(e);
          metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java:          me.initCause(e);
          metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java:          me.initCause(e);
          metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java:          me.initCause(e);
          metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java:          me.initCause(e);
          metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java:          me.initCause(e);
          metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java:          me.initCause(e);
          metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java:          me.initCause(e);
          metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java:          me.initCause(e);
          metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java:          me.initCause(e);
          metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java:          me.initCause(e);
          metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java:          me.initCause(e);
          metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java:          me.initCause(e);
          metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java:          me.initCause(e);
          metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java:          me.initCause(e);
          metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java:          me.initCause(e);
          metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java:          me.initCause(e);
          metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java:          me.initCause(e);
          metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java:          me.initCause(e);
          metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java:          me.initCause(e);
          metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java:          me.initCause(e);
          metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java:          me.initCause(e);
          metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java:          me.initCause(e);
          metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java:          me.initCause(e);
          metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java:          me.initCause(e);
          metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java:          me.initCause(e);
          metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java:          me.initCause(e);
          metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java:          te.initCause(e);
          metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java:          me.initCause(e);
          metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java:          me.initCause(e);
          metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java:          me.initCause(e);
          metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java:        me.initCause(e);
          metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java:          me.initCause(e);
          metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java:          me.initCause(e);
          metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java:          me.initCause(e);
          metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java:          me.initCause(original);
          metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java:          me.initCause(original);
          metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java:          me.initCause(e);
          metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java:          metaException.initCause(e);
          metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java:          metaException.initCause(e);
          ql/src/java/org/apache/hadoop/hive/ql/security/authorization/AuthorizationPreEventListener.java:    ex.initCause(e.getCause());
          ql/src/java/org/apache/hadoop/hive/ql/security/authorization/AuthorizationPreEventListener.java:    ex.initCause(e);
          ql/src/java/org/apache/hadoop/hive/ql/security/authorization/StorageBasedAuthorizationProvider.java:    ace.initCause(e);
          
          
          Show
          Thejas M Nair added a comment - Similar to AuthorizationPreEventListener class, there are other places where initCause is being called, that need to be reviewed -. git grep initCause hcatalog/server-extensions/src/main/java/org/apache/hcatalog/listener/NotificationListener.java: me.initCause(e); hcatalog/server-extensions/src/main/java/org/apache/hcatalog/listener/NotificationListener.java: me.initCause(e); hcatalog/server-extensions/src/main/java/org/apache/hive/hcatalog/listener/NotificationListener.java: me.initCause(e); hcatalog/server-extensions/src/main/java/org/apache/hive/hcatalog/listener/NotificationListener.java: me.initCause(e); hcatalog/storage-handlers/hbase/src/java/org/apache/hcatalog/hbase/snapshot/lock/WriteLock.java: initCause(e); hwi/src/java/org/apache/hadoop/hive/hwi/HWIServer.java: ie.initCause(e); metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java: me.initCause(e); metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java: me.initCause(e); metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java: me.initCause(e); metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java: me.initCause(e); metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java: me.initCause(e); metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java: me.initCause(e); metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java: me.initCause(e); metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java: me.initCause(e); metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java: me.initCause(e); metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java: me.initCause(e); metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java: me.initCause(e); metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java: me.initCause(e); metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java: me.initCause(e); metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java: me.initCause(e); metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java: me.initCause(e); metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java: me.initCause(e); metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java: me.initCause(e); metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java: me.initCause(e); metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java: me.initCause(e); metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java: me.initCause(e); metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java: me.initCause(e); metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java: me.initCause(e); metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java: me.initCause(e); metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java: me.initCause(e); metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java: me.initCause(e); metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java: me.initCause(e); metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java: te.initCause(e); metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java: me.initCause(e); metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java: me.initCause(e); metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java: me.initCause(e); metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java: me.initCause(e); metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java: me.initCause(e); metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java: me.initCause(e); metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java: me.initCause(e); metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java: me.initCause(original); metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java: me.initCause(original); metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java: me.initCause(e); metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java: metaException.initCause(e); metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java: metaException.initCause(e); ql/src/java/org/apache/hadoop/hive/ql/security/authorization/AuthorizationPreEventListener.java: ex.initCause(e.getCause()); ql/src/java/org/apache/hadoop/hive/ql/security/authorization/AuthorizationPreEventListener.java: ex.initCause(e); ql/src/java/org/apache/hadoop/hive/ql/security/authorization/StorageBasedAuthorizationProvider.java: ace.initCause(e);
          Hide
          Sushanth Sowmyan added a comment -

          Just a quick addendum, initCause itself is not the problem, calling initClause multiple times on the same exception is the main problem. In HIVE-5051, we had exceptions initialized with another exception as an argument, which internally is similar to calling initClause. If an exception is initialized with a string message, and then initCause is called, it will not cause this problem.

          I looked through all the other usages of initCause, and the following are all clean:

          • hcatalog/server-extensions/src/main/java/org/apache/hcatalog/listener/NotificationListener.java
          • hcatalog/server-extensions/src/main/java/org/apache/hive/hcatalog/listener/NotificationListener.java
          • hcatalog/storage-handlers/hbase/src/java/org/apache/hcatalog/hbase/snapshot/lock/WriteLock.java
          • hwi/src/java/org/apache/hadoop/hive/hwi/HWIServer.java
          • metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
          • metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java
          • ql/src/java/org/apache/hadoop/hive/ql/security/authorization/AuthorizationPreEventListener.java
          • ql/src/java/org/apache/hadoop/hive/ql/security/authorization/StorageBasedAuthorizationProvider.java

          So, this bug isn't a bug, unless you mean it to be a stylistic cleaning issue?

          Show
          Sushanth Sowmyan added a comment - Just a quick addendum, initCause itself is not the problem, calling initClause multiple times on the same exception is the main problem. In HIVE-5051 , we had exceptions initialized with another exception as an argument, which internally is similar to calling initClause. If an exception is initialized with a string message, and then initCause is called, it will not cause this problem. I looked through all the other usages of initCause, and the following are all clean: hcatalog/server-extensions/src/main/java/org/apache/hcatalog/listener/NotificationListener.java hcatalog/server-extensions/src/main/java/org/apache/hive/hcatalog/listener/NotificationListener.java hcatalog/storage-handlers/hbase/src/java/org/apache/hcatalog/hbase/snapshot/lock/WriteLock.java hwi/src/java/org/apache/hadoop/hive/hwi/HWIServer.java metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java ql/src/java/org/apache/hadoop/hive/ql/security/authorization/AuthorizationPreEventListener.java ql/src/java/org/apache/hadoop/hive/ql/security/authorization/StorageBasedAuthorizationProvider.java So, this bug isn't a bug, unless you mean it to be a stylistic cleaning issue?
          Hide
          Sushanth Sowmyan added a comment -

          Okay, having heard back from Thejas that he did not mean this to be a stylistic cleaning issue, closing this as not-a-bug.

          Show
          Sushanth Sowmyan added a comment - Okay, having heard back from Thejas that he did not mean this to be a stylistic cleaning issue, closing this as not-a-bug.

            People

            • Assignee:
              Sushanth Sowmyan
              Reporter:
              Thejas M Nair
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development