String[] columns = (String[]) columnsByPropertyPath.get(propertyName); if ( columns == null ) { throw propertyException( propertyName ); } String[] templates = (String[]) formulaTemplatesByPropertyPath.get(propertyName); String[] result = new String[columns.length]; for ( int i=0; i<columns.length; i++ ) { if ( columns[i]==null ) { result[i] = StringHelper.replace( templates[i], Template.TEMPLATE, alias ); } else { result[i] = StringHelper.qualify( alias, columns[i] ); } } return result;
String[] columns = (String[]) columnsByPropertyPath.get(propertyName); if ( columns == null ) { throw propertyException( propertyName ); } String[] templates = (String[]) formulaTemplatesByPropertyPath.get(propertyName); String[] result = new String[columns.length]; for ( int i=0; i<columns.length; i++ ) { if ( columns[i]==null ) { result[i] = StringHelper.replace( templates[i], Template.TEMPLATE, "" ); } else { result[i] = columns[i]; } } return result;
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/persister/entity/AbstractPropertyMapping.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/persister/entity/AbstractPropertyMapping.java
Method name: String[] toColumns(String, String) Method name: String[] toColumns(String)
Number of AST nodes: 10 Number of AST nodes: 10
1
String[] columns = (String[]) columnsByPropertyPath.get(propertyName);
1
String[] columns = (String[]) columnsByPropertyPath.get(propertyName);
2
		if ( columns == null ) {
2
		if ( columns == null ) {
3
			throw propertyException( propertyName );
3
			throw propertyException( propertyName );
4
		}
4
		}
5
		String[] templates = (String[]) formulaTemplatesByPropertyPath.get(propertyName);
5
		String[] templates = (String[]) formulaTemplatesByPropertyPath.get(propertyName);
6
		String[] result = new String[columns.length];
6
		String[] result = new String[columns.length];
7
		for ( int i=0; i<columns.length; i++ ) {
7
		for ( int i=0; i<columns.length; i++ ) {
8
			if ( columns[i]==null ) {
8
			if ( columns[i]==null ) {
9
				result[i] = StringHelper.replace( templates[i], Template.TEMPLATE, alias );
9
				result[i] = StringHelper.replace( templates[i], Template.TEMPLATE, "" );
10
			}
10
			}
11
			else {
11
			else {
12
				result[i] = StringHelper.qualify( alias, columns[i] );
12
				result[i] = columns[i];
13
			}
13
			}
14
		}
14
		}
15
		return result;
15
		return result;
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.3
Clones locationClones are declared in the same class
Number of node comparisons30
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements10
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)2.4
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    String[] columns = (String[])columnsByPropertyPath.get(propertyName);
    1
    String[] columns = (String[])columnsByPropertyPath.get(propertyName);
    2
    if (columns == null)
    2
    if (columns == null)
    3
    throw propertyException(propertyName);
    3
    throw propertyException(propertyName);
    4
    String[] templates = (String[])formulaTemplatesByPropertyPath.get(propertyName);
    4
    String[] templates = (String[])formulaTemplatesByPropertyPath.get(propertyName);
    5
    String[] result = new String[columns.length];
    5
    String[] result = new String[columns.length];
    6
    for (int i = 0; i < columns.length; i++)
    6
    for (int i = 0; i < columns.length; i++)
    7
    if (columns[i] == null)
    7
    if (columns[i] == null)
    8
    result[i] = StringHelper.replace(templates[i], Template.TEMPLATE, alias);
    8
    result[i] = StringHelper.replace(templates[i], Template.TEMPLATE, alias);
    8
    result[i] = StringHelper.replace(templates[i], Template.TEMPLATE, "");
    Differences
    Expression1Expression2Difference
    alias""TYPE_COMPATIBLE_REPLACEMENT
    8
    result[i] = StringHelper.replace(templates[i], Template.TEMPLATE, "");
    else
    else
    9
    result[i] = StringHelper.qualify(alias, columns[i]);
    9
    result[i] = StringHelper.qualify(alias, columns[i]);
    9
    result[i] = columns[i];
    Differences
    Expression1Expression2Difference
    StringHelper.qualify(alias,columns[i])columns[i]TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression StringHelper.qualify(alias,columns[i]) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression columns[i] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9
    result[i] = columns[i];
    10
    return result;
    10
    return result;
    Precondition Violations (2)
    Row Violation
    1Expression StringHelper.qualify(alias,columns[i]) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression columns[i] cannot be parameterized, because it has dependencies to/from statements that will be extracted