You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues-all@impala.apache.org by "Paul Rogers (JIRA)" <ji...@apache.org> on 2018/11/07 17:33:00 UTC

[jira] [Created] (IMPALA-7826) Potential NPE in CatalogOpExecutor

Paul Rogers created IMPALA-7826:
-----------------------------------

             Summary: Potential NPE in CatalogOpExecutor
                 Key: IMPALA-7826
                 URL: https://issues.apache.org/jira/browse/IMPALA-7826
             Project: IMPALA
          Issue Type: Bug
          Components: Frontend
    Affects Versions: Impala 3.0
            Reporter: Paul Rogers


{{CatalogOpExecutor}} has two copies of the following:

{code:java}
   Db db = catalog_.getDb(dbName);
   if (db == null) {
     throw new CatalogException("Database: " + db.getName() + " does not exist.");
   }
{code}

If {{db}} is null, we can’t call {{.getName()}} on that object. (The IDE showed a warning for this which is why my attention was directed to it.) We’ll get a null pointer exception (NPE) when creating the error message.

IMPALA-7823 includes the obvious fix, change {{db.getName()}} to {{dbName}}.

But, there may be deeper problems:

# Perhaps someone thoughtfully wrapped this call stack in a try/catch block and used the NPE to infer that the DB was not found.
# Perhaps if-statement is wrong: perhaps the catalog_.getDb() method returns a Db object even if not found, and the if-statement should be checking for “! db.isValid()” or some such.
# Perhaps the code is dead: it is simply never called.
# Most likely: perhaps this code is used, but the semantics are such that we already checked the DB earlier in the flow. The check here is superfluous: it can never fail. The check, if we had one, should be an assertion.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-all-unsubscribe@impala.apache.org
For additional commands, e-mail: issues-all-help@impala.apache.org