while (tests.hasMoreElements()) { Test t = (Test) tests.nextElement(); if (t instanceof TestCase) { String name = ((TestCase) t).getName(); if (!failureExpected.contains(name + "FailureExpected")) { result.addTest(t); } } }
while ( elems.hasNext() ) { Object element = elems.next(); // worrying about proxies is perhaps a little bit of overkill here... if ( element instanceof HibernateProxy ) { LazyInitializer li = ( (HibernateProxy) element ).getHibernateLazyInitializer(); if ( !li.isUninitialized() ) element = li.getImplementation(); } if ( element == childObject ) return true; }
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/type/CollectionType.java
Method name: TestSuite createFailureExpectedSuite(Class) Method name: boolean contains(Object, Object, SessionImplementor)
Number of AST nodes: 6 Number of AST nodes: 8
1
while (tests.hasMoreElements()) {
1
while ( elems.hasNext() ) {
2
          Test t = (Test) tests.nextElement();
3
          if (t instanceof TestCase) {
4
             String name = ((TestCase) t).getName();
5
             if (!failureExpected.contains(name + "FailureExpected")) {
6
                result.addTest(t);
7
             }
8
          }       
9
       
2
			Object element = elems.next();
3
			// worrying about proxies is perhaps a little bit of overkill here...
4
			if ( element instanceof HibernateProxy ) {
5
				LazyInitializer li = ( (HibernateProxy) element ).getHibernateLazyInitializer();
6
				if ( !li.isUninitialized() ) element = li.getImplementation();
7
			}
8
			if ( element == childObject ) return true;
10
}
9
		}
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.2
Clones locationClones are in different classes
Number of node comparisons1