apache/gravitino

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

Open

#7958 aperta il 7 ago 2025

Vedi su GitHub
 (8 commenti) (0 reazioni) (1 assegnatario)Java (887 fork)auto 404
good first issueimprovement

Metriche repository

Star
 (3058 star)
Metriche merge PR
 (Metriche PR in attesa)

Descrizione

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

Guida contributor