try { Script jExpr = null; if (expr instanceof File) { jExpr = ScriptFactory.createScript((File) expr); } else if (expr instanceof URL) { jExpr = ScriptFactory.createScript((URL) expr); } else { jExpr = ScriptFactory.createScript((String) expr); } return jExpr.execute(jc); } catch (Exception e) { // TODO Better messages throw new BSFException(e.getMessage()); }
try { Script jExpr = null; if (script instanceof File) { jExpr = ScriptFactory.createScript((File) script); } else if (script instanceof URL) { jExpr = ScriptFactory.createScript((URL) script); } else { jExpr = ScriptFactory.createScript((String) script); } jExpr.execute(jc); } catch (Exception e) { throw new BSFException(e.getMessage()); }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/commons/jexl/bsf/JexlEngine.java File path: /jakarta-jmeter-2.3.2/src/org/apache/commons/jexl/bsf/JexlEngine.java
Method name: Object eval(String, int, int, Object) Method name: void exec(String, int, int, Object)
Number of AST nodes: 8 Number of AST nodes: 8
1
try {
1
try {
2
            Script jExpr = null;
2
            Script jExpr = null;
3
            if (expr instanceof File) {
3
            if (script instanceof File) {
4
                jExpr = ScriptFactory.createScript((File) expr);
4
                jExpr = ScriptFactory.createScript((File) script);
5
            } else if (expr instanceof URL) {
5
            } else if (script instanceof URL) {
6
                jExpr = ScriptFactory.createScript((URL) expr);
6
                jExpr = ScriptFactory.createScript((URL) script);
7
            } else {
7
            } else {
8
                jExpr = ScriptFactory.createScript((String) expr);
8
                jExpr = ScriptFactory.createScript((String) script);
9
            }
9
            }
10
            return jExpr.execute(jc);
10
            jExpr.execute(jc);
11
        } catch (Exception e) {
11
        } catch (Exception e) {
12
            // TODO Better messages
13
            throw new BSFException(e.getMessage());
12
            throw new BSFException(e.getMessage());
14
        }
13
        }
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.4
Clones locationClones are declared in the same class
Number of node comparisons29
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements7
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)1.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    3
    try
    3
    try
    4
    Script jExpr = null;
    4
    Script jExpr = null;
    5
    if (expr instanceof File)
    5
    if (expr instanceof File)
    5
    if (script instanceof File)
    Differences
    Expression1Expression2Difference
    exprscriptVARIABLE_NAME_MISMATCH
    5
    if (script instanceof File)
    6
    jExpr = ScriptFactory.createScript((File)expr);
    6
    jExpr = ScriptFactory.createScript((File)expr);
    6
    jExpr = ScriptFactory.createScript((File)script);
    Differences
    Expression1Expression2Difference
    exprscriptVARIABLE_NAME_MISMATCH
    6
    jExpr = ScriptFactory.createScript((File)script);
    7
    else if (expr instanceof URL)
    7
    else if (expr instanceof URL)
    7
    else if (script instanceof URL)
    Differences
    Expression1Expression2Difference
    exprscriptVARIABLE_NAME_MISMATCH
    7
    else if (script instanceof URL)
    8
    jExpr = ScriptFactory.createScript((URL)expr);
    8
    jExpr = ScriptFactory.createScript((URL)expr);
    8
    jExpr = ScriptFactory.createScript((URL)script);
    Differences
    Expression1Expression2Difference
    exprscriptVARIABLE_NAME_MISMATCH
    8
    jExpr = ScriptFactory.createScript((URL)script);
    else
    else
    9
    jExpr = ScriptFactory.createScript((String)expr);
    9
    jExpr = ScriptFactory.createScript((String)expr);
    9
    jExpr = ScriptFactory.createScript((String)script);
    Differences
    Expression1Expression2Difference
    exprscriptVARIABLE_NAME_MISMATCH
    9
    jExpr = ScriptFactory.createScript((String)script);
                                                
    10
    jExpr.execute(jc);
    Preondition Violations
    Unmatched statement jExpr.execute(jc); 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
    10
    jExpr.execute(jc);
    10
    return jExpr.execute(jc);
    10
    return jExpr.execute(jc);
    Preondition Violations
    Unmatched statement return jExpr.execute(jc); 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
                                                              
    Precondition Violations (2)
    Row Violation
    1Unmatched statement jExpr.execute(jc); 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
    2Unmatched statement return jExpr.execute(jc); 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