try { for (int j = 0; j < list.length; j++) { Class clazz = Class.forName("org.columba.mail.filter.plugins." + list[j]); Method[] methods = clazz.getDeclaredMethods(); for (int i = 0; i < methods.length; i++) { if (methods[i].getName().startsWith("test")) { suite.addTest((TestCase) clazz.getConstructor( new Class[] { MailboxTstFactory.class, String.class}).newInstance( new Object[] { factory, methods[i].getName()})); } } } } catch (SecurityException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); }
try { for (int j = 0; j < list.length; j++) { Class clazz = Class.forName("org.columba.mail.folder.command." + list[j]); Method[] methods = clazz.getDeclaredMethods(); for (int i = 0; i < methods.length; i++) { if (methods[i].getName().startsWith("test")) { suite .addTest((TestCase) clazz.getConstructor( new Class[] { MailboxTstFactory.class, String.class }).newInstance( new Object[] { factory, methods[i].getName() })); } } } } catch (SecurityException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); }
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/mail/src/test/java/org/columba/mail/filter/plugins/AllTests.java File path: /columba-1.4-src/mail/src/test/java/org/columba/mail/folder/command/AllTests.java
Method name: void setup(TestSuite, MailboxTstFactory) Method name: void setup(TestSuite, MailboxTstFactory)
Number of AST nodes: 7 Number of AST nodes: 7
1
try {
1
try {
2
            for (int j = 0; j < list.length; j++) {
2
			for (int j = 0; j < list.length; j++) {
3
                Class clazz = Class.forName("org.columba.mail.filter.plugins."
3
				Class clazz = Class.forName("org.columba.mail.f
4
                        + list[j]);
5
                
4
older.command."
5
						+ list[j]);
6
Method[] methods = clazz.getDeclaredMethods();
6
				Method[] methods = clazz.getDeclaredMethods();
7
                for (int i = 0; i < methods.length; i++) {
7
				for (int i = 0; i < methods.length; i++) {
8
                    if (methods[i].getName().startsWith("test")) {
8
					if (methods[i].getName().startsWith("test")) {
9
                        suite
9
						suite
10
.addTest((TestCase) clazz.getConstructor(
10
								.addTest((TestCase) clazz.getConstructor(
11
                                new Class[] { MailboxTstFactory.class,
11
										new Class[] { MailboxTstFactory.class,
12
                                        String.class}).newInstance(
12
												String.class }).newInstance(
13
                                new Object[] { factory, 
13
										new Object[] { factory,
14
methods[i].getName()}));
14
												methods[i].getName() }));
15
                    }
16
                }
17
            }
18
        
15
					}
16
				}
17
			}
19
} catch (SecurityException e) {
18
		} catch (SecurityException e) {
20
            e.printStackTrace();
19
			e.printStackTrace();
21
        } catch (IllegalArgumentException e) {
20
		} catch (IllegalArgumentException e) {
22
            e.printStackTrace();
21
			e.printStackTrace();
23
        } catch (ClassNotFoundException e) {
22
		} catch (ClassNotFoundException e) {
24
            e.printStackTrace();
23
			e.printStackTrace();
25
        } catch (InstantiationException e) {
24
		} catch (InstantiationException e) {
26
            e.printStackTrace();
25
			e.printStackTrace();
27
        } catch (IllegalAccessException e) {
26
		} catch (IllegalAccessException e) {
28
            e.printStackTrace();
27
			e.printStackTrace();
29
        } catch (InvocationTargetException e) {
28
		} catch (InvocationTargetException e) {
30
            e.printStackTrace();
29
			e.printStackTrace();
31
        } catch (NoSuchMethodException e) {
30
		} catch (NoSuchMethodException e) {
32
            e.printStackTrace();
31
			e.printStackTrace();
33
        }
32
		}
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)1.5
Clones locationClones are in different classes
Number of node comparisons17
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements7
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)3.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    try
    1
    try
    2
    for (int j = 0; j < list.length; j++)
    2
    for (int j = 0; j < list.length; j++)
    3
    Class clazz = Class.forName("org.columba.mail.filter.plugins." + list[j]);
    3
    Class clazz = Class.forName("org.columba.mail.filter.plugins." + list[j]);
    3
    Class clazz = Class.forName("org.columba.mail.folder.command." + list[j]);
    Differences
    Expression1Expression2Difference
    "org.columba.mail.filter.plugins.""org.columba.mail.folder.command."LITERAL_VALUE_MISMATCH
    3
    Class clazz = Class.forName("org.columba.mail.folder.command." + list[j]);
    4
    Method[] methods = clazz.getDeclaredMethods();
    4
    Method[] methods = clazz.getDeclaredMethods();
    5
    for (int i = 0; i < methods.length; i++)
    5
    for (int i = 0; i < methods.length; i++)
    6
    if (methods[i].getName().startsWith("test"))
    6
    if (methods[i].getName().startsWith("test"))
    7
    suite.addTest((TestCase)clazz.getConstructor(new Class[] {MailboxTstFactory.class, String.class}).newInstance(new Object[] {factory, methods[i].getName()}));
    7
    suite.addTest((TestCase)clazz.getConstructor(new Class[] {MailboxTstFactory.class, String.class}).newInstance(new Object[] {factory, methods[i].getName()}));
    Precondition Violations (0)
    Row Violation