Source:
private void dropCatalogCore(String catName) throws MetaException, NoSuchObjectException, InvalidOperationException { boolean success = false; Catalog cat = null; Map<String, String> transactionalListenerResponses = Collections.emptyMap(); RawStore ms = getMS(); try { ms.openTransaction(); cat = ms.getCatalog(catName); firePreEvent(new PreDropCatalogEvent(this, cat)); List<String> allDbs = get_databases(prependNotNullCatToDbName(catName, null)); if (allDbs != null && !allDbs.isEmpty()) { if (allDbs.size() == 1 && allDbs.get(0).equals(DEFAULT_DATABASE_NAME)) { try { drop_database_core(ms, catName, DEFAULT_DATABASE_NAME, true, false); } catch (InvalidOperationException e) { throw new InvalidOperationException("There are still objects in the default " + "database for catalog " + catName); } catch (InvalidObjectException|IOException|InvalidInputException e) { MetaException me = new MetaException("Error attempt to drop default database for " + "catalog " + catName); me.initCause(e); throw me; } } else { throw new InvalidOperationException("There are non-default databases in the catalog " + catName + " so it cannot be dropped."); } } ms.dropCatalog(catName) ; if (!transactionalListeners.isEmpty()) { transactionalListenerResponses = MetaStoreListenerNotifier.notifyEvent(transactionalListeners, EventType.DROP_CATALOG, new DropCatalogEvent(true, this, cat)); } success = ms.commitTransaction(); } finally { if (success) { wh.deleteDir(wh.getDnsPath(new Path(cat.getLocationUri())), false, false, true); } else { ms.rollbackTransaction(); } if (!listeners.isEmpty()) { MetaStoreListenerNotifier.notifyEvent(listeners, EventType.DROP_CATALOG, new DropCatalogEvent(success, this, cat), null, transactionalListenerResponses, ms); } } }

Target:
private void dropCatalogCore(String catName) throws MetaException, NoSuchObjectException, InvalidOperationException { boolean success = false; Catalog cat = null; Map<String, String> transactionalListenerResponses = Collections.emptyMap(); RawStore ms = getMS(); try { ms.openTransaction(); cat = ms.getCatalog(catName); firePreEvent(new PreDropCatalogEvent(this, cat)); List<String> allDbs = get_databases(prependNotNullCatToDbName(catName, null)); if (allDbs != null && !allDbs.isEmpty()) { if (allDbs.size() == 1 && allDbs.get(0).equals(DEFAULT_DATABASE_NAME)) { try { drop_database_core(ms, catName, DEFAULT_DATABASE_NAME, true, false); } catch (InvalidOperationException e) { throw new InvalidOperationException("There are still objects in the default " + "database for catalog " + catName); } catch (InvalidObjectException|IOException|InvalidInputException e) { MetaException me = new MetaException("Error attempt to drop default database for " + "catalog " + catName); me.initCause(e); throw me; } } else { throw new InvalidOperationException("There are non-default databases in the catalog " + catName + " so it cannot be dropped."); } } ms.dropCatalog(catName) ; if (!transactionalListeners.isEmpty()) { transactionalListenerResponses = MetaStoreListenerNotifier.notifyEvent(transactionalListeners, EventType.DROP_CATALOG, new DropCatalogEvent(true, this, cat)); } success = ms.commitTransaction(); } finally { if (success) { wh.deleteDir(wh.getDnsPath(new Path(cat.getLocationUri())), false, false, false); } else { ms.rollbackTransaction(); } if (!listeners.isEmpty()) { MetaStoreListenerNotifier.notifyEvent(listeners, EventType.DROP_CATALOG, new DropCatalogEvent(success, this, cat), null, transactionalListenerResponses, ms); } } }