This is an automated email from the ASF dual-hosted git repository.

morningman pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new 614720709b [bugfix](auth)fix table.getDbName throw 
NullPointerException (#22288)
614720709b is described below

commit 614720709b8374bcc56d473f2a217a2fb91b76eb
Author: zhangdong <493738...@qq.com>
AuthorDate: Thu Jul 27 21:08:05 2023 +0800

    [bugfix](auth)fix table.getDbName throw NullPointerException (#22288)
    
    generate by: #22147
    
    Caused by: java.lang.NullPointerException
    at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:936) 
~[?:1.8.0_131]
    at 
java.util.concurrent.ConcurrentHashMap.containsKey(ConcurrentHashMap.java:964) 
~[?:1.8.0_131]
    at 
org.apache.doris.datasource.InternalCatalog.getDbNullable(InternalCatalog.java:249)
 ~[doris-fe.jar:1.2-SNAPSHOT]
    at org.apache.doris.catalog.Table.getDatabase(Table.java:550) 
~[doris-fe.jar:1.2-SNAPSHOT]
    at 
org.apache.doris.nereids.rules.analysis.UserAuthentication.checkPermission(UserAuthentication.java:54
---
 .../src/main/java/org/apache/doris/datasource/ExternalCatalog.java     | 3 +++
 .../src/main/java/org/apache/doris/datasource/InternalCatalog.java     | 3 +++
 2 files changed, 6 insertions(+)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/ExternalCatalog.java 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/ExternalCatalog.java
index f070cc6034..38e4fe2642 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/datasource/ExternalCatalog.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/datasource/ExternalCatalog.java
@@ -347,6 +347,9 @@ public abstract class ExternalCatalog
     @Nullable
     @Override
     public ExternalDatabase<? extends ExternalTable> getDbNullable(String 
dbName) {
+        if (StringUtils.isEmpty(dbName)) {
+            return null;
+        }
         try {
             makeSureInitialized();
         } catch (Exception e) {
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java
index bd166b57a5..efcac5a7c8 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java
@@ -246,6 +246,9 @@ public class InternalCatalog implements CatalogIf<Database> 
{
     @Nullable
     @Override
     public Database getDbNullable(String dbName) {
+        if (StringUtils.isEmpty(dbName)) {
+            return null;
+        }
         if (fullNameToDb.containsKey(dbName)) {
             return fullNameToDb.get(dbName);
         } else {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to