Argument arg = (Argument) iter.next().getObjectValue();
// Because CollectionProperty.mergeIn will not prevent adding two
// properties of the same name, we need to select the first value so
// that this element's values prevail over defaults provided by
// configuration
// elements:
if (!argMap.containsKey(arg.getName())) {
argMap.put(arg.getName(), arg.getValue());
}
try {
if (SampleResult.TEXT.equals(res.getDataType())){
writer.setValue(new String(res.getResponseData(), res.getDataEncodingWithDefault()));
}
// Otherwise don't save anything - no point
} catch (UnsupportedEncodingException e) {
writer.setValue("Unsupported encoding in response data, can't record.");
}
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/config/Arguments.java
|
|
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/save/converters/SampleResultConverter.java
|
Method name: Map getArgumentsAsMap()
|
|
Method name: void saveResponseData(HierarchicalStreamWriter, MarshallingContext, SampleResult, SampleSaveConfiguration)
|
Number of AST nodes: 3
|
|
Number of AST nodes: 3
|
|
1 | Argument arg = (Argument) iter.next().getObjectValue();↵ | | |
|
2 | // Because CollectionProperty.mergeIn will not prevent adding two↵ | | |
|
3 | // properties of the same name, we need to select the first value so↵ | | |
|
4 | // that this element's values prevail over defaults provided by↵ | | |
|
5 | // configuration↵ | | |
|
6 | // elements:↵ | | |
|
7 | if (!argMap.containsKey(arg.getName())) {↵ | | |
|
8 | argMap.put(arg.getName(), arg.getValue()↵ | | 1 | try {↵
|
| | | 2 | if (SampleResult.TEXT.equals(res.getDataType())){↵
|
| | | 3 | writer.setValue(new String(res.getResponseData(), res.getDataEncodingWithDefault()));↵
|
| | | 4 | }↵
|
| | | 5 | // Otherwise don't save anything - no point↵
|
| | | 6 | } catch (UnsupportedEncodingException e) {↵
|
9 | );↵ | | 7 | writer.setValue("Unsupported encoding in response data, can't record.");↵
|
10 | } | | 8 | }
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.1 |
Clones location | Clones are in different classes |
Number of node comparisons | 5 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 1 |
Number of unmapped statements in the first code fragment | 2 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 2.0 |
Clone type | Type 3 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
4 | Argument arg = (Argument)iter.next().getObjectValue(); | | | |
5 | if (!argMap.containsKey(arg.getName())) | | 5 | if (SampleResult.TEXT.equals(res.getDataType())) |
| | | 6 | writer.setValue(new String(res.getResponseData(), res.getDataEncodingWithDefault())); |
6 | argMap.put(arg.getName(), arg.getValue()); | | | |
Precondition Violations (2)
Row |
Violation |
1 | Unmatched statement Argument arg=(Argument)iter.next().getObjectValue(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement argMap.put(arg.getName(),arg.getValue()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |