String formatted = Integer.toHexString(intval); StringBuffer buf = new StringBuffer("00000000"); buf.replace( 8-formatted.length(), 8, formatted ); return buf.toString();
String formatted = Integer.toHexString(shortval); StringBuffer buf = new StringBuffer("0000"); buf.replace( 4-formatted.length(), 4, formatted ); return buf.toString();
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/id/UUIDHexGenerator.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/id/UUIDHexGenerator.java
Method name: String format(int) Method name: String format(short)
Number of AST nodes: 4 Number of AST nodes: 4
1
String formatted = Integer.toHexString(intval);
1
String formatted = Integer.toHexString(shortval);
2
		StringBuffer buf = new StringBuffer("00000000");
2
		StringBuffer buf = new StringBuffer("0000");
3
		buf.replace( 8-formatted.length(), 8, formatted );
3
		buf.replace( 4-formatted.length(), 4, formatted );
4
		return buf.toString();
4
		return buf.toString();
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.0
Clones locationClones are declared in the same class
Number of node comparisons10
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    String formatted = Integer.toHexString(intval);
    1
    String formatted = Integer.toHexString(intval);
    1
    String formatted = Integer.toHexString(shortval);
    Differences
    Expression1Expression2Difference
    intvalshortvalVARIABLE_NAME_MISMATCH
    intshortVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type int of variable intval does not match with type short of variable shortval
    1
    String formatted = Integer.toHexString(shortval);
    2
    StringBuffer buf = new StringBuffer("00000000");
    2
    StringBuffer buf = new StringBuffer("00000000");
    2
    StringBuffer buf = new StringBuffer("0000");
    Differences
    Expression1Expression2Difference
    "00000000""0000"LITERAL_VALUE_MISMATCH
    2
    StringBuffer buf = new StringBuffer("0000");
    3
    buf.replace(8 - formatted.length(), 8, formatted);
    3
    buf.replace(8 - formatted.length(), 8, formatted);
    3
    buf.replace(4 - formatted.length(), 4, formatted);
    Differences
    Expression1Expression2Difference
    84LITERAL_VALUE_MISMATCH
    84LITERAL_VALUE_MISMATCH
    3
    buf.replace(4 - formatted.length(), 4, formatted);
    4
    return buf.toString();
    4
    return buf.toString();
    Precondition Violations (1)
    Row Violation
    1Type int of variable intval does not match with type short of variable shortval