Restore correct URL/URI handling in URLImageDescriptor#3115
Conversation
8db4eac to
4031a36
Compare
The changes done with cee4631 cause an exception when an URL is passed as argument, which contains improperly escaped characters (most noticeably whitespaces) and therefore causes an URISyntaxException when calling URL.toURI(). This does not occur when using IPath.fromOSString(), which is the approach that was done previously. But instead of converting this path back to an OS-dependent string, it is instead converted to a file, to check whether it exists and to only then convert it back to its String representation. A test case with an ill-formed URL has been added to avoid a similar problem in the future.
4031a36 to
33616c6
Compare
Test Results 2 778 files ±0 2 778 suites ±0 1h 38m 17s ⏱️ - 10m 42s For more details on these failures, see this check. Results for commit 33616c6. ± Comparison against base commit cee4631. |
|
Test failure is unrelated again: #926 Unless there are any objections, I plan on merging this later today when I'm back home. |
|
In general URL/URI handling and conversion to Path can be quite tricky and has a lot of corner-cases. I started to create a Utility that covers all these cases, but didn't have the time yet to finish it: Once it is finished, it would probably be good to use it here as well. |
I assume you got the numbers mixed up and meant eclipse-equinox/equinox#691? |
Yes, indeed. Thanks for the correction. |
|
Thank you for the quick fix, @ptziegler! |
The changes done with cee4631 cause an exception when URL is passed as an argument which contains improperly escaped characters (most noticeably whitespaces) and therefore causes an URISyntaxException when calling URL.toURI().
This does not occur when using IPath.fromOSString(), which is the approach that was done previously. But instead of converting this path back to an OS-dependent string, it is instead converted to a file, to check whether it exists and to only then convert it back to its String representation.
A test case with an ill-formed URL has been added to avoid a similar problem in the future.