mbien commented on code in PR #8224:
URL: https://github.com/apache/netbeans/pull/8224#discussion_r1954972536
##########
ide/extbrowser/src/org/netbeans/modules/extbrowser/NbDdeBrowserImpl.java:
##########
@@ -116,17 +70,104 @@ public NbDdeBrowserImpl (ExtWebBrowser extBrowserFactory)
{
this.extBrowserFactory = extBrowserFactory;
logFine("NbDdeBrowserImpl created with factory:", extBrowserFactory);
// NOI18N
}
-
- private native byte [] reqDdeMessage (String srv, String topic, String
item, int timeout) throws NbBrowserException;
-
- /** finds registry entry for browser opening */
- public static native String getBrowserPath (String browser) throws
NbBrowserException;
-
- /** returns the command that executes default application for opening of
- * .html files
+
+ /**
+ * finds registry entry for browser opening
+ *
+ * @param browser
+ * @return
+ * @throws org.netbeans.modules.extbrowser.NbBrowserException
*/
- public static native String getDefaultOpenCommand() throws
NbBrowserException;
-
+ public static String getBrowserPath(String browser) throws
NbBrowserException {
+ String key =
String.format("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App
Paths\\%s.exe", browser);
+
+ try {
+ return getKeyValueExpanded(WinReg.HKEY_LOCAL_MACHINE, key, null);
+ } catch (Win32Exception ex) {
+ ExtWebBrowser.getEM().log(Level.FINE, "Failed to read registry
entry for " + key, ex);
+ throw new NbBrowserException("Error when retrieving path to
browser.");
Review Comment:
does this intentionally shorten the exception? if `NbBrowserException` would
receive another utility constructor, we could call:
```
throw new NbBrowserException("Error when retrieving path to
browser.", ex);
```
this would keep track of the original exception and wouldn't require the
extra log lines?
(applies to many occurrences)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists