Commandline commandLine = new Commandline(); Project aProj = getProject(); int result = 0; // Check for required attributes if (getTypeName() == null) { throw new BuildException("Required attribute TypeName not specified"); } if (getTypeValue() == null) { throw new BuildException("Required attribute TypeValue not specified"); } // 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 mkattr [options...] [viewpath ...] // as specified in the CLEARTOOL help commandLine.setExecutable(getClearToolCommand()); commandLine.createArgument().setValue(COMMAND_MKATTR); checkOptions(commandLine); if (!getFailOnErr()) { getProject().log("Ignoring any errors that occur for: " + getViewPathBasename(), Project.MSG_VERBOSE); } // For debugging // System.out.println(commandLine.toString()); 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 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()); }
Clone fragments detected by clone detection tool
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/CCCheckout.java
Method name: void execute() Method name: void execute()
Number of AST nodes: 18 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
        if (getTypeValue() == null) {
9
            throw new BuildException("Required attribute TypeValue not specified");
10
        }
11
        // Default the viewpath to basedir if it is not specified
4
        // Default the viewpath to basedir if it is not specified
12
        if (getViewPath() == null) {
5
        if (getViewPath() == null) {
13
            setViewPath(aProj.getBaseDir().getPath());
6
            setViewPath(aProj.getBaseDir().getPath());
14
        }
7
        }
15
        // build the command line from what we got. the format is
8
        // build the command line from what we got the format is
16
        // cleartool mkattr [options...] [viewpath ...]
9
        // cleartool checkout [options...] [viewpath ...]
17
        // as specified in the CLEARTOOL help
10
        // as specified in the CLEARTOOL.EXE help
18
        commandLine.setExecutable(getClearToolCommand());
11
        commandLine.setExecutable(getClearToolCommand());
19
        commandLine.createArgument().setValue(COMMAND_MKATTR);
12
        commandLine.createArgument().setValue(COMMAND_CHECKOUT);
20
        checkOptions(commandLine);
13
        checkOptions(commandLine);
21
        if (!getFailOnErr
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
         */
22
()) {
19
        if (!getNotco() && lsCheckout()) {
23
            getProject().log("Ignoring any errors that occur for: "
20
            getProject().log("Already checked out in this view: "
24
                    + getViewPathBasename(), Project.MSG_VERBOSE);
21
                    + getViewPathBasename(), Project.MSG_VERBOSE);
25
        }
22
        
26
        // For debugging
27
        // System.out.println(commandLine.toString());
23
    return;
24
        }
25
        if (!getFailOnErr()) {
26
            getProject().log("Ignoring any errors that occur for: "
27
                    + getViewPathBasename(), Project.MSG_VERBOSE);
28
        }
28
        result = run(commandLine);
29
        result = run(commandLine);
29
        if (Execute.isFailure(result) && getFailOnErr()) {
30
        if (Execute.isFailure(result) && getFailOnErr()) {
30
            String msg = "Failed executing: " + commandLine.toString();
31
            String msg = "Failed executing: " + commandLine.toString();
31
            throw new BuildException(msg, getLocation());
32
            throw new BuildException(msg, getLocation());
32
        }
33
        }
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.1
Clones locationClones are in different classes having the same super class
Number of node comparisons69
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements10
    Number of unmapped statements in the first code fragment8
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)4.6
    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;
    4
    if (getTypeName() == null)
    4
    if (getTypeName() == null)
    4
    if (getViewPath() == null)
    Differences
    Expression1Expression2Difference
    getTypeNamegetViewPathMETHOD_INVOCATION_NAME_MISMATCH
    4
    if (getViewPath() == null)
                                                                                              
    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
    5
    setViewPath(aProj.getBaseDir().getPath());
    5
    throw new BuildException("Required attribute TypeName not specified");
    5
    throw new BuildException("Required attribute TypeName not specified");
    Preondition Violations
    Unmatched throw new BuildException("Required attribute TypeName not specified");
                                                                                                                                                      
    6
    if (getTypeValue() == null)
                                                              
    7
    throw new BuildException("Required attribute TypeValue not specified");
    7
    throw new BuildException("Required attribute TypeValue not specified");
    Preondition Violations
    Unmatched throw new BuildException("Required attribute TypeValue not specified");
                                                                                                                                                        
    8
    if (getViewPath() == null)
                                                            
    9
    setViewPath(aProj.getBaseDir().getPath());
    9
    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
                                                                                              
    10
    commandLine.setExecutable(getClearToolCommand());
    6
    commandLine.setExecutable(getClearToolCommand());
    11
    commandLine.createArgument().setValue(COMMAND_MKATTR);
    11
    commandLine.createArgument().setValue(COMMAND_MKATTR);
    7
    commandLine.createArgument().setValue(COMMAND_CHECKOUT);
    Differences
    Expression1Expression2Difference
    COMMAND_MKATTRCOMMAND_CHECKOUTVARIABLE_NAME_MISMATCH
    7
    commandLine.createArgument().setValue(COMMAND_CHECKOUT);
    12
    checkOptions(commandLine);
    8
    checkOptions(commandLine);
    13
    if (!getFailOnErr())
    12
    if (!getFailOnErr())
    14
    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);
    15
    result = run(commandLine);
    15
    result = run(commandLine);
    Preondition Violations
    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
                                                            
    16
    if (Execute.isFailure(result) && getFailOnErr())
    16
    if (Execute.isFailure(result) && getFailOnErr())
    9
    if (!getNotco() && lsCheckout())
    Differences
    Expression1Expression2Difference
    Execute.isFailure(result)!getNotco()TYPE_COMPATIBLE_REPLACEMENT
    getFailOnErrlsCheckoutMETHOD_INVOCATION_NAME_MISMATCH
    9
    if (!getNotco() && lsCheckout())
                                                                                                                                                                                                                  
    10
    getProject().log("Already checked out in this view: " + getViewPathBasename(), Project.MSG_VERBOSE);
                          
    11
    return;
    Preondition Violations
    Unmatched return;
    11
    return;
    17
    String msg = "Failed executing: " + commandLine.toString();
                                                                                                                              
    18
    throw new BuildException(msg, getLocation());
    18
    throw new BuildException(msg, getLocation());
    Preondition Violations
    Unmatched throw new BuildException(msg,getLocation());
                                                                                                    
    Precondition Violations (8)
    Row Violation
    1Unmatched 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
    2Unmatched throw new BuildException("Required attribute TypeName not specified");
    3Unmatched throw new BuildException("Required attribute TypeValue not specified");
    4Unmatched 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
    5Unmatched statement result=run(commandLine); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Unmatched return;
    7Unmatched throw new BuildException(msg,getLocation());
    8Clone fragment #1 returns variables aProj, commandLine, result , while Clone fragment #2 returns variables aProj, commandLine, result