for (int index = 0 ; index < size ; index++) { String propertyName = descritors[index].getName(); if ( connectionProviderInjectionData.containsKey( propertyName ) ) { Method method = descritors[index].getWriteMethod(); method.invoke( connections, new Object[] { connectionProviderInjectionData.get( propertyName ) } ); } }
for ( int i=1; i<entityNames.length; i++ ) { Loadable loadable = (Loadable) getFactory().getEntityPersister( entityNames[i] ); if ( !loadable.isAbstract() ) { //perhaps not really necessary... String sequentialSelect = generateSequentialSelect(loadable); sequentialSelectStringsByEntityName.put( entityNames[i], sequentialSelect ); } }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/connection/ConnectionProviderFactory.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/persister/entity/SingleTableEntityPersister.java
Method name: ConnectionProvider newConnectionProvider(Properties, Map) Method name: void postInstantiate()
Number of AST nodes: 5 Number of AST nodes: 5
1
for (int index = 0 ; index < size ; index++) {
1
for ( int i=1; i<entityNames.length; i++ ) {
2
					String propertyName = descritors[index].getName();
2
				Loadable loadable = (Loadable) getFactory().getEntityPersister( entityNames[i] );
3
					if ( connectionProviderInjectionData.containsKey( propertyName ) ) {
3
				if ( 
4
						Method method = descritors[index].getWriteMethod();
5
						method.invoke( connections, new Object[] { connectionProviderInjectionData.get( propertyName ) }
4
!loadable.isAbstract() ) { //perhaps not really necessary...
5
					String sequentialSelect = generateSequentialSelect(loadable);
6
 );
6
					sequentialSelectStringsByEntityName.put( entityNames[i], sequentialSelect );
7
					}
7
				}
8
				}
8
			}
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 in different classes
Number of node comparisons14
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)13.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    17
    for (int index = 0; index < size; index++)
    17
    for (int index = 0; index < size; index++)
    4
    for (int i = 1; i < entityNames.length; i++)
    Differences
    Expression1Expression2Difference
    indexiVARIABLE_NAME_MISMATCH
    01LITERAL_VALUE_MISMATCH
    indexiVARIABLE_NAME_MISMATCH
    sizeentityNames.lengthTYPE_COMPATIBLE_REPLACEMENT
    indexiVARIABLE_NAME_MISMATCH
    4
    for (int i = 1; i < entityNames.length; i++)
                                                                                                                                                                  
    5
    Loadable loadable = (Loadable)getFactory().getEntityPersister(entityNames[i]);
    Preondition Violations
    Unmatched statement Loadable loadable=(Loadable)getFactory().getEntityPersister(entityNames[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched statement Loadable loadable=(Loadable)getFactory().getEntityPersister(entityNames[i]); 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
    5
    Loadable loadable = (Loadable)getFactory().getEntityPersister(entityNames[i]);
    18
    String propertyName = descritors[index].getName();
    18
    String propertyName = descritors[index].getName();
    Preondition Violations
    Unmatched statement String propertyName=descritors[index].getName(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                            
    19
    if (connectionProviderInjectionData.containsKey(propertyName))
    19
    if (connectionProviderInjectionData.containsKey(propertyName))
    6
    if (!loadable.isAbstract())
    Differences
    Expression1Expression2Difference
    connectionProviderInjectionData.containsKey(propertyName)!loadable.isAbstract()TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression connectionProviderInjectionData.containsKey(propertyName) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression !loadable.isAbstract() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6
    if (!loadable.isAbstract())
                                                                                                                                
    7
    String sequentialSelect = generateSequentialSelect(loadable);
    Preondition Violations
    Unmatched statement String sequentialSelect=generateSequentialSelect(loadable); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7
    String sequentialSelect = generateSequentialSelect(loadable);
                                                                                                                                                            
    8
    sequentialSelectStringsByEntityName.put(entityNames[i], sequentialSelect);
    Preondition Violations
    Unmatched statement sequentialSelectStringsByEntityName.put(entityNames[i],sequentialSelect); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8
    sequentialSelectStringsByEntityName.put(entityNames[i], sequentialSelect);
    20
    Method method = descritors[index].getWriteMethod();
    20
    Method method = descritors[index].getWriteMethod();
    Preondition Violations
    Unmatched statement Method method=descritors[index].getWriteMethod(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                              
    21
    method.invoke(connections, new Object[] {connectionProviderInjectionData.get(propertyName)});
    21
    method.invoke(connections, new Object[] {connectionProviderInjectionData.get(propertyName)});
    Preondition Violations
    Unmatched statement method.invoke(connections,new Object[]{connectionProviderInjectionData.get(propertyName)}); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched statement method.invoke(connections,new Object[]{connectionProviderInjectionData.get(propertyName)}); 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
                                                                                                                                                                                                  
    Precondition Violations (10)
    Row Violation
    1Unmatched statement Loadable loadable=(Loadable)getFactory().getEntityPersister(entityNames[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement Loadable loadable=(Loadable)getFactory().getEntityPersister(entityNames[i]); 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
    3Unmatched statement String propertyName=descritors[index].getName(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Expression connectionProviderInjectionData.containsKey(propertyName) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression !loadable.isAbstract() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Unmatched statement String sequentialSelect=generateSequentialSelect(loadable); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7Unmatched statement sequentialSelectStringsByEntityName.put(entityNames[i],sequentialSelect); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8Unmatched statement Method method=descritors[index].getWriteMethod(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    9Unmatched statement method.invoke(connections,new Object[]{connectionProviderInjectionData.get(propertyName)}); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    10Unmatched statement method.invoke(connections,new Object[]{connectionProviderInjectionData.get(propertyName)}); 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