dragonsKnight5 commented on code in PR #6626:
URL: https://github.com/apache/netbeans/pull/6626#discussion_r1374048692


##########
ide/extbrowser/src/org/netbeans/modules/extbrowser/NbDdeBrowserImpl.java:
##########
@@ -127,6 +133,59 @@ public NbDdeBrowserImpl (ExtWebBrowser extBrowserFactory) {
      */
     public static native String getDefaultOpenCommand() throws 
NbBrowserException;
     
+        /**
+     * Get the default browser name using Java JNA library
+     * @return String
+     */
+    private static String getDefaultWindowsBrowser() {
+        String userChoice = Advapi32Util
+                .registryGetStringValue(
+                        WinReg.HKEY_CURRENT_USER,
+                        
"SOFTWARE\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\https\\UserChoice",
+                        "ProgId"
+                )
+                .toUpperCase(Locale.ROOT);
+
+        // done this way so that values like FirefoxURL-308046B0AF4A39CB can 
be handled
+        if (userChoice.toUpperCase().contains(ExtWebBrowser.FIREFOX)) {
+            return ExtWebBrowser.FIREFOX;
+        }
+        else if (userChoice.toUpperCase().contains(ExtWebBrowser.CHROME)) {
+            return ExtWebBrowser.CHROME;
+        } else if (userChoice.toUpperCase().contains(ExtWebBrowser.CHROMIUM)) {
+            return ExtWebBrowser.CHROMIUM;
+        } else if (userChoice.toUpperCase().contains(ExtWebBrowser.MOZILLA)) {
+            return ExtWebBrowser.MOZILLA;
+        } else {
+            return ExtWebBrowser.IEXPLORE;
+        }
+    }
+    
+    /**
+     * Retrieves the browser execution path from the registry using the java 
JNA library
+     * @param browser
+     * @return String
+     */
+    private static String getDefaultWindowsOpenCommandPath(String browser) {
+        String executionCommand = Advapi32Util
+                .registryGetStringValue(
+                        WinReg.HKEY_CLASSES_ROOT,
+                        "Applications\\" + browser.toLowerCase() + 
".exe\\shell\\open\\command",
+                        ""
+                );
+        
+               // ensures a null value is never returned
+        if (executionCommand == null) {
+            return new String();
+        } else {
+            return executionCommand;
+        }

Review Comment:
   I was hoping to avoid causing a null related error, I have changed it back 
to how it was before



-- 
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

Reply via email to