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/CCLock.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 lock [options...]↵ | |
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_LOCK);↵ | |
16 | checkOptions(commandLine↵ | 14 | // Check the command line options↵ | |
15 | checkOptions(commandLine);↵ | |||
16 | // For debugging↵ | |||
17 | );↵ | 17 | // System.out.println(commandLine.toString());↵ | |
18 | if (!getFailOnErr()) {↵ | 18 | if (!getFailOnErr()) {↵ | |
19 | getProject().log("Ignoring any errors that occur for: "↵ | 19 | getProject().log("Ignoring any errors that occur for: "↵ | |
20 | + getTypeSpecifier(), Project.MSG_VERBOSE);↵ | 20 | + getOpType(), Project.MSG_VERBOSE);↵ | |
21 | }↵ | 21 | }↵ | |
22 | result = run(commandLine);↵ | 22 | result = run(commandLine);↵ | |
23 | if (Execute.isFailure(result) && getFailOnErr()) {↵ | 23 | if (Execute.isFailure(result) && getFailOnErr()) {↵ | |
24 | String msg = "Failed executing: " + commandLine.toString();↵ | 24 | String msg = "Failed executing: " + commandLine.toString();↵ | |
25 | throw new BuildException(msg, getLocation());↵ | 25 | throw new BuildException(msg, getLocation());↵ | |
26 | } | 26 |
| |
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.5 |
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_LOCK); | ||||||||||
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: " + getOpType(), 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 throw new BuildException("Required attribute TypeName not specified"); |