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 a0d4e77 Fix ci npe (#14159)
a0d4e77 is described below
commit a0d4e77537cd5a6cc5be2c6e09e138c464f01a29
Author: Guocheng Tang <[email protected]>
AuthorDate: Mon Dec 20 00:21:48 2021 +0800
Fix ci npe (#14159)
* Fix CI npe
* Fix ci npe
* remove unused comment
---
.../apache/shardingsphere/authority/checker/AuthorityChecker.java | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git
a/shardingsphere-kernel/shardingsphere-authority/shardingsphere-authority-core/src/main/java/org/apache/shardingsphere/authority/checker/AuthorityChecker.java
b/shardingsphere-kernel/shardingsphere-authority/shardingsphere-authority-core/src/main/java/org/apache/shardingsphere/authority/checker/AuthorityChecker.java
index c02f899..0092cd9 100644
---
a/shardingsphere-kernel/shardingsphere-authority/shardingsphere-authority-core/src/main/java/org/apache/shardingsphere/authority/checker/AuthorityChecker.java
+++
b/shardingsphere-kernel/shardingsphere-authority/shardingsphere-authority-core/src/main/java/org/apache/shardingsphere/authority/checker/AuthorityChecker.java
@@ -75,9 +75,13 @@ public final class AuthorityChecker implements
SQLChecker<AuthorityRule> {
if (!privileges.filter(optional ->
optional.hasPrivileges(currentSchema)).isPresent()) {
return new SQLCheckResult(false, String.format("Unknown database
'%s'", currentSchema));
}
+ PrivilegeType privilegeType = getPrivilege(sqlStatement);
+ if (null == privilegeType) {
+ return new SQLCheckResult(true, "");
+ }
// TODO add error msg
- return privileges.map(optional -> new
SQLCheckResult(optional.hasPrivileges(Collections.singletonList(getPrivilege(sqlStatement))),
- String.format("Access denied for operation %s",
getPrivilege(sqlStatement).name()))).orElseGet(() -> new SQLCheckResult(false,
""));
+ return privileges.map(optional -> new
SQLCheckResult(optional.hasPrivileges(Collections.singletonList(privilegeType)),
+ String.format("Access denied for operation %s",
privilegeType.name()))).orElseGet(() -> new SQLCheckResult(false, ""));
}
@Override