long val = 0; if (data.length() > 0) { try { val = Long.parseLong(data); } catch (NumberFormatException e) { val = 0; } } return val;
int val = 0; if (data.length() > 0) { try { val = Integer.parseInt(data); } catch (NumberFormatException e) { val = 0; } } return val;
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/monitor/parser/MonitorHandler.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/monitor/parser/MonitorHandler.java
Method name: long parseLong(String) Method name: int parseInt(String)
Number of AST nodes: 5 Number of AST nodes: 5
1
long val = 0;
1
int val = 0;
2
		if (data.length() > 0) {
2
		if (data.length() > 0) {
3
			try {
3
			try {
4
				val = Long.parseLong(data);
4
				val = Integer.parseInt(data);
5
			} catch (NumberFormatException e) {
5
			} catch (NumberFormatException e) {
6
				val = 0;
6
				val = 0;
7
			}
7
			}
8
		}
8
		}
9
		return val;
9
		return val;
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 declared in the same class
Number of node comparisons6
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment4
    Number of unmapped statements in the second code fragment4
    Time elapsed for statement mapping (ms)1.1
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                              
    1
    int val = 0;
    1
    long val = 0;
                                
    2
    if (data.length() > 0)
    2
    if (data.length() > 0)
                
    3
    try
                                                                
    4
    val = Integer.parseInt(data);
    Preondition Violations
    Unmatched statement val=Integer.parseInt(data); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched statement val=Integer.parseInt(data); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    4
    val = Integer.parseInt(data);
    3
    try
                
    4
    val = Long.parseLong(data);
    4
    val = Long.parseLong(data);
    Preondition Violations
    Unmatched statement val=Long.parseLong(data); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched statement val=Long.parseLong(data); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
                                                            
                                
    5
    return val;
    Preondition Violations
    Unmatched return val;
    5
    return val;
    5
    return val;
    5
    return val;
    Preondition Violations
    Unmatched return val;
                                
    Precondition Violations (7)
    Row Violation
    1Unmatched statement val=Integer.parseInt(data); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2Unmatched statement val=Integer.parseInt(data); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    3Unmatched statement val=Long.parseLong(data); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4Unmatched statement val=Long.parseLong(data); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    5Unmatched return val;
    6Unmatched return val;
    7The refactoring of the clones is infeasible, because the number of macthed statements is equal to zero