Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 339671

Summary: Program#execute(String) cuts fragment part of file:/ arguments (starting at #)
Product: [Eclipse Project] Platform Reporter: Markus Keller <markus.kell.r>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: CLOSED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: pinnamur, remy.suen, shahzadiftikhar, xixiyan
Version: 3.7   
Target Milestone: ---   
Hardware: PC   
OS: Linux-GTK   
Whiteboard:

Description Markus Keller CLA 2011-03-11 06:56:25 EST
I20110310-1119 GTK

Program#execute(String) cuts fragment part of file:/ arguments (starting at #)

When I generate Javadoc and then want to open the Javadoc of a method selected in the editor in the system browser, then the fragment part (starting at #) is cut away in the browser.

Example:

String urlText = "file:/home/me/eclipse/runtime-New_configuration/javaP/doc/p/A.html#foo()";
Program program = Program.findProgram("html");
program.execute(urlText);

The url looks right until Program#gio_execute(*) calls
OS.g_file_new_for_uri (fileNameBuffer). Maybe g_file_new_for_commandline_arg () would be better?


Unlike bug 339655 on Cocoa, this is not completely wrong, but it's unexpected. On Windows 7, the fragment is passed to the browser as expected.
Comment 1 Praveen CLA 2011-03-11 07:35:39 EST
I will look into this.
Comment 2 Xi Yan CLA 2018-11-30 16:48:13 EST
Do you have a snippet that reproduces the issue?
Comment 3 Xi Yan CLA 2018-12-14 12:53:23 EST
Closing this ticket now as there has been no response in awhile. Please reopen
it if you can reproduce the issue on GTK3.22/24 using SWT 4.10.
Comment 4 Shahzad Iftikhar CLA 2022-04-16 17:44:29 EDT
Simple snippet to reproduce: 

try {
				IWorkbenchBrowserSupport browserSupport = PlatformUI.getWorkbench().getBrowserSupport();
				IWebBrowser browser = browserSupport.getExternalBrowser();
				URL url = new URL("file://sometestfile/test.html#123");
				browser.openURL(url);
			} catch (Exception e) {
				Logger.getLogger("An error occurred trying to open browser at: " + urlString);
			}



Above code will discard #123 from the URL while opening in browser.