while ( columns.hasNext() ) { Selectable s = (Selectable) columns.next(); if ( !s.isFormula() ) { Column col = (Column) s; if ( !distinctColumns.add( col.getName() ) ) { throw new MappingException( "Repeated column in mapping for collection: " + getRole() + " column: " + col.getName() ); } } }
while ( columns.hasNext() ) { Selectable columnOrFormula = (Selectable) columns.next(); if ( !columnOrFormula.isFormula() ) { Column col = (Column) columnOrFormula; if ( !distinctColumns.add( col.getName() ) ) { throw new MappingException( "Repeated column in mapping for entity: " + getEntityName() + " column: " + col.getName() + " (should be mapped with insert=\"false\" update=\"false\")" ); } } }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/mapping/Collection.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/mapping/PersistentClass.java
Method name: void checkColumnDuplication(java.util.Set, Iterator) Method name: void checkColumnDuplication(Set, Iterator)
Number of AST nodes: 6 Number of AST nodes: 6
1
while ( columns.hasNext() ) {
1
while ( columns.hasNext() ) {
2
			Selectable s = (Selectable) columns.next();
2
			Selectable columnOrFormula = (Selectable) columns.next();
3
			if ( !s.isFormula() ) {
3
			if ( !columnOrFormula.isFormula() ) {
4
				Column col = (Column) s;
4
				Column col = (Column) columnOrFormula;
5
				if ( !distinctColumns.add( col.getName() ) ) {
5
				if ( !distinctColumns.add( col.getName() ) ) {
6
					throw new MappingException( 
6
					throw new MappingException( 
7
"Repeated column in mapping for collection: "
7
							"Repeated column in mapping for entity: " +
8
						+ getRole()
8
							getEntityName() +
9
						+ " column: "
9
							" column: "
10
 +
10
						+ col.getName() 
11
							col.getName() + 
12
							" (should be mapped with insert=\"false\" update=\"false\")"
11
);
13
						);
12
				}
14
				}
13
			}
15
			}
14
		}
16
		}
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 different classes
Number of node comparisons12
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    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.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    while (columns.hasNext())
    1
    while (columns.hasNext())
    2
    Selectable s = (Selectable)columns.next();
    2
    Selectable s = (Selectable)columns.next();
    2
    Selectable columnOrFormula = (Selectable)columns.next();
    Differences
    Expression1Expression2Difference
    scolumnOrFormulaVARIABLE_NAME_MISMATCH
    2
    Selectable columnOrFormula = (Selectable)columns.next();
    3
    if (!s.isFormula())
    3
    if (!s.isFormula())
    3
    if (!columnOrFormula.isFormula())
    Differences
    Expression1Expression2Difference
    scolumnOrFormulaVARIABLE_NAME_MISMATCH
    3
    if (!columnOrFormula.isFormula())
    4
    Column col = (Column)s;
    4
    Column col = (Column)s;
    4
    Column col = (Column)columnOrFormula;
    Differences
    Expression1Expression2Difference
    scolumnOrFormulaVARIABLE_NAME_MISMATCH
    4
    Column col = (Column)columnOrFormula;
    5
    if (!distinctColumns.add(col.getName()))
    5
    if (!distinctColumns.add(col.getName()))
    6
    throw new MappingException("Repeated column in mapping for collection: " + getRole() + " column: " + col.getName());
    6
    throw new MappingException("Repeated column in mapping for collection: " + getRole() + " column: " + col.getName());
    6
    throw new MappingException("Repeated column in mapping for entity: " + getEntityName() + " column: " + col.getName() + " (should be mapped with insert=\"false\" update=\"false\")");
    Differences
    Expression1Expression2Difference
    "Repeated column in mapping for collection: ""Repeated column in mapping for entity: "LITERAL_VALUE_MISMATCH
    getRolegetEntityNameMETHOD_INVOCATION_NAME_MISMATCH
    "Repeated column in mapping for collection: " + getRole() + " column: "+ col.getName()"Repeated column in mapping for entity: " + getEntityName() + " column: "+ col.getName()+ " (should be mapped with insert=\"false\" update=\"false\")"INFIX_EXTENDED_OPERAND_NUMBER_MISMATCH
    Preondition Violations
    Expression "Repeated column in mapping for collection: " + getRole() + " column: "+ col.getName() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression "Repeated column in mapping for entity: " + getEntityName() + " column: "+ col.getName()+ " (should be mapped with insert=\"false\" update=\"false\")" cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6
    throw new MappingException("Repeated column in mapping for entity: " + getEntityName() + " column: " + col.getName() + " (should be mapped with insert=\"false\" update=\"false\")");
    Precondition Violations (2)
    Row Violation
    1Expression "Repeated column in mapping for collection: " + getRole() + " column: "+ col.getName() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression "Repeated column in mapping for entity: " + getEntityName() + " column: "+ col.getName()+ " (should be mapped with insert=\"false\" update=\"false\")" cannot be parameterized, because it has dependencies to/from statements that will be extracted