apache/gravitino

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

Open

#7,958 创建于 2025年8月7日

在 GitHub 查看
 (8 评论) (0 反应) (1 负责人)Java (887 fork)auto 404
good first issueimprovement

仓库指标

Star
 (3,058 star)
PR 合并指标
 (PR 指标待抓取)

描述

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

贡献者指南