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

NcmlReader.mergeNcml not working with groups #1403

Closed
1 task done
lesserwhirls opened this issue Jan 3, 2025 · 0 comments · Fixed by #1404
Closed
1 task done

NcmlReader.mergeNcml not working with groups #1403

lesserwhirls opened this issue Jan 3, 2025 · 0 comments · Fixed by #1404
Assignees
Labels
bug Something isn't working NcML Issues related to NcML

Comments

@lesserwhirls
Copy link
Member

Versions impacted by the bug

v5.x

What went wrong?

When using ucar.nc2.internal.ncml.NcmlReader#mergeNcml to wrap an open NetcdfDataset with NcML and the NcML is modifying elements inside a group, the modification fails and a Nested group already exist error is produced.

Relevant stack trace

java.lang.IllegalStateException: Nested group already exists global
	at ucar.nc2.Group$Builder.lambda$addGroup$5(Group.java:1079) ~[cdm-core-5.6.1-SNAPSHOT.jar:5.6.1-SNAPSHOT]
	at java.util.Optional.ifPresent(Optional.java:178) ~[?:?]
	at ucar.nc2.Group$Builder.addGroup(Group.java:1078) ~[cdm-core-5.6.1-SNAPSHOT.jar:5.6.1-SNAPSHOT]
	at ucar.nc2.internal.ncml.NcmlReader.readGroup(NcmlReader.java:596) ~[cdm-core-5.6.1-SNAPSHOT.jar:5.6.1-SNAPSHOT]
	at ucar.nc2.internal.ncml.NcmlReader.readGroup(NcmlReader.java:647) ~[cdm-core-5.6.1-SNAPSHOT.jar:5.6.1-SNAPSHOT]
	at ucar.nc2.internal.ncml.NcmlReader.mergeNcml(NcmlReader.java:291) ~[cdm-core-5.6.1-SNAPSHOT.jar:5.6.1-SNAPSHOT]

Relevant log messages

N/A

If you have an example file that you can share, please attach it to this issue.

If so, may we include it in our test datasets to help ensure the bug does not return once fixed?
Note: the test datasets are publicly accessible without restriction.

Yes

Code of Conduct

  • I agree to follow the UCAR/Unidata Code of Conduct
@lesserwhirls lesserwhirls added the bug Something isn't working label Jan 3, 2025
@lesserwhirls lesserwhirls self-assigned this Jan 3, 2025
@lesserwhirls lesserwhirls added the NcML Issues related to NcML label Jan 3, 2025
lesserwhirls added a commit to lesserwhirls/netcdf-java that referenced this issue Jan 3, 2025
Ensure reference group is passed into readGroup when using NcmlReader.mergeNcml,
 and make sure the reference group information is taken into account by the readGroup code.

Fixes Unidata#1403
lesserwhirls added a commit that referenced this issue Jan 3, 2025
Ensure reference group is passed into readGroup when using NcmlReader.mergeNcml,
 and make sure the reference group information is taken into account by the readGroup code.

Fixes #1403
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working NcML Issues related to NcML
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant