synchronized (accumulators) { myTotals = (Totals) accumulators.get(myName); if (myTotals == null){ myTotals = new Totals(); accumulators.put(myName, myTotals); } }
comp = (TestBeanGUI) testBeanGUIs.get(testClass); if (comp == null) { comp = new TestBeanGUI(testClass); testBeanGUIs.put(testClass, comp); }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/reporters/Summariser.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/gui/ReportGuiPackage.java
Method name: void threadStarted() Method name: JMeterGUIComponent getGuiFromCache(Class, Class)
Number of AST nodes: 5 Number of AST nodes: 4
1
synchronized (accumulators) {
2
            myTotals = (Totals) accumulators.get(myName);
3
            if (myTotals
1
comp = (TestBeanGUI) testBeanGUIs.get(testClass);
4
 == null){
2
			if (comp == null) {
5
                myTotals = new Totals();
6
                accumulators.put(myName, myTotals);
7
            }
8
        
3
				comp = new TestBeanGUI(testClass);
4
				testBeanGUIs.put(testClass, comp);
9
}
5
			}
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)0.1
Clones locationClones are in different classes
Number of node comparisons11
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)0.8
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                                                                                      
    3
    comp = (TestBeanGUI)testBeanGUIs.get(testClass);
    4
    if (myTotals == null)
    4
    if (myTotals == null)
    4
    if (comp == null)
    Differences
    Expression1Expression2Difference
    myTotalscompVARIABLE_NAME_MISMATCH
    org.apache.jmeter.reporters.Summariser.Totalsorg.apache.jmeter.gui.JMeterGUIComponentVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.apache.jmeter.reporters.Summariser.Totals of variable myTotals does not match with type org.apache.jmeter.gui.JMeterGUIComponent of variable comp
    • Make classes org.apache.jmeter.reporters.Summariser.Totals and org.apache.jmeter.gui.JMeterGUIComponent extend a common superclass
    4
    if (comp == null)
                                                                          
    5
    comp = new TestBeanGUI(testClass);
    Preondition Violations
    Unmatched statement comp=new TestBeanGUI(testClass); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5
    comp = new TestBeanGUI(testClass);
    5
    myTotals = new Totals();
    5
    myTotals = new Totals();
    Preondition Violations
    Unmatched statement myTotals=new Totals(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                      
    6
    accumulators.put(myName, myTotals);
    6
    accumulators.put(myName, myTotals);
    6
    testBeanGUIs.put(testClass, comp);
    Differences
    Expression1Expression2Difference
    myNametestClassVARIABLE_NAME_MISMATCH
    java.lang.Stringjava.lang.ClassVARIABLE_TYPE_MISMATCH
    accumulatorstestBeanGUIsVARIABLE_NAME_MISMATCH
    java.util.Hashtablejava.util.MapVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.String of variable myName does not match with type java.lang.Class of variable testClass
    • Make classes java.lang.String and java.lang.Class extend a common superclass
    Type java.util.Hashtable of variable accumulators does not match with type java.util.Map of variable testBeanGUIs
    • Make classes java.util.Hashtable and java.util.Map extend a common superclass
    6
    testBeanGUIs.put(testClass, comp);
    Precondition Violations (5)
    Row Violation
    1Type org.apache.jmeter.reporters.Summariser.Totals of variable myTotals does not match with type org.apache.jmeter.gui.JMeterGUIComponent of variable comp
    2Unmatched statement comp=new TestBeanGUI(testClass); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement myTotals=new Totals(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Type java.lang.String of variable myName does not match with type java.lang.Class of variable testClass
    5Type java.util.Hashtable of variable accumulators does not match with type java.util.Map of variable testBeanGUIs