if (folderId == null) throw new IllegalArgumentException("folderId == null"); Vector<IHeaderItem> v = new Vector<IHeaderItem>(); AddressbookTreeModel model = AddressbookTreeModel.getInstance(); IFolder f = model.getFolder(folderId); if (f == null) return v; if (!(f instanceof IContactFolder)) return v; IContactFolder folder = (IContactFolder) f; try { Iterator<IContactModelPartial> it = folder.getHeaderItemList() .iterator(); while (it.hasNext()) { IContactModelPartial itemPartial = it.next(); IContactItem item = createContactItem(itemPartial); v.add(item); }
if (folderId == null) throw new IllegalArgumentException("folderId == null"); Vector<IContactItem> v = new Vector<IContactItem>(); AddressbookTreeModel model = AddressbookTreeModel.getInstance(); IFolder f = model.getFolder(folderId); if (f == null) return v; if (!(f instanceof IContactFolder)) return v; IContactFolder folder = (IContactFolder) f; try { Iterator<IContactModelPartial> it = folder.getHeaderItemList() .iterator(); while (it.hasNext()) { IContactModelPartial contactModel = it.next(); IContactItem item = createContactItem(contactModel); v.add(item); }
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: List getAllHeaderItems(String, boolean) Method name: List getAllContacts(String)
Number of AST nodes: 15 Number of AST nodes: 15
1
if (folderId == null)
1
if (folderId == null)
2
			throw new IllegalArgumentException("folderId == null");
2
			throw new IllegalArgumentException("folderId == null");
3
		Vector<IHeaderItem> v = new Vector<IHeaderItem>();
3
		Vector<IContactItem> v = new Vector<IContactItem>();
4
		AddressbookTreeModel model = AddressbookTreeModel.getInstance();
4
		AddressbookTreeModel model = AddressbookTreeModel.getInstance();
5
		IFolder f = model.getFolder(folderId);
5
		IFolder f = model.getFolder(folderId);
6
		if (f == null)
6
		if (f == null)
7
			return v;
7
			return v;
8
		if (!(f instanceof IContactFolder))
8
		if (!(f instanceof IContactFolder))
9
			return v;
9
			return v;
10
		IContactFolder folder = (IContactFolder) f;
10
		IContactFolder folder = (IContactFolder) f;
11
		try {
11
		try {
12
			Iterator<IContactModelPartial> it = folder.getHeaderItemList()
12
			Iterator<IContactModelPartial> it = folder.getHeaderItemList()
13
					.iterator();
13
					.iterator();
14
			while (it.hasNext()) {
14
			while (it.hasNext()) {
15
				IContactModelPartial itemPartial = it.next();
15
				IContactModelPartial contactModel = it.next();
16
				IContactItem item = createContactItem(itemPartial);
16
				IContactItem item = createContactItem(contactModel);
17
				v.add(item);
17
				v.add(item);
18
			}
18
			}
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 comparisons36
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)3.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
    Vector<IContactItem> v = new Vector<IContactItem>();
    3
    Vector<IHeaderItem> v = new Vector<IHeaderItem>();
                                                                                                          
    4
    AddressbookTreeModel model = AddressbookTreeModel.getInstance();
    4
    AddressbookTreeModel model = AddressbookTreeModel.getInstance();
    5
    IFolder f = model.getFolder(folderId);
    5
    IFolder f = model.getFolder(folderId);
    6
    if (f == null)
    6
    if (f == null)
                            
    7
    return v;
    Preondition Violations
    Unmatched return v;
    7
    return v;
    7
    return v;
    7
    return v;
    Preondition Violations
    Unmatched return v;
                            
    8
    if (!(f instanceof IContactFolder))
    8
    if (!(f instanceof IContactFolder))
                            
    9
    return v;
    Preondition Violations
    Unmatched return v;
    9
    return v;
    9
    return v;
    9
    return v;
    Preondition Violations
    Unmatched return v;
                            
    Precondition Violations (4)
    Row Violation
    1Unmatched return v;
    2Unmatched return v;
    3Unmatched return v;
    4Unmatched return v;