if (expr == null) { return null; } 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()); }
if (script == null) { return; } 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: 10 Number of AST nodes: 10
1
if (expr == null) {
1
if (script == null) {
2
            return null;
2
            return;
3
        }
3
        }
4
        try {
4
        try {
5
            Script jExpr = null;
5
            Script jExpr = null;
6
            if (expr instanceof File) {
6
            if (script instanceof File) {
7
                jExpr = ScriptFactory.createScript((File) expr);
7
                jExpr = ScriptFactory.createScript((File) script);
8
            } else if (expr instanceof URL) {
8
            } else if (script instanceof URL) {
9
                jExpr = ScriptFactory.createScript((URL) expr);
9
                jExpr = ScriptFactory.createScript((URL) script);
10
            } else {
10
            } else {
11
                jExpr = ScriptFactory.createScript((String) expr);
11
                jExpr = ScriptFactory.createScript((String) script);
12
            }
12
            }
13
            return jExpr.execute(jc);
13
            jExpr.execute(jc);
14
        } catch (Exception e) {
14
        } catch (Exception e) {
15
            // TODO Better messages
16
            throw new BSFException(e.getMessage());
15
            throw new BSFException(e.getMessage());
17
        }
16
        }
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.5
Clones locationClones are declared in the same class
Number of node comparisons33
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements8
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)2.3
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (expr == null)
    1
    if (expr == null)
    1
    if (script == null)
    Differences
    Expression1Expression2Difference
    exprscriptVARIABLE_NAME_MISMATCH
    1
    if (script == null)
                        
    2
    return;
    Preondition Violations
    Unmatched return;
    2
    return;
    2
    return null;
    2
    return null;
    Preondition Violations
    Unmatched return null;
                                  
    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 (4)
    Row Violation
    1Unmatched return;
    2Unmatched return null;
    3Unmatched 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
    4Unmatched 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