[ https://issues.apache.org/jira/browse/IMPALA-7826?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul Rogers reassigned IMPALA-7826: ----------------------------------- Assignee: Paul Rogers > 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 > Assignee: Paul Rogers > Priority: Minor > > {{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-unsubscr...@impala.apache.org For additional commands, e-mail: issues-all-h...@impala.apache.org