From 6c681dc47b075b34ae47e007ba18de88b78fbd17 Mon Sep 17 00:00:00 2001 From: kanthi subramanian Date: Thu, 9 Jul 2026 11:46:39 -0400 Subject: [PATCH] Add error message that explains the empty URI scheme instead of a null pointer exception stack trace. --- .../ice/internal/iceberg/io/SchemeFileIO.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/ice/src/main/java/com/altinity/ice/internal/iceberg/io/SchemeFileIO.java b/ice/src/main/java/com/altinity/ice/internal/iceberg/io/SchemeFileIO.java index 226419b3..fa9e41f7 100644 --- a/ice/src/main/java/com/altinity/ice/internal/iceberg/io/SchemeFileIO.java +++ b/ice/src/main/java/com/altinity/ice/internal/iceberg/io/SchemeFileIO.java @@ -140,9 +140,21 @@ public void close() { public DelegateFileIO io(String location) { String s = scheme(location); + if (s == null) { + throw new IllegalArgumentException( + String.format( + "File location has no URI scheme (expected s3://, file://, gs://, etc.): \"%s\". " + + "This usually means the create-table request specified a table \"location\" " + + "without a scheme, or the catalog warehouse is misconfigured.", + location)); + } String impl = SCHEME_TO_FILE_IO.get(s); - Preconditions.checkNotNull( - impl, String.format("unsupported scheme \"%s\": \"%s\"", s, location)); + if (impl == null) { + throw new IllegalArgumentException( + String.format( + "Unsupported file location scheme \"%s\": \"%s\". Supported schemes: %s", + s, location, SCHEME_TO_FILE_IO.keySet())); + } DelegateFileIO io = ioMap.get(impl); if (io != null) { return io;