if (result == null) {
try {
result =
(InputSource) resolveEntity.invoke(resolverImpl,
new Object[] {publicId, systemId});
} catch (Exception ex) {
throw new BuildException(ex);
}
}
try {
messageDigest = MessageDigest.getInstance(algorithm);
} catch (NoSuchAlgorithmException noalgo) {
throw new BuildException(noalgo, getLocation());
}
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/XMLCatalog.java
|
|
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/Checksum.java
|
Method name: InputSource resolveEntity(String, String)
|
|
Method name: boolean validateAndExecute()
|
Number of AST nodes: 3
|
|
Number of AST nodes: 2
|
|
1 | if (result == null) {↵ | | |
|
2 | try {↵ | | |
|
3 | result =↵ | | |
|
4 | (InputSource) resolveEntity.invoke(resolverImpl,↵ | | |
|
5 | new Object[] {publicId, systemId});↵ | | |
|
6 | ↵ | | 1 | try {↵
|
| | | 2 | messageDigest = MessageDigest.getInstance(algorithm);↵
|
7 | } catch (Exception ex) {↵ | | 3 | } catch (↵
|
8 | ↵ | | 4 | NoSuchAlgorithmException noalgo) {↵
|
9 | throw new BuildException(ex);↵ | | 5 | throw new BuildException(↵
|
10 | }↵ | | |
|
11 | ↵ | | 6 | noalgo, getLocation());↵
|
12 | } | | 7 | }
|
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.2 |
Clones location | Clones are in different classes |
Number of node comparisons | 4 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 1 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 5.7 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
10 | try | | 32 | try |
11 | result = (InputSource)resolveEntity.invoke(resolverImpl, new Object[] {publicId, systemId}); | | | |
| | | 33 | messageDigest = MessageDigest.getInstance(algorithm); |
Precondition Violations (2)
Row |
Violation |
1 | Unmatched statement result=(InputSource)resolveEntity.invoke(resolverImpl,new Object[]{publicId,systemId}); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted |
2 | Unmatched statement messageDigest=MessageDigest.getInstance(algorithm); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted |