if ( clazz==null || clazz==Object.class ) { throw new PropertyNotFoundException("field not found: " + name); } Field field; try { field = clazz.getDeclaredField(name); } catch (NoSuchFieldException nsfe) { field = getField( clazz, clazz.getSuperclass(), name ); } if ( !ReflectHelper.isPublic(clazz, field) ) field.setAccessible(true); return field;
if ( clazz==null || clazz==Object.class ) { throw new PropertyNotFoundException("field [" + name + "] not found on " + root.getName()); } Field field; try { field = clazz.getDeclaredField(name); } catch (NoSuchFieldException nsfe) { field = getField( root, clazz.getSuperclass(), name ); } if ( !ReflectHelper.isPublic(clazz, field) ) field.setAccessible(true); return field;
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/property/DirectPropertyAccessor.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/property/DirectPropertyAccessor.java
Method name: Field getField(Class, String) Method name: Field getField(Class, Class, String)
Number of AST nodes: 8 Number of AST nodes: 8
1
if ( clazz==null || clazz==Object.class ) {
1
if ( clazz==null || clazz==Object.class ) {
2
			throw new PropertyNotFoundException("field not found: " + name); 
2
			throw new PropertyNotFoundException("field [" + name + "] not found on " + root.getName()); 
3
		}
3
		}
4
		Field field;
4
		Field field;
5
		try {
5
		try {
6
			field = clazz.getDeclaredField(name);
6
			field = clazz.getDeclaredField(name);
7
		}
7
		}
8
		catch (NoSuchFieldException nsfe) {
8
		catch (NoSuchFieldException nsfe) {
9
			field = getField( clazz, clazz.getSuperclass(), name );
9
			field = getField( root, clazz.getSuperclass(), name );
10
		}
10
		}
11
		if ( !ReflectHelper.isPublic(clazz, field) ) field.setAccessible(true);
11
		if ( !ReflectHelper.isPublic(clazz, field) ) field.setAccessible(true);
12
		return field;
12
		return field;
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.5
Clones locationClones are declared in the same class
Number of node comparisons31
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements8
    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.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (clazz == null || clazz == Object.class)
    1
    if (clazz == null || clazz == Object.class)
    2
    throw new PropertyNotFoundException("field not found: " + name);
    2
    throw new PropertyNotFoundException("field not found: " + name);
    2
    throw new PropertyNotFoundException("field [" + name + "] not found on " + root.getName());
    Differences
    Expression1Expression2Difference
    "field not found: ""field ["LITERAL_VALUE_MISMATCH
    "field not found: " + name"field [" + name + "] not found on "+ root.getName()INFIX_EXTENDED_OPERAND_NUMBER_MISMATCH
    2
    throw new PropertyNotFoundException("field [" + name + "] not found on " + root.getName());
    3
    Field field;
    3
    Field field;
    4
    try
    4
    try
    4
    try
    Differences
    Expression1Expression2Difference
    clazzrootVARIABLE_NAME_MISMATCH
    4
    try
    5
    field = clazz.getDeclaredField(name);
    5
    field = clazz.getDeclaredField(name);
    6
    if (!ReflectHelper.isPublic(clazz, field))
    6
    if (!ReflectHelper.isPublic(clazz, field))
    7
    field.setAccessible(true);
    7
    field.setAccessible(true);
    8
    return field;
    8
    return field;
    Precondition Violations (0)
    Row Violation