This is an automated email from the ASF dual-hosted git repository.
lzljs3620320 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/paimon.git
The following commit(s) were added to refs/heads/master by this push:
new ce16065adb [rest] Fix RestCatalog exception (#5624)
ce16065adb is described below
commit ce16065adb413a64d46f6c71e4b6a94b4b827022
Author: Dapeng Sun(孙大鹏) <[email protected]>
AuthorDate: Mon May 19 17:37:41 2025 +0800
[rest] Fix RestCatalog exception (#5624)
---
paimon-core/src/main/java/org/apache/paimon/catalog/Catalog.java | 3 +++
paimon-core/src/main/java/org/apache/paimon/rest/RESTCatalog.java | 4 ++--
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/paimon-core/src/main/java/org/apache/paimon/catalog/Catalog.java
b/paimon-core/src/main/java/org/apache/paimon/catalog/Catalog.java
index 1afcef29c8..792b1a5879 100644
--- a/paimon-core/src/main/java/org/apache/paimon/catalog/Catalog.java
+++ b/paimon-core/src/main/java/org/apache/paimon/catalog/Catalog.java
@@ -21,6 +21,7 @@ package org.apache.paimon.catalog;
import org.apache.paimon.PagedList;
import org.apache.paimon.Snapshot;
import org.apache.paimon.annotation.Public;
+import org.apache.paimon.annotation.VisibleForTesting;
import org.apache.paimon.function.Function;
import org.apache.paimon.function.FunctionChange;
import org.apache.paimon.partition.Partition;
@@ -914,6 +915,7 @@ public interface Catalog extends AutoCloseable {
this.database = database;
}
+ @VisibleForTesting
public DatabaseNoPermissionException(String database) {
this(database, null);
}
@@ -977,6 +979,7 @@ public interface Catalog extends AutoCloseable {
this.identifier = identifier;
}
+ @VisibleForTesting
public TableNoPermissionException(Identifier identifier) {
this(identifier, null);
}
diff --git a/paimon-core/src/main/java/org/apache/paimon/rest/RESTCatalog.java
b/paimon-core/src/main/java/org/apache/paimon/rest/RESTCatalog.java
index 2fabf3deee..ed69638304 100644
--- a/paimon-core/src/main/java/org/apache/paimon/rest/RESTCatalog.java
+++ b/paimon-core/src/main/java/org/apache/paimon/rest/RESTCatalog.java
@@ -209,7 +209,7 @@ public class RESTCatalog implements Catalog {
} catch (NoSuchResourceException e) {
throw new DatabaseNotExistException(databaseName);
} catch (ForbiddenException e) {
- throw new DatabaseNoPermissionException(databaseName);
+ throw new DatabaseNoPermissionException(databaseName, e);
}
}
@@ -506,7 +506,7 @@ public class RESTCatalog implements Catalog {
} catch (NoSuchResourceException e) {
throw new TableNotExistException(identifier);
} catch (ForbiddenException e) {
- throw new TableNoPermissionException(identifier);
+ throw new TableNoPermissionException(identifier, e);
} catch (NotImplementedException ignored) {
// not a metastore partitioned table
}