File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/clearcase/CCRmtype.java | File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/clearcase/CCCheckin.java | |||
Method name: void execute()
|
Method name: void execute()
|
|||
Number of AST nodes: 15 | Number of AST nodes: 14 | |||
1 | Commandline commandLine = new Commandline();↵ | 1 | Commandline commandLine = new Commandline();↵ | |
2 | int result = 0;↵ | 2 | ↵ | |
3 | // Check for required attributes↵ | |||
4 | if (getTypeKind() == null) {↵ | |||
5 | throw new BuildException("Required attribute TypeKind↵ | 3 | Project aProj = getProject();↵ | |
4 | int result = 0;↵ | |||
6 | not specified");↵ | 5 | // Default the viewpath to basedir if it is not specified↵ | |
7 | }↵ | |||
8 | if (getTypeName() == null) {↵ | 6 | if (getViewPath() == null) {↵ | |
9 | throw new BuildException("Required attribute TypeName not specified");↵ | 7 | setViewPath(aProj.getBaseDir().getPath());↵ | |
10 | }↵ | 8 | }↵ | |
11 | // build the command line from what we got. the format is↵ | 9 | // build the command line from what we got. the format is↵ | |
12 | // cleartool rmtype [options...] type-selector...↵ | 10 | // cleartool checkin [options...] [viewpath ...]↵ | |
13 | // as specified in the CLEARTOOL help↵ | 11 | // as specified in the CLEARTOOL.EXE help↵ | |
14 | commandLine.setExecutable(getClearToolCommand());↵ | 12 | commandLine.setExecutable(getClearToolCommand());↵ | |
15 | commandLine.createArgument().setValue(COMMAND_RMTYPE);↵ | 13 | commandLine.createArgument().setValue(COMMAND_CHECKIN);↵ | |
16 | checkOptions(commandLine);↵ | 14 | checkOptions(commandLine);↵ | |
17 | if (!getFailOnErr()) {↵ | 15 | if (!getFailOnErr()) {↵ | |
18 | getProject().log("Ignoring any errors that occur for: "↵ | 16 | getProject().log("Ignoring any errors that occur for: "↵ | |
19 | + getTypeSpecifier(), Project.MSG_VERBOSE);↵ | 17 | + getViewPathBasename(), Project.MSG_VERBOSE);↵ | |
20 | }↵ | 18 | }↵ | |
21 | result = run(commandLine);↵ | 19 | result = run(commandLine);↵ | |
22 | if (Execute.isFailure(result) && getFailOnErr()) {↵ | 20 | if (Execute.isFailure(result) && getFailOnErr()) {↵ | |
23 | String msg = "Failed executing: " + commandLine.toString();↵ | 21 | String msg = "Failed executing: " + commandLine.toString();↵ | |
24 | throw new BuildException(msg, getLocation());↵ | 22 | throw new BuildException(msg, getLocation());↵ | |
25 | } | 23 |
| |
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.7 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 61 |
Number of mapped statements | 12 |
Number of unmapped statements in the first code fragment | 3 |
Number of unmapped statements in the second code fragment | 2 |
Time elapsed for statement mapping (ms) | 3.4 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | Commandline commandLine = new Commandline(); | 1 | Commandline commandLine = new Commandline(); | |||||||||||
| 2 | Project aProj = getProject(); | ||||||||||||
2 | int result = 0; | 3 | int result = 0; | |||||||||||
3 | if (getTypeKind() == null) |
| 4 | if (getViewPath() == null) | ||||||||||
4 | throw new BuildException("Required attribute TypeKind not specified"); |
| | |||||||||||
|
| 5 | setViewPath(aProj.getBaseDir().getPath()); | |||||||||||
5 | if (getTypeName() == null) | | ||||||||||||
6 | throw new BuildException("Required attribute TypeName not specified"); |
| | |||||||||||
7 | commandLine.setExecutable(getClearToolCommand()); | 6 | commandLine.setExecutable(getClearToolCommand()); | |||||||||||
8 | commandLine.createArgument().setValue(COMMAND_RMTYPE); |
| 7 | commandLine.createArgument().setValue(COMMAND_CHECKIN); | ||||||||||
9 | checkOptions(commandLine); | 8 | checkOptions(commandLine); | |||||||||||
10 | if (!getFailOnErr()) | 9 | if (!getFailOnErr()) | |||||||||||
11 | getProject().log("Ignoring any errors that occur for: " + getTypeSpecifier(), Project.MSG_VERBOSE); |
| 10 | getProject().log("Ignoring any errors that occur for: " + getViewPathBasename(), Project.MSG_VERBOSE); | ||||||||||
12 | result = run(commandLine); | 11 | result = run(commandLine); | |||||||||||
13 | if (Execute.isFailure(result) && getFailOnErr()) | 12 | if (Execute.isFailure(result) && getFailOnErr()) | |||||||||||
14 | String msg = "Failed executing: " + commandLine.toString(); | 13 | String msg = "Failed executing: " + commandLine.toString(); | |||||||||||
15 | throw new BuildException(msg, getLocation()); | 14 | throw new BuildException(msg, getLocation()); |
Row | Violation |
---|---|
1 | Unmatched throw new BuildException("Required attribute TypeKind not specified"); |
2 | Unmatched statement setViewPath(aProj.getBaseDir().getPath()); 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("Required attribute TypeName not specified"); |