if(expected != null && actual != null) { if(expected.length != actual.length) { System.out.println(">>>>>>>>>>>>>>>>>>>> (expected) : length " + expected.length); System.out.println(new String(expected,"UTF-8")); System.out.println("==================== (actual) : length " + actual.length); System.out.println(new String(actual,"UTF-8")); System.out.println("<<<<<<<<<<<<<<<<<<<<"); fail("arrays have different length, expected is " + expected.length + ", actual is " + actual.length); } else { for(int i = 0; i < expected.length; i++) { if(expected[i] != actual[i]) { System.out.println(">>>>>>>>>>>>>>>>>>>> (expected) : length " + expected.length); System.out.println(new String(expected,0,i+1)); System.out.println("==================== (actual) : length " + actual.length); System.out.println(new String(actual,0,i+1)); System.out.println("<<<<<<<<<<<<<<<<<<<<"); /* // Useful to when debugging for(int j = 0; j < expected.length; j++) { System.out.print(expected[j] + " "); } System.out.println(); for(int j = 0; j < actual.length; j++) { System.out.print(actual[j] + " "); } System.out.println(); */ fail("byte at position " + i + " is different, expected is " + expected[i] + ", actual is " + actual[i]); } } } } else { fail("expected or actual byte arrays were null"); }
if(expected != null && actual != null) { if(expected.length != actual.length) { System.out.println(">>>>>>>>>>>>>>>>>>>>"); System.out.println(new String(expected,"UTF-8")); System.out.println("===================="); System.out.println(new String(actual,"UTF-8")); System.out.println("<<<<<<<<<<<<<<<<<<<<"); fail("arrays have different length, expected is " + expected.length + ", actual is " + actual.length); } else { for(int i = 0; i < expected.length; i++) { if(expected[i] != actual[i]) { System.out.println(">>>>>>>>>>>>>>>>>>>>"); System.out.println(new String(expected,0,i+1)); System.out.println("===================="); System.out.println(new String(actual,0,i+1)); System.out.println("<<<<<<<<<<<<<<<<<<<<"); /* // Useful to when debugging for(int j = 0; j < expected.length; j++) { System.out.print(expected[j] + " "); } System.out.println(); for(int j = 0; j < actual.length; j++) { System.out.print(actual[j] + " "); } System.out.println(); */ fail("byte at position " + i + " is different, expected is " + expected[i] + ", actual is " + actual[i]); } } } } else { fail("expected or actual byte arrays were null"); }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/protocol/http/control/TestHTTPMirrorThread.java File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/protocol/http/sampler/TestHTTPSamplersAgainstHttpMirrorServer.java
Method name: void checkArraysHaveSameContent(byte[], byte[]) Method name: void checkArraysHaveSameContent(byte[], byte[])
Number of AST nodes: 17 Number of AST nodes: 17
1
if(expected != null && actual != null) {
1
if(expected != null && actual != null) {
2
            if(expected.length != actual.length) {
2
            if(expected.length != actual.length) {
3
            	System.out.println(">>>>>>>>>>>>>>>>>>>> (expected) : length " + expected.length);
3
            	System.out.println(">>>>>>>>>>>>>>>>>>>>");
4
            	System.out.println(new String(expected,"UTF-8"));
4
            	System.out.println(new String(expected,"UTF-8"));
5
            	System.out.println("==================== (actual) : length " + actual.length);
5
            	System.out.println("====================");
6
            	System.out.println(new String(actual,"UTF-8"));
6
            	System.out.println(new String(actual,"UTF-8"));
7
            	System.out.println("<<<<<<<<<<<<<<<<<<<<");
7
            	System.out.println("<<<<<<<<<<<<<<<<<<<<");
8
                fail("arrays have different length, expected is " + expected.length + ", actual is " + actual.length);
8
                fail("arrays have different length, expected is " + expected.length + ", actual is " + actual.length);
9
            }
9
            }
10
            else {
10
            else {
11
                for(int i = 0; i < expected.length; i++) {
11
                for(int i = 0; i < expected.length; i++) {
12
                    if(expected[i] != actual[i]) {
12
                    if(expected[i] != actual[i]) {
13
                    	System.out.println(">>>>>>>>>>>>>>>>>>>> (expected) : length " + expected.length);
13
                    	System.out.println(">>>>>>>>>>>>>>>>>>>>");
14
                       	System.out.println(new String(expected,0,i+1));
14
                       	System.out.println(new String(expected,0,i+1));
15
                    	System.out.println("==================== (actual) : length " + actual.length);
15
                    	System.out.println("====================");
16
                    	System.out.println(new String(actual,0,i+1));
16
                    	System.out.println(new String(actual,0,i+1));
17
                    	System.out.println("<<<<<<<<<<<<<<<<<<<<");
17
                    	System.out.println("<<<<<<<<<<<<<<<<<<<<");
18
/*
18
/*
19
                        
19
                     	// Useful to when debugging
20
                        // Useful to when debugging
20
                    	for(int j = 0; j  < expected.length; j++) {
21
                        for(int j = 0; j  < expected.length; j++) {
21
                    		System.out.print(expected[j] + " ");
22
                            System.out.print(expected[j] + " ");
22
                    	}
23
                        }
23
                    	System.out.println();
24
                        System.out.println();
24
                    	for(int j = 0; j  < actual.length; j++) {
25
                        for(int j = 0; j  < actual.length; j++) {
25
                    		System.out.print(actual[j] + " ");
26
                            System.out.print(actual[j] + " ");
26
                    	}
27
                        }
27
                    	System.out.println();
28
                        System.out.println();
28
*/                    	
29
*/                        
29
                        fail("byte at position " + i + " is different, expected is " + expected[i] + ", actual is " + actual[i]);
30
                        fail("byte at position " + i + " is different, expected is " + expected[i] + ", actual is " + actual[i]);
30
                    }
31
                    }
31
                }
32
                }
32
            }
33
            }
33
        }
34
        }
