String warningThresholdString = warningThresholdField.getText(); if (warningThresholdString != null) { boolean isInvalid = false; try { long warningThreshold = Long.parseLong(warningThresholdString); if (warningThreshold < 0) { isInvalid = true; } } catch (NumberFormatException ex) { isInvalid = true; } if (isInvalid) { log.warn("HTMLAssertionGui: Error threshold Not a valid number!"); JOptionPane.showMessageDialog(null, "Threshold for warnings is invalid", "Error", JOptionPane.ERROR_MESSAGE); } }
String errorThresholdString = errorThresholdField.getText(); if (errorThresholdString != null) { boolean isInvalid = false; try { long errorThreshold = Long.parseLong(errorThresholdString); if (errorThreshold < 0) { isInvalid = true; } } catch (NumberFormatException ex) { isInvalid = true; } if (isInvalid) { log.warn("HTMLAssertionGui: Error threshold Not a valid number!"); JOptionPane.showMessageDialog(null, "Threshold for errors is invalid", "Error", JOptionPane.ERROR_MESSAGE); } }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/assertions/gui/HTMLAssertionGui.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/assertions/gui/HTMLAssertionGui.java
Method name: void focusLost(FocusEvent) Method name: void focusLost(FocusEvent)
Number of AST nodes: 10 Number of AST nodes: 10
1
String warningThresholdString = warningThresholdField.getText();
1
String errorThresholdString = errorThresholdField.getText();
2
		if (warningThresholdString != null) {
2
		if (errorThresholdString != null) {
3
			boolean isInvalid = false;
3
			boolean isInvalid = false;
4
			try {
4
			try {
5
				long warningThreshold = Long.parseLong(warningThresholdString);
5
				long errorThreshold = Long.parseLong(errorThresholdString);
6
				if (warningThreshold < 0) {
6
				if (errorThreshold < 0) {
7
					isInvalid = true;
7
					isInvalid = true;
8
				}
8
				}
9
			} catch (NumberFormatException ex) {
9
			} catch (NumberFormatException ex) {
10
				isInvalid = true;
10
				isInvalid = true;
11
			}
11
			}
12
			if (isInvalid) {
12
			if (isInvalid) {
13
				log.warn("HTMLAssertionGui: Error threshold Not a valid number!");
13
				log.warn("HTMLAssertionGui: Error threshold Not a valid number!");
14
				JOptionPane.showMessageDialog(null, "Threshold for warnings is invalid", "Error",
14
				JOptionPane.showMessageDialog(null, "Threshold for errors is invalid", "Error",
15
						JOptionPane.ERROR_MESSAGE);
15
						JOptionPane.ERROR_MESSAGE);
16
			}
16
			}
17
		}
17
		}
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.3
Clones locationClones are in the same method
Number of node comparisons22
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements10
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)1.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    12
    String warningThresholdString = warningThresholdField.getText();
    12
    String warningThresholdString = warningThresholdField.getText();
    2
    String errorThresholdString = errorThresholdField.getText();
    Differences
    Expression1Expression2Difference
    warningThresholdStringerrorThresholdStringVARIABLE_NAME_MISMATCH
    warningThresholdFielderrorThresholdFieldVARIABLE_NAME_MISMATCH
    2
    String errorThresholdString = errorThresholdField.getText();
    13
    if (warningThresholdString != null)
    13
    if (warningThresholdString != null)
    3
    if (errorThresholdString != null)
    Differences
    Expression1Expression2Difference
    warningThresholdStringerrorThresholdStringVARIABLE_NAME_MISMATCH
    3
    if (errorThresholdString != null)
    14
    boolean isInvalid = false;
    4
    boolean isInvalid = false;
    15
    try
    5
    try
    16
    long warningThreshold = Long.parseLong(warningThresholdString);
    16
    long warningThreshold = Long.parseLong(warningThresholdString);
    6
    long errorThreshold = Long.parseLong(errorThresholdString);
    Differences
    Expression1Expression2Difference
    warningThresholderrorThresholdVARIABLE_NAME_MISMATCH
    warningThresholdStringerrorThresholdStringVARIABLE_NAME_MISMATCH
    6
    long errorThreshold = Long.parseLong(errorThresholdString);
    17
    if (warningThreshold < 0)
    17
    if (warningThreshold < 0)
    7
    if (errorThreshold < 0)
    Differences
    Expression1Expression2Difference
    warningThresholderrorThresholdVARIABLE_NAME_MISMATCH
    7
    if (errorThreshold < 0)
    18
    isInvalid = true;
    8
    isInvalid = true;
    19
    if (isInvalid)
    9
    if (isInvalid)
    20
    log.warn("HTMLAssertionGui: Error threshold Not a valid number!");
    10
    log.warn("HTMLAssertionGui: Error threshold Not a valid number!");
    21
    JOptionPane.showMessageDialog(null, "Threshold for warnings is invalid", "Error", JOptionPane.ERROR_MESSAGE);
    21
    JOptionPane.showMessageDialog(null, "Threshold for warnings is invalid", "Error", JOptionPane.ERROR_MESSAGE);
    11
    JOptionPane.showMessageDialog(null, "Threshold for errors is invalid", "Error", JOptionPane.ERROR_MESSAGE);
    Differences
    Expression1Expression2Difference
    "Threshold for warnings is invalid""Threshold for errors is invalid"LITERAL_VALUE_MISMATCH
    11
    JOptionPane.showMessageDialog(null, "Threshold for errors is invalid", "Error", JOptionPane.ERROR_MESSAGE);
    Precondition Violations (0)
    Row Violation