JMeterProperty prop = getProperty(MAXTHROUGHPUT); int retVal = 1; if (prop instanceof IntegerProperty) { retVal = (((IntegerProperty) prop).getIntValue()); } else { try { retVal = Integer.parseInt(prop.getStringValue()); } catch (NumberFormatException e) { } } return retVal;
JMeterProperty prop = getProperty(PERCENTTHROUGHPUT); float retVal = 100; if (prop instanceof FloatProperty) { retVal = (((FloatProperty) prop).getFloatValue()); } else { try { retVal = Float.parseFloat(prop.getStringValue()); } catch (NumberFormatException e) { } } return retVal;
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/control/ThroughputController.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/control/ThroughputController.java
Method name: int getMaxThroughputAsInt() Method name: float getPercentThroughputAsFloat()
Number of AST nodes: 7 Number of AST nodes: 7
1
JMeterProperty prop = getProperty(MAXTHROUGHPUT);
1
JMeterProperty prop = getProperty(PERCENTTHROUGHPUT);
2
		int retVal = 1;
2
		float retVal = 100;
3
		if (prop instanceof IntegerProperty) {
3
		if (prop instanceof FloatProperty) {
4
			retVal = (((IntegerProperty) prop).getIntValue());
4
			retVal = (((FloatProperty) prop).getFloatValue());
5
		} else {
5
		} else {
6
			try {
6
			try {
7
				retVal = Integer.parseInt(prop.getStringValue());
7
				retVal = Float.parseFloat(prop.getStringValue());
8
			} catch (NumberFormatException e) {
8
			} catch (NumberFormatException e) {
9
			}
9
			}
10
		}
10
		}
11
		return retVal;
11
		return retVal;
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.4
Clones locationClones are declared in the same class
Number of node comparisons17
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment4
    Number of unmapped statements in the second code fragment4
    Time elapsed for statement mapping (ms)2.4
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    JMeterProperty prop = getProperty(MAXTHROUGHPUT);
    1
    JMeterProperty prop = getProperty(MAXTHROUGHPUT);
    1
    JMeterProperty prop = getProperty(PERCENTTHROUGHPUT);
    Differences
    Expression1Expression2Difference
    MAXTHROUGHPUTPERCENTTHROUGHPUTVARIABLE_NAME_MISMATCH
    1
    JMeterProperty prop = getProperty(PERCENTTHROUGHPUT);
                                            
    2
    float retVal = 100;
    2
    int retVal = 1;
                                    
    3
    if (prop instanceof IntegerProperty)
    3
    if (prop instanceof IntegerProperty)
    3
    if (prop instanceof FloatProperty)
    Differences
    Expression1Expression2Difference
    org.apache.jmeter.testelement.property.IntegerPropertyorg.apache.jmeter.testelement.property.FloatPropertySUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression prop instanceof IntegerProperty cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression prop instanceof FloatProperty cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3
    if (prop instanceof FloatProperty)
                                                                                                        
    4
    retVal = (((FloatProperty)prop).getFloatValue());
    Preondition Violations
    Unmatched statement retVal=(((FloatProperty)prop).getFloatValue()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4
    retVal = (((FloatProperty)prop).getFloatValue());
    4
    retVal = (((IntegerProperty)prop).getIntValue());
    4
    retVal = (((IntegerProperty)prop).getIntValue());
    Preondition Violations
    Unmatched statement retVal=(((IntegerProperty)prop).getIntValue()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                        
    5
    try
    5
    try
                                                                                                        
    6
    retVal = Float.parseFloat(prop.getStringValue());
    Preondition Violations
    Unmatched statement retVal=Float.parseFloat(prop.getStringValue()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched statement retVal=Float.parseFloat(prop.getStringValue()); 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
    6
    retVal = Float.parseFloat(prop.getStringValue());
    6
    retVal = Integer.parseInt(prop.getStringValue());
    6
    retVal = Integer.parseInt(prop.getStringValue());
    Preondition Violations
    Unmatched statement retVal=Integer.parseInt(prop.getStringValue()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched statement retVal=Integer.parseInt(prop.getStringValue()); 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
                                                                                                        
                                      
    7
    return retVal;
    Preondition Violations
    Unmatched return retVal;
    7
    return retVal;
    7
    return retVal;
    7
    return retVal;
    Preondition Violations
    Unmatched return retVal;
                                      
    Precondition Violations (10)
    Row Violation
    1Expression prop instanceof IntegerProperty cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression prop instanceof FloatProperty cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Unmatched statement retVal=(((FloatProperty)prop).getFloatValue()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement retVal=(((IntegerProperty)prop).getIntValue()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched statement retVal=Float.parseFloat(prop.getStringValue()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Unmatched statement retVal=Float.parseFloat(prop.getStringValue()); 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
    7Unmatched statement retVal=Integer.parseInt(prop.getStringValue()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8Unmatched statement retVal=Integer.parseInt(prop.getStringValue()); 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
    9Unmatched return retVal;
    10Unmatched return retVal;