137-1-2

log("Copying " + fromResource + " 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()); } ResourceUtils.copyResource(fromResource, new FileResource(destDir, toFile), executionFilters, filterChains, forceOverwrite, preserveLastModified, inputEncoding, outputEncoding, getProject());
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());

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

1

    log("Copying " + fromResource + " 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

    }↵

10

                  for (Enumeration filterEnum = f↵

10

                for (Enumeration filterEnum =↵

11

    ilterSets.elements();↵

11

                        getFilterSets().elements();↵

12

                                filterEnum.hasMoreElements();) {↵

12

                    filterEnum.hasMoreElements();) {↵

13

                                executionFilters↵

13

                    executionFilters↵

14

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

14

                        .addFilterSet((FilterSet) filterEnum↵

15

                            }↵

15

                         ↵

16

                            ResourceUtils.copyResource(fromResource,↵

16

               ↵

17

                                                       new FileResource(destDir,↵

18

                                                                        toFile),↵

19

                                                      ↵

17

    .nextElement());↵

18

                }↵

20

     executionFilters,↵

19

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

21

                                                       filterChains,↵

20

                                        ↵

22

                   ↵

21

    getFilterChains(),↵

23

                                        forceOverwrite,↵

22

                                        forceOverwrite,↵

24

                                                       preserveLastModified,↵

23

                                        getPreserveLastModified(),↵

25

                                                       inputEncoding,↵

24

                                        getEncoding(),↵

26

                                                       outputEncoding,↵

25

                                        ↵

27

                   ↵

26

    getOutputEncoding(),↵

28

                                        getProject());

27

                                        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) | 8.0
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) | 3.3
   Clone type | Type 2

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

   10

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

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

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   java.lang.String | java.io.File | VARIABLE_TYPE_MISMATCH
   fromResource | fromFile | VARIABLE_NAME_MISMATCH
   org.apache.tools.ant.types.Resource | java.io.File | VARIABLE_TYPE_MISMATCH

   Preondition Violations

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

   Type org.apache.tools.ant.types.Resource of variable fromResource does not match with type java.io.File of variable fromFile
   - Make classes org.apache.tools.ant.types.Resource and java.io.File extend a common superclass

   2

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

   11

       FilterSetCollection executionFilters = new FilterSetCollection();

   3

       FilterSetCollection executionFilters = new FilterSetCollection();

   12

       if (filtering)

   4

       if (filtering)

   13

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

   5

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

   14

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

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

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

   6

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

   15

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

   7

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

   Precondition Violations (2)
   Row | Violation
   --- | ---
   1 | Type java.lang.String of variable toFile does not match with type java.io.File of variable toFile
   2 | Type org.apache.tools.ant.types.Resource of variable fromResource does not match with type java.io.File of variable fromFile