File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/Copydir.java | File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/NetRexxC.java | |||
Method name: void execute()
|
Method name: void copyFilesToDestination()
|
|||
Number of AST nodes: 7 | Number of AST nodes: 8 | |||
1 | if (filecopyList.size() > 0) {↵ | |||
1 | log("Copying " + filecopyList.size() + " file"↵ | 2 | log("Copying " + filecopyList.size() + " file"↵ | |
2 | + (filecopyList.size() == 1 ? "" : "s")↵ | 3 | + (filecopyList.size() == 1 ? "" : "s")↵ | |
3 | + " to " + destDir.getAbsolutePath());↵ | 4 | + " to " + destDir.getAbsolutePath());↵ | |
4 | ↵ | |||
5 | Enumeration e = filecopyList.keys();↵ | 5 | Enumeration e = filecopyList.keys();↵ | |
6 | ↵ | |||
7 | while (e.hasMoreElements()) {↵ | 6 | while (e.hasMoreElements()) {↵ | |
8 | String fromFile = (String) e.nextElement();↵ | 7 | String fromFile = (String) e.nextElement();↵ | |
9 | String toFile = (String) filecopyList.get(fromFile);↵ | 8 | String toFile = (String) filecopyList.get(fromFile);↵ | |
10 | ↵ | |||
11 | try {↵ | 9 | try {↵ | |
12 | getProject().copyFile(fromFile, toFile, filtering,↵ | 10 | FileUtils.getFileUtils().copyFile(fromFile, toFile↵ | |
13 | forceOverwrite);↵ | |||
14 | ↵ | 11 | );↵ | |
15 | } catch (IOException ioe) {↵ | 12 | } catch (IOException ioe) {↵ | |
16 | String msg = "Failed to copy " + fromFile + " to "↵ | 13 | String msg = "Failed to copy " + fromFile + " to "↵ | |
17 | ↵ | 14 | + toFile↵ | |
18 | + toFile + " due to " + ioe.getMessage();↵ | 15 | + " due to " + ioe.getMessage();↵ | |
19 | ↵ | |||
20 | throw new BuildException(msg, ioe, getLocation());↵ | 16 | throw new BuildException(msg, ioe↵ | |
21 | ↵ | 17 | );↵ | |
22 | }↵ | 18 | }↵ | |
23 | ↵ | 19 | }↵ | |
24 | } | 20 |
| |
See real code fragment | See real code fragment |
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.6 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 18 |
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.5 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
15 | log("Copying " + filecopyList.size() + " file" + (filecopyList.size() == 1 ? "" : "s") + " to " + destDir.getAbsolutePath()); | 2 | log("Copying " + filecopyList.size() + " file" + (filecopyList.size() == 1 ? "" : "s") + " to " + destDir.getAbsolutePath()); | |||||||||||
16 | Enumeration e = filecopyList.keys(); | 3 | Enumeration e = filecopyList.keys(); | |||||||||||
17 | while (e.hasMoreElements()) | 4 | while (e.hasMoreElements()) | |||||||||||
18 | String fromFile = (String)e.nextElement(); | 5 | String fromFile = (String)e.nextElement(); | |||||||||||
19 | String toFile = (String)filecopyList.get(fromFile); | 6 | String toFile = (String)filecopyList.get(fromFile); | |||||||||||
20 | try |
| 7 | try | ||||||||||
|
| 8 | FileUtils.getFileUtils().copyFile(fromFile, toFile); | |||||||||||
21 | getProject().copyFile(fromFile, toFile, filtering, forceOverwrite); |
| |
Row | Violation |
---|---|
1 | Unmatched statement FileUtils.getFileUtils().copyFile(fromFile,toFile); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement getProject().copyFile(fromFile,toFile,filtering,forceOverwrite); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Clone fragment #1 returns variables fromFile, toFile , while Clone fragment #2 returns variables fromFile, toFile |