if (newRoot instanceof NodeSPI) { // FIXME Hacky workaround to JBCACHE-1202 if ( !( ( ( NodeSPI ) newRoot ).getVersion() instanceof NonLockingDataVersion ) ) { ((NodeSPI) newRoot).setVersion(NonLockingDataVersion.INSTANCE); } }
if (optimistic && regionRoot instanceof NodeSPI) { // FIXME Hacky workaround to JBCACHE-1202 if ( !( ( ( NodeSPI ) regionRoot ).getVersion() instanceof NonLockingDataVersion ) ) { ((NodeSPI) regionRoot).setVersion(NonLockingDataVersion.INSTANCE); } }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/BasicRegionAdapter.java File path: /hibernate-distribution-3.3.2.GA/project/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/BasicRegionAdapter.java
Method name: void establishRegionRootNode() Method name: void activateLocalClusterNode()
Number of AST nodes: 3 Number of AST nodes: 3
1
if (newRoot instanceof NodeSPI) {
1
if (optimistic && regionRoot instanceof NodeSPI) {
2
                     // FIXME Hacky workaround to JBCACHE-1202
2
                // FIXME Hacky workaround to JBCACHE-1202
3
                     if ( !( ( ( NodeSPI ) newRoot ).getVersion() instanceof NonLockingDataVersion ) ) {
3
                if ( !( ( ( NodeSPI ) regionRoot ).getVersion() instanceof NonLockingDataVersion ) ) {
4
                          ((NodeSPI) newRoot).setVersion(NonLockingDataVersion.INSTANCE);
4
                    ((NodeSPI) regionRoot).setVersion(NonLockingDataVersion.INSTANCE);
5
                     }
5
                
6
     
6
}
7
            }
7
            }
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.2
Clones locationClones are declared in the same class
Number of node comparisons5
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    15
    if (!(((NodeSPI)newRoot).getVersion() instanceof NonLockingDataVersion))
    15
    if (!(((NodeSPI)newRoot).getVersion() instanceof NonLockingDataVersion))
    17
    if (!(((NodeSPI)regionRoot).getVersion() instanceof NonLockingDataVersion))
    Differences
    Expression1Expression2Difference
    newRootregionRootVARIABLE_NAME_MISMATCH
    17
    if (!(((NodeSPI)regionRoot).getVersion() instanceof NonLockingDataVersion))
    16
    ((NodeSPI)newRoot).setVersion(NonLockingDataVersion.INSTANCE);
    16
    ((NodeSPI)newRoot).setVersion(NonLockingDataVersion.INSTANCE);
    18
    ((NodeSPI)regionRoot).setVersion(NonLockingDataVersion.INSTANCE);
    Differences
    Expression1Expression2Difference
    newRootregionRootVARIABLE_NAME_MISMATCH
    18
    ((NodeSPI)regionRoot).setVersion(NonLockingDataVersion.INSTANCE);
    Precondition Violations (0)
    Row Violation