Skip to content

Use encoded file URI when reading persisted NcML aggregation cache#1585

Open
387809109 wants to merge 2 commits into
Unidata:maint-5.xfrom
387809109:#delimiter-aggregation-cache-URI
Open

Use encoded file URI when reading persisted NcML aggregation cache#1585
387809109 wants to merge 2 commits into
Unidata:maint-5.xfrom
387809109:#delimiter-aggregation-cache-URI

Conversation

@387809109

@387809109 387809109 commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Description of Changes

The generated cache filename is:

/path/test1.ncml#delimiter

This is a valid Linux filename.
AggregationExisting.persistRead() parsed the cache using:

Parse.readRootElement("file:" + cacheFile.getPath())

For a URL such as file:/path/test1.ncml#delimiter the #delimiter portion is interpreted as a URI fragment.

The XML parser therefore attempted to open /path/test1.ncml instead of /path/test1.ncml#delimiter
The resulting IOException was caught and persistRead() returned silently.

replaced that part with Parse.readRootElement(cacheFile.toURI().toString())
File.toURI() encodes the literal # as %23.

The resulting URI refers to the real file:
test1.ncml%23delimiter

PR Checklist

  • Link to any issues that the PR addresses
  • Add labels
  • Open as a draft PR
    until ready for review
  • Make sure GitHub tests pass
  • Mark PR as "Ready for Review"

@387809109

Copy link
Copy Markdown
Contributor Author

the cache-sensitive TestNetcdfFileCache.testNetcdfFileCache failure appears unrelated to this one-line URI change.

@387809109
387809109 marked this pull request as ready for review July 21, 2026 05:50
@387809109
387809109 requested a review from lesserwhirls as a code owner July 21, 2026 05:50
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.

1 participant