Commandline commandLine = new Commandline(); Project aProj = getProject(); int result = 0; // Default the viewpath to basedir if it is not specified if (getViewPath() == null) { setViewPath(aProj.getBaseDir().getPath()); } // build the command line from what we got the format is // cleartool checkout [options...] [viewpath ...] // as specified in the CLEARTOOL.EXE help commandLine.setExecutable(getClearToolCommand()); commandLine.createArgument().setValue(COMMAND_CHECKOUT); checkOptions(commandLine); /* * If configured to not care about whether the element is * already checked out to the current view. * Then check to see if it is checked out. */ if (!getNotco() && lsCheckout()) { getProject().log("Already checked out in this view: " + getViewPathBasename(), Project.MSG_VERBOSE); return; } if (!getFailOnErr()) { getProject().log("Ignoring any errors that occur for: " + getViewPathBasename(), Project.MSG_VERBOSE); } result = run(commandLine); if (Execute.isFailure(result) && getFailOnErr()) { String msg = "Failed executing: " + commandLine.toString(); throw new BuildException(msg, getLocation()); }
Commandline commandLine = new Commandline(); int result = 0; // Check for required attributes if (getTypeKind() == null) { throw new BuildException("Required attribute TypeKind not specified"); } if (getTypeName() == null) { throw new BuildException("Required attribute TypeName not specified"); } // build the command line from what we got. the format is // cleartool rmtype [options...] type-selector... // as specified in the CLEARTOOL help commandLine.setExecutable(getClearToolCommand()); commandLine.createArgument().setValue(COMMAND_RMTYPE); checkOptions(commandLine); if (!getFailOnErr()) { getProject().log("Ignoring any errors that occur for: " + getTypeSpecifier(), Project.MSG_VERBOSE); } result = run(commandLine); if (Execute.isFailure(result) && getFailOnErr()) { String msg = "Failed executing: " + commandLine.toString(); throw new BuildException(msg, getLocation()); }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/clearcase/CCCheckout.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: 17 Number of AST nodes: 15
1
Commandline commandLine = new Commandline();
1
Commandline commandLine = new Commandline();
2
        Project aProj = getProject();
2
        
3
        int result = 0;
4
        // Default the viewpath to basedir if it is
3
int result = 0;
4
        // Check for required attributes
5
        if (getTypeKind() == null) {
5
 not specified
6
            throw new BuildException("Required attribute TypeKind not specified");
7
        }
6
        if (getViewPath() == null) {
8
        if (getTypeName() == null) {
7
            setViewPath(aProj.getBaseDir().getPath());
9
            throw new BuildException("Required attribute TypeName not specified");
8
        }
10
        }
9
        // build the command line from what we got the format is
11
        // build the command line from what we got. the format is
10
        // cleartool checkout [options...] [viewpath ...]
12
        // cleartool rmtype [options...] type-selector...
11
        // as specified in the CLEARTOOL.EXE help
13
        // as specified in the CLEARTOOL help
12
        commandLine.setExecutable(getClearToolCommand());
14
        commandLine.setExecutable(getClearToolCommand());
13
        commandLine.createArgument().setValue(COMMAND_CHECKOUT);
15
        commandLine.createArgument().setValue(COMMAND_RMTYPE);
14
        checkOptions(commandLine);
16
        checkOptions(commandLine);
15
        /*
16
         * If configured to not care about whether the element is
17
         * already checked out to the current view.
18
         * Then check to see if it is checked out.
19
         */
20
        if (!getNotco() && lsCheckout()) {
21
            getProject().log("Already checked out in this view: "
22
                    + getViewPathBasename(), Project.MSG_VERBOSE);
23
            return;
24
        }
25
        if (!getFailOnErr()) {
17
        if (!getFailOnErr()) {
26
            getProject().log("Ignoring any errors that occur for: "
18
            getProject().log("Ignoring any errors that occur for: "
27
                    + getViewPathBasename(), Project.MSG_VERBOSE);
19
                    + getTypeSpecifier(), Project.MSG_VERBOSE);
28
        }
20
        }
29
        result = run(commandLine);
21
        result = run(commandLine);
30
        if (Execute.isFailure(result) && getFailOnErr()) {
22
        if (Execute.isFailure(result) && getFailOnErr()) {
31
            String msg = "Failed executing: " + commandLine.toString();
23
            String msg = "Failed executing: " + commandLine.toString();
32
            throw new BuildException(msg, getLocation());
24
            throw new BuildException(msg, getLocation());
33
        }
25
        }
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)1.0
Clones locationClones are in different classes having the same super class
Number of node comparisons68
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements8
    Number of unmapped statements in the first code fragment5
    Number of unmapped statements in the second code fragment7
    Time elapsed for statement mapping (ms)3.3
    Clone typeType 3
    Mapped Statements
    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
    throw new BuildException("Required attribute TypeKind not specified");
    Preondition Violations
    Unmatched throw new BuildException("Required attribute TypeKind not specified");
    4
    throw new BuildException("Required attribute TypeKind not specified");
                                                            
    5
    if (getTypeName() == null)
                                                                                                                                                      
    6
    throw new BuildException("Required attribute TypeName not specified");
    Preondition Violations
    Unmatched throw new BuildException("Required attribute TypeName not specified");
    6
    throw new BuildException("Required attribute TypeName not specified");
    5
    setViewPath(aProj.getBaseDir().getPath());
    5
    setViewPath(aProj.getBaseDir().getPath());
    Preondition Violations
    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
                                                                                              
    6
    commandLine.setExecutable(getClearToolCommand());
    7
    commandLine.setExecutable(getClearToolCommand());
    7
    commandLine.createArgument().setValue(COMMAND_CHECKOUT);
    7
    commandLine.createArgument().setValue(COMMAND_CHECKOUT);
    8
    commandLine.createArgument().setValue(COMMAND_RMTYPE);
    Differences
    Expression1Expression2Difference
    COMMAND_CHECKOUTCOMMAND_RMTYPEVARIABLE_NAME_MISMATCH
    8
    commandLine.createArgument().setValue(COMMAND_RMTYPE);
    8
    checkOptions(commandLine);
    9
    checkOptions(commandLine);
    9
    if (!getNotco() && lsCheckout())
                                                                        
    11
    return;
    11
    return;
    Preondition Violations
    Unmatched return;
                          
    12
    if (!getFailOnErr())
    10
    if (!getFailOnErr())
    13
    getProject().log("Ignoring any errors that occur for: " + getViewPathBasename(), Project.MSG_VERBOSE);
                                                                                                                                                                                                                      
                                                            
    12
    result = run(commandLine);
                                                                                                          
    13
    if (Execute.isFailure(result) && getFailOnErr())
                                                                                                                              
    14
    String msg = "Failed executing: " + commandLine.toString();
                                                                                                    
    15
    throw new BuildException(msg, getLocation());
    Preondition Violations
    Unmatched throw new BuildException(msg,getLocation());
    15
    throw new BuildException(msg, getLocation());
    Precondition Violations (6)
    Row Violation
    1Unmatched throw new BuildException("Required attribute TypeKind not specified");
    2Unmatched throw new BuildException("Required attribute TypeName not specified");
    3Unmatched 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
    4Unmatched return;
    5Unmatched throw new BuildException(msg,getLocation());
    6Clone fragment #1 returns variables commandLine, result , while Clone fragment #2 returns variables commandLine, result