secRand.nextBytes(secRandBuf16); secRandBuf16[6] &= 0x0f; secRandBuf16[6] |= 0x40; /* version 4 */ secRandBuf16[8] &= 0x3f; secRandBuf16[8] |= 0x80; /* IETF variant */ secRandBuf16[10] |= 0x80; /* multicast bit */ long mostSig = 0; for (int i = 0; i < 8; i++) { mostSig = (mostSig << 8) | (secRandBuf16[i] & 0xff); } long leastSig = 0; for (int i = 8; i < 16; i++) { leastSig = (leastSig << 8) | (secRandBuf16[i] & 0xff); } return (digits(mostSig >> 32, 8) + "-" + digits(mostSig >> 16, 4) + "-" + digits(mostSig, 4) + "-" + digits(leastSig >> 48, 4) + "-" + digits( leastSig, 12));
secRand.nextBytes(secRandBuf16); secRandBuf16[6] &= 0x0f; secRandBuf16[6] |= 0x40; /* version 4 */ secRandBuf16[8] &= 0x3f; secRandBuf16[8] |= 0x80; /* IETF variant */ secRandBuf16[10] |= 0x80; /* multicast bit */ long mostSig = 0; for (int i = 0; i < 8; i++) { mostSig = (mostSig << 8) | (secRandBuf16[i] & 0xff); } long leastSig = 0; for (int i = 8; i < 16; i++) { leastSig = (leastSig << 8) | (secRandBuf16[i] & 0xff); } return (digits(mostSig >> 32, 8) + "-" + digits(mostSig >> 16, 4) + "-" //$NON-NLS-1$//$NON-NLS-2$ + digits(mostSig, 4) + "-" + digits(leastSig >> 48, 4) + "-" + digits( //$NON-NLS-1$//$NON-NLS-2$ leastSig, 12));
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/calendar/src/main/java/org/columba/calendar/base/UUIDGenerator.java File path: /columba-1.4-src/core/src/main/java/org/columba/core/base/UUIDGenerator.java
Method name: String newUUID() Method name: String newUUID()
Number of AST nodes: 13 Number of AST nodes: 13
1
secRand.nextBytes(secRandBuf16);
1
secRand.nextBytes(secRandBuf16);
2
		secRandBuf16[6] &= 0x0f;
2
		secRandBuf16[6] &= 0x0f;
3
		secRandBuf16[6] |= 0x40; /* version 4 */
3
		secRandBuf16[6] |= 0x40; /* version 4 */
4
		secRandBuf16[8] &= 0x3f;
4
		secRandBuf16[8] &= 0x3f;
5
		secRandBuf16[8] |= 0x80; /* IETF variant */
5
		secRandBuf16[8] |= 0x80; /* IETF variant */
6
		secRandBuf16[10] |= 0x80; /* multicast bit */
6
		secRandBuf16[10] |= 0x80; /* multicast bit */
7
		long mostSig = 0;
7
		long mostSig = 0;
8
		for (int i = 0; i < 8; i++) {
8
		for (int i = 0; i < 8; i++) {
9
			mostSig = (mostSig << 8) | (secRandBuf16[i] & 0xff);
9
			mostSig = (mostSig << 8) | (secRandBuf16[i] & 0xff);
10
		}
10
		}
11
		long leastSig = 0;
11
		long leastSig = 0;
12
		for (int i = 8; i < 16; i++) {
12
		for (int i = 8; i < 16; i++) {
13
			leastSig = (leastSig << 8) | (secRandBuf16[i] & 0xff);
13
			leastSig = (leastSig << 8) | (secRandBuf16[i] & 0xff);
14
		}
14
		}
15
		return (digits(mostSig >> 32, 8) + "-" + digits(mostSig >> 16, 4) + "-"
15
		return (digits(mostSig >> 32, 8) + "-" + digits(mostSig >> 16, 4) + "-"  //$NON-NLS-1$//$NON-NLS-2$
16
				+ digits(mostSig, 4) + "-" + digits(leastSig >> 48, 4) + "-" + digits(
16
				+ digits(mostSig, 4) + "-" + digits(leastSig >> 48, 4) + "-" + digits(  //$NON-NLS-1$//$NON-NLS-2$
17
				leastSig, 12));
17
				leastSig, 12));
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.3
Clones locationClones are in different classes
Number of node comparisons54
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements13
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)4.8
    Clone typeType 1
    Mapped Statements
    ID Statement ID Statement
    1
    secRand.nextBytes(secRandBuf16);
    1
    secRand.nextBytes(secRandBuf16);
    2
    secRandBuf16[6] &= 0x0f;
    2
    secRandBuf16[6] &= 0x0f;
    3
    secRandBuf16[6] |= 0x40;
    3
    secRandBuf16[6] |= 0x40;
    4
    secRandBuf16[8] &= 0x3f;
    4
    secRandBuf16[8] &= 0x3f;
    5
    secRandBuf16[8] |= 0x80;
    5
    secRandBuf16[8] |= 0x80;
    6
    secRandBuf16[10] |= 0x80;
    6
    secRandBuf16[10] |= 0x80;
    7
    long mostSig = 0;
    7
    long mostSig = 0;
    8
    for (int i = 0; i < 8; i++)
    8
    for (int i = 0; i < 8; i++)
    9
    mostSig = (mostSig << 8) | (secRandBuf16[i] & 0xff);
    9
    mostSig = (mostSig << 8) | (secRandBuf16[i] & 0xff);
    10
    long leastSig = 0;
    10
    long leastSig = 0;
    11
    for (int i = 8; i < 16; i++)
    11
    for (int i = 8; i < 16; i++)
    12
    leastSig = (leastSig << 8) | (secRandBuf16[i] & 0xff);
    12
    leastSig = (leastSig << 8) | (secRandBuf16[i] & 0xff);
    13
    return (digits(mostSig >> 32, 8) + "-" + digits(mostSig >> 16, 4) + "-" + digits(mostSig, 4) + "-" + digits(leastSig >> 48, 4) + "-" + digits(leastSig, 12));
    13
    return (digits(mostSig >> 32, 8) + "-" + digits(mostSig >> 16, 4) + "-" + digits(mostSig, 4) + "-" + digits(leastSig >> 48, 4) + "-" + digits(leastSig, 12));
    Precondition Violations (0)
    Row Violation