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;
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;
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 getErrorStream() Method name: OutputStream getOutputStream()
Number of AST nodes: 6 Number of AST nodes: 6
1
if (this.errorStream == null) {
1
if (this.outputStream == null) {
2
            if (error != null) {
2
            if (output != null) {
3
                try {
3
                try {
4
                    setErrorStream(new PrintStream(
4
                    setOutputStream(new PrintStream(
5
                                       new BufferedOutputStream(
5
                                        new BufferedOutputStream(
6
                                           new FileOutputStream(error
6
                                            new FileOutputStream(output
7
.getPath(),
7
                                                                 .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
                setErrorStream(new LogOutputStream(this, Project.MSG_WARN));
13
                setOutputStream(new LogOutputStream(this, Project.MSG_INFO));
14
            }
14
            }
15
        }
15
        }
16
        return this.errorStream;
16
        return this.outputStream;
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.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (this.errorStream == null)
    1
    if (this.errorStream == null)
    1
    if (this.outputStream == null)
    Differences
    Expression1Expression2Difference
    errorStreamoutputStreamVARIABLE_NAME_MISMATCH
    1
    if (this.outputStream == null)
    2
    if (error != null)
    2
    if (error != null)
    2
    if (output != null)
    Differences
    Expression1Expression2Difference
    erroroutputVARIABLE_NAME_MISMATCH
    2
    if (output != null)
    3
    try
    3
    try
    4
    setErrorStream(new PrintStream(new BufferedOutputStream(new FileOutputStream(error.getPath(), append))));
    4
    setErrorStream(new PrintStream(new BufferedOutputStream(new FileOutputStream(error.getPath(), append))));
    4
    setOutputStream(new PrintStream(new BufferedOutputStream(new FileOutputStream(output.getPath(), append))));
    Differences
    Expression1Expression2Difference
    setErrorStreamsetOutputStreamMETHOD_INVOCATION_NAME_MISMATCH
    erroroutputVARIABLE_NAME_MISMATCH
    Preondition Violations
    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)))) 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)))) is a void method call, and thus it cannot be parameterized
    Expression setOutputStream(new PrintStream(new BufferedOutputStream(new FileOutputStream(output.getPath(),append)))) is a void method call, and thus it cannot be parameterized
    4
    setOutputStream(new PrintStream(new BufferedOutputStream(new FileOutputStream(output.getPath(), append))));
    else
    else
    5
    setErrorStream(new LogOutputStream(this, Project.MSG_WARN));
    5
    setErrorStream(new LogOutputStream(this, Project.MSG_WARN));
    5
    setOutputStream(new LogOutputStream(this, Project.MSG_INFO));
    Differences
    Expression1Expression2Difference
    setErrorStreamsetOutputStreamMETHOD_INVOCATION_NAME_MISMATCH
    MSG_WARNMSG_INFOVARIABLE_NAME_MISMATCH
    Preondition Violations
    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)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression setErrorStream(new LogOutputStream(this,Project.MSG_WARN)) is a void method call, and thus it cannot be parameterized
    Expression setOutputStream(new LogOutputStream(this,Project.MSG_INFO)) is a void method call, and thus it cannot be parameterized
    5
    setOutputStream(new LogOutputStream(this, Project.MSG_INFO));
    6
    return this.errorStream;
    6
    return this.errorStream;
    6
    return this.outputStream;
    Differences
    Expression1Expression2Difference
    errorStreamoutputStreamVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression this.errorStream cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression this.outputStream cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6
    return this.outputStream;
    Precondition Violations (10)
    Row Violation
    1Expression setErrorStream(new PrintStream(new BufferedOutputStream(new FileOutputStream(error.getPath(),append)))) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression setOutputStream(new PrintStream(new BufferedOutputStream(new FileOutputStream(output.getPath(),append)))) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression setErrorStream(new PrintStream(new BufferedOutputStream(new FileOutputStream(error.getPath(),append)))) is a void method call, and thus it cannot be parameterized
    4Expression setOutputStream(new PrintStream(new BufferedOutputStream(new FileOutputStream(output.getPath(),append)))) is a void method call, and thus it cannot be parameterized
    5Expression setErrorStream(new LogOutputStream(this,Project.MSG_WARN)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression setOutputStream(new LogOutputStream(this,Project.MSG_INFO)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression setErrorStream(new LogOutputStream(this,Project.MSG_WARN)) is a void method call, and thus it cannot be parameterized
    8Expression setOutputStream(new LogOutputStream(this,Project.MSG_INFO)) is a void method call, and thus it cannot be parameterized
    9Expression this.errorStream cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression this.outputStream cannot be parameterized, because it has dependencies to/from statements that will be extracted