-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ConstantTimer; enter non-numeric throws NumberFormatException #763
Comments
khammond25 (migrated from Bugzilla): |
khammond25 (migrated from Bugzilla): 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;
}
/************************************************************ |
khammond25 (migrated from Bugzilla): 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
+} |
khammond25 (migrated from Bugzilla): 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());
+ }
+ }
}
}
|
khammond25 (migrated from Bugzilla): 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) |
khammond25 (migrated from Bugzilla): ConstantTimer and RandomTimer now have default constants, and GET methods that [See also: patches for https://github.com//issues/752 and https://github.com//issues/766] |
khammond25 (migrated from Bugzilla): |
Jordi Salvat i Alabart (migrated from Bugzilla): |
Jordi Salvat i Alabart (migrated from Bugzilla): |
khammond25 (Bug 3638):
For the ConstantTimer element, if you enter a non-numeric in the "Constant
Delay" field, a java.lang.NumberFormatException error is thrown.
Also, a java.lang.NumberFormatException can be thrown when editing the field.
For example, enter 100 in the "Constant Delay" field. Next, use the BACKSPACE
key to delete 100 and enter 300. When you deleted 100, the field was
automatically converted to a number. Of course, the field was empty because we
just deleted the 100. So, an exception was thrown.
Also, if you enter a number that exceeds the maximum allowable integer, you get
a java.lang.NumberFormatException.
Severity: normal
OS: All
The text was updated successfully, but these errors were encountered: