You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by fs...@apache.org on 2018/01/29 20:17:15 UTC

svn commit: r1822578 - /jmeter/trunk/src/core/org/apache/jmeter/gui/action/OpenLinkAction.java

Author: fschumacher
Date: Mon Jan 29 20:17:14 2018
New Revision: 1822578

URL: http://svn.apache.org/viewvc?rev=1822578&view=rev
Log:
Display a warn message, if the desktop doesn't support the Desktop.Action.BROWSE.

This can happen, when JMeter is started on a ssh tunneled X11 server.

If the URL appears to be a component documentation, add a line that tells the user
to set the system property help.local to true.

Bugzilla Id: 62027

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/gui/action/OpenLinkAction.java

Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/action/OpenLinkAction.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/action/OpenLinkAction.java?rev=1822578&r1=1822577&r2=1822578&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/gui/action/OpenLinkAction.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/gui/action/OpenLinkAction.java Mon Jan 29 20:17:14 2018
@@ -18,6 +18,7 @@
 
 package org.apache.jmeter.gui.action;
 
+import java.awt.Component;
 import java.awt.event.ActionEvent;
 import java.io.IOException;
 import java.util.HashMap;
@@ -25,6 +26,8 @@ import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
 
+import javax.swing.JOptionPane;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -62,7 +65,7 @@ public class OpenLinkAction extends Abst
         String url = LINK_MAP.get(e.getActionCommand());
         if(url == null) {
             log.warn("Action {} not handled by this class", e.getActionCommand());
-            return; 
+            return;
         }
         try {
             if(e.getSource() instanceof String[]) {
@@ -73,6 +76,7 @@ public class OpenLinkAction extends Abst
             log.error("OpenLinkAction: User default browser is not found, or it fails to be launched, or the default handler application failed to be launched on {}", url, err);
         } catch (UnsupportedOperationException err) {
             log.error("OpenLinkAction: Current platform does not support the Desktop.Action.BROWSE action on {}", url, err);
+            showBrowserWarning(e.getSource(), url);
         } catch (SecurityException err) {
             log.error("OpenLinkAction: Security problem on {}", url, err);
         } catch (Exception err) {
@@ -85,4 +89,17 @@ public class OpenLinkAction extends Abst
         return commands;
     }
 
+    private void showBrowserWarning(Object targetObject, String url) {
+        String problemSolver;
+        if (url.startsWith(LINK_MAP.get(ActionNames.LINK_COMP_REF))) {
+            problemSolver = "\n\nTry to set the system property help.local to true.";
+        } else {
+            problemSolver = "";
+        }
+        JOptionPane.showMessageDialog(null, String.format(
+                "Problem opening a browser to show the content of the URL\n%s%s",
+                url, problemSolver), "Problem opening browser",
+                JOptionPane.WARNING_MESSAGE);
+    }
+
 }