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;
Class tuplizerClass = ( Class ) defaultImplClassByMode.get( entityMode ); if ( tuplizerClass == null ) { throw new HibernateException( "could not determine default tuplizer class to use [" + entityMode + "]" ); } return constructTuplizer( tuplizerClass, metamodel, persistentClass );
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/id/Assigned.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/tuple/entity/EntityTuplizerFactory.java
Method name: Serializable generate(SessionImplementor, Object) Method name: EntityTuplizer constructDefaultTuplizer(EntityMode, EntityMetamodel, PersistentClass)
Number of AST nodes: 4 Number of AST nodes: 4
1
final Serializable id = session.getEntityPersister( entityName, obj ) 
2
				//TODO: cache the persister, this shows up in yourkit
3
				.getIdentifier( obj, session.getEntityMode() );
1
Class tuplizerClass = ( Class ) defaultImplClassByMode.get( entityMode );
4
		
2
		
5
		if (id==null) {
3
if ( tuplizerClass == null ) {
6
			throw new IdentifierGenerationException(
4
			throw new 
7
				"ids for this class must be manually assigned before calling save(): " + 
8
				entityName
9
			);
5
HibernateException( "could not determine default tuplizer class to use [" + entityMode + "]" );
10
		}
6
		}
11
		
12
		return id;
7
		return constructTuplizer( tuplizerClass, metamodel, persistentClass );
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 in different classes
Number of node comparisons8
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)7.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                                                                                              
    1
    Class tuplizerClass = (Class)defaultImplClassByMode.get(entityMode);
    1
    final Serializable id = session.getEntityPersister(entityName, obj).getIdentifier(obj, session.getEntityMode());
    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
                                                                                                                                                                                                                                  
    2
    if (id == null)
    2
    if (id == null)
    2
    if (tuplizerClass == null)
    Differences
    Expression1Expression2Difference
    idtuplizerClassVARIABLE_NAME_MISMATCH
    java.io.Serializablejava.lang.ClassVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.io.Serializable of variable id does not match with type java.lang.Class of variable tuplizerClass
    • Make classes java.io.Serializable and java.lang.Class extend a common superclass
    2
    if (tuplizerClass == null)
                                                                                                                                                                                                                        
    3
    throw new HibernateException("could not determine default tuplizer class to use [" + entityMode + "]");
    Preondition Violations
    Unmatched statement throw new HibernateException("could not determine default tuplizer class to use [" + entityMode + "]"); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    Unmatched throw new HibernateException("could not determine default tuplizer class to use [" + entityMode + "]");
    3
    throw new HibernateException("could not determine default tuplizer class to use [" + entityMode + "]");
    3
    throw new IdentifierGenerationException("ids for this class must be manually assigned before calling save(): " + entityName);
    3
    throw new IdentifierGenerationException("ids for this class must be manually assigned before calling save(): " + entityName);
    Preondition Violations
    Unmatched statement throw new IdentifierGenerationException("ids for this class must be manually assigned before calling save(): " + entityName); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    Unmatched throw new IdentifierGenerationException("ids for this class must be manually assigned before calling save(): " + entityName);
                                                                                                                                                                                                                                                                    
                                                                                                                                              
    4
    return constructTuplizer(tuplizerClass, metamodel, persistentClass);
    Preondition Violations
    Unmatched statement return constructTuplizer(tuplizerClass,metamodel,persistentClass); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched return constructTuplizer(tuplizerClass,metamodel,persistentClass);
    4
    return constructTuplizer(tuplizerClass, metamodel, persistentClass);
    4
    return id;
    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;
                              
    Precondition Violations (11)
    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.io.Serializable of variable id does not match with type java.lang.Class of variable tuplizerClass
    3Unmatched statement throw new HibernateException("could not determine default tuplizer class to use [" + entityMode + "]"); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    4Unmatched throw new HibernateException("could not determine default tuplizer class to use [" + entityMode + "]");
    5Unmatched statement throw new IdentifierGenerationException("ids for this class must be manually assigned before calling save(): " + entityName); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    6Unmatched throw new IdentifierGenerationException("ids for this class must be manually assigned before calling save(): " + entityName);
    7Unmatched statement return constructTuplizer(tuplizerClass,metamodel,persistentClass); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    8Unmatched return constructTuplizer(tuplizerClass,metamodel,persistentClass);
    9Unmatched statement return id; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    10Unmatched return id;
    11The refactoring of the clones is infeasible, because the number of macthed statements is equal to zero