try {
System.out.println("Thread "+Thread.currentThread().getName());
md.getDatabaseProductName();
if (sleepTime > 0) {
Thread.sleep(sleepTime);
}
} catch (Exception e) {
handleException(e);
}
try {
System.out.println("Thread "+Thread.currentThread().getName());
md.getDatabaseProductVersion();
if (sleepTime > 0) {
Thread.sleep(sleepTime);
}
} catch (Exception e) {
handleException(e);
}
Clone fragments detected by clone detection tool
File path: /sql12/test/adhoc/test/DBMetaDataConcurrencyTester.java
|
|
File path: /sql12/test/adhoc/test/DBMetaDataConcurrencyTester.java
|
Method name: void run()
|
|
Method name: void run()
|
Number of AST nodes: 5
|
|
Number of AST nodes: 5
|
|
1 | try {↵ | | 1 | try {↵
|
2 | System.out.println("Thread "+Thread.currentThread().getName());↵ | | 2 | System.out.println("Thread "+Thread.currentThread().getName());↵
|
3 | md.getDatabaseProductName();↵ | | 3 | md.getDatabaseProductVersion();↵
|
4 | if (sleepTime > 0) {↵ | | 4 | if (sleepTime > 0) {↵
|
5 | Thread.sleep(sleepTime);↵ | | 5 | Thread.sleep(sleepTime);↵
|
6 | }↵ | | 6 | }↵
|
7 | } catch (Exception e) {↵ | | 7 | } catch (Exception e) {↵
|
8 | handleException(e);↵ | | 8 | handleException(e);↵
|
9 | } | | 9 | }
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.3 |
Clones location | Clones are in the same java file |
Number of node comparisons | 14 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 5 |
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) | 1.8 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
3 | try | | 3 | try |
4 | System.out.println("Thread " + Thread.currentThread().getName()); | | 4 | System.out.println("Thread " + Thread.currentThread().getName()); |
5 | md.getDatabaseProductName(); | | 5 | md.getDatabaseProductVersion(); |
6 | | | 6 | |
7 | | | 7 | |
Precondition Violations (4)
Row |
Violation |
1 | Expression md.getDatabaseProductName() is a method call throwing exception(s) that should be caught by a try block that will be extracted |
2 | Expression md.getDatabaseProductVersion() is a method call throwing exception(s) that should be caught by a try block that will be extracted |
3 | Expression md.getDatabaseProductName() is a void method call, and thus it cannot be parameterized |
4 | Expression md.getDatabaseProductVersion() is a void method call, and thus it cannot be parameterized |