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"); } // 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 mklabel [options...] [viewpath ...] // as specified in the CLEARTOOL help commandLine.setExecutable(getClearToolCommand()); commandLine.createArgument().setValue(COMMAND_MKLABEL); 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()); }
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/CCMklabel.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: 16 Number of AST nodes: 15
1
Commandline commandLine = new Commandline();
1
Commandline commandLine = new Commandline();
2
        Project aProj = getProject();
3
        int result = 0;
2
        int result = 0;
4
        // Check for required attributes
3
        // Check for required attributes
5
        if (getTypeName() == null) {
4
        if (getTypeKind() == null) {
6
            throw new BuildException("Required attribute TypeName not specified");
5
            throw new BuildException("Required attribute TypeKind not specified");
7
        }
6
        }
8
        // Default the viewpath to basedir if it is not specified
9
        if (getViewPath() == null) {
7
        if (getTypeName() == null) {
10
            setViewPath(aProj.getBaseDir().getPath());
8
            throw new BuildException("Required attribute TypeName not specified");
11
        }
9
        }
12
        // build the command line from what we got. the format is
10
        // build the command line from what we got. the format is
13
        // cleartool mklabel [options...] [viewpath ...]
11
        // cleartool rmtype [options...] type-selector...
14
        // as specified in the CLEARTOOL help
12
        // as specified in the CLEARTOOL help
15
        commandLine.setExecutable(getClearToolCommand());
13
        commandLine.setExecutable(getClearToolCommand());
16
        commandLine.createArgument().setValue(COMMAND_MKLABEL);
14
        commandLine.createArgument().setValue(COMMAND_RMTYPE);
17
        checkOptions(commandLine);
15
        checkOptions(commandLine);
18
        if (!getFailOnErr()) {
16
        if (!getFailOnErr()) {
19
            getProject().log("Ignoring any errors that occur for: "
17
            getProject().log("Ignoring any errors that occur for: "
20
                    + getViewPathBasename(), Project.MSG_VERBOSE);
18
                    + getTypeSpecifier(), Project.MSG_VERBOSE);
21
        }
19
        }
22
        result = run(commandLine);
20
        result = run(commandLine);
23
        if (Execute.isFailure(result) && getFailOnErr()) {
21
        if (Execute.isFailure(result) && getFailOnErr()) {
24
            String msg = "Failed executing: " + commandLine.toString();
22
            String msg = "Failed executing: " + commandLine.toString();
25
            throw new BuildException(msg, getLocation());
23
            throw new BuildException(msg, getLocation());
26
        }
24
        }
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.9
Clones locationClones are in different classes having the same super class
Number of node comparisons79
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements14
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)4.2
    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
    if (getTypeName() == null)
    5
    if (getTypeName() == null)
    5
    throw new BuildException("Required attribute TypeName not specified");
    6
    throw new BuildException("Required attribute TypeName not specified");
    6
    if (getViewPath() == null)
    6
    if (getViewPath() == null)
    3
    if (getTypeKind() == null)
    Differences
    Expression1Expression2Difference
    getViewPathgetTypeKindMETHOD_INVOCATION_NAME_MISMATCH
    3
    if (getTypeKind() == null)
                                                                                                                                                      
    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");
    7
    setViewPath(aProj.getBaseDir().getPath());
    7
    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
                                                                                              
    8
    commandLine.setExecutable(getClearToolCommand());
    7
    commandLine.setExecutable(getClearToolCommand());
    9
    commandLine.createArgument().setValue(COMMAND_MKLABEL);
    9
    commandLine.createArgument().setValue(COMMAND_MKLABEL);
    8
    commandLine.createArgument().setValue(COMMAND_RMTYPE);
    Differences
    Expression1Expression2Difference
    COMMAND_MKLABELCOMMAND_RMTYPEVARIABLE_NAME_MISMATCH
    8
    commandLine.createArgument().setValue(COMMAND_RMTYPE);
    10
    checkOptions(commandLine);
    9
    checkOptions(commandLine);
    11
    if (!getFailOnErr())
    10
    if (!getFailOnErr())
    12
    getProject().log("Ignoring any errors that occur for: " + getViewPathBasename(), Project.MSG_VERBOSE);
    12
    getProject().log("Ignoring any errors that occur for: " + getViewPathBasename(), Project.MSG_VERBOSE);
    11
    getProject().log("Ignoring any errors that occur for: " + getTypeSpecifier(), Project.MSG_VERBOSE);
    Differences
    Expression1Expression2Difference
    getViewPathBasenamegetTypeSpecifierMETHOD_INVOCATION_NAME_MISMATCH
    11
    getProject().log("Ignoring any errors that occur for: " + getTypeSpecifier(), Project.MSG_VERBOSE);
    13
    result = run(commandLine);
    12
    result = run(commandLine);
    14
    if (Execute.isFailure(result) && getFailOnErr())
    13
    if (Execute.isFailure(result) && getFailOnErr())
    15
    String msg = "Failed executing: " + commandLine.toString();
    14
    String msg = "Failed executing: " + commandLine.toString();
    16
    throw new BuildException(msg, getLocation());
    15
    throw new BuildException(msg, getLocation());
    Precondition Violations (2)
    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