if (contactItem == null) throw new IllegalArgumentException("IContactItem is null"); AddressbookTreeModel model = AddressbookTreeModel.getInstance(); SelectAddressbookFolderDialog dialog = new SelectAddressbookFolderDialog( model); if (dialog.success()) { IFolder folder = dialog.getSelectedFolder(); String uid = folder.getId(); addContact(uid, contactItem); } else return;
if (contactItems == null) throw new IllegalArgumentException( "Zero IContactItem's were specified to add to addressbook folder"); AddressbookTreeModel model = AddressbookTreeModel.getInstance(); SelectAddressbookFolderDialog dialog = new SelectAddressbookFolderDialog( model); if (dialog.success()) { IFolder folder = dialog.getSelectedFolder(); String uid = folder.getId(); addContacts(uid, contactItems); } else return;
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: void addContact(IContactItem) Method name: void addContacts(IContactItem[])
Number of AST nodes: 9 Number of AST nodes: 9
1
if (contactItem == null)
1
if (contactItems == null)
2
			throw new IllegalArgumentException("IContactItem is null
2
			throw new IllegalArgumentException(
3
");
3
					"Zero IContactItem's were specified to add to addressbook folder");
4
		AddressbookTreeModel model = AddressbookTreeModel.getInstance();
4
		AddressbookTreeModel model = AddressbookTreeModel.getInstance();
5
		SelectAddressbookFolderDialog dialog = new SelectAddressbookFolderDialog(
5
		SelectAddressbookFolderDialog dialog = new SelectAddressbookFolderDialog(
6
				model);
6
				model);
7
		if (dialog.success()) {
7
		if (dialog.success()) {
8
			IFolder folder = dialog.getSelectedFolder();
8
			IFolder folder = dialog.getSelectedFolder();
9
			String uid = folder.getId();
9
			String uid = folder.getId();
10
			addContact(uid, contactItem);
10
			addContacts(uid, contactItems);
11
		} else
11
		} else
12
			return;
12
			return;
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.4
Clones locationClones are declared in the same class
Number of node comparisons33
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements8
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)2.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (contactItem == null)
    1
    if (contactItem == null)
    1
    if (contactItems == null)
    Differences
    Expression1Expression2Difference
    contactItemcontactItemsVARIABLE_NAME_MISMATCH
    org.columba.addressbook.facade.IContactItemorg.columba.addressbook.facade.IContactItem[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.columba.addressbook.facade.IContactItem of variable contactItem does not match with type org.columba.addressbook.facade.IContactItem[] of variable contactItems
    • Make classes org.columba.addressbook.facade.IContactItem and org.columba.addressbook.facade.IContactItem[] extend a common superclass
    1
    if (contactItems == null)
    2
    throw new IllegalArgumentException("IContactItem is null");
    2
    throw new IllegalArgumentException("IContactItem is null");
    2
    throw new IllegalArgumentException("Zero IContactItem's were specified to add to addressbook folder");
    Differences
    Expression1Expression2Difference
    "IContactItem is null""Zero IContactItem's were specified to add to addressbook folder"LITERAL_VALUE_MISMATCH
    2
    throw new IllegalArgumentException("Zero IContactItem's were specified to add to addressbook folder");
    3
    AddressbookTreeModel model = AddressbookTreeModel.getInstance();
    3
    AddressbookTreeModel model = AddressbookTreeModel.getInstance();
    4
    SelectAddressbookFolderDialog dialog = new SelectAddressbookFolderDialog(model);
    4
    SelectAddressbookFolderDialog dialog = new SelectAddressbookFolderDialog(model);
    5
    if (dialog.success())
    5
    if (dialog.success())
    6
    IFolder folder = dialog.getSelectedFolder();
    6
    IFolder folder = dialog.getSelectedFolder();
    7
    String uid = folder.getId();
    7
    String uid = folder.getId();
                                                                      
    8
    addContacts(uid, contactItems);
    Preondition Violations
    Unmatched statement addContacts(uid,contactItems); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched statement addContacts(uid,contactItems); 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
    8
    addContacts(uid, contactItems);
    8
    addContact(uid, contactItem);
    8
    addContact(uid, contactItem);
    Preondition Violations
    Unmatched statement addContact(uid,contactItem); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched statement addContact(uid,contactItem); 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
                                                                  
    else
    else
    9
    return;
    9
    return;
    Precondition Violations (5)
    Row Violation
    1Type org.columba.addressbook.facade.IContactItem of variable contactItem does not match with type org.columba.addressbook.facade.IContactItem[] of variable contactItems
    2Unmatched statement addContacts(uid,contactItems); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement addContacts(uid,contactItems); 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
    4Unmatched statement addContact(uid,contactItem); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched statement addContact(uid,contactItem); 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