34
        else {
35
        else {
35
            fail("expected or actual byte arrays were null");
36
            fail("expected or actual byte arrays were null");
36
        }
37
        }
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.8
Clones locationClones are in different classes having the same super class
Number of node comparisons103
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements17
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)21.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (expected != null && actual != null)
    1
    if (expected != null && actual != null)
    2
    if (expected.length != actual.length)
    2
    if (expected.length != actual.length)
    3
    System.out.println(">>>>>>>>>>>>>>>>>>>> (expected) : length " + expected.length);
    3
    System.out.println(">>>>>>>>>>>>>>>>>>>> (expected) : length " + expected.length);
    3
    System.out.println(">>>>>>>>>>>>>>>>>>>>");
    Differences
    Expression1Expression2Difference
    ">>>>>>>>>>>>>>>>>>>> (expected) : length " + expected.length">>>>>>>>>>>>>>>>>>>>"TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression ">>>>>>>>>>>>>>>>>>>> (expected) : length " + expected.length cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3
    System.out.println(">>>>>>>>>>>>>>>>>>>>");
    4
    System.out.println(new String(expected, "UTF-8"));
    4
    System.out.println(new String(expected, "UTF-8"));
    5
    System.out.println("==================== (actual) : length " + actual.length);
    5
    System.out.println("==================== (actual) : length " + actual.length);
    5
    System.out.println("====================");
    Differences
    Expression1Expression2Difference
    "==================== (actual) : length " + actual.length"===================="TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression "==================== (actual) : length " + actual.length cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5
    System.out.println("====================");
    6
    System.out.println(new String(actual, "UTF-8"));
    6
    System.out.println(new String(actual, "UTF-8"));
    7
    System.out.println("<<<<<<<<<<<<<<<<<<<<");
    7
    System.out.println("<<<<<<<<<<<<<<<<<<<<");
    8
    fail("arrays have different length, expected is " + expected.length + ", actual is " + actual.length);
    8
    fail("arrays have different length, expected is " + expected.length + ", actual is " + actual.length);
    else
    else
    9
    for (int i = 0; i < expected.length; i++)
    9
    for (int i = 0; i < expected.length; i++)
    10
    if (expected[i] != actual[i])
    10
    if (expected[i] != actual[i])
    11
    System.out.println(">>>>>>>>>>>>>>>>>>>> (expected) : length " + expected.length);
    11
    System.out.println(">>>>>>>>>>>>>>>>>>>> (expected) : length " + expected.length);
    11
    System.out.println(">>>>>>>>>>>>>>>>>>>>");
    Differences
    Expression1Expression2Difference
    ">>>>>>>>>>>>>>>>>>>> (expected) : length " + expected.length">>>>>>>>>>>>>>>>>>>>"TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression ">>>>>>>>>>>>>>>>>>>> (expected) : length " + expected.length cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11
    System.out.println(">>>>>>>>>>>>>>>>>>>>");
    12
    System.out.println(new String(expected, 0, i + 1));
    12
    System.out.println(new String(expected, 0, i + 1));
    13
    System.out.println("==================== (actual) : length " + actual.length);
    13
    System.out.println("==================== (actual) : length " + actual.length);
    13
    System.out.println("====================");
    Differences
    Expression1Expression2Difference
    "==================== (actual) : length " + actual.length"===================="TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression "==================== (actual) : length " + actual.length cannot be parameterized, because it has dependencies to/from statements that will be extracted
    13
    System.out.println("====================");
    14
    System.out.println(new String(actual, 0, i + 1));
    14
    System.out.println(new String(actual, 0, i + 1));
    15
    System.out.println("<<<<<<<<<<<<<<<<<<<<");
    15
    System.out.println("<<<<<<<<<<<<<<<<<<<<");
    16
    fail("byte at position " + i + " is different, expected is " + expected[i] + ", actual is " + actual[i]);
    16
    fail("byte at position " + i + " is different, expected is " + expected[i] + ", actual is " + actual[i]);
    else
    else
    17
    fail("expected or actual byte arrays were null");
    17
    fail("expected or actual byte arrays were null");
    Precondition Violations (4)
    Row Violation
    1Expression ">>>>>>>>>>>>>>>>>>>> (expected) : length " + expected.length cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression "==================== (actual) : length " + actual.length cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression ">>>>>>>>>>>>>>>>>>>> (expected) : length " + expected.length cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression "==================== (actual) : length " + actual.length cannot be parameterized, because it has dependencies to/from statements that will be extracted