while (getProductName && count++ < iterations) {
try {
System.out.println("Thread "+Thread.currentThread().getName());
md.getDatabaseProductName();
if (sleepTime > 0) {
Thread.sleep(sleepTime);
}
} catch (Exception e) {
handleException(e);
}
}
while (getProductVersion && count++ < iterations) {
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: 6
|
|
Number of AST nodes: 6
|
|
1 | while (getProductName && count++ < iterations) {↵ | | 1 | while (getProductVersion && count++ < iterations) {↵
|
2 | try {↵ | | 2 | try {↵
|
3 | System.out.println("Thread "+Thread.currentThread().getName());↵ | | 3 | System.out.println("Thread "+Thread.currentThread().getName());↵
|
4 | md.getDatabaseProductName();↵ | | 4 | md.getDatabaseProductVersion();↵
|
5 | if (sleepTime > 0) {↵ | | 5 | if (sleepTime > 0) {↵
|
6 | Thread.sleep(sleepTime);↵ | | 6 | Thread.sleep(sleepTime);↵
|
7 | }↵ | | 7 | }↵
|
8 | } catch (Exception e) {↵ | | 8 | } catch (Exception e) {↵
|
9 | handleException(e);↵ | | 9 | handleException(e);↵
|
10 | } ↵ | | 10 | } ↵
|
11 | } | | 11 | }
|
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 | 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) | 1.7 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
2 | while (getProductName && count++ < iterations) | | 2 | while (getProductVersion && count++ < iterations) |
3 | | | 3 | |
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 |