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

panjuan 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 0bf6158073e Remove useless UnauthorizedOperationException (#29607)
0bf6158073e is described below

commit 0bf6158073e4d5af0341f379b20561dc6f04f2cd
Author: Liang Zhang <[email protected]>
AuthorDate: Sun Dec 31 20:33:30 2023 +0800

    Remove useless UnauthorizedOperationException (#29607)
---
 .../user-manual/error-code/sql-error-code.cn.md    |  1 -
 .../user-manual/error-code/sql-error-code.en.md    |  1 -
 .../exception/UnauthorizedOperationException.java  | 35 ----------------------
 .../handler/ShowAuthorityRuleExecutorTest.java     | 23 +++++++-------
 4 files changed, 11 insertions(+), 49 deletions(-)

diff --git a/docs/document/content/user-manual/error-code/sql-error-code.cn.md 
b/docs/document/content/user-manual/error-code/sql-error-code.cn.md
index 779f387141d..6f22a1ec204 100644
--- a/docs/document/content/user-manual/error-code/sql-error-code.cn.md
+++ b/docs/document/content/user-manual/error-code/sql-error-code.cn.md
@@ -98,7 +98,6 @@ SQL 错误码以标准的 SQL State,Vendor Code 和详细错误信息提供,
 
 | SQL State | Vendor Code | 错误信息                              |
 |-----------|-------------|-----------------------------------|
-| 44000     | 16500       | Access denied for operation `%s`. |
 
 ### 集群
 
diff --git a/docs/document/content/user-manual/error-code/sql-error-code.en.md 
b/docs/document/content/user-manual/error-code/sql-error-code.en.md
index bd7f6229a56..445b6842ac2 100644
--- a/docs/document/content/user-manual/error-code/sql-error-code.en.md
+++ b/docs/document/content/user-manual/error-code/sql-error-code.en.md
@@ -98,7 +98,6 @@ SQL error codes provide by standard `SQL State`, `Vendor 
Code` and `Reason`, whi
 
 | SQL State | Vendor Code | Reason                            |
 |-----------|-------------|-----------------------------------|
-| 44000     | 16500       | Access denied for operation `%s`. |
 
 ### Cluster
 
diff --git 
a/kernel/authority/core/src/main/java/org/apache/shardingsphere/authority/exception/UnauthorizedOperationException.java
 
b/kernel/authority/core/src/main/java/org/apache/shardingsphere/authority/exception/UnauthorizedOperationException.java
deleted file mode 100644
index b6953463dbd..00000000000
--- 
a/kernel/authority/core/src/main/java/org/apache/shardingsphere/authority/exception/UnauthorizedOperationException.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.authority.exception;
-
-import 
org.apache.shardingsphere.infra.exception.core.external.sql.sqlstate.XOpenSQLState;
-import 
org.apache.shardingsphere.infra.exception.core.external.sql.type.kernel.KernelSQLException;
-
-/**
- * Unauthorized operation exception.
- */
-public final class UnauthorizedOperationException extends KernelSQLException {
-    
-    private static final long serialVersionUID = -182093939317068572L;
-    
-    private static final int KERNEL_CODE = 6;
-    
-    public UnauthorizedOperationException(final String operation) {
-        super(XOpenSQLState.CHECK_OPTION_VIOLATION, KERNEL_CODE, 500, "Access 
denied for operation `%s`.", operation);
-    }
-}
diff --git 
a/kernel/authority/distsql/handler/src/test/java/org/apache/shardingsphere/authority/distsql/handler/ShowAuthorityRuleExecutorTest.java
 
b/kernel/authority/distsql/handler/src/test/java/org/apache/shardingsphere/authority/distsql/handler/ShowAuthorityRuleExecutorTest.java
index e670463a2e1..a2bd3782b40 100644
--- 
a/kernel/authority/distsql/handler/src/test/java/org/apache/shardingsphere/authority/distsql/handler/ShowAuthorityRuleExecutorTest.java
+++ 
b/kernel/authority/distsql/handler/src/test/java/org/apache/shardingsphere/authority/distsql/handler/ShowAuthorityRuleExecutorTest.java
@@ -55,6 +55,17 @@ class ShowAuthorityRuleExecutorTest {
         assertThat(row.getCell(3), is(""));
     }
     
+    private ShardingSphereMetaData mockMetaData() {
+        AuthorityRule authorityRule = mock(AuthorityRule.class);
+        
when(authorityRule.getConfiguration()).thenReturn(createAuthorityRuleConfiguration());
+        return new ShardingSphereMetaData(new LinkedHashMap<>(), 
mock(ResourceMetaData.class), new 
RuleMetaData(Collections.singleton(authorityRule)), new 
ConfigurationProperties(new Properties()));
+    }
+    
+    private AuthorityRuleConfiguration createAuthorityRuleConfiguration() {
+        ShardingSphereUser root = new ShardingSphereUser("root", "", 
"localhost");
+        return new AuthorityRuleConfiguration(Collections.singleton(root), new 
AlgorithmConfiguration("ALL_PERMITTED", new Properties()), 
Collections.emptyMap(), null);
+    }
+    
     @Test
     void assertGetColumnNames() {
         ShowAuthorityRuleExecutor executor = new ShowAuthorityRuleExecutor();
@@ -65,16 +76,4 @@ class ShowAuthorityRuleExecutorTest {
         assertThat(iterator.next(), is("provider"));
         assertThat(iterator.next(), is("props"));
     }
-    
-    private ShardingSphereMetaData mockMetaData() {
-        AuthorityRule authorityRule = mock(AuthorityRule.class);
-        
when(authorityRule.getConfiguration()).thenReturn(createAuthorityRuleConfiguration());
-        return new ShardingSphereMetaData(new LinkedHashMap<>(), 
mock(ResourceMetaData.class),
-                new RuleMetaData(Collections.singleton(authorityRule)), new 
ConfigurationProperties(new Properties()));
-    }
-    
-    private AuthorityRuleConfiguration createAuthorityRuleConfiguration() {
-        ShardingSphereUser root = new ShardingSphereUser("root", "", 
"localhost");
-        return new AuthorityRuleConfiguration(Collections.singleton(root), new 
AlgorithmConfiguration("ALL_PERMITTED", new Properties()), 
Collections.emptyMap(), null);
-    }
 }

Reply via email to