Class clazz = (Class) eventInterfaceFromType.get(type); if (clazz == null) { throw new MappingException("Unrecognized listener type [" + type + "]"); } return clazz;
Type type = (Type) typesByPropertyPath.get(propertyName); if ( type == null ) { throw propertyException( propertyName ); } return type;
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/event/EventListeners.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/persister/entity/AbstractPropertyMapping.java
Method name: Class getListenerClassFor(String) Method name: Type toType(String)
Number of AST nodes: 4 Number of AST nodes: 4
1
Class clazz = (Class) eventInterfaceFromType.get(type);
2
		
1
Type type = (Type) typesByPropertyPath.get(propertyName);
3
		if (clazz == null) {
2
		if ( type == null ) {
4
			throw new MappingException("Unrecognized listener type [" + type + "]");
3
			throw propertyException( propertyName );
5
		}
4
		}
6
		return clazz;
5
		return type;
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 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)0.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                                                                      
    1
    Type type = (Type)typesByPropertyPath.get(propertyName);
    1
    Class clazz = (Class)eventInterfaceFromType.get(type);
                                                                                                                  
    2
    if (clazz == null)
    2
    if (clazz == null)
    2
    if (type == null)
    Differences
    Expression1Expression2Difference
    clazztypeVARIABLE_NAME_MISMATCH
    java.lang.Classorg.hibernate.type.TypeVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.Class of variable clazz does not match with type org.hibernate.type.Type of variable type
    • Make classes java.lang.Class and org.hibernate.type.Type extend a common superclass
    2
    if (type == null)
    3
    throw new MappingException("Unrecognized listener type [" + type + "]");
    3
    throw new MappingException("Unrecognized listener type [" + type + "]");
    3
    throw propertyException(propertyName);
    Differences
    Expression1Expression2Difference
    new MappingException("Unrecognized listener type [" + type + "]")propertyException(propertyName)TYPE_COMPATIBLE_REPLACEMENT
    3
    throw propertyException(propertyName);
                                  
    4
    return type;
    Preondition Violations
    Unmatched return type;
    4
    return type;
    4
    return clazz;
    4
    return clazz;
    Preondition Violations
    Unmatched return clazz;
                                    
    Precondition Violations (3)
    Row Violation
    1Type java.lang.Class of variable clazz does not match with type org.hibernate.type.Type of variable type
    2Unmatched return type;
    3Unmatched return clazz;