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 (f == null) throw new IllegalArgumentException("contact folder does not exist"); if (!(f instanceof IContactFolder)) return null; IContactFolder contactFolder = (IContactFolder) f; String id = contactFolder.findByEmailAddress(emailAddress); return id;
if (folderId == null) throw new IllegalArgumentException("folderId = null"); if (name == null) throw new IllegalArgumentException("name == null"); AddressbookTreeModel model = AddressbookTreeModel.getInstance(); IFolder f = (IFolder) model.getFolder(folderId); if (f == null) throw new IllegalArgumentException("contact folder does not exist"); if (!(f instanceof IContactFolder)) return null; IContactFolder contactFolder = (IContactFolder) f; String id = contactFolder.findByName(name); return id;
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: String findByName(String, String)
Number of AST nodes: 13 Number of AST nodes: 13
1
if (folderId == null)
1
if (folderId == null)
2
			throw new IllegalArgumentException("folderId = null");
2
			throw new IllegalArgumentException("folderId = null");
3
		if (emailAddress == null)
3
		if (name == null)
4
			throw new IllegalArgumentException("emailAddress == null");
4
			throw new IllegalArgumentException("name == null");
5
		AddressbookTreeModel model = AddressbookTreeModel.getInstance();
5
		AddressbookTreeModel model = AddressbookTreeModel.getInstance();
6
		IFolder f = (IFolder) model.getFolder(folderId);
6
		IFolder f = (IFolder) model.getFolder(folderId);
7
		if (f == null)
7
		if (f == null)
8
			throw new IllegalArgumentException("contact folder does not exist");
8
			throw new IllegalArgumentException("contact folder does not exist");
9
		if (!(f instanceof IContactFolder))
9
		if (!(f instanceof IContactFolder))
10
			return null;
10
			return null;
11
		IContactFolder contactFolder = (IContactFolder) f;
11
		IContactFolder contactFolder = (IContactFolder) f;
12
		String id = contactFolder.findByEmailAddress(emailAddress);
12
		String id = contactFolder.findByName(name);
13
		return id;
13
		return id;
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.8
Clones locationClones are declared in the same class
Number of node comparisons71
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements13
    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
    1
    if (folderId == null)
    1
    if (folderId == null)
    2
    throw new IllegalArgumentException("folderId = null");
    2
    throw new IllegalArgumentException("folderId = null");
    3
    if (emailAddress == null)
    3
    if (emailAddress == null)
    3
    if (name == null)
    Differences
    Expression1Expression2Difference
    emailAddressnameVARIABLE_NAME_MISMATCH
    3
    if (name == null)
    4
    throw new IllegalArgumentException("emailAddress == null");
    4
    throw new IllegalArgumentException("emailAddress == null");
    4
    throw new IllegalArgumentException("name == null");
    Differences
    Expression1Expression2Difference
    "emailAddress == null""name == null"LITERAL_VALUE_MISMATCH
    4
    throw new IllegalArgumentException("name == null");
    5
    AddressbookTreeModel model = AddressbookTreeModel.getInstance();
    5
    AddressbookTreeModel model = AddressbookTreeModel.getInstance();
    6
    IFolder f = (IFolder)model.getFolder(folderId);
    6
    IFolder f = (IFolder)model.getFolder(folderId);
    7
    if (f == null)
    7
    if (f == null)
    8
    throw new IllegalArgumentException("contact folder does not exist");
    8
    throw new IllegalArgumentException("contact folder does not exist");
    9
    if (!(f instanceof IContactFolder))
    9
    if (!(f instanceof IContactFolder))
    10
    return null;
    10
    return null;
    11
    IContactFolder contactFolder = (IContactFolder)f;
    11
    IContactFolder contactFolder = (IContactFolder)f;
    12
    String id = contactFolder.findByEmailAddress(emailAddress);
    12
    String id = contactFolder.findByEmailAddress(emailAddress);
    12
    String id = contactFolder.findByName(name);
    Differences
    Expression1Expression2Difference
    findByEmailAddressfindByNameMETHOD_INVOCATION_NAME_MISMATCH
    emailAddressnameVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression contactFolder.findByEmailAddress(emailAddress) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression contactFolder.findByName(name) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12
    String id = contactFolder.findByName(name);
    13
    return id;
    13
    return id;
    Precondition Violations (2)
    Row Violation
    1Expression contactFolder.findByEmailAddress(emailAddress) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression contactFolder.findByName(name) cannot be parameterized, because it has dependencies to/from statements that will be extracted