Index current = (Index) indexes.get( index.getName() ); if ( current != null ) { throw new MappingException( "Index " + index.getName() + " already exists!" ); } indexes.put( index.getName(), index ); return index;
UniqueKey current = (UniqueKey) uniqueKeys.get( uniqueKey.getName() ); if ( current != null ) { throw new MappingException( "UniqueKey " + uniqueKey.getName() + " already exists!" ); } uniqueKeys.put( uniqueKey.getName(), uniqueKey ); return uniqueKey;
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/mapping/Table.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/mapping/Table.java
Method name: Index addIndex(Index) Method name: UniqueKey addUniqueKey(UniqueKey)
Number of AST nodes: 5 Number of AST nodes: 5
1
Index current = (Index) indexes.get( index.getName() );
1
UniqueKey current = (UniqueKey) uniqueKeys.get( uniqueKey.getName() );
2
		if ( current != null ) {
2
		if ( current != null ) {
3
			throw new MappingException( "Index " + index.getName() + " already exists!" );
3
			throw new MappingException( "UniqueKey " + uniqueKey.getName() + " already exists!" );
4
		}
4
		}
5
		indexes.put( index.getName(), index );
5
		uniqueKeys.put( uniqueKey.getName(), uniqueKey );
6
		return index;
6
		return uniqueKey;
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.1
Clones locationClones are declared in the same class
Number of node comparisons13
  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)14.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    Index current = (Index)indexes.get(index.getName());
    1
    Index current = (Index)indexes.get(index.getName());
    1
    UniqueKey current = (UniqueKey)uniqueKeys.get(uniqueKey.getName());
    Differences
    Expression1Expression2Difference
    org.hibernate.mapping.Indexorg.hibernate.mapping.UniqueKeySUBCLASS_TYPE_MISMATCH
    org.hibernate.mapping.Indexorg.hibernate.mapping.UniqueKeySUBCLASS_TYPE_MISMATCH
    org.hibernate.mapping.Indexorg.hibernate.mapping.UniqueKeySUBCLASS_TYPE_MISMATCH
    indexuniqueKeyVARIABLE_NAME_MISMATCH
    org.hibernate.mapping.Indexorg.hibernate.mapping.UniqueKeySUBCLASS_TYPE_MISMATCH
    indexesuniqueKeysVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression Index cannot be unified with expression UniqueKey , because common superclass org.hibernate.mapping.RelationalModel does not declare member(s) public java.lang.String getName()
    Expression current cannot be unified with expression current , because common superclass org.hibernate.mapping.RelationalModel does not declare member(s) public java.lang.String getName()
    Expression (Index)indexes.get(index.getName()) cannot be unified with expression (UniqueKey)uniqueKeys.get(uniqueKey.getName()) , because common superclass org.hibernate.mapping.RelationalModel does not declare member(s) public java.lang.String getName()
    Expression index cannot be unified with expression uniqueKey , because common superclass org.hibernate.mapping.RelationalModel does not declare member(s) public java.lang.String getName()
    1
    UniqueKey current = (UniqueKey)uniqueKeys.get(uniqueKey.getName());
    2
    if (current != null)
    2
    if (current != null)
    2
    if (current != null)
    Differences
    Expression1Expression2Difference
    org.hibernate.mapping.Indexorg.hibernate.mapping.UniqueKeySUBCLASS_TYPE_MISMATCH
    2
    if (current != null)
    3
    throw new MappingException("Index " + index.getName() + " already exists!");
    3
    throw new MappingException("Index " + index.getName() + " already exists!");
    3
    throw new MappingException("UniqueKey " + uniqueKey.getName() + " already exists!");
    Differences
    Expression1Expression2Difference
    "Index ""UniqueKey "LITERAL_VALUE_MISMATCH
    indexuniqueKeyVARIABLE_NAME_MISMATCH
    org.hibernate.mapping.Indexorg.hibernate.mapping.UniqueKeySUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression index cannot be unified with expression uniqueKey , because common superclass org.hibernate.mapping.RelationalModel does not declare member(s) public java.lang.String getName()
    3
    throw new MappingException("UniqueKey " + uniqueKey.getName() + " already exists!");
    4
    indexes.put(index.getName(), index);
    4
    indexes.put(index.getName(), index);
    4
    uniqueKeys.put(uniqueKey.getName(), uniqueKey);
    Differences
    Expression1Expression2Difference
    indexuniqueKeyVARIABLE_NAME_MISMATCH
    org.hibernate.mapping.Indexorg.hibernate.mapping.UniqueKeySUBCLASS_TYPE_MISMATCH
    indexuniqueKeyVARIABLE_NAME_MISMATCH
    org.hibernate.mapping.Indexorg.hibernate.mapping.UniqueKeySUBCLASS_TYPE_MISMATCH
    indexesuniqueKeysVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression index cannot be unified with expression uniqueKey , because common superclass org.hibernate.mapping.RelationalModel does not declare member(s) public java.lang.String getName()
    Expression index cannot be unified with expression uniqueKey , because common superclass type org.hibernate.mapping.RelationalModel cannot be passed as an argument to public abstract java.lang.Object put(java.lang.Object, java.lang.Object)
    Expression index cannot be unified with expression uniqueKey , because common superclass org.hibernate.mapping.RelationalModel does not declare member(s) public java.lang.String getName()
    4
    uniqueKeys.put(uniqueKey.getName(), uniqueKey);
    5
    return index;
    5
    return index;
    5
    return uniqueKey;
    Differences
    Expression1Expression2Difference
    indexuniqueKeyVARIABLE_NAME_MISMATCH
    org.hibernate.mapping.Indexorg.hibernate.mapping.UniqueKeySUBCLASS_TYPE_MISMATCH
    5
    return uniqueKey;
    Precondition Violations (8)
    Row Violation
    1Expression Index cannot be unified with expression UniqueKey , because common superclass org.hibernate.mapping.RelationalModel does not declare member(s) public java.lang.String getName()
    2Expression current cannot be unified with expression current , because common superclass org.hibernate.mapping.RelationalModel does not declare member(s) public java.lang.String getName()
    3Expression (Index)indexes.get(index.getName()) cannot be unified with expression (UniqueKey)uniqueKeys.get(uniqueKey.getName()) , because common superclass org.hibernate.mapping.RelationalModel does not declare member(s) public java.lang.String getName()
    4Expression index cannot be unified with expression uniqueKey , because common superclass org.hibernate.mapping.RelationalModel does not declare member(s) public java.lang.String getName()
    5Expression index cannot be unified with expression uniqueKey , because common superclass org.hibernate.mapping.RelationalModel does not declare member(s) public java.lang.String getName()
    6Expression index cannot be unified with expression uniqueKey , because common superclass org.hibernate.mapping.RelationalModel does not declare member(s) public java.lang.String getName()
    7Expression index cannot be unified with expression uniqueKey , because common superclass type org.hibernate.mapping.RelationalModel cannot be passed as an argument to public abstract java.lang.Object put(java.lang.Object, java.lang.Object)
    8Expression index cannot be unified with expression uniqueKey , because common superclass org.hibernate.mapping.RelationalModel does not declare member(s) public java.lang.String getName()