File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/Execute.java | File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/Execute.java | |||
Method name: Process exec(Project, String[], String[], File)
|
Method name: Process exec(Project, String[], String[], File)
|
|||
Number of AST nodes: 12 | Number of AST nodes: 12 | |||
1 | if (project == null) {↵ | 1 | if (project == null) {↵ | |
2 | if (workingDir == null) {↵ | 2 | if (workingDir == null) {↵ | |
3 | return exec(project, cmd, env);↵ | 3 | return exec(project, cmd, env);↵ | |
4 | }↵ | 4 | }↵ | |
5 | throw new IOException("Cannot locate antRun script: "↵ | 5 | throw new IOException("Cannot locate antRun script: "↵ | |
6 | + "No project provided");↵ | 6 | + "No project provided");↵ | |
7 | }↵ | 7 | }↵ | |
8 | // Locate the auxiliary script↵ | 8 | // Locate the auxiliary script↵ | |
9 | String antHome = project.getProperty(MagicNames.ANT_HOME);↵ | 9 | String antHome = project.getProperty(MagicNames.ANT_HOME);↵ | |
10 | if (antHome == null) {↵ | 10 | if (antHome == null) {↵ | |
11 | throw new IOException("Cannot locate antRun script: "↵ | 11 | throw new IOException("Cannot locate antRun script: "↵ | |
12 | + "Property '" + MagicNames.ANT_HOME + "' not found");↵ | 12 | + "Property '" + MagicNames.ANT_HOME + "' not found");↵ | |
13 | }↵ | 13 | }↵ | |
14 | String antRun =↵ | 14 | String antRun =↵ | |
15 | FILE_UTILS.resolveFile(project.getBaseDir(),↵ | 15 | FILE_UTILS.resolveFile(project.getBaseDir(),↵ | |
16 | antHome + File.separator + myScript).toString();↵ | 16 | antHome + File.separator + myScript).toString();↵ | |
17 | // Build the command↵ | 17 | // Build the command↵ | |
18 | File commandDir = workingDir;↵ | 18 | File commandDir = workingDir;↵ | |
19 | if (workingDir == null && project != null) {↵ | 19 | if (workingDir == null && project != null) {↵ | |
20 | commandDir = project.getBaseDir();↵ | 20 | commandDir = project.getBaseDir();↵ | |
21 | }↵ | 21 | }↵ | |
22 | String[] newcmd = new String[cmd.length + 2]; | 22 | String[] newcmd = new String[cmd.length + 3]; | |
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.4 |
Clones location | Clones are in the same java file |
Number of node comparisons | 34 |
Number of mapped statements | 12 |
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) | 5.8 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | if (project == null) | 1 | if (project == null) | |||||||||||
2 | if (workingDir == null) | 2 | if (workingDir == null) | |||||||||||
3 | return exec(project, cmd, env); | 3 | return exec(project, cmd, env); | |||||||||||
4 | throw new IOException("Cannot locate antRun script: " + "No project provided"); | 4 | throw new IOException("Cannot locate antRun script: " + "No project provided"); | |||||||||||
5 | String antHome = project.getProperty(MagicNames.ANT_HOME); | 5 | String antHome = project.getProperty(MagicNames.ANT_HOME); | |||||||||||
6 | if (antHome == null) | 6 | if (antHome == null) | |||||||||||
7 | throw new IOException("Cannot locate antRun script: " + "Property '" + MagicNames.ANT_HOME + "' not found"); | 7 | throw new IOException("Cannot locate antRun script: " + "Property '" + MagicNames.ANT_HOME + "' not found"); | |||||||||||
8 | String antRun = FILE_UTILS.resolveFile(project.getBaseDir(), antHome + File.separator + myScript).toString(); | 8 | String antRun = FILE_UTILS.resolveFile(project.getBaseDir(), antHome + File.separator + myScript).toString(); | |||||||||||
9 | File commandDir = workingDir; | 9 | File commandDir = workingDir; | |||||||||||
10 | if (workingDir == null && project != null) | 10 | if (workingDir == null && project != null) | |||||||||||
11 | commandDir = project.getBaseDir(); | 11 | commandDir = project.getBaseDir(); | |||||||||||
12 | String[] newcmd = new String[cmd.length + 2]; |
| 12 | String[] newcmd = new String[cmd.length + 3]; |
Row | Violation |
---|---|
1 | Clone fragment #1 returns variables antRun, newcmd, commandDir , while Clone fragment #2 returns variables newcmd, antRun, commandDir |
2 | Not all possible execution flows end in a return statement |