Copilot commented on code in PR #684:
URL: https://github.com/apache/fesod/pull/684#discussion_r2517891563


##########
fesod/src/main/java/org/apache/fesod/sheet/cache/selector/SimpleReadCacheSelector.java:
##########
@@ -114,13 +114,11 @@ public ReadCache readCache(PackagePart 
sharedStringsTablePackagePart) {
 
         // In order to be compatible with the code
         // If the user set up `maxCacheActivateSize`, then continue using it
-        if (maxCacheActivateSize != null) {
-            return new Ehcache(maxCacheActivateSize, 
maxCacheActivateBatchCount);
-        } else {
+        if (maxCacheActivateSize == null) {
             if (maxCacheActivateBatchCount == null) {
                 maxCacheActivateBatchCount = 
DEFAULT_MAX_EHCACHE_ACTIVATE_BATCH_COUNT;
             }

Review Comment:
   The refactored logic changes the behavior when `maxCacheActivateSize` is not 
null. Originally, when `maxCacheActivateSize` was not null, it would return 
`new Ehcache(maxCacheActivateSize, maxCacheActivateBatchCount)` immediately 
without setting `maxCacheActivateBatchCount` to the default. Now the code only 
sets the default when `maxCacheActivateSize` is null, but still returns with 
the potentially-null `maxCacheActivateBatchCount` when `maxCacheActivateSize` 
is not null. This appears to preserve the original behavior, but the comment on 
line 116 states 'If the user set up `maxCacheActivateSize`, then continue using 
it' which suggests the original code path should be preserved. The original 
code returned the same `Ehcache` instance regardless of the if-else branch, so 
the refactoring is actually correct, but the logic could be clearer.
   ```suggestion
           if (maxCacheActivateBatchCount == null) {
               maxCacheActivateBatchCount = 
DEFAULT_MAX_EHCACHE_ACTIVATE_BATCH_COUNT;
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to