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/06/01 10:28:37 UTC

[shardingsphere] branch master updated: Fix npe when execute getProtocolTypeType (#18132)

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

zhaojinchao 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 61d51f4ce08 Fix npe when execute getProtocolTypeType (#18132)
61d51f4ce08 is described below

commit 61d51f4ce0833c6e17cd25e11f5f9373b35cbdb5
Author: Zhengqiang Duan <du...@apache.org>
AuthorDate: Wed Jun 1 18:28:31 2022 +0800

    Fix npe when execute getProtocolTypeType (#18132)
---
 .../jdbc/executor/callback/ProxyJDBCExecutorCallback.java              | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/executor/callback/ProxyJDBCExecutorCallback.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/executor/callback/ProxyJDBCExecutorCallback.java
index 01ff334a45c..d8c934c3444 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/executor/callback/ProxyJDBCExecutorCallback.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/executor/callback/ProxyJDBCExecutorCallback.java
@@ -113,8 +113,7 @@ public abstract class ProxyJDBCExecutorCallback extends JDBCExecutorCallback<Exe
         if (ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getDatabases().isEmpty()) {
             return DatabaseTypeEngine.getTrunkDatabaseType("MySQL");
         }
-        String databaseName = ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getDatabases().keySet().iterator().next();
-        return ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getDatabases().get(databaseName).getResource().getDatabaseType();
+        return ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getDatabases().values().iterator().next().getProtocolType();
     }
     
     private static Optional<DatabaseType> findConfiguredDatabaseType() {