File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/BuildNumber.java | File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/extension/JarLibResolveTask.java | |||
Method name: void validate()
|
Method name: void checkExtension(File)
|
|||
Number of AST nodes: 6 | Number of AST nodes: 6 | |||
1 | if (!myFile.canRead()) {↵ | 1 | if (!file.exists()) {↵ | |
2 | final String message = "Unable to read from↵ | 2 | final String message =↵ | |
3 | " + myFile + ".";↵ | 3 | "File " + file + " does not exist";↵ | |
4 | throw new BuildException(message);↵ | 4 | throw new BuildException(message);↵ | |
5 | }↵ | 5 | }↵ | |
6 | if (!myFile.canWrite()) {↵ | 6 | if (!file.isFile()) {↵ | |
7 | final String message = "Unable to write to↵ | 7 | final String message =↵ | |
8 | " + myFile + ".";↵ | 8 | "File " + file + " is not a file";↵ | |
9 | throw new BuildException(message);↵ | 9 | throw new BuildException(message);↵ | |
10 | } | 10 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
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 | 28 |
Number of mapped statements | 6 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 2.7 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6 | if (!myFile.canRead()) |
| 1 | if (!file.exists()) | ||||||||||||||||
7 | final String message = "Unable to read from " + myFile + "."; |
| 2 | final String message = "File " + file + " does not exist"; | ||||||||||||||||
8 | throw new BuildException(message); | 3 | throw new BuildException(message); | |||||||||||||||||
9 | if (!myFile.canWrite()) |
| 4 | if (!file.isFile()) | ||||||||||||||||
10 | final String message = "Unable to write to " + myFile + "."; |
| 5 | final String message = "File " + file + " is not a file"; | ||||||||||||||||
11 | throw new BuildException(message); | 6 | throw new BuildException(message); |
Row | Violation |
---|---|
1 | Expression myFile.canRead() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression file.exists() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression myFile.canWrite() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Expression file.isFile() cannot be parameterized, because it has dependencies to/from statements that will be extracted |