region.ensureRegionRootExists(); // We ignore minimalPutOverride. JBossCache putForExternalRead is // already about as minimal as we can get; it will promptly return // if it discovers that the node we want to write to already exists Option opt = getDataVersionOption(version, version); return CacheHelper.putForExternalRead(cache, regionFqn, key, value, opt);
region.ensureRegionRootExists(); Option opt = getDataVersionOption(currentVersion, previousVersion); CacheHelper.put(cache, regionFqn, key, value, opt); return true;
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/access/OptimisticTransactionalAccessDelegate.java File path: /hibernate-distribution-3.3.2.GA/project/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/access/OptimisticTransactionalAccessDelegate.java
Method name: boolean putFromLoad(Object, Object, long, Object, boolean) Method name: boolean update(Object, Object, Object, Object)
Number of AST nodes: 3 Number of AST nodes: 4
1
region.ensureRegionRootExists();
1
region.ensureRegionRootExists();
2
        // We ignore minimalPutOverride. JBossCache putForExternalRead is
3
        // already about as minimal as we can get; it will promptly return
4
        // if it discovers that the node we want to write to already exists
5
        Option opt = getDataVersionOption(version, version);
2
        Option opt = getDataVersionOption(currentVersion, previousVersion);
6
        return CacheHelper.putForExternalRead(cache, regionFqn, key, value, opt);
3
        CacheHelper.put(cache, regionFqn, key, value, opt);
4
        return true;
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.0
Clones locationClones are declared in the same class
Number of node comparisons12
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    region.ensureRegionRootExists();
    1
    region.ensureRegionRootExists();
    2
    Option opt = getDataVersionOption(version, version);
    2
    Option opt = getDataVersionOption(version, version);
    2
    Option opt = getDataVersionOption(currentVersion, previousVersion);
    Differences
    Expression1Expression2Difference
    versioncurrentVersionVARIABLE_NAME_MISMATCH
    versionpreviousVersionVARIABLE_NAME_MISMATCH
    2
    Option opt = getDataVersionOption(currentVersion, previousVersion);
                                                                                                        
    3
    CacheHelper.put(cache, regionFqn, key, value, opt);
    Preondition Violations
    Unmatched statement CacheHelper.put(cache,regionFqn,key,value,opt); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3
    CacheHelper.put(cache, regionFqn, key, value, opt);
    3
    return CacheHelper.putForExternalRead(cache, regionFqn, key, value, opt);
    3
    return CacheHelper.putForExternalRead(cache, regionFqn, key, value, opt);
    Preondition Violations
    Unmatched statement return CacheHelper.putForExternalRead(cache,regionFqn,key,value,opt); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched return CacheHelper.putForExternalRead(cache,regionFqn,key,value,opt);
                                                                                                                                                    
                                  
    4
    return true;
    Preondition Violations
    Unmatched return true;
    4
    return true;
    Precondition Violations (4)
    Row Violation
    1Unmatched statement CacheHelper.put(cache,regionFqn,key,value,opt); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement return CacheHelper.putForExternalRead(cache,regionFqn,key,value,opt); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched return CacheHelper.putForExternalRead(cache,regionFqn,key,value,opt);
    4Unmatched return true;