Skip to content

Fix URIFactoryTest failing on Windows#7527

Merged
karianna merged 6 commits intoPCGen:masterfrom
karianna:fix-uri-factory-test-windows
Feb 26, 2026
Merged

Fix URIFactoryTest failing on Windows#7527
karianna merged 6 commits intoPCGen:masterfrom
karianna:fix-uri-factory-test-windows

Conversation

@karianna
Copy link
Contributor

Problem

URIFactoryTest.testGetURI_WithValidRootAndOffset() fails on Windows CI runners with:

java.net.URISyntaxException: Illegal character in opaque part at index 7: file:D:\a\pcgen\pcgen/data/file.txt

The test constructed the expected URI via new URI("file:" + System.getProperty("user.dir") + "/data/file.txt"). On Windows, user.dir contains backslashes (e.g. D:\a\pcgen\pcgen) which are illegal in URIs.

Fix

Use new File(System.getProperty("user.dir"), "data/file.txt").toURI() which produces a properly formatted file:/// URI with forward slashes on all platforms.

karianna and others added 6 commits February 26, 2026 22:11
Use File.toURI() instead of manually constructing a URI string with
new URI("file:" + path). On Windows, System.getProperty("user.dir")
returns backslash-separated paths (e.g. D:\a\pcgen\pcgen) which are
illegal characters in a URI, causing URISyntaxException.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@karianna karianna merged commit 737ac4a into PCGen:master Feb 26, 2026
0 of 2 checks passed
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