Skip to content

NullPointerException when module.txt contains an extra trailing comma #133

@keturn

Description

@keturn

for (DependencyInfo dependency : version.getMetadata().getDependencies()) {
if (involvedModules.add(dependency.getId())) {
moduleQueue.push(dependency.getId());
moduleVersionPool.put(dependency.getId(), PossibleVersion.OPTIONAL_VERSION);
}
}

Apparently ModuleMetadata.getDependencies can return a list with a null element when module.txt contains an extra trailing comma, as in the example below.

Could catch the null here, but probably better to fix it so that list can't contain null elements at all, even if the JSON is invalid.

[example module.txt]

module.txt:

{
  "id": "BlockDetector",
  "version": "1.4.0-SNAPSHOT",
  "author": "rzats",
  "displayName": "BlockDetector",
  "description": "Adds a detector item that indicates the location of arbitrary blocks.",
  "dependencies": [
    {
      "id": "CoreAssets",
      "minVersion": "2.0.0"
    },
    {
      "id": "Inventory",
      "minVersion": "1.1.0"
    },
  ],
  "serverSideOnly": false,
  "isAsset": true,
  "isLibrary": true
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Category: CrashRequests, Issues and Changes targeting unexpected terminations, segfaults, etc.Good First IssueGood for learners that are new to TerasologySize: SSmall effort likely only affecting a single area and requiring little to no researchTopic: StabilizationRequests, Issues and Changes related to improving stablity and reducing flakynessType: BugIssues reporting and PRs fixing problems

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions