137-2-3

log("Copying " + fromFile + " to " + toFile, verbosity); FilterSetCollection executionFilters = new FilterSetCollection(); if (filtering) { executionFilters .addFilterSet(getProject().getGlobalFilterSet()); } for (Enumeration filterEnum = getFilterSets().elements(); filterEnum.hasMoreElements();) { executionFilters .addFilterSet((FilterSet) filterEnum .nextElement()); } getFileUtils().copyFile(fromFile, toFile, executionFilters, getFilterChains(), forceOverwrite, getPreserveLastModified(), getEncoding(), getOutputEncoding(), getProject());
log("Copying " + fromFile + " to " + toFile, verbosity); FilterSetCollection executionFilters = new FilterSetCollection(); if (filtering) { executionFilters .addFilterSet(getProject().getGlobalFilterSet()); } for (Enumeration filterEnum = filterSets.elements(); filterEnum.hasMoreElements();) { executionFilters .addFilterSet((FilterSet) filterEnum.nextElement()); } fileUtils.copyFile(fromFile, toFile, executionFilters, filterChains, forceOverwrite, preserveLastModified, inputEncoding, outputEncoding, getProject());

Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/Move.java |  | File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/Copy.java
Method name: `void copyFile(File, File, boolean, boolean)` |  | Method name: `void doFileOperations()`
Number of AST nodes: 7 |  | Number of AST nodes: 7

1

    log("Copying " + fromFile + " to " + toFile,↵

1

    log("Copying " + fromFile + " to " + toFile,↵

2

                    verbosity);↵

2

     verbosity);↵

3

                FilterSetCollection executionFilters =↵

3

                            FilterSetCollection executionFilters =↵

4

                    new FilterSetCollection();↵

4

                                new FilterSetCollection();↵

5

                if (filtering) {↵

5

                            if (filtering) {↵

6

                    executionFilters↵

6

                                executionFilters↵

7

                        .addFilterSet(getProject().getGlobalFilterSet());↵

7

                                    .addFilterSet(getProject().getGlobalFilterSet());↵

8

                }↵

8

                ↵

9

                }↵

9

                for (Enumeration filterEnum =↵

10

                            for (Enumeration filterEnum =↵

10

                        getFilterSets().elements();↵

11

     filterSets.elements();↵

11

                    filterEnum.hasMoreElements();) {↵

12

                                filterEnum.hasMoreElements();) {↵

12

                    executionFilters↵

13

                                executionFilters↵

13

                        .addFilterSet((FilterSet) filterEnum↵

14

                                    .addFilterSet((FilterSet) filterEnum↵

14

           ↵

15

    .nextElement());↵

15

                             .nextElement());↵

16

                            }↵

16

                }↵

17

                ↵

17

                getFileUtils().copyFile(fromFile, toFile, executionFilters,↵

18

                fileUtils.copyFile(fromFile, toFile, executionFilters,↵

18

                                        getFilterChains(),↵

19

                                               filterChains↵

19

                                        forceOverwrite,↵

20

    , forceOverwrite,↵

20

                                        getPreserveLastModified(),↵

21

                                               preserveLastModified↵

21

                                        getEncoding(),↵

22

    , inputEncoding,↵

22

                                        getOutputEncoding(),↵

23

                                               outputEncoding↵

23

                                        getProject());

24

    , getProject());

See real code fragment |  | See real code fragment

Summary
Number of common nesting structure subtrees | 1
Number of refactorable cases | 0
Number of non-refactorable cases | 1
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.4
Clones location | Clones are in different classes having the same super class
Number of node comparisons | 20

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 6
   Number of unmapped statements in the first code fragment | 1
   Number of unmapped statements in the second code fragment | 1
   Time elapsed for statement mapping (ms) | 2.9
   Clone type | Type 2

   Mapped Statements
   ID | Statement |  | ID | Statement
   --- | --- | --- | --- | ---

   2

       log("Copying " + fromFile + " to " + toFile, verbosity);

   2 | log("Copying " + fromFile + " to " + toFile, verbosity);
   13 | log("Copying " + fromFile + " to " + toFile, verbosity);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   java.io.File | java.lang.String | VARIABLE_TYPE_MISMATCH
   java.io.File | java.lang.String | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type java.io.File of variable toFile does not match with type java.lang.String of variable toFile
   - Make classes java.io.File and java.lang.String extend a common superclass

   Type java.io.File of variable fromFile does not match with type java.lang.String of variable fromFile
   - Make classes java.io.File and java.lang.String extend a common superclass

   13

       log("Copying " + fromFile + " to " + toFile, verbosity);

   3

       FilterSetCollection executionFilters = new FilterSetCollection();

   14

       FilterSetCollection executionFilters = new FilterSetCollection();

   4

       if (filtering)

   15

       if (filtering)

   5

       executionFilters.addFilterSet(getProject().getGlobalFilterSet());

   16

       executionFilters.addFilterSet(getProject().getGlobalFilterSet());

   6

       for (Enumeration filterEnum = getFilterSets().elements(); filterEnum.hasMoreElements(); )

   6 | for (Enumeration filterEnum = getFilterSets().elements(); filterEnum.hasMoreElements(); )
   17 | for (Enumeration filterEnum = filterSets.elements(); filterEnum.hasMoreElements(); )

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   getFilterSets() | filterSets | FIELD_ACCESS_REPLACED_WITH_GETTER

   17

       for (Enumeration filterEnum = filterSets.elements(); filterEnum.hasMoreElements(); )

   7

       executionFilters.addFilterSet((FilterSet)filterEnum.nextElement());

   18

       executionFilters.addFilterSet((FilterSet)filterEnum.nextElement());

   Precondition Violations (2)
   Row | Violation
   --- | ---
   1 | Type java.io.File of variable toFile does not match with type java.lang.String of variable toFile
   2 | Type java.io.File of variable fromFile does not match with type java.lang.String of variable fromFile