Bug 571112

Summary: org.eclipse.core.runtime.URIUtil.append(URI, String) has insufficient path-handling
Product: [Eclipse Project] Platform Reporter: Moritz Strübe <moritz.struebe>
Component: ResourcesAssignee: Platform-Resources-Inbox <platform-resources-inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3    
Version: 4.20   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Moritz Strübe CLA 2021-02-11 03:03:20 EST
When having a URL like file:////WSL$/... java.net.URI.getPath() will return /WSL$/.... When passing this to java.net.URI() as path-parameter, the first element is not interpreted as path, but as Authority, which does not support the $ (see backtrace)(IMO this is a bug in the java-lib).
While this problem occurred using the Winows-WSL, this can occur with any root-path containing special characters (-at least if I did not miss anything).

java.lang.RuntimeException: java.net.URISyntaxException: Illegal character in hostname at index 10: file://WSL$/Ubuntu/home/[..]
	at org.eclipse.core.runtime.URIUtil.append(URIUtil.java:85)
	at org.eclipse.cdt.core.EFSExtensionProvider.append(EFSExtensionProvider.java:166)
	at org.eclipse.cdt.utils.EFSExtensionManager.append(EFSExtensionManager.java:216)
	at org.eclipse.cdt.core.ErrorParserManager.toURI(ErrorParserManager.java:758)
	at org.eclipse.cdt.core.ErrorParserManager.findFileInWorkspace(ErrorParserManager.java:498)
[..]
Caused by: java.net.URISyntaxException: Illegal character in hostname at index 10: file://WSL$/Ubuntu/home/morty/[..]
	at java.base/java.net.URI$Parser.fail(URI.java:2963)
	at java.base/java.net.URI$Parser.parseHostname(URI.java:3498)
	at java.base/java.net.URI$Parser.parseServer(URI.java:3347)
	at java.base/java.net.URI$Parser.parseAuthority(URI.java:3266)
	at java.base/java.net.URI$Parser.parseHierarchical(URI.java:3208)
	at java.base/java.net.URI$Parser.parse(URI.java:3164)
	at java.base/java.net.URI.<init>(URI.java:708)
	at org.eclipse.core.runtime.URIUtil.append(URIUtil.java:75)
Comment 1 Moritz Strübe CLA 2022-05-31 07:46:24 EDT
This seems related to https://bugs.eclipse.org/bugs/show_bug.cgi?id=207103