From 863d42d5d55fa2e5e70d3ad957f59c031b9b206d Mon Sep 17 00:00:00 2001 From: BSSsunny <1216013850@qq.com> Date: Mon, 3 Jun 2024 16:53:35 +0800 Subject: [PATCH] [#3088] Improvement(jdbc-doris): Improve greedy regular expressions for DorisExceptionConverter (#3120) ### What changes were proposed in this pull request? https://github.com/datastrato/gravitino/issues/3088 ### Why are the changes needed? In DorisExceptionConverter.java we have a greedy regular expression that could potentially cause issues Fix: #3088 ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? IT&UT Co-authored-by: Qi Yu --- .../catalog/doris/converter/DorisExceptionConverter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/catalogs/catalog-jdbc-doris/src/main/java/com/datastrato/gravitino/catalog/doris/converter/DorisExceptionConverter.java b/catalogs/catalog-jdbc-doris/src/main/java/com/datastrato/gravitino/catalog/doris/converter/DorisExceptionConverter.java index 7b5758bb479..da272bd3287 100644 --- a/catalogs/catalog-jdbc-doris/src/main/java/com/datastrato/gravitino/catalog/doris/converter/DorisExceptionConverter.java +++ b/catalogs/catalog-jdbc-doris/src/main/java/com/datastrato/gravitino/catalog/doris/converter/DorisExceptionConverter.java @@ -32,7 +32,7 @@ public class DorisExceptionConverter extends JdbcExceptionConverter { static final int CODE_OTHER = 1105; private static final String DATABASE_ALREADY_EXISTS_PATTERN_STRING = - ".*detailMessage = Can't create database '.*'; database exists"; + ".*?detailMessage = Can't create database '.*?'; database exists"; private static final Pattern DATABASE_ALREADY_EXISTS_PATTERN = Pattern.compile(DATABASE_ALREADY_EXISTS_PATTERN_STRING);