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_MKELEM); 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 (getTypeName() == null) { throw new BuildException("Required attribute TypeName not specified"); } // build the command line from what we got. the format is // cleartool mklbtype [options...] type-selector... // as specified in the CLEARTOOL help commandLine.setExecutable(getClearToolCommand()); commandLine.createArgument().setValue(COMMAND_MKLBTYPE); 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/CCMkelem.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/clearcase/CCMklbtype.java
Method name: void execute() Method name: void execute()
Number of AST nodes: 14 Number of AST nodes: 13
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 not specified
3
int result = 0;
4
        // Check for required attributes
5
        if (getViewPath() == null) {
5
        if (getTypeName() == null) {
6
            setViewPath(aProj.getBaseDir().getPath());
6
            throw new BuildException("Required attribute TypeName not specified");
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 mkelem [options...] [viewpath ...]
9
        // cleartool mklbtype [options...] type-selector...
10
        // as specified in the CLEARTOOL.EXE help
10
        // as specified in the CLEARTOOL help
11
        commandLine.setExecutable(getClearToolCommand());
11
        commandLine.setExecutable(getClearToolCommand());
12
        commandLine.createArgument().setValue(COMMAND_MKELEM);
12
        commandLine.createArgument().setValue(COMMAND_MKLBTYPE);
13
        checkOptions(commandLine);
13
        checkOptions(commandLine);
14
        if (!getFailOnErr()) {
14
        if (!getFailOnErr()) {
15
            getProject().log("Ignoring any errors that occur for: "
15
            getProject().log("Ignoring any errors that occur for: "
16
                    + getViewPathBasename(), Project.MSG_VERBOSE);
16
                    + getTypeSpecifier(), Project.MSG_VERBOSE);
17
        }
17
        }
18
        result = run(commandLine);
18
        result = run(commandLine);
19
        if (Execute.isFailure(result) && getFailOnErr()) {
19
        if (Execute.isFailure(result) && getFailOnErr()) {
20
            String msg = "Failed executing: " + commandLine.toString();
20
            String msg = "Failed executing: " + commandLine.toString();
21
            throw new BuildException(msg, getLocation());
21
            throw new BuildException(msg, getLocation());
22
        }
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.6
Clones locationClones are in different classes having the same super class
Number of node comparisons58
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements12
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)3.6
    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 (getViewPath() == null)
    4
    if (getViewPath() == null)
    3
    if (getTypeName() == null)
    Differences
    Expression1Expression2Difference
    getViewPathgetTypeNameMETHOD_INVOCATION_NAME_MISMATCH
    3
    if (getTypeName() == null)
                                                                                                                                                      
    4
    throw new BuildException("Required attribute TypeName not specified");
    Preondition Violations
    Unmatched throw new BuildException("Required attribute TypeName not specified");
    4
    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());
    5
    commandLine.setExecutable(getClearToolCommand());
    7
    commandLine.createArgument().setValue(COMMAND_MKELEM);
    7
    commandLine.createArgument().setValue(COMMAND_MKELEM);
    6
    commandLine.createArgument().setValue(COMMAND_MKLBTYPE);
    Differences
    Expression1Expression2Difference
    COMMAND_MKELEMCOMMAND_MKLBTYPEVARIABLE_NAME_MISMATCH
    6
    commandLine.createArgument().setValue(COMMAND_MKLBTYPE);
    8
    checkOptions(commandLine);
    7
    checkOptions(commandLine);
    9
    if (!getFailOnErr())
    8
    if (!getFailOnErr())
    10
    getProject().log("Ignoring any errors that occur for: " + getViewPathBasename(), Project.MSG_VERBOSE);
    10
    getProject().log("Ignoring any errors that occur for: " + getViewPathBasename(), Project.MSG_VERBOSE);
    9
    getProject().log("Ignoring any errors that occur for: " + getTypeSpecifier(), Project.MSG_VERBOSE);
    Differences
    Expression1Expression2Difference
    getViewPathBasenamegetTypeSpecifierMETHOD_INVOCATION_NAME_MISMATCH
    9
    getProject().log("Ignoring any errors that occur for: " + getTypeSpecifier(), Project.MSG_VERBOSE);
    11
    result = run(commandLine);
    10
    result = run(commandLine);
    12
    if (Execute.isFailure(result) && getFailOnErr())
    11
    if (Execute.isFailure(result) && getFailOnErr())
    13
    String msg = "Failed executing: " + commandLine.toString();
    12
    String msg = "Failed executing: " + commandLine.toString();
    14
    throw new BuildException(msg, getLocation());
    13
    throw new BuildException(msg, getLocation());
    Precondition Violations (2)
    Row Violation
    1Unmatched throw new BuildException("Required attribute TypeName 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