if (literal == null) return null;
byte[] value = HexBin.decode(collapseWhiteSpace(literal));
if (value == null)
{
throw new InvalidDatatypeValueException("Invalid hexBinary value: '" + literal + "'");
}
return value;
if (literal == null) return null;
byte[] value = Base64.decode(collapseWhiteSpace(literal));
if (value == null)
{
throw new InvalidDatatypeValueException("Invalid base64Binary 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[] createHexBinary(String)
|
|
Method name: byte[] createBase64Binary(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 = HexBin.decode(collapseWhiteSpace(literal));↵ | | 2 | byte[] value = Base64.decode(collapseWhiteSpace(literal));↵
|
3 | if (value == null)↵ | | 3 | if (value == null)↵
|
4 | {↵ | | 4 | {↵
|
5 | throw new InvalidDatatypeValueException("Invalid hexBinary value: '" + literal + "'");↵ | | 5 | throw new InvalidDatatypeValueException("Invalid base64Binary value: '" + literal + "'");↵
|
6 | }↵ | | 6 | }↵
|
7 | return value; | | 7 | return value;
|
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.3 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 17 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 6 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 0.9 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
1 | if (literal == null) | | 1 | if (literal == null) |
2 | | | 2 | |
3 | byte[] value = HexBin.decode(collapseWhiteSpace(literal)); | | 3 | byte[] value = Base64.decode(collapseWhiteSpace(literal)); |
4 | if (value == null) | | 4 | if (value == null) |
5 | throw new InvalidDatatypeValueException("Invalid hexBinary value: '" + literal + "'"); | | 5 | throw new InvalidDatatypeValueException("Invalid base64Binary value: '" + literal + "'"); |
6 | return value; | | 6 | return value; |
Precondition Violations (1)
Row |
Violation |
1 | Type org.eclipse.emf.ecore.xml.type.internal.DataValue.HexBin of variable HexBin does not match with type org.eclipse.emf.ecore.xml.type.internal.DataValue.Base64 of variable Base64 |