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