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) ); }
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: 3 Number of AST nodes: 3
1
String prop = (String) iter.next();
1
String prop = (String) iter.next();
2
			if ( prop.indexOf(Environment.CONNECTION_PREFIX) > -1 && !SPECIAL_PROPERTIES.contains(prop) ) {
2
			if ( prop.indexOf(Environment.JNDI_PREFIX) > -1 && !specialProps.contains(prop) ) {
3
				result.setProperty(
3
				result.setProperty(
4
					prop.substring( Environment.CONNECTION_PREFIX.length()+1 ),
4
						prop.substring( Environment.JNDI_PREFIX.length()+1 ),
5
					properties.getProperty(prop)
5
						properties.getProperty(prop)
6
				);
6
					);
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.4
Clones locationClones are in different classes
Number of node comparisons6
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    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.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    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.HashSetVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.util.Set of variable SPECIAL_PROPERTIES does not match with type java.util.HashSet of variable specialProps
    • Make classes java.util.Set and java.util.HashSet extend a common superclass
    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 (1)
    Row Violation
    1Type java.util.Set of variable SPECIAL_PROPERTIES does not match with type java.util.HashSet of variable specialProps