if ( propertyName.indexOf( '.' ) > 0 ) { String root = StringHelper.root( propertyName ); Criteria subcriteria = getAliasedCriteria( root ); if ( subcriteria != null ) { return getSQLAlias( subcriteria ); } } return getSQLAlias( criteria );
if ( propertyName.indexOf( '.' ) > 0 ) { String root = StringHelper.root( propertyName ); Criteria crit = getAliasedCriteria( root ); if ( crit != null ) { return propertyName.substring( root.length() + 1 ); } } return propertyName;
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/loader/criteria/CriteriaQueryTranslator.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/loader/criteria/CriteriaQueryTranslator.java
Method name: String getSQLAlias(Criteria, String) Method name: String getPropertyName(String)
Number of AST nodes: 6 Number of AST nodes: 6
1
if ( propertyName.indexOf( '.' ) > 0 ) {
1
if ( propertyName.indexOf( '.' ) > 0 ) {
2
			String root = StringHelper.root( propertyName );
2
			String root = StringHelper.root( propertyName );
3
			Criteria subcriteria = getAliasedCriteria( root );
3
			Criteria crit = getAliasedCriteria( root );
4
			if ( subcriteria != null ) {
4
			if ( crit != null ) {
5
				return getSQLAlias( subcriteria );
5
				return 
6
			}
7
		}
8
		return getSQLAlias( criteria )
6
propertyName.substring( root.length() + 1 );
7
			}
8
		}
9
;
9
		return propertyName;
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.2
Clones locationClones are declared in the same class
Number of node comparisons14
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)2.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (propertyName.indexOf('.') > 0)
    1
    if (propertyName.indexOf('.') > 0)
    2
    String root = StringHelper.root(propertyName);
    2
    String root = StringHelper.root(propertyName);
    3
    Criteria subcriteria = getAliasedCriteria(root);
    3
    Criteria subcriteria = getAliasedCriteria(root);
    3
    Criteria crit = getAliasedCriteria(root);
    Differences
    Expression1Expression2Difference
    subcriteriacritVARIABLE_NAME_MISMATCH
    3
    Criteria crit = getAliasedCriteria(root);
    4
    if (subcriteria != null)
    4
    if (subcriteria != null)
    4
    if (crit != null)
    Differences
    Expression1Expression2Difference
    subcriteriacritVARIABLE_NAME_MISMATCH
    4
    if (crit != null)
                                                                                                            
    5
    return propertyName.substring(root.length() + 1);
    Preondition Violations
    Unmatched statement return propertyName.substring(root.length() + 1); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched return propertyName.substring(root.length() + 1);
    5
    return propertyName.substring(root.length() + 1);
    5
    return getSQLAlias(subcriteria);
    5
    return getSQLAlias(subcriteria);
    Preondition Violations
    Unmatched statement return getSQLAlias(subcriteria); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched return getSQLAlias(subcriteria);
                                                                          
    6
    return getSQLAlias(criteria);
    6
    return getSQLAlias(criteria);
    6
    return propertyName;
    Differences
    Expression1Expression2Difference
    getSQLAlias(criteria)propertyNameTYPE_COMPATIBLE_REPLACEMENT
    6
    return propertyName;
    Precondition Violations (4)
    Row Violation
    1Unmatched statement return propertyName.substring(root.length() + 1); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched return propertyName.substring(root.length() + 1);
    3Unmatched statement return getSQLAlias(subcriteria); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched return getSQLAlias(subcriteria);