Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
keturn opened this issue May 19, 2022 · 2 comments
Open
Labels
Category: Crash Requests, Issues and Changes targeting unexpected terminations, segfaults, etc. Good First Issue Good for learners that are new to Terasology Size: S Small effort likely only affecting a single area and requiring little to no research Topic: Stabilization Requests, Issues and Changes related to improving stablity and reducing flakyness Type: Bug Issues reporting and PRs fixing problems
Milestone

Comments

@keturn
Copy link
Member

keturn commented May 19, 2022

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
}
@keturn keturn added Type: Bug Issues reporting and PRs fixing problems Good First Issue Good for learners that are new to Terasology Category: Crash Requests, Issues and Changes targeting unexpected terminations, segfaults, etc. Size: S Small effort likely only affecting a single area and requiring little to no research Topic: Stabilization Requests, Issues and Changes related to improving stablity and reducing flakyness labels May 19, 2022
@keturn keturn added this to the 7.next milestone May 19, 2022
@youssef-abdallah
Copy link

Probably the issue will be fixed by adding .setLenient() to GsonBuilder in the constructor of ModuleMetadataJsonAdapter. Is there any guide to contributing?

@keturn
Copy link
Member Author

keturn commented May 20, 2022

I'm not finding a gestalt-specific contributing guide, but you can refer to the one for Terasology: https://github.com/MovingBlocks/Terasology/blob/develop/.github/CONTRIBUTING.md

There are some differences. For one, I think gestalt needs to stay Android-compatible; it builds with an older Java source compatibility level than Terasology does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Crash Requests, Issues and Changes targeting unexpected terminations, segfaults, etc. Good First Issue Good for learners that are new to Terasology Size: S Small effort likely only affecting a single area and requiring little to no research Topic: Stabilization Requests, Issues and Changes related to improving stablity and reducing flakyness Type: Bug Issues reporting and PRs fixing problems
Projects
None yet
Development

No branches or pull requests

2 participants