if (value==null) { return null; } else { return (Serializable) deepCopy( value, session.getEntityMode(), session.getFactory() ); }
String str = rs.getString(name); if (str==null) { return null; } else { return new Character( str.charAt(0) ); }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/type/AbstractType.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/type/CharacterType.java
Method name: Serializable disassemble(Object, SessionImplementor, Object) Method name: Object get(ResultSet, String)
Number of AST nodes: 3 Number of AST nodes: 4
1
if (value
1
String str = rs.getString(name);
2
==null) {
2
		if (str==null) {
3
			return null;
3
			return null;
4
		}
4
		}
5
		else {
5
		else {
6
			return (Serializable) deepCopy( value, session.getEntityMode(), session.getFactory() );
6
			return new Character( str.charAt(0) );
7
		}
7
		}
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 having the same super class
Number of node comparisons9
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)0.8
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                                                      
    1
    String str = rs.getString(name);
    1
    if (value == null)
    1
    if (value == null)
    2
    if (str == null)
    Differences
    Expression1Expression2Difference
    valuestrVARIABLE_NAME_MISMATCH
    java.lang.Objectjava.lang.StringVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.Object of variable value does not match with type java.lang.String of variable str
    • Make classes java.lang.Object and java.lang.String extend a common superclass
    2
    if (str == null)
    2
    return null;
    3
    return null;
    else
            
    3
    return (Serializable)deepCopy(value, session.getEntityMode(), session.getFactory());
    3
    return (Serializable)deepCopy(value, session.getEntityMode(), session.getFactory());
    Preondition Violations
    Unmatched statement return (Serializable)deepCopy(value,session.getEntityMode(),session.getFactory()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched statement return (Serializable)deepCopy(value,session.getEntityMode(),session.getFactory()); 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 return (Serializable)deepCopy(value,session.getEntityMode(),session.getFactory());
                                                                                                                                                                              
                                                                                  
    4
    return new Character(str.charAt(0));
    Preondition Violations
    Unmatched statement return new Character(str.charAt(0)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched return new Character(str.charAt(0));
    4
    return new Character(str.charAt(0));
    Precondition Violations (7)
    Row Violation
    1Type java.lang.Object of variable value does not match with type java.lang.String of variable str
    2Unmatched statement return (Serializable)deepCopy(value,session.getEntityMode(),session.getFactory()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3Unmatched statement return (Serializable)deepCopy(value,session.getEntityMode(),session.getFactory()); 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 return (Serializable)deepCopy(value,session.getEntityMode(),session.getFactory());
    5Unmatched statement return new Character(str.charAt(0)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    6Unmatched return new Character(str.charAt(0));
    7Not all possible execution flows end in a return statement