if (this.outputStream == null) { if (output != null) { try { setOutputStream(new PrintStream( new BufferedOutputStream( new FileOutputStream(output .getPath(), append)))); } catch (IOException e) { throw new BuildException(e, getLocation()); } } else { setOutputStream(new LogOutputStream(this, Project.MSG_INFO)); } } return this.outputStream;
if (this.errorStream == null) { if (error != null) { try { setErrorStream(new PrintStream( new BufferedOutputStream( new FileOutputStream(error.getPath(), append)))); } catch (IOException e) { throw new BuildException(e, getLocation()); } } else { setErrorStream(new LogOutputStream(this, Project.MSG_WARN)); } } return this.errorStream;
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/AbstractCvsTask.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/AbstractCvsTask.java
Method name: OutputStream getOutputStream() Method name: OutputStream getErrorStream()
Number of AST nodes: 6 Number of AST nodes: 6
1
if (this.outputStream == null) {
1
if (this.errorStream == null) {
2
            if (output != null) {
2
            if (error != null) {
3
                try {
3
                try {
4
                    setOutputStream(new PrintStream(
4
                    setErrorStream(new PrintStream(
5
                                        new BufferedOutputStream(
5
                                       new BufferedOutputStream(
6
                                            new FileOutputStream(output
6
                                           new FileOutputStream(
7
                                                                 .getPath(),
7
error.getPath(),
8
                                                                 append))));
8
                                                                append))));
9
                } catch (IOException e) {
9
                } catch (IOException e) {
10
                    throw new BuildException(e, getLocation());
10
                    throw new BuildException(e, getLocation());
11
                }
11
                }
12
            } else {
12
            } else {
13
                setOutputStream(new LogOutputStream(this, Project.MSG_INFO));
13
                setErrorStream(new LogOutputStream(this, Project.MSG_WARN));
14
            }
14
            }
15
        }
15
        }
16
        return this.outputStream;
16
        return this.errorStream;
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.5
Clones locationClones are declared in the same class
Number of node comparisons10
  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)1.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (this.outputStream == null)
    1
    if (this.outputStream == null)
    1
    if (this.errorStream == null)
    Differences
    Expression1Expression2Difference
    outputStreamerrorStreamVARIABLE_NAME_MISMATCH
    1
    if (this.errorStream == null)
    2
    if (output != null)
    2
    if (output != null)
    2
    if (error != null)
    Differences
    Expression1Expression2Difference
    outputerrorVARIABLE_NAME_MISMATCH
    2
    if (error != null)
    3
    try
    3
    try
    4
    setOutputStream(new PrintStream(new BufferedOutputStream(new FileOutputStream(output.getPath(), append))));
    4
    setOutputStream(new PrintStream(new BufferedOutputStream(new FileOutputStream(output.getPath(), append))));
    4
    setErrorStream(new PrintStream(new BufferedOutputStream(new FileOutputStream(error.getPath(), append))));
    Differences
    Expression1Expression2Difference
    setOutputStreamsetErrorStreamMETHOD_INVOCATION_NAME_MISMATCH
    outputerrorVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression setOutputStream(new PrintStream(new BufferedOutputStream(new FileOutputStream(output.getPath(),append)))) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression setErrorStream(new PrintStream(new BufferedOutputStream(new FileOutputStream(error.getPath(),append)))) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression setOutputStream(new PrintStream(new BufferedOutputStream(new FileOutputStream(output.getPath(),append)))) is a void method call, and thus it cannot be parameterized
    Expression setErrorStream(new PrintStream(new BufferedOutputStream(new FileOutputStream(error.getPath(),append)))) is a void method call, and thus it cannot be parameterized
    4
    setErrorStream(new PrintStream(new BufferedOutputStream(new FileOutputStream(error.getPath(), append))));
    else
    else
    5
    setOutputStream(new LogOutputStream(this, Project.MSG_INFO));
    5
    setOutputStream(new LogOutputStream(this, Project.MSG_INFO));
    5
    setErrorStream(new LogOutputStream(this, Project.MSG_WARN));
    Differences
    Expression1Expression2Difference
    setOutputStreamsetErrorStreamMETHOD_INVOCATION_NAME_MISMATCH
    MSG_INFOMSG_WARNVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression setOutputStream(new LogOutputStream(this,Project.MSG_INFO)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression setErrorStream(new LogOutputStream(this,Project.MSG_WARN)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression setOutputStream(new LogOutputStream(this,Project.MSG_INFO)) is a void method call, and thus it cannot be parameterized
    Expression setErrorStream(new LogOutputStream(this,Project.MSG_WARN)) is a void method call, and thus it cannot be parameterized
    5
    setErrorStream(new LogOutputStream(this, Project.MSG_WARN));
    6
    return this.outputStream;
    6
    return this.outputStream;
    6
    return this.errorStream;
    Differences
    Expression1Expression2Difference
    outputStreamerrorStreamVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression this.outputStream cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression this.errorStream cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6
    return this.errorStream;
    Precondition Violations (10)
    Row Violation
    1Expression setOutputStream(new PrintStream(new BufferedOutputStream(new FileOutputStream(output.getPath(),append)))) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression setErrorStream(new PrintStream(new BufferedOutputStream(new FileOutputStream(error.getPath(),append)))) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression setOutputStream(new PrintStream(new BufferedOutputStream(new FileOutputStream(output.getPath(),append)))) is a void method call, and thus it cannot be parameterized
    4Expression setErrorStream(new PrintStream(new BufferedOutputStream(new FileOutputStream(error.getPath(),append)))) is a void method call, and thus it cannot be parameterized
    5Expression setOutputStream(new LogOutputStream(this,Project.MSG_INFO)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression setErrorStream(new LogOutputStream(this,Project.MSG_WARN)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression setOutputStream(new LogOutputStream(this,Project.MSG_INFO)) is a void method call, and thus it cannot be parameterized
    8Expression setErrorStream(new LogOutputStream(this,Project.MSG_WARN)) is a void method call, and thus it cannot be parameterized
    9Expression this.outputStream cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression this.errorStream cannot be parameterized, because it has dependencies to/from statements that will be extracted