InputStreamReader isr = null; if (inputEncoding == null) { isr = new InputStreamReader(source.getInputStream()); } else { isr = new InputStreamReader(source.getInputStream(), inputEncoding); } in = new BufferedReader(isr);
OutputStreamWriter osw = null; if (outputEncoding == null) { osw = new OutputStreamWriter(dest.getOutputStream()); } else { osw = new OutputStreamWriter(dest.getOutputStream(), outputEncoding); } out = new BufferedWriter(osw);
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
InputStreamReader isr = null;
1
OutputStreamWriter osw = null;
2
                if (inputEncoding == null) {
2
                if (outputEncoding == null) {
3
                    isr = new InputStreamReader(source.getInputStream());
3
                    osw = new OutputStreamWriter(dest.getOutputStream());
4
                } else {
4
                } else {
5
                    isr = new InputStreamReader(source.getInputStream(),
5
                    osw = new OutputStreamWriter(dest.getOutputStream(),
6
                                                inputEncoding);
6
                                                 outputEncoding);
7
                }
7
                }
8
                in = new BufferedReader(isr);
8
                out = new BufferedWriter(osw);
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.3
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.4
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    11
    InputStreamReader isr = null;
    11
    InputStreamReader isr = null;
    48
    OutputStreamWriter osw = null;
    Differences
    Expression1Expression2Difference
    java.io.InputStreamReaderjava.io.OutputStreamWriterSUBCLASS_TYPE_MISMATCH
    isroswVARIABLE_NAME_MISMATCH
    java.io.InputStreamReaderjava.io.OutputStreamWriterSUBCLASS_TYPE_MISMATCH
    48
    OutputStreamWriter osw = null;
    12
    if (inputEncoding == null)
    12
    if (inputEncoding == null)
    49
    if (outputEncoding == null)
    Differences
    Expression1Expression2Difference
    inputEncodingoutputEncodingVARIABLE_NAME_MISMATCH
    49
    if (outputEncoding == null)
    13
    isr = new InputStreamReader(source.getInputStream());
    13
    isr = new InputStreamReader(source.getInputStream());
    50
    osw = new OutputStreamWriter(dest.getOutputStream());
    Differences
    Expression1Expression2Difference
    isroswVARIABLE_NAME_MISMATCH
    java.io.InputStreamReaderjava.io.OutputStreamWriterSUBCLASS_TYPE_MISMATCH
    java.io.InputStreamReaderjava.io.OutputStreamWriterSUBCLASS_TYPE_MISMATCH
    getInputStreamgetOutputStreamMETHOD_INVOCATION_NAME_MISMATCH
    sourcedestVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression new InputStreamReader(source.getInputStream()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new OutputStreamWriter(dest.getOutputStream()) cannot be parameterized, because it has dependencies to/from statements 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
    Expression dest.getOutputStream() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    50
    osw = new OutputStreamWriter(dest.getOutputStream());
    else
    else
    14
    isr = new InputStreamReader(source.getInputStream(), inputEncoding);
    14
    isr = new InputStreamReader(source.getInputStream(), inputEncoding);
    51
    osw = new OutputStreamWriter(dest.getOutputStream(), outputEncoding);
    Differences
    Expression1Expression2Difference
    isroswVARIABLE_NAME_MISMATCH
    java.io.InputStreamReaderjava.io.OutputStreamWriterSUBCLASS_TYPE_MISMATCH
    java.io.InputStreamReaderjava.io.OutputStreamWriterSUBCLASS_TYPE_MISMATCH
    getInputStreamgetOutputStreamMETHOD_INVOCATION_NAME_MISMATCH
    sourcedestVARIABLE_NAME_MISMATCH
    inputEncodingoutputEncodingVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression new InputStreamReader(source.getInputStream(),inputEncoding) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new OutputStreamWriter(dest.getOutputStream(),outputEncoding) cannot be parameterized, because it has dependencies to/from statements 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
    Expression dest.getOutputStream() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    51
    osw = new OutputStreamWriter(dest.getOutputStream(), outputEncoding);
    15
    in = new BufferedReader(isr);
    15
    in = new BufferedReader(isr);
    52
    out = new BufferedWriter(osw);
    Differences
    Expression1Expression2Difference
    inoutVARIABLE_NAME_MISMATCH
    java.io.BufferedReaderjava.io.BufferedWriterSUBCLASS_TYPE_MISMATCH
    java.io.BufferedReaderjava.io.BufferedWriterSUBCLASS_TYPE_MISMATCH
    isroswVARIABLE_NAME_MISMATCH
    java.io.InputStreamReaderjava.io.OutputStreamWriterSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression new BufferedReader(isr) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new BufferedWriter(osw) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    52
    out = new BufferedWriter(osw);
    Precondition Violations (11)
    Row Violation
    1Expression new InputStreamReader(source.getInputStream()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression new OutputStreamWriter(dest.getOutputStream()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression source.getInputStream() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    4Expression dest.getOutputStream() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    5Expression new InputStreamReader(source.getInputStream(),inputEncoding) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression new OutputStreamWriter(dest.getOutputStream(),outputEncoding) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression source.getInputStream() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    8Expression dest.getOutputStream() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    9Expression new BufferedReader(isr) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression new BufferedWriter(osw) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Clone fragment #1 returns variable in with type java.io.BufferedReader , while Clone fragment #2 returns variable out with type java.io.BufferedWriter