GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Datastore - call to setNamespace fails under certain Locales · Issue #1957 · googleapis/google-cloud-java

Datastore - call to setNamespace fails under certain Locales  #1957

New issue
Copy link
New issue
Copy link
Closed
Closed
Datastore - call to setNamespace fails under certain Locales #1957
Copy link
Assignees
vam-google

Description

@sai-pullabhotla
sai-pullabhotla
opened on Apr 21, 2017
Issue body actions

When the JVM is running under certain locales (e.g. new Locale("hi", "IN"), the call to setNamespace fails. with the below Exception:

Exception in thread "main" java.lang.ExceptionInInitializerError
	at com.google.cloud.datastore.DatastoreOptions$Builder.setNamespace(DatastoreOptions.java:96)
	at com.example.test.App.main(App.java:21)
Caused by: java.util.regex.PatternSyntaxException: Unclosed counted closure near index 19
[0-9A-Za-z\._\-]{0,१००}
                   ^
	at java.util.regex.Pattern.error(Pattern.java:1955)
	at java.util.regex.Pattern.closure(Pattern.java:3141)
	at java.util.regex.Pattern.sequence(Pattern.java:2134)
	at java.util.regex.Pattern.expr(Pattern.java:1996)
	at java.util.regex.Pattern.compile(Pattern.java:1696)
	at java.util.regex.Pattern.<init>(Pattern.java:1351)
	at java.util.regex.Pattern.compile(Pattern.java:1028)
	at com.google.cloud.datastore.Validator.<clinit>(Validator.java:34)
	... 2 more

Sample Code

public static void main(String[] args) {
  Locale.setDefault(new Locale("hi", "IN")); //Hindi/India
  Datastore datastore = DatastoreOptions.newBuilder().setProjectId("myproject").setNamespace("mynamespace").build().getService();
}

The issue is with the below Pattern in the Validator class:

  private static final Pattern NAMESPACE_PATTERN =
      Pattern.compile(String.format("[0-9A-Za-z\\._\\-]{0,%d}", MAX_NAMESPACE_LENGTH));

String.format uses the JVM's Locale and MAX_NAMESPACE_LENGTH 100 becomes "१००" (equivalent of 100 in Hindi/India Locale), which makes the Pattern invalid.

Activity

  1. vam-google
    self-assigned this
    on May 5, 2017
  2. vam-google
    added 2 commits that reference this issue on May 5, 2017

    Fix Datastore - call to setNamespace fails under certain Locales goog…

    e775f82

    Fix Datastore - call to setNamespace fails under certain Locales (#2037)

    d70f696
  3. vam-google commented on May 5, 2017

    @vam-google
    vam-google
    on May 5, 2017
    Contributor
    More actions

    Merged. The sample code (see above) now passes without errors. Closing.

  4. vam-google
    closed this as completedon May 5, 2017
  5. theacodes
    unassigned
    vam-google
    on Sep 28, 2018
  6. JustinBeckwith
    assigned
    vam-google
    on Feb 1, 2021
  7. meltsufin
    added a commit that references this issue on Dec 22, 2025

    chore: update requirements.txt to address dependabot security alerts. (…

    8236be9
  8. chingor13
    added a commit that references this issue on Jan 22, 2026

    chore: Update generation configuration at Sun Oct 19 02:31:07 UTC 2025 (

    b9b95cb
  9. chingor13
    added 2 commits that reference this issue on Feb 20, 2026

    feat: add timeout to inflight queue waiting (#1957)

    3159b12

    chore(main): release 2.29.0 (#1969)

    b05fff5
  10. suztomo
    added 2 commits that reference this issue on Mar 9, 2026

    chore: update requirements.txt to address dependabot security alerts. (…

    63075dd

    chore: update requirements.txt to address dependabot security alerts. (…

    82e192e
  11. lqiu96
    added a commit that references this issue on Mar 20, 2026

    chore: Update generation configuration at Sun Oct 19 02:31:07 UTC 2025 (

    9884d06
  12. meltsufin
    added 6 commits that reference this issue on Apr 29, 2026

    deps: update dependency com.google.cloud:google-cloud-storage to v2.3…

    0d8c182

    chore(main): release 1.127.3 (#1959)

    e49cdc4

    chore(main): release 1.133.0 (#2206)

    a3b6539

    deps: update dependency com.google.cloud:google-cloud-storage to v2.3…

    57fee25

    chore(main): release 1.127.3 (#1959)

    fd73ca3

    chore(main): release 1.133.0 (#2206)

    1180af9
  13. benjaminp
    added a commit that references this issue on Jul 13, 2026

    chore(main): release 2.28.1-SNAPSHOT (googleapis#1957)

    c3160fc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @vam-google
    vam-google

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.