String dialectName = props.getProperty( Environment.DIALECT ); if ( dialectName == null ) { return getDialect(); } return instantiateDialect( dialectName );
String dialectName = properties.getProperty( Environment.DIALECT ); if ( dialectName == null ) { throw new HibernateException( "'hibernate.dialect' must be set when no Connection avalable" ); } return constructDialect( dialectName );
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/dialect/Dialect.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/dialect/resolver/DialectFactory.java
Method name: Dialect getDialect(Properties) Method name: Dialect buildDialect(Properties)
Number of AST nodes: 4 Number of AST nodes: 4
1
String dialectName = props.getProperty( Environment.DIALECT );
1
String dialectName = properties.getProperty( Environment.DIALECT );
2
		if ( dialectName == null ) {
2
		if ( dialectName == null ) {
3
			return getDialect();
3
			throw new HibernateException( "'hibernate.dialect' must be set when no Connection avalable" );
4
		}
4
		}
5
		return instantiateDialect( dialectName );
5
		return constructDialect( dialectName );
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.1
Clones locationClones are in different classes
Number of node comparisons8
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)0.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    String dialectName = props.getProperty(Environment.DIALECT);
    1
    String dialectName = props.getProperty(Environment.DIALECT);
    1
    String dialectName = properties.getProperty(Environment.DIALECT);
    Differences
    Expression1Expression2Difference
    propspropertiesVARIABLE_NAME_MISMATCH
    1
    String dialectName = properties.getProperty(Environment.DIALECT);
    2
    if (dialectName == null)
    2
    if (dialectName == null)
                                                                                                                                                                                                  
    3
    throw new HibernateException("'hibernate.dialect' must be set when no Connection avalable");
    Preondition Violations
    Unmatched throw new HibernateException("'hibernate.dialect' must be set when no Connection avalable");
    3
    throw new HibernateException("'hibernate.dialect' must be set when no Connection avalable");
    3
    return getDialect();
    3
    return getDialect();
    Preondition Violations
    Unmatched return getDialect();
                                                  
    4
    return instantiateDialect(dialectName);
    4
    return instantiateDialect(dialectName);
    4
    return constructDialect(dialectName);
    Differences
    Expression1Expression2Difference
    instantiateDialectconstructDialectMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression instantiateDialect(dialectName) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method instantiateDialect
    Expression constructDialect(dialectName) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4
    return constructDialect(dialectName);
    Precondition Violations (4)
    Row Violation
    1Unmatched throw new HibernateException("'hibernate.dialect' must be set when no Connection avalable");
    2Unmatched return getDialect();
    3Expression instantiateDialect(dialectName) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression constructDialect(dialectName) cannot be parameterized, because it has dependencies to/from statements that will be extracted