String name = (String) iter.next(); /* * JMeterTreeNode and TestBeanGUI are special GUI classes, and * aren't intended to be added to menus * * TODO: find a better way of checking this */ if (name.endsWith("JMeterTreeNode") || name.endsWith("TestBeanGUI")) { continue;// Don't try to instantiate these } JMeterGUIComponent item; try { Class c = Class.forName(name); if (TestBean.class.isAssignableFrom(c)) { item = new TestBeanGUI(c); } else { item = (JMeterGUIComponent) c.newInstance(); } } catch (NoClassDefFoundError e) { log.warn("Missing jar? Could not create " + name + ". " + e); continue; } catch (Throwable e) { log.warn("Could not instantiate " + name, e); continue; } if (elementsToSkip.contains(name) || elementsToSkip.contains(item.getStaticLabel())) { log.info("Skipping " + name); continue; } else { elementsToSkip.add(name); } Collection categories = item.getMenuCategories(); if (categories == null) { log.debug(name + " participates in no menus."); continue; } if (categories.contains(POST_PROCESSORS)) { postProcessors.add(new MenuInfo(item.getStaticLabel(), name)); } if (categories.contains(PRE_PROCESSORS)) { preProcessors.add(new MenuInfo(item.getStaticLabel(), name)); } if (categories.contains(CONTROLLERS)) { controllers.add(new MenuInfo(item.getStaticLabel(), name)); } if (categories.contains(NON_TEST_ELEMENTS)) { nonTestElements.add(new MenuInfo(item.getStaticLabel(), name)); } if (categories.contains(LISTENERS)) { listeners.add(new MenuInfo(item.getStaticLabel(), name)); } if (categories.contains(CONFIG_ELEMENTS)) { configElements.add(new MenuInfo(item.getStaticLabel(), name)); } if (categories.contains(TABLES)) { tables.add(new MenuInfo(item.getStaticLabel(), name)); } if (categories.contains(REPORT_PAGE)) { reportPage.add(new MenuInfo(item.getStaticLabel(), name)); }
String name = (String) iter.next(); /* * JMeterTreeNode and TestBeanGUI are special GUI classes, and * aren't intended to be added to menus * * TODO: find a better way of checking this */ if (name.endsWith("JMeterTreeNode") // $NON-NLS-1$ || name.endsWith("TestBeanGUI")) {// $NON-NLS-1$ continue;// Don't try to instantiate these } JMeterGUIComponent item; try { Class c = Class.forName(name); if (TestBean.class.isAssignableFrom(c)) { item = new TestBeanGUI(c); } else { item = (JMeterGUIComponent) c.newInstance(); } } catch (NoClassDefFoundError e) { log.warn("Missing jar? Could not create " + name + ". " + e); continue; } catch (Throwable e) { log.warn("Could not instantiate " + name, e); continue; } if (elementsToSkip.contains(name) || elementsToSkip.contains(item.getStaticLabel())) { log.info("Skipping " + name); continue; } else { elementsToSkip.add(name); } Collection categories = item.getMenuCategories(); if (categories == null) { log.debug(name + " participates in no menus."); continue; } if (categories.contains(TIMERS)) { timers.add(new MenuInfo(item.getStaticLabel(), name)); } if (categories.contains(POST_PROCESSORS)) { postProcessors.add(new MenuInfo(item.getStaticLabel(), name)); } if (categories.contains(PRE_PROCESSORS)) { preProcessors.add(new MenuInfo(item.getStaticLabel(), name)); } if (categories.contains(CONTROLLERS)) { controllers.add(new MenuInfo(item.getStaticLabel(), name)); } if (categories.contains(SAMPLERS)) { samplers.add(new MenuInfo(item.getStaticLabel(), name)); } if (categories.contains(NON_TEST_ELEMENTS)) { nonTestElements.add(new MenuInfo(item.getStaticLabel(), name)); } if (categories.contains(LISTENERS)) { listeners.add(new MenuInfo(item.getStaticLabel(), name)); } if (categories.contains(CONFIG_ELEMENTS)) { configElements.add(new MenuInfo(item.getStaticLabel(), name)); }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/gui/util/ReportMenuFactory.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/gui/util/MenuFactory.java
Method name: void initializeMenus() Method name: void initializeMenus()
Number of AST nodes: 33 Number of AST nodes: 33
1
String name = (String) iter.next();
1
String name = (String) iter.next();
2
				/*
2
				/*
3
				 * JMeterTreeNode and TestBeanGUI are special GUI classes, and
3
				 * JMeterTreeNode and TestBeanGUI are special GUI classes, and
4
				 * aren't intended to be added to menus
4
				 * aren't intended to be added to menus
5
				 * 
5
				 * 
6
				 * TODO: find a better way of checking this
6
				 * TODO: find a better way of checking this
7
				 */
7
				 */
8
				if (name.endsWith("JMeterTreeNode")
8
				if (name.endsWith("JMeterTreeNode") // $NON-NLS-1$
9
 || name.endsWith("TestBeanGUI")) {
9
                        || name.endsWith("TestBeanGUI")) {// $NON-NLS-1$
10
					continue;// Don't try to instantiate these
10
					continue;// Don't try to instantiate these
11
				}
11
				}
12
				JMeterGUIComponent item;
12
				JMeterGUIComponent item;
13
				try {
13
				try {
14
					Class c = Class.forName(name);
14
					Class c = Class.forName(name);
15
					if (TestBean.class.isAssignableFrom(c)) {
15
					if (TestBean.class.isAssignableFrom(c)) {
16
						item = new TestBeanGUI(c);
16
						item = new TestBeanGUI(c);
17
					} else {
17
					} else {
18
						item = (JMeterGUIComponent) c.newInstance();
18
						item = (JMeterGUIComponent) c.newInstance();
19
					}
19
					}
20
				} catch (NoClassDefFoundError e) {
20
				} catch (NoClassDefFoundError e) {
21
					log.warn("Missing jar? Could not create " + name + ". " + e);
21
					log.warn("Missing jar? Could not create " + name + ". " + e);
22
					continue;
22
					continue;
23
				} catch (Throwable e) {
23
				} catch (Throwable e) {
24
					log.warn("Could not instantiate " + name, e);
24
					log.warn("Could not instantiate " + name, e);
25
					continue;
25
					continue;
26
				}
26
				}
27
				if (elementsToSkip.contains(name) || elementsToSkip.contains(item.getStaticLabel())) {
27
				if (elementsToSkip.contains(name) || elementsToSkip.contains(item.getStaticLabel())) {
28
					log.info("Skipping " + name);
28
					log.info("Skipping " + name);
29
					continue;
29
					continue;
30
				} else {
30
				} else {
31
					elementsToSkip.add(name);
31
					elementsToSkip.add(name);
32
				}
32
				}
33
				Collection categories = item.getMenuCategories();
33
				Collection categories = item.getMenuCategories();
34
				if (categories == null) {
34
				if (categories == null) {
35
					log.debug(name + " participates in no menus.");
35
					log.debug(name + " participates in no menus.");
36
					continue;
36
					continue;
37
				}
37
				}
38
				if (categories.contains(TIMERS)) {
39
					timers.add(new MenuInfo(item.getStaticLabel(), name));
40
				}
38
				if (categories.contains(POST_PROCESSORS)) {
41
				if (categories.contains(POST_PROCESSORS)) {
39
					postProcessors.add(new MenuInfo(item.getStaticLabel(), name));
42
					postProcessors.add(new MenuInfo(item.getStaticLabel(), name));
40
				}
43
				}
41
				if (categories.contains(PRE_PROCESSORS)) {
44
				if (categories.contains(PRE_PROCESSORS)) {
42
					preProcessors.add(new MenuInfo(item.getStaticLabel(), name));
45
					preProcessors.add(new MenuInfo(item.getStaticLabel(), name));
43
				}
46
				}
44
				if (categories.contains(CONTROLLERS)) {
47
				if (categories.contains(CONTROLLERS)) {
45
					controllers.add(new MenuInfo(item.getStaticLabel(), name));
48
					controllers.add(new MenuInfo(item.getStaticLabel(), name));
46
				}
49
				}
50
				if (categories.contains(SAMPLERS)) {
51
					samplers.add(new MenuInfo(item.getStaticLabel(), name));
52
				}
47
				if (categories.contains(NON_TEST_ELEMENTS)) {
53
				if (categories.contains(NON_TEST_ELEMENTS)) {
48
					nonTestElements.add(new MenuInfo(item.getStaticLabel(), name));
54
					nonTestElements.add(new MenuInfo(item.getStaticLabel(), name));
49
				}
55
				}
50
				if (categories.contains(LISTENERS)) {
56
				if (categories.contains(LISTENERS)) {
51
					listeners.add(new MenuInfo(item.getStaticLabel(), name));
57
					listeners.add(new MenuInfo(item.getStaticLabel(), name));
52
				}
58
				}
53
				if (categories.contains(CONFIG_ELEMENTS)) {
59
				if (categories.contains(CONFIG_ELEMENTS)) {
54
					configElements.add(new MenuInfo(item.getStaticLabel(), name));
60
					configElements.add(new MenuInfo(item.getStaticLabel(), name));
55
				}
61
				}
56
				if (categories.contains(TABLES)) {
57
					tables.add(new MenuInfo(item.getStaticLabel(), name));
58
				}
59
				if (categories.contains(REPORT_PAGE)) {
60
					reportPage.add(new MenuInfo(item.getStaticLabel(), name));
61
				}
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)5.1
Clones locationClones are in different classes
Number of node comparisons414
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements33
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)49.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    22
    String name = (String)iter.next();
    24
    String name = (String)iter.next();
    23
    if (name.endsWith("JMeterTreeNode") || name.endsWith("TestBeanGUI"))
    25
    if (name.endsWith("JMeterTreeNode") || name.endsWith("TestBeanGUI"))
    24
    continue;
    24
    continue;
    26
    continue;
    Preondition Violations
    Statement continue; without innermost loop
    Statement continue; without innermost loop
    26
    continue;
    25
    JMeterGUIComponent item;
    27
    JMeterGUIComponent item;
    26
    try
    28
    try
    27
    Class c = Class.forName(name);
    29
    Class c = Class.forName(name);
    28
    if (TestBean.class.isAssignableFrom(c))
    30
    if (TestBean.class.isAssignableFrom(c))
    29
    item = new TestBeanGUI(c);
    31
    item = new TestBeanGUI(c);
    else
    else
    30
    item = (JMeterGUIComponent)c.newInstance();
    32
    item = (JMeterGUIComponent)c.newInstance();
    31
    if (elementsToSkip.contains(name) || elementsToSkip.contains(item.getStaticLabel()))
    33
    if (elementsToSkip.contains(name) || elementsToSkip.contains(item.getStaticLabel()))
    32
    log.info("Skipping " + name);
    34
    log.info("Skipping " + name);
    33
    continue;
    33
    continue;
    35
    continue;
    Preondition Violations
    Statement continue; without innermost loop
    Statement continue; without innermost loop
    35
    continue;
    else
    else
    34
    elementsToSkip.add(name);
    36
    elementsToSkip.add(name);
    35
    Collection categories = item.getMenuCategories();
    37
    Collection categories = item.getMenuCategories();
    36
    if (categories == null)
    38
    if (categories == null)
    37
    log.debug(name + " participates in no menus.");
    39
    log.debug(name + " participates in no menus.");
    38
    continue;
    38
    continue;
    40
    continue;
    Preondition Violations
    Statement continue; without innermost loop
    Statement continue; without innermost loop
    40
    continue;
    39
    if (categories.contains(POST_PROCESSORS))
    43
    if (categories.contains(POST_PROCESSORS))
    40
    postProcessors.add(new MenuInfo(item.getStaticLabel(), name));
    44
    postProcessors.add(new MenuInfo(item.getStaticLabel(), name));
    41
    if (categories.contains(PRE_PROCESSORS))
    45
    if (categories.contains(PRE_PROCESSORS))
    42
    preProcessors.add(new MenuInfo(item.getStaticLabel(), name));
    46
    preProcessors.add(new MenuInfo(item.getStaticLabel(), name));
    43
    if (categories.contains(CONTROLLERS))
    47
    if (categories.contains(CONTROLLERS))
    44
    controllers.add(new MenuInfo(item.getStaticLabel(), name));
    48
    controllers.add(new MenuInfo(item.getStaticLabel(), name));
    45
    if (categories.contains(NON_TEST_ELEMENTS))
    51
    if (categories.contains(NON_TEST_ELEMENTS))
    46
    nonTestElements.add(new MenuInfo(item.getStaticLabel(), name));
    52
    nonTestElements.add(new MenuInfo(item.getStaticLabel(), name));
    47
    if (categories.contains(LISTENERS))
    53
    if (categories.contains(LISTENERS))
    48
    listeners.add(new MenuInfo(item.getStaticLabel(), name));
    54
    listeners.add(new MenuInfo(item.getStaticLabel(), name));
    49
    if (categories.contains(CONFIG_ELEMENTS))
    55
    if (categories.contains(CONFIG_ELEMENTS))
    50
    configElements.add(new MenuInfo(item.getStaticLabel(), name));
    56
    configElements.add(new MenuInfo(item.getStaticLabel(), name));
    51
    if (categories.contains(TABLES))
    51
    if (categories.contains(TABLES))
    49
    if (categories.contains(SAMPLERS))
    Differences
    Expression1Expression2Difference
    TABLESSAMPLERSVARIABLE_NAME_MISMATCH
    49
    if (categories.contains(SAMPLERS))
    52
    tables.add(new MenuInfo(item.getStaticLabel(), name));
    52
    tables.add(new MenuInfo(item.getStaticLabel(), name));
    50
    samplers.add(new MenuInfo(item.getStaticLabel(), name));
    Differences
    Expression1Expression2Difference
    tablessamplersVARIABLE_NAME_MISMATCH
    50
    samplers.add(new MenuInfo(item.getStaticLabel(), name));
    53
    if (categories.contains(REPORT_PAGE))
    53
    if (categories.contains(REPORT_PAGE))
    41
    if (categories.contains(TIMERS))
    Differences
    Expression1Expression2Difference
    REPORT_PAGETIMERSVARIABLE_NAME_MISMATCH
    41
    if (categories.contains(TIMERS))
    54
    reportPage.add(new MenuInfo(item.getStaticLabel(), name));
    54
    reportPage.add(new MenuInfo(item.getStaticLabel(), name));
    42
    timers.add(new MenuInfo(item.getStaticLabel(), name));
    Differences
    Expression1Expression2Difference
    reportPagetimersVARIABLE_NAME_MISMATCH
    42
    timers.add(new MenuInfo(item.getStaticLabel(), name));
    Precondition Violations (7)
    Row Violation
    1Statement continue; without innermost loop
    2Statement continue; without innermost loop
    3Statement continue; without innermost loop
    4Statement continue; without innermost loop
    5Statement continue; without innermost loop
    6Statement continue; without innermost loop
    7Clone fragment #1 returns variables , while Clone fragment #2 returns variables categories, name, item