Skip to content

fix: Assert failure in gov.nasa.jpf.test.java.io.FileTest.testToURI (Windows 11/Java 11)#598

Open
gRid08 wants to merge 1 commit intojavapathfinder:masterfrom
gRid08:fix/file-touri-windows
Open

fix: Assert failure in gov.nasa.jpf.test.java.io.FileTest.testToURI (Windows 11/Java 11)#598
gRid08 wants to merge 1 commit intojavapathfinder:masterfrom
gRid08:fix/file-touri-windows

Conversation

@gRid08
Copy link
Copy Markdown

@gRid08 gRid08 commented Feb 12, 2026

Closes #597

Root Cause

In FileTest.java,test named testToURI the expected URI is created via: expectedURI = new URI("file:" + file.getAbsolutePath());

On Windows, file.getAbsolutePath() returns a path like C:\jpf-core\test.txt
new URI("file:" + ...) creates: file:C:\jpf-core\test.txt
file.toURI() (Actual) creates: file:/C:/jpf-core/test.txt (Note the leading slash required for the authority component).
Because the manual string concatenation lacks the leading slash (and proper character escaping), the assertEquals fails.

Proposed Fix

The test should use the host JVM's standard way of generating a URI from a file object to ensure platform compatibility. I have modified the test to use: expectedURI = file.getAbsoluteFile().toURI();

@gRid08 gRid08 marked this pull request as draft February 14, 2026 09:08
@gRid08 gRid08 marked this pull request as ready for review February 14, 2026 09:09
@gRid08
Copy link
Copy Markdown
Author

gRid08 commented Feb 14, 2026

@cyrille-artho Can you please review

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.

Assert failure in gov.nasa.jpf.test.java.io.FileTest.testToURI (Windows 11/Java 11)

1 participant