String warningThresholdString = warningThresholdField.getText(); long warningThreshold = 0; try { warningThreshold = Long.parseLong(warningThresholdString); } catch (NumberFormatException e) { warningThreshold = 0; } ((HTMLAssertion) inElement).setWarningThreshold(warningThreshold);
String errorThresholdString = errorThresholdField.getText(); long errorThreshold = 0; try { errorThreshold = Long.parseLong(errorThresholdString); } catch (NumberFormatException e) { errorThreshold = 0; } ((HTMLAssertion) inElement).setErrorThreshold(errorThreshold);
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: 5
1
String warningThresholdString = warningThresholdField.getText();
1
String errorThresholdString = errorThresholdField.getText();
2
		long warningThreshold = 0;
2
		long errorThreshold = 0;
3
		try {
3
		try {
4
			warningThreshold = Long.parseLong(warningThresholdString);
4
			errorThreshold = Long.parseLong(errorThresholdString);
5
		} catch (NumberFormatException e) {
5
		} catch (NumberFormatException e) {
6
			warningThreshold = 0;
6
			errorThreshold = 0;
7
		}
7
		}
8
		((HTMLAssertion) inElement).setWarningThreshold(warningThreshold);
8
		((HTMLAssertion) inElement).setErrorThreshold(errorThreshold);
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 comparisons13
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    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.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    8
    String warningThresholdString = warningThresholdField.getText();
    8
    String warningThresholdString = warningThresholdField.getText();
    3
    String errorThresholdString = errorThresholdField.getText();
    Differences
    Expression1Expression2Difference
    warningThresholdStringerrorThresholdStringVARIABLE_NAME_MISMATCH
    warningThresholdFielderrorThresholdFieldVARIABLE_NAME_MISMATCH
    3
    String errorThresholdString = errorThresholdField.getText();
    9
    long warningThreshold = 0;
    9
    long warningThreshold = 0;
    4
    long errorThreshold = 0;
    Differences
    Expression1Expression2Difference
    warningThresholderrorThresholdVARIABLE_NAME_MISMATCH
    4
    long errorThreshold = 0;
    10
    try
    10
    try
    5
    try
    Differences
    Expression1Expression2Difference
    warningThresholderrorThresholdVARIABLE_NAME_MISMATCH
    5
    try
    11
    warningThreshold = Long.parseLong(warningThresholdString);
    11
    warningThreshold = Long.parseLong(warningThresholdString);
    6
    errorThreshold = Long.parseLong(errorThresholdString);
    Differences
    Expression1Expression2Difference
    warningThresholderrorThresholdVARIABLE_NAME_MISMATCH
    warningThresholdStringerrorThresholdStringVARIABLE_NAME_MISMATCH
    6
    errorThreshold = Long.parseLong(errorThresholdString);
    12
    ((HTMLAssertion)inElement).setWarningThreshold(warningThreshold);
    12
    ((HTMLAssertion)inElement).setWarningThreshold(warningThreshold);
    7
    ((HTMLAssertion)inElement).setErrorThreshold(errorThreshold);
    Differences
    Expression1Expression2Difference
    setWarningThresholdsetErrorThresholdMETHOD_INVOCATION_NAME_MISMATCH
    warningThresholderrorThresholdVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression ((HTMLAssertion)inElement).setWarningThreshold(warningThreshold) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression ((HTMLAssertion)inElement).setErrorThreshold(errorThreshold) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression ((HTMLAssertion)inElement).setWarningThreshold(warningThreshold) is a void method call, and thus it cannot be parameterized
    Expression ((HTMLAssertion)inElement).setErrorThreshold(errorThreshold) is a void method call, and thus it cannot be parameterized
    7
    ((HTMLAssertion)inElement).setErrorThreshold(errorThreshold);
    Precondition Violations (4)
    Row Violation
    1Expression ((HTMLAssertion)inElement).setWarningThreshold(warningThreshold) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression ((HTMLAssertion)inElement).setErrorThreshold(errorThreshold) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression ((HTMLAssertion)inElement).setWarningThreshold(warningThreshold) is a void method call, and thus it cannot be parameterized
    4Expression ((HTMLAssertion)inElement).setErrorThreshold(errorThreshold) is a void method call, and thus it cannot be parameterized