File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java | File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java | |||
Method name: int executeInVM(CommandlineJava)
|
Method name: int executeInVM(CommandlineJava)
|
|||
Number of AST nodes: 7 | Number of AST nodes: 7 | |||
1 | File f = new File(cP[i]);↵ | 1 | File f = new File(sP[i]);↵ | |
2 | // not necessary as JDepend would fail, but why loose↵ | 2 | // not necessary as JDepend would fail, but why loose↵ | |
3 | // some time?↵ | 3 | // some time?↵ | |
4 | if (!f.exists()) {↵ | 4 | if (!f.exists() || !f.isDirectory()) {↵ | |
5 | String msg = "\""↵ | 5 | String msg = "\""↵ | |
6 | + f.getPath()↵ | 6 | + f.getPath()↵ | |
7 | + "\" does not represent a valid"↵ | 7 | + "\" does not represent a valid"↵ | |
8 | + " file or directory. JDepend would fail.";↵ | 8 | + " directory. JDepend would fail.";↵ | |
9 | log(msg);↵ | 9 | log(msg);↵ | |
10 | throw new BuildException(msg);↵ | 10 | throw new BuildException(msg);↵ | |
11 | }↵ | 11 | }↵ | |
12 | try {↵ | 12 | try {↵ | |
13 | jdepend.addDirectory(f.getPath());↵ | 13 | jdepend.addDirectory(f.getPath());↵ | |
14 | } catch (IOException e) {↵ | 14 | } catch (IOException e) {↵ | |
15 | String msg =↵ | 15 | String msg =↵ | |
16 | "JDepend Failed when adding a class directory: "↵ | 16 | "JDepend Failed when adding a source directory: "↵ | |
17 | + e.getMessage();↵ | 17 | + e.getMessage();↵ | |
18 | log(msg);↵ | 18 | log(msg);↵ | |
19 | throw new BuildException(msg);↵ | 19 | throw new BuildException(msg);↵ | |
20 | } | 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.8 |
Clones location | Clones are in the same method |
Number of node comparisons | 9 |
Number of mapped statements | 3 |
Number of unmapped statements in the first code fragment | 4 |
Number of unmapped statements in the second code fragment | 4 |
Time elapsed for statement mapping (ms) | 1.5 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
15 | File f = new File(cP[i]); |
| 25 | File f = new File(sP[i]); | ||||||||||
16 | if (!f.exists()) |
| | |||||||||||
17 | String msg = "\"" + f.getPath() + "\" does not represent a valid" + " file or directory. JDepend would fail."; |
| | |||||||||||
18 | log(msg); | | ||||||||||||
19 | throw new BuildException(msg); |
| | |||||||||||
|
| 26 | if (!f.exists() || !f.isDirectory()) | |||||||||||
|
| 27 | String msg = "\"" + f.getPath() + "\" does not represent a valid" + " directory. JDepend would fail."; | |||||||||||
| 28 | log(msg); | ||||||||||||
|
| 29 | throw new BuildException(msg); | |||||||||||
20 | try |
| 30 | try | ||||||||||
21 | jdepend.addDirectory(f.getPath()); | 31 | jdepend.addDirectory(f.getPath()); |
Row | Violation |
---|---|
1 | Unmatched statement if(!f.exists()) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement String msg="\"" + f.getPath() + "\" does not represent a valid"+ " file or directory. JDepend would fail."; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Unmatched throw new BuildException(msg); |
4 | Unmatched statement if(!f.exists() || !f.isDirectory()) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
5 | Unmatched statement String msg="\"" + f.getPath() + "\" does not represent a valid"+ " directory. JDepend would fail."; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
6 | Unmatched throw new BuildException(msg); |