if (initialized) { inputStream.close(); }
if (!closed) { close(true); closed = true; }
Clone fragments detected by clone detection tool
File path: /sql12/plugins/dataimport/src/com/csvreader/CsvReader.java File path: /sql12/plugins/dataimport/src/com/csvreader/CsvReader.java
Method name: void close(boolean) Method name: void close()
Number of AST nodes: 2 Number of AST nodes: 3
1
if (initialized) {
1
if (
2
					inputStream.
2
!closed) {
3
close();
3
			close(true);
4
			
4
			closed = true;
5
	}
5
		}
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.1
Clones locationClones are declared in the same class
Number of node comparisons6
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)1.0
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    10
    if (initialized)
    10
    if (initialized)
    1
    if (!closed)
    Differences
    Expression1Expression2Difference
    initialized!closedTYPE_COMPATIBLE_REPLACEMENT
    1
    if (!closed)
    11
    inputStream.close();
    11
    inputStream.close();
    2
    close(true);
    Differences
    Expression1Expression2Difference
    inputStream.close()close(true)ARGUMENT_NUMBER_MISMATCH
    inputStreamMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression inputStream.close() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    Expression close(true) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method close
    Expression inputStream.close() is a void method call, and thus it cannot be parameterized
    Expression close(true) is a void method call, and thus it cannot be parameterized
    2
    close(true);
                                  
    3
    closed = true;
    Preondition Violations
    Unmatched statement closed=true; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3
    closed = true;
    Precondition Violations (5)
    Row Violation
    1Expression inputStream.close() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    2Expression close(true) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression inputStream.close() is a void method call, and thus it cannot be parameterized
    4Expression close(true) is a void method call, and thus it cannot be parameterized
    5Unmatched statement closed=true; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted