Skip to content

NcmlReader.mergeNcml not working with groups #1403

@lesserwhirls

Description

@lesserwhirls

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

Metadata

Metadata

Assignees

Labels

NcMLIssues related to NcMLbugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions