Object[] listeners = listenerList.getListenerList(); // Process the listeners last to first, notifying // those that are interested in this event for (int i = listeners.length - 2; i >= 0; i -= 2) { if (listeners[i] == IStoreListener.class) { ((IStoreListener) listeners[i + 1]).itemAdded(e); } }
Object[] listeners = listenerList.getListenerList(); // Process the listeners last to first, notifying // those that are interested in this event for (int i = listeners.length - 2; i >= 0; i -= 2) { if (listeners[i] == IExceptionListener.class) { ((IExceptionListener) listeners[i + 1]).exceptionOccured(e); } }
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/calendar/src/main/java/org/columba/calendar/store/AbstractCalendarStore.java File path: /columba-1.4-src/core/src/main/java/org/columba/core/command/Worker.java
Method name: void fireItemAdded(Object) Method name: void fireExceptionOccured(Exception)
Number of AST nodes: 4 Number of AST nodes: 4
1
Object[] listeners = listenerList.getListenerList();
1
Object[] listeners = listenerList.getListenerList();
2
		// Process the listeners last to first, notifying
2
	// Process the listeners last to first, notifying
3
		// those that are interested in this event
3
	// those that are interested in this event
4
		for (int i = listeners.length - 2; i >= 0; i -= 2) {
4
	for (int i = listeners.length - 2; i >= 0; i -= 2) {
5
			if (listeners[i] == IStoreListener.class) {
5
	    if (listeners[i] == IExceptionListener.class) {
6
				((IStoreListener) listeners[i + 1]).itemAdded(e);
6
		((IExceptionListener) listeners[i + 1]).exceptionOccured(e);
7
			}
7
	    }
8
		}
8
	}
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.7
Clones locationClones are in different classes
Number of node comparisons6
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)2.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    2
    Object[] listeners = listenerList.getListenerList();
    1
    Object[] listeners = listenerList.getListenerList();
    3
    for (int i = listeners.length - 2; i >= 0; i -= 2)
    2
    for (int i = listeners.length - 2; i >= 0; i -= 2)
    4
    if (listeners[i] == IStoreListener.class)
    3
    if (listeners[i] == IExceptionListener.class)
    5
    ((IStoreListener)listeners[i + 1]).itemAdded(e);
    5
    ((IStoreListener)listeners[i + 1]).itemAdded(e);
    4
    ((IExceptionListener)listeners[i + 1]).exceptionOccured(e);
    Differences
    Expression1Expression2Difference
    itemAddedexceptionOccuredMETHOD_INVOCATION_NAME_MISMATCH
    org.columba.calendar.store.api.StoreEventjava.lang.ExceptionVARIABLE_TYPE_MISMATCH
    org.columba.calendar.store.api.IStoreListenerorg.columba.api.exception.IExceptionListenerVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression ((IStoreListener)listeners[i + 1]).itemAdded(e) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression ((IExceptionListener)listeners[i + 1]).exceptionOccured(e) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression ((IStoreListener)listeners[i + 1]).itemAdded(e) is a void method call, and thus it cannot be parameterized
    Expression ((IExceptionListener)listeners[i + 1]).exceptionOccured(e) is a void method call, and thus it cannot be parameterized
    Type org.columba.calendar.store.api.StoreEvent of variable e does not match with type java.lang.Exception of variable e
    • Make classes org.columba.calendar.store.api.StoreEvent and java.lang.Exception extend a common superclass
    Expression (IStoreListener)listeners[i + 1] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression (IExceptionListener)listeners[i + 1] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type org.columba.calendar.store.api.IStoreListener of variable (IStoreListener)listeners[i + 1] does not match with type org.columba.api.exception.IExceptionListener of variable (IExceptionListener)listeners[i + 1]
    • Make classes org.columba.calendar.store.api.IStoreListener and org.columba.api.exception.IExceptionListener extend a common superclass
    4
    ((IExceptionListener)listeners[i + 1]).exceptionOccured(e);
    Precondition Violations (8)
    Row Violation
    1Expression ((IStoreListener)listeners[i + 1]).itemAdded(e) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression ((IExceptionListener)listeners[i + 1]).exceptionOccured(e) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression ((IStoreListener)listeners[i + 1]).itemAdded(e) is a void method call, and thus it cannot be parameterized
    4Expression ((IExceptionListener)listeners[i + 1]).exceptionOccured(e) is a void method call, and thus it cannot be parameterized
    5Type org.columba.calendar.store.api.StoreEvent of variable e does not match with type java.lang.Exception of variable e
    6Expression (IStoreListener)listeners[i + 1] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression (IExceptionListener)listeners[i + 1] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Type org.columba.calendar.store.api.IStoreListener of variable (IStoreListener)listeners[i + 1] does not match with type org.columba.api.exception.IExceptionListener of variable (IExceptionListener)listeners[i + 1]