apache/gravitino

[Improvement] Creating a namespace from just white space should not be allowed

Open

#7,958 opened on Aug 7, 2025

View on GitHub
 (8 comments) (0 reactions) (1 assignee)Java (887 forks)auto 404
good first issueimprovement

Repository metrics

Stars
 (3,058 stars)
PR merge metrics
 (PR metrics pending)

Description

What would you like to be improved?

Update this test to the following, and the test will fail.

  @Test
  public void testFromStringInvalidArgs() {
    Assertions.assertThrows(IllegalArgumentException.class, () -> Namespace.fromString(null));
    Assertions.assertThrows(IllegalArgumentException.class, () -> Namespace.fromString(".a"));
    Assertions.assertThrows(IllegalArgumentException.class, () -> Namespace.fromString("a."));
    Assertions.assertThrows(IllegalArgumentException.class, () -> Namespace.fromString("a..b"));
    Assertions.assertThrows(IllegalArgumentException.class, () -> Namespace.fromString(" "));
  }

How should we improve?

Update Namespace.fromString to throw a IllegalArgumentException if given a namespace that is just whitespace

Contributor guide