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(); 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 mkelem [options...] [viewpath ...] // as specified in the CLEARTOOL.EXE help commandLine.setExecutable(getClearToolCommand()); commandLine.createArgument().setValue(COMMAND_MKDIR); checkOptions(commandLine); 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()); }
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/CCMkdir.java
Method name: void execute() Method name: void execute()
Number of AST nodes: 17 Number of AST nodes: 14
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
        // Default the viewpath to basedir if it is not specified
4
        // Default the viewpath to basedir if it is not specified
5
        if (getViewPath() == null) {
5
        if (getViewPath() == null) {
6
            setViewPath(aProj.getBaseDir().getPath());
6
            setViewPath(aProj.getBaseDir().getPath());
7
        }
7
        }
8
        // build the command line from what we got the format is
8
        // build the command line from what we got. the format is
9
        // cleartool checkout [options...] [viewpath ...]
9
        // cleartool mkelem [options...] [viewpath ...]
10
        // as specified in the CLEARTOOL.EXE help
10
        // as specified in the CLEARTOOL.EXE help
11
        commandLine.setExecutable(getClearToolCommand());
11
        commandLine.setExecutable(getClearToolCommand());
12
        commandLine.createArgument().setValue(COMMAND_CHECKOUT);
12
        commandLine.createArgument().setValue(COMMAND_MKDIR);
13
        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
        }
24
        if (!getFailOnErr()) {
14
        if (!getFailOnErr()) {
25
            getProject().log("Ignoring any errors that occur for: "
15
            getProject().log("Ignoring any errors that occur for: "
26
                    + getViewPathBasename(), Project.MSG_VERBOSE);
16
                    + getViewPathBasename(), Project.MSG_VERBOSE);
27
        }
17
        }
28
        result = run(commandLine);
18
        result = run(commandLine);
29
        if (Execute.isFailure(result) && getFailOnErr()) {
19
        if (Execute.isFailure(result) && getFailOnErr()) {
30
            String msg = "Failed executing: " + commandLine.toString();
20
            String msg = "Failed executing: " + commandLine.toString();
31
            throw new BuildException(msg, getLocation());
21
            throw new BuildException(msg, getLocation());
32
        }
22
        }
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)0.7
Clones locationClones are in different classes having the same super class
Number of node comparisons69
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements11
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    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();
    2
    Project aProj = getProject();
    3
    int result = 0;
    3
    int result = 0;
    6
    commandLine.setExecutable(getClearToolCommand());
    6
    commandLine.setExecutable(getClearToolCommand());
    7
    commandLine.createArgument().setValue(COMMAND_CHECKOUT);
    7
    commandLine.createArgument().setValue(COMMAND_CHECKOUT);
    7
    commandLine.createArgument().setValue(COMMAND_MKDIR);
    Differences
    Expression1Expression2Difference
    COMMAND_CHECKOUTCOMMAND_MKDIRVARIABLE_NAME_MISMATCH
    7
    commandLine.createArgument().setValue(COMMAND_MKDIR);
    8
    checkOptions(commandLine);
    8
    checkOptions(commandLine);
    9
    if (!getNotco() && lsCheckout())
                                                                        
    11
    return;
    11
    return;
    Preondition Violations
    Unmatched return;
                          
    12
    if (!getFailOnErr())
    9
    if (!getFailOnErr())
    13
    getProject().log("Ignoring any errors that occur for: " + getViewPathBasename(), Project.MSG_VERBOSE);
                                                                                                                                                                                                                      
    14
    result = run(commandLine);
    11
    result = run(commandLine);
                                                                                                          
    12
    if (Execute.isFailure(result) && getFailOnErr())
                                                                                                                              
    13
    String msg = "Failed executing: " + commandLine.toString();
                                                                                                    
    14
    throw new BuildException(msg, getLocation());
    Preondition Violations
    Unmatched throw new BuildException(msg,getLocation());
    14
    throw new BuildException(msg, getLocation());
    Precondition Violations (3)
    Row Violation
    1Unmatched return;
    2Unmatched throw new BuildException(msg,getLocation());
    3Clone fragment #1 returns variables result, commandLine , while Clone fragment #2 returns variables result, commandLine