if ( property.isUpdateable() && generation == PropertyGeneration.ALWAYS ) { if ( updateNode == null ) { // updateable only because the user did not specify // anything; just override it property.setUpdateable( false ); } else { // the user specifically supplied update="true", // which constitutes an illegal combo throw new MappingException( "cannot specify both update=\"true\" and generated=\"" + generation.getName() + "\" for property: " + propName ); } }
if ( property.isInsertable() ) { if ( insertNode == null ) { // insertable simply because that is the user did not specify // anything; just override it property.setInsertable( false ); } else { // the user specifically supplied insert="true", // which constitutes an illegal combo throw new MappingException( "cannot specify both insert=\"true\" and generated=\"" + generation.getName() + "\" for property: " + propName ); } }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/cfg/HbmBinder.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/cfg/HbmBinder.java
Method name: void bindProperty(Element, Property, Mappings, java.util.Map) Method name: void bindProperty(Element, Property, Mappings, java.util.Map)
Number of AST nodes: 4 Number of AST nodes: 4
1
if ( property.isUpdateable() && generation == PropertyGeneration.ALWAYS ) {
1
if ( property.isInsertable() ) {
2
		        if ( updateNode == null ) {
2
		        if ( insertNode == null ) {
3
			        // updateable only because the user did not specify 
3
			        // insertable simply because that is the user did not specify
4
			        // anything; just override it
4
			        // anything; just override it
5
			        property.setUpdateable( false );
5
					property.setInsertable( false );
6
		        }
6
		        }
7
		        else {
7
		        else {
8
			        // the user specifically supplied update="true",
8
			        // the user specifically supplied insert="true",
9
			        // which constitutes an illegal combo
9
			        // which constitutes an illegal combo
10
					throw new MappingException(
10
					throw new MappingException(
11
							"cannot specify both update=\"true\" and generated=\"" + generation.getName() +
11
							"cannot specify both insert=\"true\" and generated=\"" + generation.getName() +
12
							"\" for property: " +
12
							"\" for property: " +
13
							propName
13
							propName
14
					);
14
					);
15
		        }
15
		        }
16
	        }
16
	        }
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.2
Clones locationClones are in the same method
Number of node comparisons10
  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)0.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    31
    if (updateNode == null)
    31
    if (updateNode == null)
    27
    if (insertNode == null)
    Differences
    Expression1Expression2Difference
    updateNodeinsertNodeVARIABLE_NAME_MISMATCH
    27
    if (insertNode == null)
    32
    property.setUpdateable(false);
    32
    property.setUpdateable(false);
    28
    property.setInsertable(false);
    Differences
    Expression1Expression2Difference
    setUpdateablesetInsertableMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression property.setUpdateable(false) is a void method call, and thus it cannot be parameterized
    Expression property.setInsertable(false) is a void method call, and thus it cannot be parameterized
    28
    property.setInsertable(false);
    else
    else
    33
    throw new MappingException("cannot specify both update=\"true\" and generated=\"" + generation.getName() + "\" for property: " + propName);
    33
    throw new MappingException("cannot specify both update=\"true\" and generated=\"" + generation.getName() + "\" for property: " + propName);
    29
    throw new MappingException("cannot specify both insert=\"true\" and generated=\"" + generation.getName() + "\" for property: " + propName);
    Differences
    Expression1Expression2Difference
    "cannot specify both update=\"true\" and generated=\"""cannot specify both insert=\"true\" and generated=\""LITERAL_VALUE_MISMATCH
    29
    throw new MappingException("cannot specify both insert=\"true\" and generated=\"" + generation.getName() + "\" for property: " + propName);
    Precondition Violations (2)
    Row Violation
    1Expression property.setUpdateable(false) is a void method call, and thus it cannot be parameterized
    2Expression property.setInsertable(false) is a void method call, and thus it cannot be parameterized