diff --git a/core/common-util/src/main/java/uk/gov/gchq/gaffer/commonutil/PropertiesUtil.java b/core/common-util/src/main/java/uk/gov/gchq/gaffer/commonutil/PropertiesUtil.java index 1dd660a6e8a..e688e2354a2 100644 --- a/core/common-util/src/main/java/uk/gov/gchq/gaffer/commonutil/PropertiesUtil.java +++ b/core/common-util/src/main/java/uk/gov/gchq/gaffer/commonutil/PropertiesUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2023 Crown Copyright + * Copyright 2017-2025 Crown Copyright * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,7 +23,7 @@ * Utility methods for Schema Properties. */ public final class PropertiesUtil { - private static final Pattern PROPERTY_ALLOWED_CHARACTERS = Pattern.compile("[a-zA-Z0-9|-]*"); + private static final Pattern PROPERTY_ALLOWED_CHARACTERS = Pattern.compile("[a-zA-Z0-9|\\-]+"); private PropertiesUtil() { // Private constructor to prevent instantiation. diff --git a/core/common-util/src/test/java/uk/gov/gchq/gaffer/commonutil/PropertiesUtilTest.java b/core/common-util/src/test/java/uk/gov/gchq/gaffer/commonutil/PropertiesUtilTest.java index a4ffa83ee68..7ab3ae63c06 100644 --- a/core/common-util/src/test/java/uk/gov/gchq/gaffer/commonutil/PropertiesUtilTest.java +++ b/core/common-util/src/test/java/uk/gov/gchq/gaffer/commonutil/PropertiesUtilTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2024 Crown Copyright + * Copyright 2017-2025 Crown Copyright * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,7 +30,7 @@ class PropertiesUtilTest { void shouldThrowExceptionWithInvalidStringName() { assertThatIllegalArgumentException() .isThrownBy(() -> PropertiesUtil.validateName(INVALID_STRING)) - .withMessage("Property is invalid: inv@l1dStr|ng&^, it must match regex: [a-zA-Z0-9|-]*"); + .withMessage("Property is invalid: inv@l1dStr|ng&^, it must match regex: [a-zA-Z0-9|\\-]+"); } @Test