if (userSettings.CaptureRawRecord && dataBuffer.Count > 0) { if (rawBuffer.Buffer.length - rawBuffer.Position < dataBuffer.Count - dataBuffer.LineStart) { int newLength = rawBuffer.Buffer.length + Math.max(dataBuffer.Count - dataBuffer.LineStart, rawBuffer.Buffer.length); char[] holder = new char[newLength]; System.arraycopy(rawBuffer.Buffer, 0, holder, 0, rawBuffer.Position); rawBuffer.Buffer = holder; } System.arraycopy(dataBuffer.Buffer, dataBuffer.LineStart, rawBuffer.Buffer, rawBuffer.Position, dataBuffer.Count - dataBuffer.LineStart); rawBuffer.Position += dataBuffer.Count - dataBuffer.LineStart; }
if (startedColumn && dataBuffer.ColumnStart < dataBuffer.Position) { if (columnBuffer.Buffer.length - columnBuffer.Position < dataBuffer.Position - dataBuffer.ColumnStart) { int newLength = columnBuffer.Buffer.length + Math.max( dataBuffer.Position - dataBuffer.ColumnStart, columnBuffer.Buffer.length); char[] holder = new char[newLength]; System.arraycopy(columnBuffer.Buffer, 0, holder, 0, columnBuffer.Position); columnBuffer.Buffer = holder; } System.arraycopy(dataBuffer.Buffer, dataBuffer.ColumnStart, columnBuffer.Buffer, columnBuffer.Position, dataBuffer.Position - dataBuffer.ColumnStart); columnBuffer.Position += dataBuffer.Position - dataBuffer.ColumnStart; }
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 checkDataLength() Method name: void updateCurrentValue()
Number of AST nodes: 8 Number of AST nodes: 8
1
if (userSettings.CaptureRawRecord && dataBuffer.Count &gt; 0) {
1
if (startedColumn && dataBuffer.ColumnStart &lt; dataBuffer.Position) {
2
			if (rawBuffer.Buffer.length - rawBuffer.Position < dataBuffer.Count
2
			if (columnBuffer.Buffer.length - columnBuffer.Position < dataBuffer.Position
3
					- dataBuffer.LineStart) {
3
					- dataBuffer.ColumnStart) {
4
				int newLength = rawBuffer.Buffer.length
4
				int newLength = columnBuffer.Buffer.length
5
						+ Math.max(
5
						+ Math.max(
6
dataBuffer.Count - dataBuffer.LineStart,
6
								dataBuffer.Position - dataBuffer.ColumnStart,
7
								rawBuffer.Buffer.length);
7
								columnBuffer.Buffer.length);
8
				char[] holder = new char[newLength];
8
				char[] holder = new char[newLength];
9
				System.arraycopy(rawBuffer.Buffer, 0, holder, 0,
9
				System.arraycopy(columnBuffer.Buffer, 0, holder, 0,
10
						rawBuffer.Position);
10
						columnBuffer.Position);
11
				rawBuffer.Buffer = holder;
11
				columnBuffer.Buffer = holder;
12
			}
12
			}
13
			System.arraycopy(dataBuffer.Buffer, dataBuffer.LineStart,
13
			System.arraycopy(dataBuffer.Buffer, dataBuffer.ColumnStart,
14
					rawBuffer.Buffer, rawBuffer.Position, 
14
					columnBuffer.Buffer, columnBuffer.Position,
15
dataBuffer.Count
15
					dataBuffer.
16
							- dataBuffer.LineStart);
16
Position - dataBuffer.ColumnStart);
17
			rawBuffer.Position += dataBuffer.Count 
17
			columnBuffer.Position += dataBuffer.Position
18
- dataBuffer.LineStart;
18
					- dataBuffer.ColumnStart;
19
		}
19
		}
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)1.2
Clones locationClones are declared in the same class
Number of node comparisons34
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements8
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)9.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    7
    if (userSettings.CaptureRawRecord && dataBuffer.Count > 0)
    7
    if (userSettings.CaptureRawRecord && dataBuffer.Count > 0)
    1
    if (startedColumn && dataBuffer.ColumnStart < dataBuffer.Position)
    Differences
    Expression1Expression2Difference
    userSettings.CaptureRawRecordstartedColumnTYPE_COMPATIBLE_REPLACEMENT
    CountColumnStartVARIABLE_NAME_MISMATCH
    0dataBuffer.PositionTYPE_COMPATIBLE_REPLACEMENT
    ><OPERATOR_MISMATCH
    1
    if (startedColumn && dataBuffer.ColumnStart < dataBuffer.Position)
    8
    if (rawBuffer.Buffer.length - rawBuffer.Position < dataBuffer.Count - dataBuffer.LineStart)
    8
    if (rawBuffer.Buffer.length - rawBuffer.Position < dataBuffer.Count - dataBuffer.LineStart)
    2
    if (columnBuffer.Buffer.length - columnBuffer.Position < dataBuffer.Position - dataBuffer.ColumnStart)
    Differences
    Expression1Expression2Difference
    rawBuffercolumnBufferVARIABLE_NAME_MISMATCH
    com.csvreader.CsvReader.RawRecordBuffercom.csvreader.CsvReader.ColumnBufferVARIABLE_TYPE_MISMATCH
    rawBuffercolumnBufferVARIABLE_NAME_MISMATCH
    com.csvreader.CsvReader.RawRecordBuffercom.csvreader.CsvReader.ColumnBufferVARIABLE_TYPE_MISMATCH
    CountPositionVARIABLE_NAME_MISMATCH
    LineStartColumnStartVARIABLE_NAME_MISMATCH
    Preondition Violations
    Type char[] of variable rawBuffer.Buffer does not match with type char[] of variable columnBuffer.Buffer
    • Make classes com.csvreader.CsvReader.RawRecordBuffer and com.csvreader.CsvReader.ColumnBuffer extend a common superclass
    Type int of variable rawBuffer.Position does not match with type int of variable columnBuffer.Position
    • Make classes com.csvreader.CsvReader.RawRecordBuffer and com.csvreader.CsvReader.ColumnBuffer extend a common superclass
    Expression dataBuffer.Count cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression dataBuffer.Position cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression dataBuffer.LineStart cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression dataBuffer.ColumnStart cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2
    if (columnBuffer.Buffer.length - columnBuffer.Position < dataBuffer.Position - dataBuffer.ColumnStart)
    9
    int newLength = rawBuffer.Buffer.length + Math.max(dataBuffer.Count - dataBuffer.LineStart, rawBuffer.Buffer.length);
    9
    int newLength = rawBuffer.Buffer.length + Math.max(dataBuffer.Count - dataBuffer.LineStart, rawBuffer.Buffer.length);
    3
    int newLength = columnBuffer.Buffer.length + Math.max(dataBuffer.Position - dataBuffer.ColumnStart, columnBuffer.Buffer.length);
    Differences
    Expression1Expression2Difference
    rawBuffercolumnBufferVARIABLE_NAME_MISMATCH
    com.csvreader.CsvReader.RawRecordBuffercom.csvreader.CsvReader.ColumnBufferVARIABLE_TYPE_MISMATCH
    CountPositionVARIABLE_NAME_MISMATCH
    LineStartColumnStartVARIABLE_NAME_MISMATCH
    rawBuffercolumnBufferVARIABLE_NAME_MISMATCH
    com.csvreader.CsvReader.RawRecordBuffercom.csvreader.CsvReader.ColumnBufferVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression rawBuffer.Buffer cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression columnBuffer.Buffer cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type char[] of variable rawBuffer.Buffer does not match with type char[] of variable columnBuffer.Buffer
    • Make classes com.csvreader.CsvReader.RawRecordBuffer and com.csvreader.CsvReader.ColumnBuffer extend a common superclass
    Expression dataBuffer.Count cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression dataBuffer.Position cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression dataBuffer.LineStart cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression dataBuffer.ColumnStart cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression rawBuffer.Buffer cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression columnBuffer.Buffer cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type char[] of variable rawBuffer.Buffer does not match with type char[] of variable columnBuffer.Buffer
    • Make classes com.csvreader.CsvReader.RawRecordBuffer and com.csvreader.CsvReader.ColumnBuffer extend a common superclass
    3
    int newLength = columnBuffer.Buffer.length + Math.max(dataBuffer.Position - dataBuffer.ColumnStart, columnBuffer.Buffer.length);
    10
    char[] holder = new char[newLength];
    4
    char[] holder = new char[newLength];
    11
    System.arraycopy(rawBuffer.Buffer, 0, holder, 0, rawBuffer.Position);
    11
    System.arraycopy(rawBuffer.Buffer, 0, holder, 0, rawBuffer.Position);
    5
    System.arraycopy(columnBuffer.Buffer, 0, holder, 0, columnBuffer.Position);
    Differences
    Expression1Expression2Difference
    rawBuffercolumnBufferVARIABLE_NAME_MISMATCH
    com.csvreader.CsvReader.RawRecordBuffercom.csvreader.CsvReader.ColumnBufferVARIABLE_TYPE_MISMATCH
    rawBuffercolumnBufferVARIABLE_NAME_MISMATCH
    com.csvreader.CsvReader.RawRecordBuffercom.csvreader.CsvReader.ColumnBufferVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression rawBuffer.Buffer cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression columnBuffer.Buffer cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type char[] of variable rawBuffer.Buffer does not match with type char[] of variable columnBuffer.Buffer
    • Make classes com.csvreader.CsvReader.RawRecordBuffer and com.csvreader.CsvReader.ColumnBuffer extend a common superclass
    Expression rawBuffer.Position cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression columnBuffer.Position cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type int of variable rawBuffer.Position does not match with type int of variable columnBuffer.Position
    • Make classes com.csvreader.CsvReader.RawRecordBuffer and com.csvreader.CsvReader.ColumnBuffer extend a common superclass
    5
    System.arraycopy(columnBuffer.Buffer, 0, holder, 0, columnBuffer.Position);
    12
    rawBuffer.Buffer = holder;
    12
    rawBuffer.Buffer = holder;
    6
    columnBuffer.Buffer = holder;
    Differences
    Expression1Expression2Difference
    rawBuffercolumnBufferVARIABLE_NAME_MISMATCH
    com.csvreader.CsvReader.RawRecordBuffercom.csvreader.CsvReader.ColumnBufferVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression rawBuffer.Buffer cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression columnBuffer.Buffer cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type char[] of variable rawBuffer.Buffer does not match with type char[] of variable columnBuffer.Buffer
    • Make classes com.csvreader.CsvReader.RawRecordBuffer and com.csvreader.CsvReader.ColumnBuffer extend a common superclass
    6
    columnBuffer.Buffer = holder;
    13
    System.arraycopy(dataBuffer.Buffer, dataBuffer.LineStart, rawBuffer.Buffer, rawBuffer.Position, dataBuffer.Count - dataBuffer.LineStart);
    13
    System.arraycopy(dataBuffer.Buffer, dataBuffer.LineStart, rawBuffer.Buffer, rawBuffer.Position, dataBuffer.Count - dataBuffer.LineStart);
    7
    System.arraycopy(dataBuffer.Buffer, dataBuffer.ColumnStart, columnBuffer.Buffer, columnBuffer.Position, dataBuffer.Position - dataBuffer.ColumnStart);
    Differences
    Expression1Expression2Difference
    LineStartColumnStartVARIABLE_NAME_MISMATCH
    rawBuffercolumnBufferVARIABLE_NAME_MISMATCH
    com.csvreader.CsvReader.RawRecordBuffercom.csvreader.CsvReader.ColumnBufferVARIABLE_TYPE_MISMATCH
    rawBuffercolumnBufferVARIABLE_NAME_MISMATCH
    com.csvreader.CsvReader.RawRecordBuffercom.csvreader.CsvReader.ColumnBufferVARIABLE_TYPE_MISMATCH
    CountPositionVARIABLE_NAME_MISMATCH
    LineStartColumnStartVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression dataBuffer.LineStart cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression dataBuffer.ColumnStart cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression rawBuffer.Buffer cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression columnBuffer.Buffer cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type char[] of variable rawBuffer.Buffer does not match with type char[] of variable columnBuffer.Buffer
    • Make classes com.csvreader.CsvReader.RawRecordBuffer and com.csvreader.CsvReader.ColumnBuffer extend a common superclass
    Expression rawBuffer.Position cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression columnBuffer.Position cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type int of variable rawBuffer.Position does not match with type int of variable columnBuffer.Position
    • Make classes com.csvreader.CsvReader.RawRecordBuffer and com.csvreader.CsvReader.ColumnBuffer extend a common superclass
    Expression dataBuffer.Count cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression dataBuffer.Position cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression dataBuffer.LineStart cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression dataBuffer.ColumnStart cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7
    System.arraycopy(dataBuffer.Buffer, dataBuffer.ColumnStart, columnBuffer.Buffer, columnBuffer.Position, dataBuffer.Position - dataBuffer.ColumnStart);
    14
    rawBuffer.Position += dataBuffer.Count - dataBuffer.LineStart;
    14
    rawBuffer.Position += dataBuffer.Count - dataBuffer.LineStart;
    8
    columnBuffer.Position += dataBuffer.Position - dataBuffer.ColumnStart;
    Differences
    Expression1Expression2Difference
    rawBuffercolumnBufferVARIABLE_NAME_MISMATCH
    com.csvreader.CsvReader.RawRecordBuffercom.csvreader.CsvReader.ColumnBufferVARIABLE_TYPE_MISMATCH
    CountPositionVARIABLE_NAME_MISMATCH
    LineStartColumnStartVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression rawBuffer.Position cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression columnBuffer.Position cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type int of variable rawBuffer.Position does not match with type int of variable columnBuffer.Position
    • Make classes com.csvreader.CsvReader.RawRecordBuffer and com.csvreader.CsvReader.ColumnBuffer extend a common superclass
    Expression dataBuffer.Count cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression dataBuffer.Position cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression dataBuffer.LineStart cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression dataBuffer.ColumnStart cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8
    columnBuffer.Position += dataBuffer.Position - dataBuffer.ColumnStart;
    Precondition Violations (44)
    Row Violation
    1Type char[] of variable rawBuffer.Buffer does not match with type char[] of variable columnBuffer.Buffer
    2Type int of variable rawBuffer.Position does not match with type int of variable columnBuffer.Position
    3Expression dataBuffer.Count cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression dataBuffer.Position cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression dataBuffer.LineStart cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression dataBuffer.ColumnStart cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression rawBuffer.Buffer cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression columnBuffer.Buffer cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Type char[] of variable rawBuffer.Buffer does not match with type char[] of variable columnBuffer.Buffer
    10Expression dataBuffer.Count cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression dataBuffer.Position cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12Expression dataBuffer.LineStart cannot be parameterized, because it has dependencies to/from statements that will be extracted
    13Expression dataBuffer.ColumnStart cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14Expression rawBuffer.Buffer cannot be parameterized, because it has dependencies to/from statements that will be extracted
    15Expression columnBuffer.Buffer cannot be parameterized, because it has dependencies to/from statements that will be extracted
    16Type char[] of variable rawBuffer.Buffer does not match with type char[] of variable columnBuffer.Buffer
    17Expression rawBuffer.Buffer cannot be parameterized, because it has dependencies to/from statements that will be extracted
    18Expression columnBuffer.Buffer cannot be parameterized, because it has dependencies to/from statements that will be extracted
    19Type char[] of variable rawBuffer.Buffer does not match with type char[] of variable columnBuffer.Buffer
    20Expression rawBuffer.Position cannot be parameterized, because it has dependencies to/from statements that will be extracted
    21Expression columnBuffer.Position cannot be parameterized, because it has dependencies to/from statements that will be extracted
    22Type int of variable rawBuffer.Position does not match with type int of variable columnBuffer.Position
    23Expression rawBuffer.Buffer cannot be parameterized, because it has dependencies to/from statements that will be extracted
    24Expression columnBuffer.Buffer cannot be parameterized, because it has dependencies to/from statements that will be extracted
    25Type char[] of variable rawBuffer.Buffer does not match with type char[] of variable columnBuffer.Buffer
    26Expression dataBuffer.LineStart cannot be parameterized, because it has dependencies to/from statements that will be extracted
    27Expression dataBuffer.ColumnStart cannot be parameterized, because it has dependencies to/from statements that will be extracted
    28Expression rawBuffer.Buffer cannot be parameterized, because it has dependencies to/from statements that will be extracted
    29Expression columnBuffer.Buffer cannot be parameterized, because it has dependencies to/from statements that will be extracted
    30Type char[] of variable rawBuffer.Buffer does not match with type char[] of variable columnBuffer.Buffer
    31Expression rawBuffer.Position cannot be parameterized, because it has dependencies to/from statements that will be extracted
    32Expression columnBuffer.Position cannot be parameterized, because it has dependencies to/from statements that will be extracted
    33Type int of variable rawBuffer.Position does not match with type int of variable columnBuffer.Position
    34Expression dataBuffer.Count cannot be parameterized, because it has dependencies to/from statements that will be extracted
    35Expression dataBuffer.Position cannot be parameterized, because it has dependencies to/from statements that will be extracted
    36Expression dataBuffer.LineStart cannot be parameterized, because it has dependencies to/from statements that will be extracted
    37Expression dataBuffer.ColumnStart cannot be parameterized, because it has dependencies to/from statements that will be extracted
    38Expression rawBuffer.Position cannot be parameterized, because it has dependencies to/from statements that will be extracted
    39Expression columnBuffer.Position cannot be parameterized, because it has dependencies to/from statements that will be extracted
    40Type int of variable rawBuffer.Position does not match with type int of variable columnBuffer.Position
    41Expression dataBuffer.Count cannot be parameterized, because it has dependencies to/from statements that will be extracted
    42Expression dataBuffer.Position cannot be parameterized, because it has dependencies to/from statements that will be extracted
    43Expression dataBuffer.LineStart cannot be parameterized, because it has dependencies to/from statements that will be extracted
    44Expression dataBuffer.ColumnStart cannot be parameterized, because it has dependencies to/from statements that will be extracted