Test t = (Test) tests.nextElement(); if (t instanceof TestCase) { String name = ((TestCase) t).getName(); if (!failureExpected.contains(name + "FailureExpected")) { result.addTest(t); } }
if ( maybeProxy instanceof HibernateProxy ) { HibernateProxy proxy = (HibernateProxy) maybeProxy; LazyInitializer li = proxy.getHibernateLazyInitializer(); if ( li.isUninitialized() ) { throw new PersistentObjectException( "object was an uninitialized proxy for " + li.getEntityName() ); } return li.getImplementation(); //unwrap the object } else { return maybeProxy; }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/cache-jbosscache2/src/test/java/org/hibernate/test/util/CacheTestUtil.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/engine/StatefulPersistenceContext.java
Method name: TestSuite createFailureExpectedSuite(Class) Method name: Object unproxy(Object)
Number of AST nodes: 5 Number of AST nodes: 7
1
Test t = (Test) tests.nextElement();
2
          if (t instanceof TestCase) {
3
             String name = ((TestCase) t).getName();
4
             if (!failureExpected.contains(name + "FailureExpected")) {
5
                result.addTest(t);
6
             }
7
          
1
if ( maybeProxy instanceof HibernateProxy ) {
2
			HibernateProxy proxy = (HibernateProxy) maybeProxy;
3
			LazyInitializer li = proxy.getHibernateLazyInitializer();
4
			if ( li.isUninitialized() ) {
5
				throw new PersistentObjectException(
6
						"object was an uninitialized proxy for " +
7
						li.getEntityName()
8
				);
9
			}
10
			return li.getImplementation(); //unwrap the object
11
		}
12
		else {
13
			return maybeProxy;
8
}
14
		}
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 different classes
Number of node comparisons7
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)3.9
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                                                                                          
    4
    HibernateProxy proxy = (HibernateProxy)maybeProxy;
                                                                                                                        
    5
    LazyInitializer li = proxy.getHibernateLazyInitializer();
    15
    String name = ((TestCase)t).getName();
    15
    String name = ((TestCase)t).getName();
    Preondition Violations
    Unmatched statement String name=((TestCase)t).getName(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                    
    16
    if (!failureExpected.contains(name + "FailureExpected"))
    16
    if (!failureExpected.contains(name + "FailureExpected"))
    6
    if (li.isUninitialized())
    Differences
    Expression1Expression2Difference
    !failureExpected.contains(name + "FailureExpected")li.isUninitialized()TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression !failureExpected.contains(name + "FailureExpected") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression li.isUninitialized() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6
    if (li.isUninitialized())
                                                                                                                                                                                                                
    7
    throw new PersistentObjectException("object was an uninitialized proxy for " + li.getEntityName());
    Preondition Violations
    Unmatched statement throw new PersistentObjectException("object was an uninitialized proxy for " + li.getEntityName()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched statement throw new PersistentObjectException("object was an uninitialized proxy for " + li.getEntityName()); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    Unmatched throw new PersistentObjectException("object was an uninitialized proxy for " + li.getEntityName());
    7
    throw new PersistentObjectException("object was an uninitialized proxy for " + li.getEntityName());
    17
    result.addTest(t);
                                                
    Precondition Violations (7)
    Row Violation
    1Unmatched statement String name=((TestCase)t).getName(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Expression !failureExpected.contains(name + "FailureExpected") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression li.isUninitialized() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Unmatched statement throw new PersistentObjectException("object was an uninitialized proxy for " + li.getEntityName()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5Unmatched statement throw new PersistentObjectException("object was an uninitialized proxy for " + li.getEntityName()); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    6Unmatched throw new PersistentObjectException("object was an uninitialized proxy for " + li.getEntityName());
    7The refactoring of the clones is infeasible, because the number of macthed statements is equal to zero