if (literal == null) return null; byte[] value = Base64.decode(collapseWhiteSpace(literal)); if (value == null) { throw new InvalidDatatypeValueException("Invalid base64Binary value: '" + literal + "'"); } return value;
if (literal == null) return null; byte[] value = HexBin.decode(collapseWhiteSpace(literal)); if (value == null) { throw new InvalidDatatypeValueException("Invalid hexBinary value: '" + literal + "'"); } return value;
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/xml/type/impl/XMLTypeFactoryImpl.java File path: /emf-2.4.1/src/org/eclipse/emf/ecore/xml/type/impl/XMLTypeFactoryImpl.java
Method name: byte[] createBase64Binary(String) Method name: byte[] createHexBinary(String)
Number of AST nodes: 6 Number of AST nodes: 6
1
if (literal == null) return null;
1
if (literal == null) return null;
2
    byte[] value = Base64.decode(collapseWhiteSpace(literal));
2
    byte[] value = HexBin.decode(collapseWhiteSpace(literal));
3
    if (value == null)
3
    if (value == null)
4
    {
4
    {
5
      throw new InvalidDatatypeValueException("Invalid base64Binary value: '" + literal + "'");
5
      throw new InvalidDatatypeValueException("Invalid hexBinary value: '" + literal + "'");
6
    }
6
    }
7
    return value;
7
    return value;
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.3
Clones locationClones are declared in the same class
Number of node comparisons17
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)1.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (literal == null)
    1
    if (literal == null)
    2
    return null;
    2
    return null;
    3
    byte[] value = Base64.decode(collapseWhiteSpace(literal));
    3
    byte[] value = Base64.decode(collapseWhiteSpace(literal));
    3
    byte[] value = HexBin.decode(collapseWhiteSpace(literal));
    Differences
    Expression1Expression2Difference
    org.eclipse.emf.ecore.xml.type.internal.DataValue.Base64org.eclipse.emf.ecore.xml.type.internal.DataValue.HexBinVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.eclipse.emf.ecore.xml.type.internal.DataValue.Base64 of variable Base64 does not match with type org.eclipse.emf.ecore.xml.type.internal.DataValue.HexBin of variable HexBin
    • Make classes org.eclipse.emf.ecore.xml.type.internal.DataValue.Base64 and org.eclipse.emf.ecore.xml.type.internal.DataValue.HexBin extend a common superclass
    3
    byte[] value = HexBin.decode(collapseWhiteSpace(literal));
    4
    if (value == null)
    4
    if (value == null)
    5
    throw new InvalidDatatypeValueException("Invalid base64Binary value: '" + literal + "'");
    5
    throw new InvalidDatatypeValueException("Invalid base64Binary value: '" + literal + "'");
    5
    throw new InvalidDatatypeValueException("Invalid hexBinary value: '" + literal + "'");
    Differences
    Expression1Expression2Difference
    "Invalid base64Binary value: '""Invalid hexBinary value: '"LITERAL_VALUE_MISMATCH
    5
    throw new InvalidDatatypeValueException("Invalid hexBinary value: '" + literal + "'");
    6
    return value;
    6
    return value;
    Precondition Violations (1)
    Row Violation
    1Type org.eclipse.emf.ecore.xml.type.internal.DataValue.Base64 of variable Base64 does not match with type org.eclipse.emf.ecore.xml.type.internal.DataValue.HexBin of variable HexBin