synchronized (threadGroupsInfoMap) { groupInfo = (ThroughputInfo)threadGroupsInfoMap.get(group); if (groupInfo == null) { groupInfo = new ThroughputInfo(); threadGroupsInfoMap.put(group, groupInfo); } }
synchronized (accumulators) { myTotals = (Totals) accumulators.get(myName); if (myTotals == null){ myTotals = new Totals(); accumulators.put(myName, myTotals); } }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/timers/ConstantThroughputTimer.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/reporters/Summariser.java
Method name: long calculateDelay() Method name: void threadStarted()
Number of AST nodes: 5 Number of AST nodes: 5
1
synchronized (threadGroupsInfoMap) {
1
synchronized (accumulators) {
2
                groupInfo = (ThroughputInfo)threadGroupsInfoMap.get(group);
2
            
3
    
3
myTotals = (Totals) accumulators.get(myName);
4
            if (groupInfo == null) {
4
            if (myTotals == null){
5
                    groupInfo = new ThroughputInfo();
5
                
6
                    threadGroupsInfoMap.put(group, groupInfo
6
myTotals = new Totals();
7
);
7
                accumulators.put(myName, myTotals);
8
                }
8
            
9
    
9
}
10
        }
10
        }
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.2
Clones locationClones are in different classes having the same super class
Number of node comparisons13
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)2.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    16
    synchronized (threadGroupsInfoMap)
    16
    synchronized (threadGroupsInfoMap)
    2
    synchronized (accumulators)
    Differences
    Expression1Expression2Difference
    threadGroupsInfoMapaccumulatorsVARIABLE_NAME_MISMATCH
    java.util.Mapjava.util.HashtableSUBCLASS_TYPE_MISMATCH
    2
    synchronized (accumulators)
                                                                                              
    3
    myTotals = (Totals)accumulators.get(myName);
    Preondition Violations
    Unmatched statement myTotals=(Totals)accumulators.get(myName); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3
    myTotals = (Totals)accumulators.get(myName);
    17
    groupInfo = (ThroughputInfo)threadGroupsInfoMap.get(group);
    17
    groupInfo = (ThroughputInfo)threadGroupsInfoMap.get(group);
    Preondition Violations
    Unmatched statement groupInfo=(ThroughputInfo)threadGroupsInfoMap.get(group); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                                              
    18
    if (groupInfo == null)
    18
    if (groupInfo == null)
    4
    if (myTotals == null)
    Differences
    Expression1Expression2Difference
    groupInfomyTotalsVARIABLE_NAME_MISMATCH
    org.apache.jmeter.timers.ConstantThroughputTimer.ThroughputInfoorg.apache.jmeter.reporters.Summariser.TotalsVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.apache.jmeter.timers.ConstantThroughputTimer.ThroughputInfo of variable groupInfo does not match with type org.apache.jmeter.reporters.Summariser.Totals of variable myTotals
    • Make classes org.apache.jmeter.timers.ConstantThroughputTimer.ThroughputInfo and org.apache.jmeter.reporters.Summariser.Totals extend a common superclass
    4
    if (myTotals == null)
                                                      
    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
    5
    myTotals = new Totals();
    19
    groupInfo = new ThroughputInfo();
    19
    groupInfo = new ThroughputInfo();
    Preondition Violations
    Unmatched statement groupInfo=new ThroughputInfo(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                          
    20
    threadGroupsInfoMap.put(group, groupInfo);
    20
    threadGroupsInfoMap.put(group, groupInfo);
    6
    accumulators.put(myName, myTotals);
    Differences
    Expression1Expression2Difference
    groupmyNameVARIABLE_NAME_MISMATCH
    org.apache.jmeter.threads.ThreadGroupjava.lang.StringVARIABLE_TYPE_MISMATCH
    groupInfomyTotalsVARIABLE_NAME_MISMATCH
    org.apache.jmeter.timers.ConstantThroughputTimer.ThroughputInfoorg.apache.jmeter.reporters.Summariser.TotalsVARIABLE_TYPE_MISMATCH
    threadGroupsInfoMapaccumulatorsVARIABLE_NAME_MISMATCH
    java.util.Mapjava.util.HashtableSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Type org.apache.jmeter.threads.ThreadGroup of variable group does not match with type java.lang.String of variable myName
    • Make classes org.apache.jmeter.threads.ThreadGroup and java.lang.String extend a common superclass
    Type org.apache.jmeter.timers.ConstantThroughputTimer.ThroughputInfo of variable groupInfo does not match with type org.apache.jmeter.reporters.Summariser.Totals of variable myTotals
    • Make classes org.apache.jmeter.timers.ConstantThroughputTimer.ThroughputInfo and org.apache.jmeter.reporters.Summariser.Totals extend a common superclass
    6
    accumulators.put(myName, myTotals);
    Precondition Violations (7)
    Row Violation
    1Unmatched statement myTotals=(Totals)accumulators.get(myName); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2Unmatched statement groupInfo=(ThroughputInfo)threadGroupsInfoMap.get(group); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3Type org.apache.jmeter.timers.ConstantThroughputTimer.ThroughputInfo of variable groupInfo does not match with type org.apache.jmeter.reporters.Summariser.Totals of variable myTotals
    4Unmatched statement myTotals=new Totals(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched statement groupInfo=new ThroughputInfo(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Type org.apache.jmeter.threads.ThreadGroup of variable group does not match with type java.lang.String of variable myName
    7Type org.apache.jmeter.timers.ConstantThroughputTimer.ThroughputInfo of variable groupInfo does not match with type org.apache.jmeter.reporters.Summariser.Totals of variable myTotals