long errorThreshold = 0; try { errorThreshold = Long.parseLong(errorThresholdString); } catch (NumberFormatException e) { errorThreshold = 0; } ((HTMLAssertion) inElement).setErrorThreshold(errorThreshold); String warningThresholdString = warningThresholdField.getText();
long warningThreshold = 0; try { warningThreshold = Long.parseLong(warningThresholdString); } catch (NumberFormatException e) { warningThreshold = 0; } ((HTMLAssertion) inElement).setWarningThreshold(warningThreshold);
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 modifyTestElement(TestElement) Method name: void modifyTestElement(TestElement)
Number of AST nodes: 5 Number of AST nodes: 4
1
long errorThreshold = 0;
1
long warningThreshold = 0;
2
		try {
2
		try {
3
			errorThreshold = Long.parseLong(errorThresholdString);
3
			warningThreshold = Long.parseLong(warningThresholdString);
4
		} catch (NumberFormatException e) {
4
		} catch (NumberFormatException e) {
5
			errorThreshold = 0;
5
			warningThreshold = 0;
6
		}
6
		}
7
		((HTMLAssertion) inElement).setErrorThreshold(errorThreshold);
7
		((HTMLAssertion) inElement).set
8
		String warningThresholdString = warningThresholdField.getText();
8
WarningThreshold(warningThreshold);
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.1
Clones locationClones are in the same method
Number of node comparisons10
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)1.0
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    4
    long errorThreshold = 0;
    4
    long errorThreshold = 0;
    9
    long warningThreshold = 0;
    Differences
    Expression1Expression2Difference
    errorThresholdwarningThresholdVARIABLE_NAME_MISMATCH
    9
    long warningThreshold = 0;
    5
    try
    5
    try
    10
    try
    Differences
    Expression1Expression2Difference
    errorThresholdwarningThresholdVARIABLE_NAME_MISMATCH
    10
    try
    6
    errorThreshold = Long.parseLong(errorThresholdString);
    6
    errorThreshold = Long.parseLong(errorThresholdString);
    11
    warningThreshold = Long.parseLong(warningThresholdString);
    Differences
    Expression1Expression2Difference
    errorThresholdwarningThresholdVARIABLE_NAME_MISMATCH
    errorThresholdStringwarningThresholdStringVARIABLE_NAME_MISMATCH
    11
    warningThreshold = Long.parseLong(warningThresholdString);
    7
    ((HTMLAssertion)inElement).setErrorThreshold(errorThreshold);
    7
    ((HTMLAssertion)inElement).setErrorThreshold(errorThreshold);
    12
    ((HTMLAssertion)inElement).setWarningThreshold(warningThreshold);
    Differences
    Expression1Expression2Difference
    setErrorThresholdsetWarningThresholdMETHOD_INVOCATION_NAME_MISMATCH
    errorThresholdwarningThresholdVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression ((HTMLAssertion)inElement).setErrorThreshold(errorThreshold) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression ((HTMLAssertion)inElement).setWarningThreshold(warningThreshold) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression ((HTMLAssertion)inElement).setErrorThreshold(errorThreshold) is a void method call, and thus it cannot be parameterized
    Expression ((HTMLAssertion)inElement).setWarningThreshold(warningThreshold) is a void method call, and thus it cannot be parameterized
    12
    ((HTMLAssertion)inElement).setWarningThreshold(warningThreshold);
    8
    String warningThresholdString = warningThresholdField.getText();
                                                                                                                                      
    Precondition Violations (4)
    Row Violation
    1Expression ((HTMLAssertion)inElement).setErrorThreshold(errorThreshold) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression ((HTMLAssertion)inElement).setWarningThreshold(warningThreshold) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression ((HTMLAssertion)inElement).setErrorThreshold(errorThreshold) is a void method call, and thus it cannot be parameterized
    4Expression ((HTMLAssertion)inElement).setWarningThreshold(warningThreshold) is a void method call, and thus it cannot be parameterized