File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/clearcase/CCMklabel.java | File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/clearcase/CCCheckout.java | |||
Method name: void execute()
|
Method name: void execute()
|
|||
Number of AST nodes: 16 | Number of AST nodes: 17 | |||
1 | Commandline commandLine = new Commandline();↵ | 1 | Commandline commandLine = new Commandline();↵ | |
2 | Project aProj = getProject();↵ | 2 | Project aProj = getProject();↵ | |
3 | int result = 0;↵ | 3 | int result = 0;↵ | |
4 | // Check for required attributes↵ | |||
5 | if (getTypeName() == null) {↵ | |||
6 | throw new BuildException("Required attribute TypeName not specified");↵ | |||
7 | }↵ | |||
8 | // Default the viewpath to basedir if it is not specified↵ | 4 | // Default the viewpath to basedir if it is not specified↵ | |
9 | if (getViewPath() == null) {↵ | 5 | if (getViewPath() == null) {↵ | |
10 | setViewPath(aProj.getBaseDir().getPath());↵ | 6 | setViewPath(aProj.getBaseDir().getPath());↵ | |
11 | }↵ | 7 | }↵ | |
12 | // build the command line from what we got. the format is↵ | 8 | // build the command line from what we got the format is↵ | |
13 | // cleartool mklabel [options...] [viewpath ...]↵ | 9 | // cleartool checkout [options...] [viewpath ...]↵ | |
14 | // as specified in the CLEARTOOL help↵ | 10 | // as specified in the CLEARTOOL.EXE help↵ | |
15 | commandLine.setExecutable(getClearToolCommand());↵ | 11 | commandLine.setExecutable(getClearToolCommand());↵ | |
16 | commandLine.createArgument().setValue(COMMAND_MKLABEL);↵ | 12 | commandLine.createArgument().setValue(COMMAND_CHECKOUT);↵ | |
17 | checkOptions(commandLine);↵ | 13 | checkOptions(commandLine);↵ | |
14 | /*↵ | |||
15 | * If configured to not care about whether the element is↵ | |||
16 | * already checked out to the current view.↵ | |||
17 | * Then check to see if it is checked out.↵ | |||
18 | */↵ | |||
19 | if (!getNotco() && lsCheckout()) {↵ | |||
20 | getProject().log("Already checked out in this view: "↵ | |||
21 | + getViewPathBasename(), Project.MSG_VERBOSE);↵ | |||
22 | return;↵ | |||
23 | }↵ | |||
18 | if (!getFailOnErr()) {↵ | 24 | if (!getFailOnErr()) {↵ | |
19 | getProject().log("Ignoring any errors that occur for: "↵ | 25 | getProject().log("Ignoring any errors that occur for: "↵ | |
20 | + getViewPathBasename(), Project.MSG_VERBOSE);↵ | 26 | + getViewPathBasename(), Project.MSG_VERBOSE);↵ | |
21 | }↵ | 27 | }↵ | |
22 | result = run(commandLine);↵ | 28 | result = run(commandLine);↵ | |
23 | if (Execute.isFailure(result) && getFailOnErr()) {↵ | 29 | if (Execute.isFailure(result) && getFailOnErr()) {↵ | |
24 | String msg = "Failed executing: " + commandLine.toString();↵ | 30 | String msg = "Failed executing: " + commandLine.toString();↵ | |
25 | throw new BuildException(msg, getLocation());↵ | 31 | throw new BuildException(msg, getLocation());↵ | |
26 | } | 32 |
| |
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) | 1.0 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 65 |
Number of mapped statements | 10 |
Number of unmapped statements in the first code fragment | 6 |
Number of unmapped statements in the second code fragment | 3 |
Time elapsed for statement mapping (ms) | 5.6 |
Clone type | Type 3 |
ID | Statement | ID | Statement | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | Commandline commandLine = new Commandline(); | 1 | Commandline commandLine = new Commandline(); | ||||||||||||||
2 | Project aProj = getProject(); | 2 | Project aProj = getProject(); | ||||||||||||||
3 | int result = 0; | 3 | int result = 0; | ||||||||||||||
4 | if (getTypeName() == null) |
| 4 | if (getViewPath() == null) | |||||||||||||
|
| 5 | setViewPath(aProj.getBaseDir().getPath()); | ||||||||||||||
5 | throw new BuildException("Required attribute TypeName not specified"); |
| | ||||||||||||||
6 | if (getViewPath() == null) | | |||||||||||||||
7 | setViewPath(aProj.getBaseDir().getPath()); |
| | ||||||||||||||
8 | commandLine.setExecutable(getClearToolCommand()); | 6 | commandLine.setExecutable(getClearToolCommand()); | ||||||||||||||
9 | commandLine.createArgument().setValue(COMMAND_MKLABEL); |
| 7 | commandLine.createArgument().setValue(COMMAND_CHECKOUT); | |||||||||||||
10 | checkOptions(commandLine); | 8 | checkOptions(commandLine); | ||||||||||||||
11 | if (!getFailOnErr()) | 12 | if (!getFailOnErr()) | ||||||||||||||
12 | getProject().log("Ignoring any errors that occur for: " + getViewPathBasename(), Project.MSG_VERBOSE); | 13 | getProject().log("Ignoring any errors that occur for: " + getViewPathBasename(), Project.MSG_VERBOSE); | ||||||||||||||
13 | result = run(commandLine); |
| | ||||||||||||||
14 | if (Execute.isFailure(result) && getFailOnErr()) |
| 9 | if (!getNotco() && lsCheckout()) | |||||||||||||
| 10 | getProject().log("Already checked out in this view: " + getViewPathBasename(), Project.MSG_VERBOSE); | |||||||||||||||
|
| 11 | return; | ||||||||||||||
15 | String msg = "Failed executing: " + commandLine.toString(); | | |||||||||||||||
16 | throw new BuildException(msg, getLocation()); |
| |
Row | Violation |
---|---|
1 | 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 |
2 | Unmatched throw new BuildException("Required attribute TypeName not specified"); |
3 | 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 |
4 | Unmatched statement result=run(commandLine); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
5 | Unmatched return; |
6 | Unmatched throw new BuildException(msg,getLocation()); |
7 | Clone fragment #1 returns variables aProj, commandLine, result , while Clone fragment #2 returns variables aProj, commandLine, result |