You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by mi...@apache.org on 2023/05/10 11:53:52 UTC

[jmeter] branch master updated (193bd552d4 -> a838243450)

This is an automated email from the ASF dual-hosted git repository.

milamber pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git


    from 193bd552d4 chore: Capture build scans on ge.apache.org to benefit from deep build insights
     new 45eff09fac Fix NumberFormatException when counter is empty or not a digit on Proxy Settings panel
     new 7f9219c3b5 Merge branch 'Fix_NFE_on_counter_button'
     new a838243450 update changes.xml with #5901 (Fix NumberFormatException when counter is empty or not a digit on Proxy Settings panel)

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../apache/jmeter/resources/messages.properties    |  2 +
 .../apache/jmeter/resources/messages_fr.properties |  2 +
 .../protocol/http/proxy/gui/ProxyControlGui.java   | 50 +++++++++++++++-------
 xdocs/changes.xml                                  |  1 +
 4 files changed, 39 insertions(+), 16 deletions(-)


[jmeter] 01/03: Fix NumberFormatException when counter is empty or not a digit on Proxy Settings panel

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

milamber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git

commit 45eff09fac544600e87134ebc434d387a823d254
Author: Milamber <mi...@apache.org>
AuthorDate: Tue May 9 18:37:13 2023 +0100

    Fix NumberFormatException when counter is empty or not a digit on Proxy Settings panel
---
 .../apache/jmeter/resources/messages.properties    |  2 +
 .../apache/jmeter/resources/messages_fr.properties |  2 +
 .../protocol/http/proxy/gui/ProxyControlGui.java   | 50 +++++++++++++++-------
 3 files changed, 38 insertions(+), 16 deletions(-)

diff --git a/src/core/src/main/resources/org/apache/jmeter/resources/messages.properties b/src/core/src/main/resources/org/apache/jmeter/resources/messages.properties
index dc93ac77c1..535e175cd2 100644
--- a/src/core/src/main/resources/org/apache/jmeter/resources/messages.properties
+++ b/src/core/src/main/resources/org/apache/jmeter/resources/messages.properties
@@ -879,6 +879,8 @@ proxy_sampler_graphql_settings=GraphQL HTTP Sampler settings
 proxy_sampler_settings=HTTP Sampler settings
 proxy_sampler_type=Type\:
 proxy_separators=Add Separators
+proxy_settings_counter_error_digits=Only digits allowed
+proxy_settings_counter_error_invalid_data=Invalid data
 proxy_settings_pause_error_digits=Only digits allowed
 proxy_settings_pause_error_invalid_data=Invalid data
 proxy_settings_port_error_digits=Only digits allowed
diff --git a/src/core/src/main/resources/org/apache/jmeter/resources/messages_fr.properties b/src/core/src/main/resources/org/apache/jmeter/resources/messages_fr.properties
index 5a68c3ebd5..fe279153c6 100644
--- a/src/core/src/main/resources/org/apache/jmeter/resources/messages_fr.properties
+++ b/src/core/src/main/resources/org/apache/jmeter/resources/messages_fr.properties
@@ -868,6 +868,8 @@ proxy_sampler_graphql_settings=Configuration de la requête GraphQL
 proxy_sampler_settings=Paramètres Echantillon HTTP
 proxy_sampler_type=Type \:
 proxy_separators=Ajouter des séparateurs
+proxy_settings_counter_error_digits=Seuls les chiffres sont autorisés.
+proxy_settings_counter_error_invalid_data=Données invalides
 proxy_settings_pause_error_digits=Seuls les chiffres sont autorisés.
 proxy_settings_pause_error_invalid_data=Données invalides
 proxy_settings_port_error_digits=Seuls les chiffres sont autorisés.
diff --git a/src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/proxy/gui/ProxyControlGui.java b/src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/proxy/gui/ProxyControlGui.java
index 5b7e776d09..e5e99f8b0b 100644
--- a/src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/proxy/gui/ProxyControlGui.java
+++ b/src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/proxy/gui/ProxyControlGui.java
@@ -63,6 +63,7 @@ import javax.swing.SwingUtilities;
 import javax.swing.Timer;
 
 import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.math.NumberUtils;
 import org.apache.jmeter.control.Controller;
 import org.apache.jmeter.control.gui.LogicControllerGui;
 import org.apache.jmeter.control.gui.TreeNodeWrapper;
@@ -237,6 +238,8 @@ public class ProxyControlGui extends LogicControllerGui implements JMeterGUIComp
     private JButton start;
     private JButton restart;
 
+    private JTextField counterValue;
+
     private transient RecorderDialog recorderDialog;
 
     private JTextField httpSampleNameFormat;
@@ -265,6 +268,8 @@ public class ProxyControlGui extends LogicControllerGui implements JMeterGUIComp
 
     private static final String ADD_SUGGESTED_EXCLUDES = "exclude_suggested";
 
+    private static final String SET_COUNTERS = "set_counters";
+
     static final String HTTP_SAMPLER_NAMING_MODE = "proxy_http_sampler_naming_mode"; // $NON-NLS-1$
 
     static final String PREFIX_HTTP_SAMPLER_NAME = "proxy_prefix_http_sampler_name"; // $NON-NLS-1$
@@ -410,7 +415,7 @@ public class ProxyControlGui extends LogicControllerGui implements JMeterGUIComp
         httpSampleNameFormat.setText(model.getHttpSampleNameFormat());
 
         reinitializeTargetCombo();// Set up list of potential targets and
-                                    // enable listener
+        // enable listener
 
         populateTable(includeModel, model.getIncludePatterns().iterator());
         populateTable(excludeModel, model.getExcludePatterns().iterator());
@@ -499,6 +504,8 @@ public class ProxyControlGui extends LogicControllerGui implements JMeterGUIComp
             addSuggestedExcludes(excludeTable);
             excludeModel.fireTableDataChanged();
             enableRestart();
+        } else if (command.equals(SET_COUNTERS)) {
+            setSetCounters();
         }
     }
 
@@ -589,15 +596,15 @@ public class ProxyControlGui extends LogicControllerGui implements JMeterGUIComp
         } catch (IOException ioe) {
             JOptionPane.showMessageDialog(this,
                     JMeterUtils.getResString("proxy_daemon_error_read_args") // $NON-NLS-1$
-                    + "\n" + ioe.getLocalizedMessage(), JMeterUtils.getResString("error_title"),  // $NON-NLS-1$  $NON-NLS-2$
+                            + "\n" + ioe.getLocalizedMessage(), JMeterUtils.getResString("error_title"),  // $NON-NLS-1$  $NON-NLS-2$
                     JOptionPane.ERROR_MESSAGE);
         } catch (UnsupportedFlavorException ufe) {
             JOptionPane.showMessageDialog(this,
                     JMeterUtils.getResString("proxy_daemon_error_not_retrieve") + SPACE // $NON-NLS-1$
-                        + DataFlavor.stringFlavor.getHumanPresentableName() + SPACE
-                        + JMeterUtils.getResString("proxy_daemon_error_from_clipboard") // $NON-NLS-1$
-                        + ufe.getLocalizedMessage(), JMeterUtils.getResString("error_title"),  // $NON-NLS-1$
-                        JOptionPane.ERROR_MESSAGE);
+                            + DataFlavor.stringFlavor.getHumanPresentableName() + SPACE
+                            + JMeterUtils.getResString("proxy_daemon_error_from_clipboard") // $NON-NLS-1$
+                            + ufe.getLocalizedMessage(), JMeterUtils.getResString("error_title"),  // $NON-NLS-1$
+                    JOptionPane.ERROR_MESSAGE);
         }
     }
 
@@ -633,11 +640,11 @@ public class ProxyControlGui extends LogicControllerGui implements JMeterGUIComp
                         .append("</b>&nbsp;").append(JMeterUtils.getResString("proxy_daemon_msg_created_in_bin"));
                 sb.append("<br>").append(JMeterUtils.getResString("proxy_daemon_msg_install_as_in_doc")); // $NON-NLS-1$
                 sb.append("<br><b>").append(MessageFormat.format(
-                        JMeterUtils.getResString("proxy_daemon_msg_check_expiration"),
-                        ProxyControl.CERT_VALIDITY)) // $NON-NLS-1$
-                    .append("</b><br>");
+                                JMeterUtils.getResString("proxy_daemon_msg_check_expiration"),
+                                ProxyControl.CERT_VALIDITY)) // $NON-NLS-1$
+                        .append("</b><br>");
                 sb.append("<br>").append(JMeterUtils.getResString("proxy_daemon_msg_check_details"))
-                    .append("<ul>"); // $NON-NLS-1$
+                        .append("<ul>"); // $NON-NLS-1$
                 for(String detail : details) {
                     sb.append("<li>").append(detail).append("</li>");
                 }
@@ -656,10 +663,10 @@ public class ProxyControlGui extends LogicControllerGui implements JMeterGUIComp
                 timer.start();
                 JOptionPane.showMessageDialog(this,
                         messageLabel,
-                    JMeterUtils.getResString("proxy_daemon_msg_rootca_cert") + SPACE // $NON-NLS-1$
-                    + KeyToolUtils.ROOT_CACERT_CRT_PFX + SPACE
-                    + JMeterUtils.getResString("proxy_daemon_msg_created_in_bin"), // $NON-NLS-1$
-                    JOptionPane.INFORMATION_MESSAGE);
+                        JMeterUtils.getResString("proxy_daemon_msg_rootca_cert") + SPACE // $NON-NLS-1$
+                                + KeyToolUtils.ROOT_CACERT_CRT_PFX + SPACE
+                                + JMeterUtils.getResString("proxy_daemon_msg_created_in_bin"), // $NON-NLS-1$
+                        JOptionPane.INFORMATION_MESSAGE);
             }
             return true;
         } catch (InvalidVariableException e) {
@@ -691,6 +698,16 @@ public class ProxyControlGui extends LogicControllerGui implements JMeterGUIComp
         }
     }
 
+    void setSetCounters() {
+        if ((counterValue.getText().length() > 0) && NumberUtils.isParsable(counterValue.getText())) {
+            Proxy.setCounter(Integer.parseInt(counterValue.getText()));
+        } else {
+            JOptionPane.showMessageDialog(this,
+                    JMeterUtils.getResString("proxy_settings_counter_error_digits"), // $NON-NLS-1$
+                    JMeterUtils.getResString("proxy_settings_counter_error_invalid_data"), // $NON-NLS-1$
+                    JOptionPane.WARNING_MESSAGE);
+        }
+    }
     /** {@inheritDoc} */
     @Override
     public void keyPressed(KeyEvent e) {
@@ -979,10 +996,11 @@ public class ProxyControlGui extends LogicControllerGui implements JMeterGUIComp
         httpSampleNameFormat.setToolTipText(JMeterUtils.getResString("sample_naming_format_help"));
 
         JLabel labelSetCounter = new JLabel(JMeterUtils.getResString("sample_creator_counter_value"));
-        JTextField counterValue = new JTextField(10);
+        counterValue = new JTextField(10);
         labelSetCounter.setLabelFor(counterValue);
         JButton buttonSetCounter = new JButton(JMeterUtils.getResString("sample_creator_set_counter"));
-        buttonSetCounter.addActionListener(e -> Proxy.setCounter(Integer.parseInt(counterValue.getText())));
+        buttonSetCounter.setActionCommand(SET_COUNTERS);
+        buttonSetCounter.addActionListener(this);
         panel.add(labelSetCounter);
         panel.add(counterValue);
         panel.add(buttonSetCounter);


[jmeter] 03/03: update changes.xml with #5901 (Fix NumberFormatException when counter is empty or not a digit on Proxy Settings panel)

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

milamber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git

commit a838243450c0b90134d748c1940396055acb0c89
Author: Milamber <mi...@apache.org>
AuthorDate: Wed May 10 12:53:22 2023 +0100

    update changes.xml with #5901 (Fix NumberFormatException when counter is empty or not a digit on Proxy Settings panel)
---
 xdocs/changes.xml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xdocs/changes.xml b/xdocs/changes.xml
index 6a4159075b..936694aa6b 100644
--- a/xdocs/changes.xml
+++ b/xdocs/changes.xml
@@ -128,6 +128,7 @@ Summary
 
 <h3>HTTP Samplers and Test Script Recorder</h3>
 <ul>
+  <li><pr>5901</pr>Fix NumberFormatException when counter is empty or not a digit on Proxy Settings panel</li>
 </ul>
 
 <h3>Other Samplers</h3>


[jmeter] 02/03: Merge branch 'Fix_NFE_on_counter_button'

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

milamber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git

commit 7f9219c3b508df1789f4cdcd1aef9f8fb069e460
Merge: 193bd552d4 45eff09fac
Author: Milamber <mi...@apache.org>
AuthorDate: Wed May 10 12:51:00 2023 +0100

    Merge branch 'Fix_NFE_on_counter_button'
    
    See PR #5901

 .../apache/jmeter/resources/messages.properties    |  2 +
 .../apache/jmeter/resources/messages_fr.properties |  2 +
 .../protocol/http/proxy/gui/ProxyControlGui.java   | 50 +++++++++++++++-------
 3 files changed, 38 insertions(+), 16 deletions(-)