OutputStreamWriter osw = null; if (outputEncoding == null) { osw = new OutputStreamWriter(dest.getOutputStream()); } else { osw = new OutputStreamWriter(dest.getOutputStream(), outputEncoding); } out = new BufferedWriter(osw);
InputStreamReader isr = null; if (inputEncoding == null) { isr = new InputStreamReader(source.getInputStream()); } else { isr = new InputStreamReader(source.getInputStream(), inputEncoding); } in = new BufferedReader(isr);
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/util/ResourceUtils.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/util/ResourceUtils.java
Method name: void copyResource(Resource, Resource, FilterSetCollection, Vector, boolean, boolean, String, String, Project) Method name: void copyResource(Resource, Resource, FilterSetCollection, Vector, boolean, boolean, String, String, Project)
Number of AST nodes: 5 Number of AST nodes: 5
1
OutputStreamWriter osw = null;
1
InputStreamReader isr = null;
2
                if (outputEncoding == null) {
2
                if (inputEncoding == null) {
3
                    osw = new OutputStreamWriter(dest.getOutputStream());
3
                    isr = new InputStreamReader(source.getInputStream());
4
                } else {
4
                } else {
5
                    osw = new OutputStreamWriter(dest.getOutputStream(),
5
                    isr = new InputStreamReader(source.getInputStream(),
6
                                                 outputEncoding);
6
                                                inputEncoding);
7
                }
7
                }
8
                out = new BufferedWriter(osw);
8
                in = new BufferedReader(isr);
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 the same method
Number of node comparisons14
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)17.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    16
    OutputStreamWriter osw = null;
    16
    OutputStreamWriter osw = null;
    43
    InputStreamReader isr = null;
    Differences
    Expression1Expression2Difference
    java.io.OutputStreamWriterjava.io.InputStreamReaderSUBCLASS_TYPE_MISMATCH
    oswisrVARIABLE_NAME_MISMATCH
    java.io.OutputStreamWriterjava.io.InputStreamReaderSUBCLASS_TYPE_MISMATCH
    43
    InputStreamReader isr = null;
    17
    if (outputEncoding == null)
    17
    if (outputEncoding == null)
    44
    if (inputEncoding == null)
    Differences
    Expression1Expression2Difference
    outputEncodinginputEncodingVARIABLE_NAME_MISMATCH
    44
    if (inputEncoding == null)
    18
    osw = new OutputStreamWriter(dest.getOutputStream());
    18
    osw = new OutputStreamWriter(dest.getOutputStream());
    45
    isr = new InputStreamReader(source.getInputStream());
    Differences
    Expression1Expression2Difference
    oswisrVARIABLE_NAME_MISMATCH
    java.io.OutputStreamWriterjava.io.InputStreamReaderSUBCLASS_TYPE_MISMATCH
    java.io.OutputStreamWriterjava.io.InputStreamReaderSUBCLASS_TYPE_MISMATCH
    getOutputStreamgetInputStreamMETHOD_INVOCATION_NAME_MISMATCH
    destsourceVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression new OutputStreamWriter(dest.getOutputStream()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new InputStreamReader(source.getInputStream()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression dest.getOutputStream() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    Expression source.getInputStream() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    45
    isr = new InputStreamReader(source.getInputStream());
    else
    else
    19
    osw = new OutputStreamWriter(dest.getOutputStream(), outputEncoding);
    19
    osw = new OutputStreamWriter(dest.getOutputStream(), outputEncoding);
    46
    isr = new InputStreamReader(source.getInputStream(), inputEncoding);
    Differences
    Expression1Expression2Difference
    oswisrVARIABLE_NAME_MISMATCH
    java.io.OutputStreamWriterjava.io.InputStreamReaderSUBCLASS_TYPE_MISMATCH
    java.io.OutputStreamWriterjava.io.InputStreamReaderSUBCLASS_TYPE_MISMATCH
    getOutputStreamgetInputStreamMETHOD_INVOCATION_NAME_MISMATCH
    destsourceVARIABLE_NAME_MISMATCH
    outputEncodinginputEncodingVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression new OutputStreamWriter(dest.getOutputStream(),outputEncoding) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new InputStreamReader(source.getInputStream(),inputEncoding) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression dest.getOutputStream() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    Expression source.getInputStream() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    46
    isr = new InputStreamReader(source.getInputStream(), inputEncoding);
    20
    out = new BufferedWriter(osw);
    20
    out = new BufferedWriter(osw);
    47
    in = new BufferedReader(isr);
    Differences
    Expression1Expression2Difference
    outinVARIABLE_NAME_MISMATCH
    java.io.BufferedWriterjava.io.BufferedReaderSUBCLASS_TYPE_MISMATCH
    java.io.BufferedWriterjava.io.BufferedReaderSUBCLASS_TYPE_MISMATCH
    oswisrVARIABLE_NAME_MISMATCH
    java.io.OutputStreamWriterjava.io.InputStreamReaderSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression new BufferedWriter(osw) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new BufferedReader(isr) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    47
    in = new BufferedReader(isr);
    Precondition Violations (11)
    Row Violation
    1Expression new OutputStreamWriter(dest.getOutputStream()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression new InputStreamReader(source.getInputStream()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression dest.getOutputStream() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    4Expression source.getInputStream() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    5Expression new OutputStreamWriter(dest.getOutputStream(),outputEncoding) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression new InputStreamReader(source.getInputStream(),inputEncoding) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression dest.getOutputStream() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    8Expression source.getInputStream() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    9Expression new BufferedWriter(osw) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression new BufferedReader(isr) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Clone fragment #1 returns variable out with type java.io.BufferedWriter , while Clone fragment #2 returns variable in with type java.io.BufferedReader