apache / apache/gravitino

[Improvement] Fix potential null pointer expections in CLI

Open
#6,528 1 comment 0 reactions 1 assignee Claimed by @Brijeshthummar02 View on GitHub
good first issue improvement
Dominant language
Java
Stars
3.2k
Forks
935
Avg merge
1d 16h
Merged PRs (30d)
298

Description

### What would you like to be improved?

There are several places with potential a NPE could occur. While these are unlikely to occur, we should still add checks.

In CatalogAudit.java:
` displayAuditInfo(result.auditInfo());`

In CreateTable.java:
`client.loadCatalog(catalog).asTableCatalog().createTable(tableName, columns, comment, null);`

in ListCatalogProperties.java:
` Map properties = gCatalog.properties();`

In ListColumns.java:
` for (int i = 0; i < columns.length; i++) {`

In ListFilesetProperties.java:
` Map properties = gFileset.properties();`

In ListMetalakeProperties.java:
` Map properties = gMetalake.properties();`

In ListSchemaProperties.java:
` Map properties = gSchema.properties();`

In ListTableProperties.java:
`Map properties = gTable.properties();`

In ListTables.java:
`if (tables.length == 0) {`

In ListTagProperties.java:
`Map properties = gTag.properties();`

In ListTopicProperties.java:
`Map properties = gTopic.properties();`

In ModelDetails.java:
`String.format("Model name %s, latest version: %s%n", gModel.name(), gModel.latestVersion());`

In SchemaAudit.java:
`displayAuditInfo(result.auditInfo());`

In TableAudit.java:
`displayAuditInfo(gTable.auditInfo());`

In TableDistribution.java:
`printInformation(distribution.strategy() + "," + distribution.number());`

In TopicDetails.java:
`printResults(gTopic.name() + "," + gTopic.comment());`

In UserDetails.java:
`if (roles.isEmpty()) {`

### How should we improve?

Add appropriate null checks.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.