File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/Rpm.java | File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/ExecTask.java | |||
Method name: String guessRpmBuildCommand()
|
Method name: String resolveExecutable(String, boolean)
|
|||
Number of AST nodes: 7 | Number of AST nodes: 6 | |||
1 | if (path != null) {↵ | 1 | if (p != null) {↵ | |
2 | Path p = new Path(getProject(), path);↵ | 2 | ↵ | |
3 | String[] pElements = p.list();↵ | 3 | String[] dirs = p.list();↵ | |
4 | for (int i = 0; i < pElements.length; i++) {↵ | 4 | for (int i = 0; i < dirs.length; i++) {↵ | |
5 | File f = new File(pElements[i],↵ | 5 | ↵ | |
6 | "rpmbuild"↵ | |||
7 | + (Os.isFamily("dos") ? ".exe" : ""));↵ | |||
8 | if (f.canRead↵ | 6 | executableFile↵ | |
7 | = FILE_UTILS.resolveFile(new File(dirs[i]), exec);↵ | |||
9 | ()) {↵ | 8 | if (executableFile.exists()) {↵ | |
10 | return f.getAbsolutePath();↵ | 9 | return executableFile.getAbsolutePath();↵ | |
11 | }↵ | 10 | ↵ | |
11 | }↵ | |||
12 | }↵ | 12 | }↵ | |
13 | } | 13 | } | |
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.3 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 16 |
Number of mapped statements | 5 |
Number of unmapped statements in the first code fragment | 2 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 1.2 |
Clone type | Type 3 |
ID | Statement | ID | Statement | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8 | if (path != null) |
| 26 | if (p != null) | |||||||||||||||
9 | Path p = new Path(getProject(), path); | | |||||||||||||||||
10 | String[] pElements = p.list(); |
| 27 | String[] dirs = p.list(); | |||||||||||||||
11 | for (int i = 0; i < pElements.length; i++) |
| 28 | for (int i = 0; i < dirs.length; i++) | |||||||||||||||
12 | File f = new File(pElements[i], "rpmbuild" + (Os.isFamily("dos") ? ".exe" : "")); |
| | ||||||||||||||||
|
| 29 | executableFile = FILE_UTILS.resolveFile(new File(dirs[i]), exec); | ||||||||||||||||
13 | if (f.canRead()) |
| 30 | if (executableFile.exists()) | |||||||||||||||
14 | return f.getAbsolutePath(); |
| 31 | return executableFile.getAbsolutePath(); |
Row | Violation |
---|---|
1 | Type java.lang.String of variable path does not match with type org.apache.tools.ant.types.Path of variable p |
2 | Unmatched statement File f=new File(pElements[i],"rpmbuild" + (Os.isFamily("dos") ? ".exe" : "")); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Unmatched statement executableFile=FILE_UTILS.resolveFile(new File(dirs[i]),exec); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
4 | Expression f.canRead() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
5 | Expression executableFile.exists() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
6 | Clone fragment #1 returns variables pElements, i , while Clone fragment #2 returns variables dirs, i |