Skip to content

Commit da5089c

Browse files
committed
Align obkv-hbase enable/disable exception handling with HBase
1 parent c328bca commit da5089c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/main/java/com/alipay/oceanbase/hbase/util/OHTableAccessControlExecutor.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ public Void enableTable(String tableName) throws IOException, TableNotFoundExcep
4242
requestData.put("table_name", tableName);
4343
String jsonData = JSON.toJSONString(requestData);
4444
request.setData(jsonData);
45-
try{
45+
try {
4646
return execute(tableClient, request);
4747
} catch (IOException e) {
4848
Throwable cause = e.getCause();
4949
if (cause instanceof ObTableException) {
5050
ObTableException obEx = (ObTableException) cause;
5151
int errCode = obEx.getErrorCode();
52-
if(ResultCodes.OB_KV_TABLE_NOT_DISABLED.errorCode == errCode) {
52+
if(ResultCodes.OB_KV_TABLE_NOT_ENABLED.errorCode == errCode) {
5353
throw new TableNotEnabledException("Table is not enabled: " + tableName + obEx);
5454
} else if (ResultCodes.OB_TABLEGROUP_NOT_EXIST.errorCode == errCode) {
5555
throw new TableNotFoundException("Table not found: " + tableName + obEx);
@@ -66,15 +66,15 @@ public Void disableTable(String tableName) throws IOException, TableNotFoundExce
6666
requestData.put("table_name", tableName);
6767
String jsonData = JSON.toJSONString(requestData);
6868
request.setData(jsonData);
69-
try{
69+
try {
7070
return execute(tableClient, request);
7171
} catch (IOException e) {
7272
Throwable cause = e.getCause();
7373
if (cause instanceof ObTableException) {
7474
ObTableException obEx = (ObTableException) cause;
7575
int errCode = obEx.getErrorCode();
7676
if(ResultCodes.OB_KV_TABLE_NOT_DISABLED.errorCode == errCode) {
77-
throw new TableNotEnabledException("Table is not enabled: " + tableName + obEx);
77+
throw new TableNotDisabledException("Table is not disabled: " + tableName + obEx);
7878
} else if (ResultCodes.OB_TABLEGROUP_NOT_EXIST.errorCode == errCode) {
7979
throw new TableNotFoundException("Table not found: " + tableName + obEx);
8080
}

0 commit comments

Comments
 (0)