while ( iter.hasNext() ) { String prop = (String) iter.next(); if ( prop.indexOf(Environment.CONNECTION_PREFIX) > -1 && !SPECIAL_PROPERTIES.contains(prop) ) { result.setProperty( prop.substring( Environment.CONNECTION_PREFIX.length()+1 ), properties.getProperty(prop) ); } }
while ( iter.hasNext() ) { String prop = (String) iter.next(); if ( prop.indexOf(Environment.JNDI_PREFIX) > -1 && !specialProps.contains(prop) ) { result.setProperty( prop.substring( Environment.JNDI_PREFIX.length()+1 ), properties.getProperty(prop) ); } }
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/util/NamingHelper.java
Method name: Properties getConnectionProperties(Properties) Method name: Properties getJndiProperties(Properties)
Number of AST nodes: 4 Number of AST nodes: 4
1
while ( iter.hasNext() ) {
1
while ( iter.hasNext() ) {
2
			String prop = (String) iter.next();
2
			String prop = (String) iter.next();
3
			if ( prop.indexOf(Environment.CONNECTION_PREFIX) > -1 && !SPECIAL_PROPERTIES.contains(prop) ) {
3
			if ( prop.indexOf(Environment.JNDI_PREFIX) > -1 && !specialProps.contains(prop) ) {
4
				result.setProperty(
4
				result.setProperty(
5
					prop.substring( Environment.CONNECTION_PREFIX.length()+1 ),
5
						prop.substring( Environment.JNDI_PREFIX.length()+1 ),
6
					properties.getProperty(prop)
6
						properties.getProperty(prop)
7
				);
7
					);
8
			}
8
			}
9
		}
9
		}
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.4
Clones locationClones are in different classes
Number of node comparisons8
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)1.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    3
    while (iter.hasNext())
    6
    while (iter.hasNext())
    4
    String prop = (String)iter.next();
    7
    String prop = (String)iter.next();
    5
    if (prop.indexOf(Environment.CONNECTION_PREFIX) > -1 && !SPECIAL_PROPERTIES.contains(prop))
    5
    if (prop.indexOf(Environment.CONNECTION_PREFIX) > -1 && !SPECIAL_PROPERTIES.contains(prop))
    8
    if (prop.indexOf(Environment.JNDI_PREFIX) > -1 && !specialProps.contains(prop))
    Differences
    Expression1Expression2Difference
    CONNECTION_PREFIXJNDI_PREFIXVARIABLE_NAME_MISMATCH
    SPECIAL_PROPERTIESspecialPropsVARIABLE_NAME_MISMATCH
    java.util.Setjava.util.HashSetSUBCLASS_TYPE_MISMATCH
    8
    if (prop.indexOf(Environment.JNDI_PREFIX) > -1 && !specialProps.contains(prop))
    6
    result.setProperty(prop.substring(Environment.CONNECTION_PREFIX.length() + 1), properties.getProperty(prop));
    6
    result.setProperty(prop.substring(Environment.CONNECTION_PREFIX.length() + 1), properties.getProperty(prop));
    9
    result.setProperty(prop.substring(Environment.JNDI_PREFIX.length() + 1), properties.getProperty(prop));
    Differences
    Expression1Expression2Difference
    CONNECTION_PREFIXJNDI_PREFIXVARIABLE_NAME_MISMATCH
    9
    result.setProperty(prop.substring(Environment.JNDI_PREFIX.length() + 1), properties.getProperty(prop));
    Precondition Violations (0)
    Row Violation