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()); }
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 checkin [options...] [viewpath ...] // as specified in the CLEARTOOL.EXE help commandLine.setExecutable(getClearToolCommand()); commandLine.createArgument().setValue(COMMAND_CHECKIN); 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/CCRmtype.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/clearcase/CCCheckin.java
Method name: void execute() Method name: void execute()
Number of AST nodes: 15 Number of AST nodes: 14
1
Commandline commandLine = new Commandline();
1
Commandline commandLine = new Commandline();
2
        int result = 0;
2
        
3
        // Check for required attributes
4
        if (getTypeKind() == null) {
5
            throw new BuildException("Required attribute TypeKind
3
Project aProj = getProject();
4
        int result = 0;
6
 not specified");
5
        // Default the viewpath to basedir if it is not specified
7
        }
8
        if (getTypeName() == null) {
6
        if (getViewPath() == null) {
9
            throw new BuildException("Required attribute TypeName not specified");
7
            setViewPath(aProj.getBaseDir().getPath());
10
        }
8
        }
11
        // build the command line from what we got. the format is
9
        // build the command line from what we got. the format is
12
        // cleartool rmtype [options...] type-selector...
10
        // cleartool checkin [options...] [viewpath ...]
13
        // as specified in the CLEARTOOL help
11
        // as specified in the CLEARTOOL.EXE help
14
        commandLine.setExecutable(getClearToolCommand());
12
        commandLine.setExecutable(getClearToolCommand());
15
        commandLine.createArgument().setValue(COMMAND_RMTYPE);
13
        commandLine.createArgument().setValue(COMMAND_CHECKIN);
16
        checkOptions(commandLine);
14
        checkOptions(commandLine);
17
        if (!getFailOnErr()) {
15
        if (!getFailOnErr()) {
18
            getProject().log("Ignoring any errors that occur for: "
16
            getProject().log("Ignoring any errors that occur for: "
19
                    + getTypeSpecifier(), Project.MSG_VERBOSE);
17
                    + getViewPathBasename(), Project.MSG_VERBOSE);
20
        }
18
        }
21
        result = run(commandLine);
19
        result = run(commandLine);
22
        if (Execute.isFailure(result) && getFailOnErr()) {
20
        if (Execute.isFailure(result) && getFailOnErr()) {
23
            String msg = "Failed executing: " + commandLine.toString();
21
            String msg = "Failed executing: " + commandLine.toString();
24
            throw new BuildException(msg, getLocation());
22
            throw new BuildException(msg, getLocation());
25
        }
23
        }
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 comparisons61
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements12
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)3.4
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    Commandline commandLine = new Commandline();
    1
    Commandline commandLine = new Commandline();
                                                                
    2
    Project aProj = getProject();
    2
    int result = 0;
    3
    int result = 0;
    3
    if (getTypeKind() == null)
    3
    if (getTypeKind() == null)
    4
    if (getViewPath() == null)
    Differences
    Expression1Expression2Difference
    getTypeKindgetViewPathMETHOD_INVOCATION_NAME_MISMATCH
    4
    if (getViewPath() == null)
    4
    throw new BuildException("Required attribute TypeKind not specified");
    4
    throw new BuildException("Required attribute TypeKind not specified");
    Preondition Violations
    Unmatched throw new BuildException("Required attribute TypeKind not specified");
                                                                                                                                                      
                                                                                              
    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
    if (getTypeName() == null)
                                                            
    6
    throw new BuildException("Required attribute TypeName not specified");
    6
    throw new BuildException("Required attribute TypeName not specified");
    Preondition Violations
    Unmatched throw new BuildException("Required attribute TypeName not specified");
                                                                                                                                                      
    7
    commandLine.setExecutable(getClearToolCommand());
    6
    commandLine.setExecutable(getClearToolCommand());
    8
    commandLine.createArgument().setValue(COMMAND_RMTYPE);
    8
    commandLine.createArgument().setValue(COMMAND_RMTYPE);
    7
    commandLine.createArgument().setValue(COMMAND_CHECKIN);
    Differences
    Expression1Expression2Difference
    COMMAND_RMTYPECOMMAND_CHECKINVARIABLE_NAME_MISMATCH
    7
    commandLine.createArgument().setValue(COMMAND_CHECKIN);
    9
    checkOptions(commandLine);
    8
    checkOptions(commandLine);
    10
    if (!getFailOnErr())
    9
    if (!getFailOnErr())
    11
    getProject().log("Ignoring any errors that occur for: " + getTypeSpecifier(), Project.MSG_VERBOSE);
    11
    getProject().log("Ignoring any errors that occur for: " + getTypeSpecifier(), Project.MSG_VERBOSE);
    10
    getProject().log("Ignoring any errors that occur for: " + getViewPathBasename(), Project.MSG_VERBOSE);
    Differences
    Expression1Expression2Difference
    getTypeSpecifiergetViewPathBasenameMETHOD_INVOCATION_NAME_MISMATCH
    10
    getProject().log("Ignoring any errors that occur for: " + getViewPathBasename(), Project.MSG_VERBOSE);
    12
    result = run(commandLine);
    11
    result = run(commandLine);
    13
    if (Execute.isFailure(result) && getFailOnErr())
    12
    if (Execute.isFailure(result) && getFailOnErr())
    14
    String msg = "Failed executing: " + commandLine.toString();
    13
    String msg = "Failed executing: " + commandLine.toString();
    15
    throw new BuildException(msg, getLocation());
    14
    throw new BuildException(msg, getLocation());
    Precondition Violations (3)
    Row Violation
    1Unmatched throw new BuildException("Required attribute TypeKind not specified");
    2Unmatched 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
    3Unmatched throw new BuildException("Required attribute TypeName not specified");