String header = propertyName != null ? StringHelper.unqualify( propertyName ) : propertyTableName; if (header == null) throw new AssertionFailure("NammingStrategy not properly filled"); return columnName( header );
final Serializable id = session.getEntityPersister( entityName, obj ) //TODO: cache the persister, this shows up in yourkit .getIdentifier( obj, session.getEntityMode() ); if (id==null) { throw new IdentifierGenerationException( "ids for this class must be manually assigned before calling save(): " + entityName ); } return id;
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/cfg/DefaultNamingStrategy.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/id/Assigned.java
Method name: String foreignKeyColumnName(String, String, String, String) Method name: Serializable generate(SessionImplementor, Object)
Number of AST nodes: 4 Number of AST nodes: 4
1
String header = propertyName != null ? StringHelper.unqualify( propertyName ) : propertyTableName
1
final Serializable id = session.getEntityPersister( entityName, obj ) 
2
				//TODO: cache the persister, this shows up in yourkit
2
;
3
				.getIdentifier( obj, session.getEntityMode() );
3
		
4
		
4
if (header == null) 
5
		if (id==null) {
5
throw new AssertionFailure("NammingStrategy not properly filled");
6
			throw new 
6
		return columnName( header )
7
IdentifierGenerationException(
8
				"ids for this class must be manually assigned before calling save(): " + 
9
				entityName
10
			);
11
		}
12
		
7
;
13
		return id;
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.2
Clones locationClones are in different classes
Number of node comparisons8
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)1.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                                                                                                                                                                                  
    1
    final Serializable id = session.getEntityPersister(entityName, obj).getIdentifier(obj, session.getEntityMode());
    Preondition Violations
    Unmatched statement final Serializable id=session.getEntityPersister(entityName,obj).getIdentifier(obj,session.getEntityMode()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    1
    final Serializable id = session.getEntityPersister(entityName, obj).getIdentifier(obj, session.getEntityMode());
    1
    String header = propertyName != null ? StringHelper.unqualify(propertyName) : propertyTableName;
                                                                                                                                                                                                      
    2
    if (header == null)
    2
    if (header == null)
    2
    if (id == null)
    Differences
    Expression1Expression2Difference
    headeridVARIABLE_NAME_MISMATCH
    java.lang.Stringjava.io.SerializableVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.String of variable header does not match with type java.io.Serializable of variable id
    • Make classes java.lang.String and java.io.Serializable extend a common superclass
    2
    if (id == null)
    3
    throw new AssertionFailure("NammingStrategy not properly filled");
    3
    throw new AssertionFailure("NammingStrategy not properly filled");
    3
    throw new IdentifierGenerationException("ids for this class must be manually assigned before calling save(): " + entityName);
    Differences
    Expression1Expression2Difference
    org.hibernate.AssertionFailureorg.hibernate.id.IdentifierGenerationExceptionSUBCLASS_TYPE_MISMATCH
    "NammingStrategy not properly filled""ids for this class must be manually assigned before calling save(): " + entityNameTYPE_COMPATIBLE_REPLACEMENT
    3
    throw new IdentifierGenerationException("ids for this class must be manually assigned before calling save(): " + entityName);
                              
    4
    return id;
    Preondition Violations
    Unmatched statement return id; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched return id;
    4
    return id;
    4
    return columnName(header);
    4
    return columnName(header);
    Preondition Violations
    Unmatched statement return columnName(header); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched return columnName(header);
                                                              
    Precondition Violations (7)
    Row Violation
    1Unmatched statement final Serializable id=session.getEntityPersister(entityName,obj).getIdentifier(obj,session.getEntityMode()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2Type java.lang.String of variable header does not match with type java.io.Serializable of variable id
    3Unmatched statement return id; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4Unmatched return id;
    5Unmatched statement return columnName(header); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    6Unmatched return columnName(header);
    7The refactoring of the clones is infeasible, because classes org.hibernate.cfg.DefaultNamingStrategy and org.hibernate.id.Assigned do not have a common superclass