command = (Command) commandClass.newInstance(); Iterator iter = command.getActionNames().iterator(); while (iter.hasNext()) { String commandName = (String) iter.next(); Set commandObjects = (Set) commands.get(commandName); if (commandObjects == null) { commandObjects = new HashSet(); commands.put(commandName, commandObjects); } commandObjects.add(command); }
while (iter.hasNext()) { Map.Entry entry = (Map.Entry) iter.next(); Object item = entry.getKey(); Object prop = entry.getValue(); if (newColl == null) { try { newColl = (Map) coll.getClass().newInstance(); } catch (Exception e) { log.error("Bad collection", e); return coll; } } newColl.put(item, convertObject(prop)); }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/gui/action/ActionRouter.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/testelement/property/AbstractProperty.java
Method name: void populateCommandMap() Method name: Map normalizeMap(Map)
Number of AST nodes: 9 Number of AST nodes: 8
1
command = (Command) commandClass.newInstance();
2
                        Iterator iter = command.getActionNames().iterator();
3
                        while (iter.hasNext()) {
4
                            String commandName = (String) iter.next();
5
                            Set command
1
while (iter.hasNext()) {
2
			Map.Entry entry = (Map.Entry) iter.next();
3
            Object item = entry.getKey();
6
Objects = (Set) commands.get(commandName);
4
			Object
7
                            if (commandObjects == null) {
8
                                commandObjects = new HashSet();
9
                                commands.put(commandName, commandObjects);
10
                            }
11
                            commandObjects.add(command);
12
                        
5
 prop = entry.getValue();
6
			if (newColl == null) {
7
				try {
8
					newColl = (Map) coll.getClass().newInstance();
9
				} catch (Exception e) {
10
					log.error("Bad collection", e);
11
					return coll;
12
				}
13
			}
14
			newColl.put(item, convertObject(prop));
13
}
15
		}
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones locationClones are in different classes
Number of node comparisons1