This is an automated email from the ASF dual-hosted git repository.
jmclean pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gravitino.git
The following commit(s) were added to refs/heads/main by this push:
new fe0712846 [#5825] improvement(CLI): Update the error message for
creating a metalake when the required parameter is missing. (#5851)
fe0712846 is described below
commit fe0712846d7b771c1c72389e8268874e9cd18fd3
Author: Lord of Abyss <[email protected]>
AuthorDate: Mon Dec 16 10:28:31 2024 +0800
[#5825] improvement(CLI): Update the error message for creating a metalake
when the required parameter is missing. (#5851)
### What changes were proposed in this pull request?
Currently, when a metalake is created without specifying the metalake
argument, the message "Cannot parse a null or empty identifier" is
displayed. This message is unclear and lacks helpful guidance for the
user. Update the message to: "! metalake is not defined" to make it more
user-friendly and informative.
### Why are the changes needed?
Fix: #5825
### Does this PR introduce _any_ user-facing change?
NO
### How was this patch tested?
<img width="282" alt="image"
src="https://github.com/user-attachments/assets/cb59089f-e60f-4c12-a781-0a79e449c472"
/>
---
.../src/main/java/org/apache/gravitino/cli/GravitinoCommandLine.java | 5 +++++
1 file changed, 5 insertions(+)
diff --git
a/clients/cli/src/main/java/org/apache/gravitino/cli/GravitinoCommandLine.java
b/clients/cli/src/main/java/org/apache/gravitino/cli/GravitinoCommandLine.java
index 843593487..1e376b8be 100644
---
a/clients/cli/src/main/java/org/apache/gravitino/cli/GravitinoCommandLine.java
+++
b/clients/cli/src/main/java/org/apache/gravitino/cli/GravitinoCommandLine.java
@@ -28,6 +28,7 @@ import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Map;
+import java.util.Objects;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Options;
@@ -174,6 +175,10 @@ public class GravitinoCommandLine extends
TestableCommandLine {
} else if (CommandActions.LIST.equals(command)) {
newListMetalakes(url, ignore, outputFormat).handle();
} else if (CommandActions.CREATE.equals(command)) {
+ if (Objects.isNull(metalake)) {
+ System.err.println("! " + CommandEntities.METALAKE + " is not
defined");
+ return;
+ }
String comment = line.getOptionValue(GravitinoOptions.COMMENT);
newCreateMetalake(url, ignore, metalake, comment).handle();
} else if (CommandActions.DELETE.equals(command)) {