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); } }
if (sizeString != null) { try { long assertionSize = Long.parseLong(sizeString); if (assertionSize < 0) { isInvalid = true; } } catch (NumberFormatException ex) { isInvalid = true; } if (isInvalid) { JOptionPane.showMessageDialog(null, JMeterUtils.getResString("size_assertion_input_error"), //$NON-NLS-1$ "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/SizeAssertionGui.java
Method name: void focusLost(FocusEvent) Method name: void focusLost(FocusEvent)
Number of AST nodes: 9 Number of AST nodes: 7
1
if (warningThresholdString != null) {
1
if (sizeString != null) {
2
			boolean isInvalid = false;
2
			
3
			try {
4
				long warningThreshold
3
try {
5
 = Long.parseLong(warningThresholdString);
4
				long assertionSize = Long.parseLong(sizeString);
6
				if (warningThreshold < 0) {
5
				if (assertionSize < 0) {
7
					isInvalid = true;
6
					isInvalid = true;
8
				}
7
				}
9
			} catch (NumberFormatException ex) {
8
			} catch (NumberFormatException ex) {
10
				isInvalid = true;
9
				isInvalid = true;
11
			}
10
			}
12
			if (isInvalid) {
11
			if (isInvalid) {
13
				log.warn("HTMLAssertionGui: Error threshold Not a valid number!");
12
				
14
				JOptionPane.showMessageDialog(null, "Threshold for warnings is invalid", 
13
JOptionPane.showMessageDialog(null, 
14
						JMeterUtils.getResString("size_assertion_input_error"), //$NON-NLS-1$
15
"Error",
15
						"Error",
16
						JOptionPane.ERROR_MESSAGE);
16
						JOptionPane.ERROR_MESSAGE);
17
			}
17
			}
18
		}
18
		}
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 different classes having the same super class
Number of node comparisons16
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements7
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)1.4
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    13
    if (warningThresholdString != null)
    13
    if (warningThresholdString != null)
    3
    if (sizeString != null)
    Differences
    Expression1Expression2Difference
    warningThresholdStringsizeStringVARIABLE_NAME_MISMATCH
    3
    if (sizeString != null)
    14
    boolean isInvalid = false;
                                                            
    15
    try
    4
    try
    16
    long warningThreshold = Long.parseLong(warningThresholdString);
    16
    long warningThreshold = Long.parseLong(warningThresholdString);
    5
    long assertionSize = Long.parseLong(sizeString);
    Differences
    Expression1Expression2Difference
    warningThresholdassertionSizeVARIABLE_NAME_MISMATCH
    warningThresholdStringsizeStringVARIABLE_NAME_MISMATCH
    5
    long assertionSize = Long.parseLong(sizeString);
    17
    if (warningThreshold < 0)
    17
    if (warningThreshold < 0)
    6
    if (assertionSize < 0)
    Differences
    Expression1Expression2Difference
    warningThresholdassertionSizeVARIABLE_NAME_MISMATCH
    6
    if (assertionSize < 0)
    18
    isInvalid = true;
    7
    isInvalid = true;
    19
    if (isInvalid)
    8
    if (isInvalid)
    20
    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);
    9
    JOptionPane.showMessageDialog(null, JMeterUtils.getResString("size_assertion_input_error"), "Error", JOptionPane.ERROR_MESSAGE);
    Differences
    Expression1Expression2Difference
    "Threshold for warnings is invalid"JMeterUtils.getResString("size_assertion_input_error")TYPE_COMPATIBLE_REPLACEMENT
    9
    JOptionPane.showMessageDialog(null, JMeterUtils.getResString("size_assertion_input_error"), "Error", JOptionPane.ERROR_MESSAGE);
    Precondition Violations (0)
    Row Violation