Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 339671 - Program#execute(String) cuts fragment part of file:/ arguments (starting at #)
Summary: Program#execute(String) cuts fragment part of file:/ arguments (starting at #)
Status: CLOSED WORKSFORME
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.7   Edit
Hardware: PC Linux-GTK
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-11 06:56 EST by Markus Keller CLA
Modified: 2022-04-16 17:44 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.