if (folderId == null) throw new IllegalArgumentException("folderId = null"); if (emailAddress == null) throw new IllegalArgumentException("emailAddress == null"); AddressbookTreeModel model = AddressbookTreeModel.getInstance(); IFolder f = (IFolder) model.getFolder(folderId);
if (uid == null) throw new IllegalArgumentException("uid == null"); if (contactItems == null) throw new IllegalArgumentException( "Zero IContactItem's were specified to add to addressbook folder"); AddressbookTreeModel model = AddressbookTreeModel.getInstance(); IContactFolder folder = (IContactFolder) model.getFolder(uid);
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/contact/src/main/java/org/columba/addressbook/facade/ContactFacade.java File path: /columba-1.4-src/contact/src/main/java/org/columba/addressbook/facade/ContactFacade.java
Method name: String findByEmailAddress(String, String) Method name: void addContacts(String, IContactItem[])
Number of AST nodes: 6 Number of AST nodes: 6
1
if (folderId == null)
1
if (uid == null)
2
			throw new IllegalArgumentException("folderId = null");
2
			throw new IllegalArgumentException("uid == null");
3
		if (emailAddress == null)
3
		if (contactItems == null)
4
			throw new IllegalArgumentException("emailAddress == null
4
			throw new IllegalArgumentException(
5
");
5
					"Zero IContactItem's were specified to add to addressbook folder");
6
		AddressbookTreeModel model = AddressbookTreeModel.getInstance();
6
		AddressbookTreeModel model = AddressbookTreeModel.getInstance();
7
		IFolder f = (IFolder) model.getFolder(folderId);
7
		IContactFolder folder = (IContactFolder) model.getFolder(uid);
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.3
Clones locationClones are declared in the same class
Number of node comparisons17
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)11.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (folderId == null)
    1
    if (folderId == null)
    1
    if (uid == null)
    Differences
    Expression1Expression2Difference
    folderIduidVARIABLE_NAME_MISMATCH
    1
    if (uid == null)
    2
    throw new IllegalArgumentException("folderId = null");
    2
    throw new IllegalArgumentException("folderId = null");
    2
    throw new IllegalArgumentException("uid == null");
    Differences
    Expression1Expression2Difference
    "folderId = null""uid == null"LITERAL_VALUE_MISMATCH
    2
    throw new IllegalArgumentException("uid == null");
    3
    if (emailAddress == null)
    3
    if (emailAddress == null)
    3
    if (contactItems == null)
    Differences
    Expression1Expression2Difference
    emailAddresscontactItemsVARIABLE_NAME_MISMATCH
    java.lang.Stringorg.columba.addressbook.facade.IContactItem[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.String of variable emailAddress does not match with type org.columba.addressbook.facade.IContactItem[] of variable contactItems
    • Make classes java.lang.String and org.columba.addressbook.facade.IContactItem[] extend a common superclass
    3
    if (contactItems == null)
    4
    throw new IllegalArgumentException("emailAddress == null");
    4
    throw new IllegalArgumentException("emailAddress == null");
    4
    throw new IllegalArgumentException("Zero IContactItem's were specified to add to addressbook folder");
    Differences
    Expression1Expression2Difference
    "emailAddress == null""Zero IContactItem's were specified to add to addressbook folder"LITERAL_VALUE_MISMATCH
    4
    throw new IllegalArgumentException("Zero IContactItem's were specified to add to addressbook folder");
    5
    AddressbookTreeModel model = AddressbookTreeModel.getInstance();
    5
    AddressbookTreeModel model = AddressbookTreeModel.getInstance();
    6
    IFolder f = (IFolder)model.getFolder(folderId);
    6
    IFolder f = (IFolder)model.getFolder(folderId);
    6
    IContactFolder folder = (IContactFolder)model.getFolder(uid);
    Differences
    Expression1Expression2Difference
    org.columba.addressbook.folder.IFolderorg.columba.addressbook.folder.IContactFolderSUBCLASS_TYPE_MISMATCH
    ffolderVARIABLE_NAME_MISMATCH
    org.columba.addressbook.folder.IFolderorg.columba.addressbook.folder.IContactFolderSUBCLASS_TYPE_MISMATCH
    org.columba.addressbook.folder.IFolderorg.columba.addressbook.folder.IContactFolderSUBCLASS_TYPE_MISMATCH
    folderIduidVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression (IFolder)model.getFolder(folderId) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression (IContactFolder)model.getFolder(uid) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6
    IContactFolder folder = (IContactFolder)model.getFolder(uid);
    Precondition Violations (4)
    Row Violation
    1Type java.lang.String of variable emailAddress does not match with type org.columba.addressbook.facade.IContactItem[] of variable contactItems
    2Expression (IFolder)model.getFolder(folderId) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression (IContactFolder)model.getFolder(uid) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Clone fragment #1 returns variable f with type org.columba.addressbook.folder.IFolder , while Clone fragment #2 returns variable folder with type org.columba.addressbook.folder.IContactFolder