This is an automated email from the ASF dual-hosted git repository. mkevo pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git
The following commit(s) were added to refs/heads/develop by this push: new da0b1de GEODE-7956: correct legal region names (#5159) da0b1de is described below commit da0b1de256a90b20495658c6151aae5b401ae523 Author: Mario Kevo <48509719+mk...@users.noreply.github.com> AuthorDate: Wed Jun 3 07:43:00 2020 +0200 GEODE-7956: correct legal region names (#5159) * GEODE-7956: correct legal region names --- .../geode/internal/cache/RegionNameValidation.java | 2 +- .../internal/cache/RegionNameValidationTest.java | 40 ++++++++++++++++++++++ .../data_regions/region_naming.html.md.erb | 4 +-- 3 files changed, 43 insertions(+), 3 deletions(-) diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/RegionNameValidation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/RegionNameValidation.java index 37ca1b6..0ceaa0c 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/RegionNameValidation.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/RegionNameValidation.java @@ -25,7 +25,7 @@ import java.util.regex.Pattern; public class RegionNameValidation { - private static final Pattern NAME_PATTERN = Pattern.compile("[aA-zZ0-9-_.]+"); + private static final Pattern NAME_PATTERN = Pattern.compile("[a-zA-Z0-9-_.^`\\[\\]\\\\]+"); static Pattern getNamePattern() { return NAME_PATTERN; diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/RegionNameValidationTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/RegionNameValidationTest.java index 58b1ca8..b07de81 100644 --- a/geode-core/src/test/java/org/apache/geode/internal/cache/RegionNameValidationTest.java +++ b/geode-core/src/test/java/org/apache/geode/internal/cache/RegionNameValidationTest.java @@ -137,6 +137,46 @@ public class RegionNameValidationTest { } @Test + public void startingAndEndingWithSquareBracketsIsOk() { + validate("[validRegionName]"); + } + + @Test + public void containingSquareBracketsIsOk() { + validate("validRegion[EMPTY]Name"); + } + + @Test + public void startingWithCaretIsOk() { + validate("^validRegionName"); + } + + @Test + public void containingCaretIsOk() { + validate("validRegion^Name"); + } + + @Test + public void endingWithCaretIsOk() { + validate("validRegionName^"); + } + + @Test + public void startingWithBackquoteIsOk() { + validate("`validRegionName"); + } + + @Test + public void containingBackquoteIsOk() { + validate("validRegion`Name"); + } + + @Test + public void endingWithBackquoteIsOk() { + validate("validRegionName`"); + } + + @Test public void nameWithDot() throws Exception { validate("valid.valid"); } diff --git a/geode-docs/basic_config/data_regions/region_naming.html.md.erb b/geode-docs/basic_config/data_regions/region_naming.html.md.erb index 7809e71..d25e54d 100644 --- a/geode-docs/basic_config/data_regions/region_naming.html.md.erb +++ b/geode-docs/basic_config/data_regions/region_naming.html.md.erb @@ -22,9 +22,9 @@ limitations under the License. To be able to perform all available operations on your data regions, follow these region naming guidelines. -- Permitted characters within region names are alphanumeric characters +- Characters permitted in region names are alphanumeric characters (`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`), -the underscore character (`_`), and the hyphen character (`-`). +period (`.`), underscore (`_`), square brackets (`[, ]`), hyphen (`-`), caret (`^`) and backquote (```). - Do not use the slash character (`/`). - Do not begin region names with two underscore characters (`__`), as this is reserved for internal use.