From 537638de80de7e5f38f928b80c3d9d1236412041 Mon Sep 17 00:00:00 2001 From: CF Mitrah Date: Fri, 2 Feb 2024 21:33:10 +0530 Subject: [PATCH] improve invalid datasource name exception for LDEV-4787 --- core/src/main/java/lucee/runtime/tag/Admin.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/lucee/runtime/tag/Admin.java b/core/src/main/java/lucee/runtime/tag/Admin.java index 3351581889..e201f34f33 100755 --- a/core/src/main/java/lucee/runtime/tag/Admin.java +++ b/core/src/main/java/lucee/runtime/tag/Admin.java @@ -2628,11 +2628,11 @@ private void doUpdateDatasource() throws PageException { cn = "com.microsoft.sqlserver.jdbc.SQLServerDriver"; } - Pattern pattern = Pattern.compile("[a-zA-Z0-9_]*"); + Pattern pattern = Pattern.compile("[a-zA-Z0-9_-]*"); Matcher matcher = pattern.matcher(getString("admin", action, "newName")); if (matcher.matches() == false) { - throw new ExpressionException("Trying to create a data source with a name that is invalid. Data source Names must match proper variable naming conventions"); + throw new ExpressionException("Creating a datasource name was invalid; valid formats include alphanumeric characters, underscores and hyphens"); } ClassDefinition cd = new ClassDefinitionImpl(cn, getString("bundleName", null), getString("bundleVersion", null), config.getIdentification());