Task task = getThreadTask(Thread.currentThread()); if (task == null) { log(output, isWarning ? MSG_WARN : MSG_INFO); } else { if (isWarning) { task.handleErrorOutput(output); } else { task.handleOutput(output); } }
Task task = getThreadTask(Thread.currentThread()); if (task == null) { fireMessageLogged(this, output, isError ? MSG_ERR : MSG_INFO); } else { if (isError) { task.handleErrorFlush(output); } else { task.handleFlush(output); } }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/Project.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/Project.java
Method name: void demuxOutput(String, boolean) Method name: void demuxFlush(String, boolean)
Number of AST nodes: 6 Number of AST nodes: 6
1
Task task = getThreadTask(Thread.currentThread());
1
Task task = getThreadTask(Thread.currentThread());
2
        if (task == null) {
2
        if (task == null) {
3
            log(output, isWarning ? MSG_WARN : MSG_INFO);
3
            fireMessageLogged(this, output, isError ? MSG_ERR : MSG_INFO);
4
        } else {
4
        } else {
5
            if (isWarning) {
5
            if (isError) {
6
                task.handleErrorOutput(output);
6
                task.handleErrorFlush(output);
7
            } else {
7
            } else {
8
                task.handleOutput(output);
8
                task.handleFlush(output);
9
            }
9
            }
10
        }
10
        }
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.2
Clones locationClones are declared in the same class
Number of node comparisons14
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)2.4
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    Task task = getThreadTask(Thread.currentThread());
    1
    Task task = getThreadTask(Thread.currentThread());
    2
    if (task == null)
    2
    if (task == null)
    3
    log(output, isWarning ? MSG_WARN : MSG_INFO);
    3
    log(output, isWarning ? MSG_WARN : MSG_INFO);
    3
    fireMessageLogged(this, output, isError ? MSG_ERR : MSG_INFO);
    Differences
    Expression1Expression2Difference
    logfireMessageLoggedMETHOD_INVOCATION_NAME_MISMATCH
    log(output,isWarning ? MSG_WARN : MSG_INFO)fireMessageLogged(this,output,isError ? MSG_ERR : MSG_INFO)ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression log(output,isWarning ? MSG_WARN : MSG_INFO) is a void method call, and thus it cannot be parameterized
    Expression fireMessageLogged(this,output,isError ? MSG_ERR : MSG_INFO) is a void method call, and thus it cannot be parameterized
    Expression log(output,isWarning ? MSG_WARN : MSG_INFO) is a void method call, and thus it cannot be parameterized
    Expression fireMessageLogged(this,output,isError ? MSG_ERR : MSG_INFO) is a void method call, and thus it cannot be parameterized
    3
    fireMessageLogged(this, output, isError ? MSG_ERR : MSG_INFO);
    else
    else
    4
    if (isWarning)
    4
    if (isWarning)
    4
    if (isError)
    Differences
    Expression1Expression2Difference
    isWarningisErrorVARIABLE_NAME_MISMATCH
    4
    if (isError)
    5
    task.handleErrorOutput(output);
    5
    task.handleErrorOutput(output);
    5
    task.handleErrorFlush(output);
    Differences
    Expression1Expression2Difference
    handleErrorOutputhandleErrorFlushMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression task.handleErrorOutput(output) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression task.handleErrorFlush(output) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression task.handleErrorOutput(output) is a void method call, and thus it cannot be parameterized
    Expression task.handleErrorFlush(output) is a void method call, and thus it cannot be parameterized
    5
    task.handleErrorFlush(output);
    else
    else
    6
    task.handleOutput(output);
    6
    task.handleOutput(output);
    6
    task.handleFlush(output);
    Differences
    Expression1Expression2Difference
    handleOutputhandleFlushMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression task.handleOutput(output) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression task.handleFlush(output) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression task.handleOutput(output) is a void method call, and thus it cannot be parameterized
    Expression task.handleFlush(output) is a void method call, and thus it cannot be parameterized
    6
    task.handleFlush(output);
    Precondition Violations (12)
    Row Violation
    1Expression log(output,isWarning ? MSG_WARN : MSG_INFO) is a void method call, and thus it cannot be parameterized
    2Expression fireMessageLogged(this,output,isError ? MSG_ERR : MSG_INFO) is a void method call, and thus it cannot be parameterized
    3Expression log(output,isWarning ? MSG_WARN : MSG_INFO) is a void method call, and thus it cannot be parameterized
    4Expression fireMessageLogged(this,output,isError ? MSG_ERR : MSG_INFO) is a void method call, and thus it cannot be parameterized
    5Expression task.handleErrorOutput(output) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression task.handleErrorFlush(output) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression task.handleErrorOutput(output) is a void method call, and thus it cannot be parameterized
    8Expression task.handleErrorFlush(output) is a void method call, and thus it cannot be parameterized
    9Expression task.handleOutput(output) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression task.handleFlush(output) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression task.handleOutput(output) is a void method call, and thus it cannot be parameterized
    12Expression task.handleFlush(output) is a void method call, and thus it cannot be parameterized