You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2022/07/15 14:34:08 UTC

[shardingsphere] branch master updated: Fixes #19243. (#19244)

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

zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 32a64a18d03 Fixes #19243. (#19244)
32a64a18d03 is described below

commit 32a64a18d036467c8c1c6cbabf8d545c42463e14
Author: Raigor <ra...@gmail.com>
AuthorDate: Fri Jul 15 22:34:02 2022 +0800

    Fixes #19243. (#19244)
---
 .../text/admin/executor/AbstractDatabaseMetadataExecutor.java       | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/admin/executor/AbstractDatabaseMetadataExecutor.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/admin/executor/AbstractDatabaseMetadataExecutor.java
index 986fff0e59a..1fb833d48ad 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/admin/executor/AbstractDatabaseMetadataExecutor.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/admin/executor/AbstractDatabaseMetadataExecutor.java
@@ -197,9 +197,9 @@ public abstract class AbstractDatabaseMetadataExecutor implements DatabaseAdminQ
          */
         @Override
         protected List<String> getDatabaseNames(final ConnectionSession connectionSession) {
-            String database = ProxyContext.getInstance().getAllDatabaseNames().stream().filter(each -> hasAuthority(each, connectionSession.getGrantee()))
-                    .filter(AbstractDatabaseMetadataExecutor::hasDataSource).findFirst().orElseThrow(ResourceNotExistedException::new);
-            return Collections.singletonList(database);
+            Optional<String> database = ProxyContext.getInstance().getAllDatabaseNames().stream().filter(each -> hasAuthority(each, connectionSession.getGrantee()))
+                    .filter(AbstractDatabaseMetadataExecutor::hasDataSource).findFirst();
+            return database.isPresent() ? Collections.singletonList(database.get()) : Collections.emptyList();
         }
         
         /**