Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add existence check (file protocol) in URLImageDescriptor.getFilePath() #1788

Conversation

HeikoKlare
Copy link
Contributor

The URLImageDescriptor.getFilePath() method currently returns a path for a given URL using the file protocol even if the file does not exist. This conflicts with the method's contract and breaks consumers (such as the scaled image data retrieval in SWT's DPIUtil).

With this change, the method properly checks for the existence of a file at the given location and returns null in case it does not exist, according to the method's contract. A test case is added to demonstrate the bug and detect regressions.

The URLImageDescriptor.getFilePath() method currently returns a path for
a given URL using the file protocol even if the file does not exist.
This conflicts with the method's contract and breaks consumers (such as
the scaled image data retrieval in SWT's DPIUtil).

With this change, the method properly checks for the existence of a file
at the given location and returns null in case it does not exist,
according to the method's contract. A test case is added to demonstrate
the bug and detect regressions.
Copy link
Contributor

Test Results

   917 files   -     1     917 suites   - 1   36m 21s ⏱️ - 10m 18s
 7 510 tests +    1   7 357 ✅ ±    0  151 💤 ±  0  2 ❌ +1 
22 106 runs   - 1 570  21 718 ✅  - 1 452  386 💤  - 119  2 ❌ +1 

For more details on these failures, see this check.

Results for commit 828411a. ± Comparison against base commit 3f00c8b.

@HeikoKlare HeikoKlare marked this pull request as ready for review March 30, 2024 15:24
@HeikoKlare
Copy link
Contributor Author

Failing tests are unrelated and already documented: #1005.

@HeikoKlare HeikoKlare merged commit cff785d into eclipse-platform:master Apr 3, 2024
14 of 16 checks passed
@HeikoKlare HeikoKlare deleted the image-descriptor-file-existance-check branch April 3, 2024 11:29
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.

2 participants