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
            }
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.3
Clones locationClones are in the same java file
Number of node comparisons15
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements7
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)2.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    int count = 0;
    1
    int count = 0;
    2
    while (getProductName && count++ < iterations)
    2
    while (getProductName && count++ < iterations)
    2
    while (getProductVersion && count++ < iterations)
    Differences
    Expression1Expression2Difference
    getProductNamegetProductVersionVARIABLE_NAME_MISMATCH
    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.getDatabaseProductName();
    5
    md.getDatabaseProductVersion();
    Differences
    Expression1Expression2Difference
    getDatabaseProductNamegetDatabaseProductVersionMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression md.getDatabaseProductName() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    Expression md.getDatabaseProductVersion() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    Expression md.getDatabaseProductName() is a void method call, and thus it cannot be parameterized
    Expression md.getDatabaseProductVersion() is a void method call, and thus it cannot be parameterized
    5
    md.getDatabaseProductVersion();
    6
    if (sleepTime > 0)
    6
    if (sleepTime > 0)
    7
    Thread.sleep(sleepTime);
    7
    Thread.sleep(sleepTime);
    Precondition Violations (4)
    Row Violation
    1Expression md.getDatabaseProductName() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    2Expression md.getDatabaseProductVersion() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    3Expression md.getDatabaseProductName() is a void method call, and thus it cannot be parameterized
    4Expression md.getDatabaseProductVersion() is a void method call, and thus it cannot be parameterized