int count = 0;
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);
}
}
int count = 0;
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: 7
|
|
Number of AST nodes: 7
|
|
1 | int count = 0;↵ | | 1 | int count = 0;↵
|
2 | while (getProductName && count++ < iterations) {↵ | | 2 | while (getProductVersion && count++ < iterations) {↵
|
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 | if (sleepTime > 0) {↵ | | 6 | if (sleepTime > 0) {↵
|
7 | Thread.sleep(sleepTime);↵ | | 7 | Thread.sleep(sleepTime);↵
|
8 | }↵ | | 8 | }↵
|
9 | } catch (Exception e) {↵ | | 9 | } catch (Exception e) {↵
|
10 | handleException(e);↵ | | 10 | handleException(e);↵
|
11 | } ↵ | | 11 | } ↵
|
12 | } | | 12 | }
|
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 | 15 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 7 |
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) | 2.0 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
1 | int count = 0; | | 1 | int count = 0; |
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 |