String[] inputTargets = null; try { inputTargets = inputMapper.getImplementation().mapFileName(sourcefile); } catch (NullPointerException enPeaEx) { if (sourcefile != null) { throw enPeaEx; } } if (inputTargets != null && inputTargets.length > 0) { redirector.setInput(toFileArray(inputTargets)); }
String[] outputTargets = null; try { outputTargets = outputMapper.getImplementation().mapFileName(sourcefile); } catch (NullPointerException enPeaEx) { if (sourcefile != null) { throw enPeaEx; } } if (outputTargets != null && outputTargets.length > 0) { redirector.setOutput(toFileArray(outputTargets)); }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/RedirectorElement.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/RedirectorElement.java
Method name: void configure(Redirector, String) Method name: void configure(Redirector, String)
Number of AST nodes: 5 Number of AST nodes: 5
1
String[] inputTargets = null;
1
String[] outputTargets = null;
2
            try {
2
            try {
3
                inputTargets =
3
                outputTargets =
4
                    inputMapper.getImplementation().mapFileName(sourcefile);
4
                    outputMapper.getImplementation().mapFileName(sourcefile);
5
            } catch (NullPointerException enPeaEx) {
5
            } catch (NullPointerException enPeaEx) {
6
                if (sourcefile != null) {
6
                if (sourcefile != null) {
7
                    throw enPeaEx;
7
                    throw enPeaEx;
8
                }
8
                }
9
            }
9
            }
10
            if (inputTargets != null && inputTargets.length > 0) {
10
            if (outputTargets != null && outputTargets.length > 0) {
11
                redirector.setInput(toFileArray(inputTargets));
11
                redirector.setOutput(toFileArray(outputTargets));
12
            }
12
            }
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.4
Clones locationClones are in the same method
Number of node comparisons15
  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)1.3
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    21
    String[] inputTargets = null;
    21
    String[] inputTargets = null;
    27
    String[] outputTargets = null;
    Differences
    Expression1Expression2Difference
    inputTargetsoutputTargetsVARIABLE_NAME_MISMATCH
    27
    String[] outputTargets = null;
    22
    try
    28
    try
    23
    inputTargets = inputMapper.getImplementation().mapFileName(sourcefile);
    23
    inputTargets = inputMapper.getImplementation().mapFileName(sourcefile);
    29
    outputTargets = outputMapper.getImplementation().mapFileName(sourcefile);
    Differences
    Expression1Expression2Difference
    inputTargetsoutputTargetsVARIABLE_NAME_MISMATCH
    inputMapperoutputMapperVARIABLE_NAME_MISMATCH
    29
    outputTargets = outputMapper.getImplementation().mapFileName(sourcefile);
    24
    if (inputTargets != null && inputTargets.length > 0)
    24
    if (inputTargets != null && inputTargets.length > 0)
    30
    if (outputTargets != null && outputTargets.length > 0)
    Differences
    Expression1Expression2Difference
    inputTargetsoutputTargetsVARIABLE_NAME_MISMATCH
    inputTargetsoutputTargetsVARIABLE_NAME_MISMATCH
    30
    if (outputTargets != null && outputTargets.length > 0)
    25
    redirector.setInput(toFileArray(inputTargets));
    25
    redirector.setInput(toFileArray(inputTargets));
    31
    redirector.setOutput(toFileArray(outputTargets));
    Differences
    Expression1Expression2Difference
    setInputsetOutputMETHOD_INVOCATION_NAME_MISMATCH
    inputTargetsoutputTargetsVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression redirector.setInput(toFileArray(inputTargets)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression redirector.setOutput(toFileArray(outputTargets)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression redirector.setInput(toFileArray(inputTargets)) is a void method call, and thus it cannot be parameterized
    Expression redirector.setOutput(toFileArray(outputTargets)) is a void method call, and thus it cannot be parameterized
    31
    redirector.setOutput(toFileArray(outputTargets));
    Precondition Violations (4)
    Row Violation
    1Expression redirector.setInput(toFileArray(inputTargets)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression redirector.setOutput(toFileArray(outputTargets)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression redirector.setInput(toFileArray(inputTargets)) is a void method call, and thus it cannot be parameterized
    4Expression redirector.setOutput(toFileArray(outputTargets)) is a void method call, and thus it cannot be parameterized