Enumeration e = handler.getExtensionEnumeration(); while (e.hasMoreElements()) { Extension extension = (Extension) e.nextElement(); // retrieving the instance for the first time // creates an instance in ExtensionHandler subclass // // instance reference is kept in hashmap automatically IColumbaService service = getServiceInstance(extension); service.initService(); }
Enumeration e = handler.getExtensionEnumeration(); while (e.hasMoreElements()) { Extension extension = (Extension) e.nextElement(); IColumbaService service = getServiceInstance(extension); service.stopService(); }
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/core/src/main/java/org/columba/core/scripting/service/ServiceManager.java File path: /columba-1.4-src/core/src/main/java/org/columba/core/scripting/service/ServiceManager.java
Method name: void initServices() Method name: void stopServices()
Number of AST nodes: 5 Number of AST nodes: 5
1
Enumeration e = handler.getExtensionEnumeration();
1
Enumeration e = handler.getExtensionEnumeration();
2
		while (e.hasMoreElements()) {
2
		while (e.hasMoreElements()) {
3
			Extension extension = (Extension) e.nextElement();
3
			Extension extension = (Extension) e.nextElement();
4
			// retrieving the instance for the first time
5
			// creates an instance in ExtensionHandler subclass
6
			// 
7
			// instance reference is kept in hashmap automatically
8
			IColumbaService service = getServiceInstance(extension);
4
			IColumbaService service = getServiceInstance(extension);
9
			service.initService();
5
			service.stopService();
10
		}
6
		}
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)0.1
Clones locationClones are declared in the same class
Number of node comparisons17
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)2.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    Enumeration e = handler.getExtensionEnumeration();
    1
    Enumeration e = handler.getExtensionEnumeration();
    2
    while (e.hasMoreElements())
    2
    while (e.hasMoreElements())
    3
    Extension extension = (Extension)e.nextElement();
    3
    Extension extension = (Extension)e.nextElement();
    4
    IColumbaService service = getServiceInstance(extension);
    4
    IColumbaService service = getServiceInstance(extension);
                                                      
    5
    service.stopService();
    Preondition Violations
    Unmatched statement service.stopService(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5
    service.stopService();
    5
    service.initService();
    5
    service.initService();
    Preondition Violations
    Unmatched statement service.initService(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched statement service.initService(); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
                                                      
    Precondition Violations (3)
    Row Violation
    1Unmatched statement service.stopService(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement service.initService(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement service.initService(); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted