Skip to content

Conversation

@Xenokieser
Copy link
Contributor

null pointer exception if the GLTF file references a node that doesn't exist.
I got this problem while tring to convert my GLTF file, i got 440 animations on the file with 3 animation that have joint index missmatch.
Maybe it's better to log the errors detail so the user have all the information to correct the error

null pointer exception if the GLTF file references a node that doesn't exist.
I got this problem while tring to convert my GLTF file, i got 440 animations on the file with 3 animation that have joint index missmatch.
Maybe it's better to log the errors detail so the user have all the information to correct the error
@tlf30
Copy link
Contributor

tlf30 commented Feb 22, 2021

In this instance I would think it would be better to throw an IOException as it seems to me the gltf file is corrupt. I don't know what you used to convert your models to gltf, but it is not normal for nodes to be missing. I think even if the model loads with missing nodes in your case, it would just add the possibility for a corrupt gltf to get further in the load process before breaking, which would be even more difficult to troubleshoot.

@Xenokieser
Copy link
Contributor Author

Xenokieser commented Feb 22, 2021

Its true that if there is any corruption in the file it need to be corrected. But for an end-user of the plug-in, he need to understand what is happening while trying to convert a file. A bulk null-pointer exception in console log is very hard to debug. A more friendly parsing log is better.
As for the throw exception proposal the calling methods don't have any proper exception error handling structure.
If i have more time, i am going to refactor the entire class and add some unit test.

@stephengold
Copy link
Member

No refactoring or units tests have been forthcoming. I'll finish this PR and integrate it.

This seems to be how model issues are reported by GltfLoader.
@stephengold stephengold added this to the v3.5.0 milestone Nov 2, 2021
@stephengold stephengold changed the title Update GltfLoader.java avoid an NPE in GltfLoader.findChildren() Nov 2, 2021
@stephengold
Copy link
Member

I believe this is ready to be integrated now.

@stephengold stephengold merged commit f0dd68b into jMonkeyEngine:master Nov 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants