Code Monkey home page Code Monkey logo

Comments (9)

asfimport avatar asfimport commented on May 20, 2024

khammond25 (migrated from Bugzilla):
This also applies to the Gaussian Random and Uniform Random Timers.

from jmeter.

asfimport avatar asfimport commented on May 20, 2024

khammond25 (migrated from Bugzilla):
Created attachment patch.ConstantTimer.diff: Patch for ConstantTimer.java; file contains the diff

patch.ConstantTimer.diff
--- \jakarta-jmeter-cvs\jakarta-jmeter\src\org\apache\jmeter\timers\ConstantTimer.java	Fri Aug 31 00:46:46 2001
+++ \jakarta-jmeter-nightly\2001.09.15\jakarta-jmeter\src\org\apache\jmeter\timers\ConstantTimer.java	Tue Sep 18 14:04:42 2001
@@ -77,7 +77,8 @@
 public class ConstantTimer implements Timer, JMeterComponentModel, Saveable,
 		Serializable
 {
-	private long delay = 300;
+	private final long DEFAULT_DELAY = 300;
+	private long delay = DEFAULT_DELAY;
 	private String name;
 	private static List addableList = new LinkedList();
 
@@ -135,6 +136,16 @@
 	public long getDelay()
 	{
 		return delay;
+	}
+
+	/************************************************************
+	 *  !ToDoo (Method description)
+	 *
+	 *@return    !ToDo (Return description)
+	 ***********************************************************/
+	public long getDefaultDelay()
+	{
+		return DEFAULT_DELAY;
 	}
 
 	/************************************************************

from jmeter.

asfimport avatar asfimport commented on May 20, 2024

khammond25 (migrated from Bugzilla):
Created attachment patch.ConstantTimerGui.diff: Patch for ConstantTimerGui.java; file contains the diff

patch.ConstantTimerGui.diff
--- \jakarta-jmeter-cvs\jakarta-jmeter\src\org\apache\jmeter\timers\gui\ConstantTimerGui.java	Thu Jul 26 00:34:52 2001
+++ \jakarta-jmeter-nightly\2001.09.15\jakarta-jmeter\src\org\apache\jmeter\timers\gui\ConstantTimerGui.java	Tue Sep 18 14:08:54 2001
@@ -124,7 +124,24 @@
 			}
 			else
 			{
-				model.setDelay(Long.parseLong(delayField.getText()));
+				try
+				{
+					model.setDelay(Long.parseLong(delayField.getText()));
+				}
+				catch (NumberFormatException nfe)
+				{
+					if (delayField.getText().length() > 0)
+					{
+						JOptionPane.showMessageDialog(this, "You must enter a valid number",
+								"Invalid data", JOptionPane.WARNING_MESSAGE);
+						model.setDelay(model.getDefaultDelay());
+						delayField.setText("");
+					}
+					else
+					{
+						model.setDelay(model.getDefaultDelay());
+					}
+				}
 			}
 		}
 
@@ -135,4 +152,4 @@
 	public void keyTyped(KeyEvent e)
 	{
 	}
-}
\ No newline at end of file
+}

from jmeter.

asfimport avatar asfimport commented on May 20, 2024

khammond25 (migrated from Bugzilla):
Created attachment patch.GaussianRandomTimerGui.diff: Patch for GaussianRandomTimerGui.java; file contains the diff

patch.GaussianRandomTimerGui.diff
--- \jakarta-jmeter-cvs\jakarta-jmeter\src\org\apache\jmeter\timers\gui\GaussianRandomTimerGui.java	Thu Jul 26 00:34:52 2001
+++ \jakarta-jmeter-nightly\2001.09.15\jakarta-jmeter\src\org\apache\jmeter\timers\gui\GaussianRandomTimerGui.java	Tue Sep 18 14:13:18 2001
@@ -109,11 +109,45 @@
 		}
 		else if (temp.equals("Timer Delay"))
 		{
-			model.setDelay(Long.parseLong(delayField.getText()));
+			try
+			{
+				model.setDelay(Long.parseLong(delayField.getText()));
+			}
+			catch (NumberFormatException nfe)
+			{
+				if (delayField.getText().length() > 0)
+				{
+					JOptionPane.showMessageDialog(this, "You must enter a valid number",
+							"Invalid data", JOptionPane.WARNING_MESSAGE);
+					model.setDelay(model.getDefaultDelay());
+					delayField.setText("");
+				}
+				else
+				{
+					model.setDelay(model.getDefaultDelay());
+				}
+			}
 		}
 		else if (temp.equals("Timer Delay Range"))
 		{
-			model.setRange(Double.parseDouble(rangeField.getText()));
+			try
+			{
+				model.setRange(Double.parseDouble(rangeField.getText()));
+			}
+			catch (NumberFormatException nfe)
+			{
+				if (rangeField.getText().length() > 0)
+				{
+					JOptionPane.showMessageDialog(this, "You must enter a valid number",
+							"Invalid data", JOptionPane.WARNING_MESSAGE);
+					model.setRange(model.getDefaultRange());
+					rangeField.setText("");
+				}
+				else
+				{
+					model.setRange(model.getDefaultRange());
+				}
+			}
 		}
 	}
 

from jmeter.

asfimport avatar asfimport commented on May 20, 2024

khammond25 (migrated from Bugzilla):
Created attachment patch.RandomTimer.diff: Patch for RandomTimer.java; file contains the diff

patch.RandomTimer.diff
--- \jakarta-jmeter-cvs\jakarta-jmeter\src\org\apache\jmeter\timers\RandomTimer.java	Fri Aug 31 00:46:46 2001
+++ \jakarta-jmeter-nightly\2001.09.15\jakarta-jmeter\src\org\apache\jmeter\timers\RandomTimer.java	Tue Sep 18 14:16:18 2001
@@ -76,8 +76,10 @@
 		JMeterComponentModel, Saveable, Serializable
 {
 	protected Random random;
-	protected long delay = 300;
-	protected double range = 100.0;
+	protected final long DEFAULT_DELAY = 300;
+	protected final double DEFAULT_RANGE = 100.0;
+	protected long delay = DEFAULT_DELAY;
+	protected double range = DEFAULT_RANGE;
 	private String name;
 	private static List addableList = new LinkedList();
 
@@ -142,6 +144,16 @@
 	 *
 	 *@return    !ToDo (Return description)
 	 ***********************************************************/
+	public double getDefaultRange()
+	{
+		return DEFAULT_RANGE;
+	}
+
+	/************************************************************
+	 *  !ToDoo (Method description)
+	 *
+	 *@return    !ToDo (Return description)
+	 ***********************************************************/
 	public Class getTagHandlerClass()
 	{
 		return org.apache.jmeter.save.handlers.TimerHandler.class;
@@ -159,6 +171,15 @@
 		return delay;
 	}
 
+	/************************************************************
+	 *  !ToDoo (Method description)
+	 *
+	 *@return    !ToDo (Return description)
+	 ***********************************************************/
+	public long getDefaultDelay()
+	{
+		return DEFAULT_DELAY;
+	}
 
 	/************************************************************
 	 *  !ToDoo (Method description)

from jmeter.

asfimport avatar asfimport commented on May 20, 2024

khammond25 (migrated from Bugzilla):
The four patches fix all parts of this bug. Additionally, a dialog is
displayed if the user enters an invalid number. No more NumberFormatExceptions
in the console.

ConstantTimer and RandomTimer now have default constants, and GET methods that
the GUI can use to reset numeric fields to the default values if the user
enters an invalid number.

[See also: patches for https://github.com//issues/752 and https://github.com//issues/766]

from jmeter.

asfimport avatar asfimport commented on May 20, 2024

khammond25 (migrated from Bugzilla):
Fixed 2001.09.27.

from jmeter.

asfimport avatar asfimport commented on May 20, 2024

Jordi Salvat i Alabart (migrated from Bugzilla):
Marking all bugs RESOLVED before JMeter 1.8's release date as VERIFIED.
Yes, it's pretty poor QA procedure, but there's bugs here lingering since JMeter
1.6, and we need to clean up a little.

from jmeter.

asfimport avatar asfimport commented on May 20, 2024

Jordi Salvat i Alabart (migrated from Bugzilla):
Bulk-closing all bugs RESOLVED before JMeter 1.8 release date.

from jmeter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.