Skip to content

Fix native file monitor relative URI handling#3258

Merged
ryanjbaxter merged 1 commit into
spring-cloud:mainfrom
hutiefang76:codex/scc-file-monitor-relative-native
Jun 25, 2026
Merged

Fix native file monitor relative URI handling#3258
ryanjbaxter merged 1 commit into
spring-cloud:mainfrom
hutiefang76:codex/scc-file-monitor-relative-native

Conversation

@hutiefang76

Copy link
Copy Markdown
Contributor

Fixes gh-2997

This updates the file monitor path resolution for native search locations that use relative file URIs such as file:target/config.d or file:./config.d.

Previously, FileMonitorConfiguration resolved existing native resources with Paths.get(resource.getURI()). For relative file resources this can throw IllegalArgumentException: URI is not hierarchical, causing the path to be skipped and local config changes not to be monitored.

The fix resolves FileSystemResource and FileUrlResource through resource.getFile().toPath().toAbsolutePath().normalize(), while keeping the existing URI-based fallback for other resource types.

Verification:

  • Red: the new test failed before the fix with Cannot resolve URI for path: file:target/... and an empty monitored directory set.
  • Green: ./mvnw -pl spring-cloud-config-monitor -Dtest=FileMonitorConfigurationTest#testStart_withNativeEnvironmentRepositoryAndRelativeFileUri -Dstyle.color=never --no-transfer-progress test
  • Regression: ./mvnw -pl spring-cloud-config-monitor -Dtest=FileMonitorConfigurationTest -Dstyle.color=never --no-transfer-progress test
  • git diff --check

Fixes spring-cloudgh-2997

Signed-off-by: hutiefang <hutiefang@qq.com>
@ryanjbaxter ryanjbaxter merged commit f5a284f into spring-cloud:main Jun 25, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐞Bug: Cannot resolve URI for path: ... using native profile

3 participants