try { Method setLocationM = proxy.getClass().getMethod( "setLocation", new Class[] {Location.class}); if (setLocationM != null) { setLocationM.invoke(proxy, new Object[] {getLocation()}); } } catch (NoSuchMethodException e) { // ignore this if the class being used as a task does not have // a set location method. } catch (Exception ex) { log("Error setting location in " + proxy.getClass(), Project.MSG_ERR); throw new BuildException(ex); }
try { Method setProjectM = proxy.getClass().getMethod( "setProject", new Class[] {Project.class}); if (setProjectM != null) { setProjectM.invoke(proxy, new Object[] {getProject()}); } } catch (NoSuchMethodException e) { // ignore this if the class being used as a task does not have // a set project method. } catch (Exception ex) { log("Error setting project in " + proxy.getClass(), Project.MSG_ERR); throw new BuildException(ex); }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/TaskAdapter.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/TaskAdapter.java
Method name: void execute() Method name: void execute()
Number of AST nodes: 4 Number of AST nodes: 4
1
try {
1
try {
2
            Method setLocationM = proxy.getClass().getMethod(
2
            Method setProjectM = proxy.getClass().getMethod(
3
                "setLocation", new Class[] {Location.class});
3
                "setProject", new Class[] {Project.class});
4
            if (setLocationM != null) {
4
            if (setProjectM != null) {
5
                setLocationM.invoke(proxy, new Object[] {getLocation()});
5
                setProjectM.invoke(proxy, new Object[] {getProject()});
6
            }
6
            }
7
        } catch (NoSuchMethodException e) {
7
        } catch (NoSuchMethodException e) {
8
            // ignore this if the class being used as a task does not have
8
            // ignore this if the class being used as a task does not have
9
            // a set location method.
9
            // a set project method.
10
        } catch (Exception ex) {
10
        } catch (Exception ex) {
11
            log("Error setting location in " + proxy.getClass(),
11
            log("Error setting project in " + proxy.getClass(),
12
                Project.MSG_ERR);
12
                Project.MSG_ERR);
13
            throw new BuildException(ex);
13
            throw new BuildException(ex);
14
        }
14
        }
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 in the same method
Number of node comparisons8
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    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.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    try
    1
    try
    5
    try
    Differences
    Expression1Expression2Difference
    "Error setting location in ""Error setting project in "LITERAL_VALUE_MISMATCH
    5
    try
    2
    Method setLocationM = proxy.getClass().getMethod("setLocation", new Class[] {Location.class});
    2
    Method setLocationM = proxy.getClass().getMethod("setLocation", new Class[] {Location.class});
    6
    Method setProjectM = proxy.getClass().getMethod("setProject", new Class[] {Project.class});
    Differences
    Expression1Expression2Difference
    setLocationMsetProjectMVARIABLE_NAME_MISMATCH
    "setLocation""setProject"LITERAL_VALUE_MISMATCH
    6
    Method setProjectM = proxy.getClass().getMethod("setProject", new Class[] {Project.class});
    3
    if (setLocationM != null)
    3
    if (setLocationM != null)
    7
    if (setProjectM != null)
    Differences
    Expression1Expression2Difference
    setLocationMsetProjectMVARIABLE_NAME_MISMATCH
    7
    if (setProjectM != null)
    4
    setLocationM.invoke(proxy, new Object[] {getLocation()});
    4
    setLocationM.invoke(proxy, new Object[] {getLocation()});
    Preondition Violations
    Unmatched statement setLocationM.invoke(proxy,new Object[]{getLocation()}); 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
                                                                                                                        
                                                                                                                    
    8
    setProjectM.invoke(proxy, new Object[] {getProject()});
    Preondition Violations
    Unmatched statement setProjectM.invoke(proxy,new Object[]{getProject()}); 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
    8
    setProjectM.invoke(proxy, new Object[] {getProject()});
    Precondition Violations (2)
    Row Violation
    1Unmatched statement setLocationM.invoke(proxy,new Object[]{getLocation()}); 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 setProjectM.invoke(proxy,new Object[]{getProject()}); 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