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