-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] [Java Client]When getMessages() returns to default locale's translation, cache can't get updated translation(default locale) after it is expired. #664
Comments
The issue also is reproducible when getMessages() return to default locale's translation from offlineBundles in mixed mode. |
(Pasting the same comment I put in issue #662 ) I just tested this and it works for me. I am guessing there is something wrong with the steps you wrote above. Please check the following: In step 2, how is the client cache expire time set? If you are testing the new client workflow, make sure to NOT set the cacheExpiredTime property in the properties config file. Otherwise, cacheExpiredTime will be used instead of the value set by the Singleton service in the cache-control max age header in the HTTP response. |
|
Test pass on commit 3b6f338. |
…/variables that will never be null (#829) * Loading configuration from the JSON configuration file * Removing code that is not yet ready to be used from the sample application * fixing failing code scan https://sonarcloud.io/project/issues?id=jessiejuachon-java-client-g11n-java-client&issues=AXDG68NFL24bPpi-pS5s&open=AXDG68NFL24bPpi-pS5s https://sonarcloud.io/project/issues?id=jessiejuachon-java-client-g11n-java-client&issues=AXDG68IGL24bPpi-pS2r&open=AXDG68IGL24bPpi-pS2r Signed-off-by: Jessie <jessiejuachon@gmail.com> * Adding a cache properties map to hold cache details such as etag and cache control * Removing white space Signed-off-by: Jessie <jessiejuachon@gmail.com> * Fixing failing unit test * Parse headers, response code, response message from an HTTP response and return them upstream. * Storing response headers in Map of cache properties * Fixing failing unit test due to NullPointerException when doing Map.putAll(null) * Changes after code review. * Removing exception handling for now * Deprecating VIPCfg.initialize; cleaning up code * Storing the http response code in the cache * Using cached etag as if-none-match request header value in the request in order to get a 304 NOT MODIFIED http response * Handling 404 response from Singleton service * Using HTTP repsonse's Cache-Control max-age and timestamp to dertermine if component locale's cache has expired * Moving constants to URLUtils * Fixing failing test * Fixing failing code scan * Cleaning up import in ComponentService,java * Cleaning up code - caching/expiry * Adding tests for new caching workflow; enabling old caching workflow using cacheExpiredTime config * Fixing a failing test * Adding mock server response * Removing unused file sampleconfig.json * Changes from code review * Value of VIPCfg.cacheExpiredTime is -1 when value is not set in config file. This means max age from server will be used. Setting VIPCfg.cacheExpiredTime to 0 disables caching. * Changing a LinkedHashMap to a HashMap because insertion order does not need to be maintained. * Adding CacheItem object to contain map of data and a another map for any other cache properties * Fixing failing unit test * Fixing code scan issues * Code cleanup * Lazily instantiating cacheProps; code clean up and comments * Changes after code review * Adding header to CacheItem.java * Fixing code san issue. Synchronize on a final field * Fixing code scan bug * Changes after code review * Updating CasheService.isContainComponent to return false if cache key is stored but has a null value * HttpRequester if-none-match header and other customized headers are added to each specific request locally. * Code clean up; keep old caching expiration logic * Fixing code scan bug * code clean up * Removing response code and response msg from cache; Passing cacheItem object to be updated down the line. * Changes after code review * Adding header to CacheItem.java file * Fixing failing unit test * Changes after code review * Fixing code scan bugs * Not storing anything in cache if response is neither 200 nor 304 * Loading messages from specified offline resource bundles * Adding header * Fixing failing unie test * Code changes after review; code clean up * Using java.nio.file.Paths * Offline mode as fallback when service fetch fails * Resetting VIPCfg and I18nFactory instances for each test * Resetting VIPCfg and I18nFactory after test * Fixing tests * Limit to wiremock test logging * Decreasing unit test log * this test is timing out and trying to connect 70+ times * Adding comments to code * Adding timestamp to cache fromn local bundle * Deprecating methods in TranslationMessage; adding new method getMessage * Added tests for TranslationMessage.getMessage * Fixing test * Fixing test * Fixing test * Removing comment field because source collection is not supported anymore; cleaning up tests; adding comments for javadoc * Code clean up * Changes from code review * Code clean up * Optional SourceOpt in initialization Signed-off-by: Jessie <jessiejuachon@gmail.com> * Fixing test * Adding comments to code * Adding comment for javadoc * Cleaning up code * Code clean up * Fixing test * Removing source message fallback from this PR * Default locale in config file instead of hardcoded; get supported locales for offline mode; fixing some bugs in getting supported locales * Fixing test * Fixing tests * Default locale to Locale.ENGLISH if not set in config file * Changed after code review: code clean up, bug fix * Update src/main/java/com/vmware/vipclient/i18n/messages/api/opt/local/LocalLocaleOpt.java Co-authored-by: Xiaochao Li <48587632+Xiaochao8@users.noreply.github.com> * Update src/main/java/com/vmware/vipclient/i18n/messages/api/opt/local/LocalLocaleOpt.java Co-authored-by: Xiaochao Li <48587632+Xiaochao8@users.noreply.github.com> * code clean up, error logging, bug fix * code clean up * code clean up * Using messages_source.json for source locale messages. * code clean up * Commenting out a test * code clean up * code clean up * Error logging when fetch failed * bug fix * code clean up * Updating sample application * fixing failing smoke test * code clean up * fixing code scan * Fixing code scan * Adding prodMode configuration * code clean up * Setting default prodMode to true * Removing prodMode configuration and logic. Throwing exception if source key not found. Returning default locale message if locale not supported. * Updating javadoc * Fixing bug: Fallback shall apply to both TranslationMessage.getMessage and TranslationMessage.getMessages * Adding test for Translateion.getMessages, locale not supported * code comments * code clean up * Fix issue: #622 * code clean up * code clean up * code clean up * code clean up * code clean up * code clean up * code clean up * Fix for #661 * adding license header * changes after code review * Update src/main/java/com/vmware/vipclient/i18n/messages/api/opt/local/LocalComponentOpt.java Co-authored-by: Xiaochao Li <48587632+Xiaochao8@users.noreply.github.com> * Update src/main/java/com/vmware/vipclient/i18n/messages/service/ProductService.java Co-authored-by: Xiaochao Li <48587632+Xiaochao8@users.noreply.github.com> * changes after code review * changes after code review * fix for issues: 664, 662, 686 * code clean up * code clean up * Adding LocaleDTO * code clean up * code clean up * changes after code review * Bug fix #604, #664, #662 * code clean up * Mapping to the fallback locale's cache * code clean up * changes after code review * code clean up * code clean up * code clean up * code clean up * code clean up * Fixing bug on reading offline bundles in jar file. * sample shared library * sample application with shared library * Adding license header * Fix for #746 MsgOriginsQueue cannot be cleared once initializing VIPCfg * code clean up * Adding list of supported locales used by L3 in cache * Removing logic of adding a cacheItem with an empty dataMap to cache * code clean up * Update src/main/java/com/vmware/vipclient/i18n/messages/service/ComponentService.java Co-authored-by: Xiaochao Li <48587632+Xiaochao8@users.noreply.github.com> * changes based on review comments * Enablling locale fallback for matched locale * code clean up for MessageCacheItem * removing unrelated changes * removing unrelated changes * changes in expire logic Co-authored-by: Xiaochao Li <48587632+Xiaochao8@users.noreply.github.com>
…tch for a non-supported locale (#823) * Loading configuration from the JSON configuration file * Removing code that is not yet ready to be used from the sample application * fixing failing code scan https://sonarcloud.io/project/issues?id=jessiejuachon-java-client-g11n-java-client&issues=AXDG68NFL24bPpi-pS5s&open=AXDG68NFL24bPpi-pS5s https://sonarcloud.io/project/issues?id=jessiejuachon-java-client-g11n-java-client&issues=AXDG68IGL24bPpi-pS2r&open=AXDG68IGL24bPpi-pS2r Signed-off-by: Jessie <jessiejuachon@gmail.com> * Adding a cache properties map to hold cache details such as etag and cache control * Removing white space Signed-off-by: Jessie <jessiejuachon@gmail.com> * Fixing failing unit test * Parse headers, response code, response message from an HTTP response and return them upstream. * Storing response headers in Map of cache properties * Fixing failing unit test due to NullPointerException when doing Map.putAll(null) * Changes after code review. * Removing exception handling for now * Deprecating VIPCfg.initialize; cleaning up code * Storing the http response code in the cache * Using cached etag as if-none-match request header value in the request in order to get a 304 NOT MODIFIED http response * Handling 404 response from Singleton service * Using HTTP repsonse's Cache-Control max-age and timestamp to dertermine if component locale's cache has expired * Moving constants to URLUtils * Fixing failing test * Fixing failing code scan * Cleaning up import in ComponentService,java * Cleaning up code - caching/expiry * Adding tests for new caching workflow; enabling old caching workflow using cacheExpiredTime config * Fixing a failing test * Adding mock server response * Removing unused file sampleconfig.json * Changes from code review * Value of VIPCfg.cacheExpiredTime is -1 when value is not set in config file. This means max age from server will be used. Setting VIPCfg.cacheExpiredTime to 0 disables caching. * Changing a LinkedHashMap to a HashMap because insertion order does not need to be maintained. * Adding CacheItem object to contain map of data and a another map for any other cache properties * Fixing failing unit test * Fixing code scan issues * Code cleanup * Lazily instantiating cacheProps; code clean up and comments * Changes after code review * Adding header to CacheItem.java * Fixing code san issue. Synchronize on a final field * Fixing code scan bug * Changes after code review * Updating CasheService.isContainComponent to return false if cache key is stored but has a null value * HttpRequester if-none-match header and other customized headers are added to each specific request locally. * Code clean up; keep old caching expiration logic * Fixing code scan bug * code clean up * Removing response code and response msg from cache; Passing cacheItem object to be updated down the line. * Changes after code review * Adding header to CacheItem.java file * Fixing failing unit test * Changes after code review * Fixing code scan bugs * Not storing anything in cache if response is neither 200 nor 304 * Loading messages from specified offline resource bundles * Adding header * Fixing failing unie test * Code changes after review; code clean up * Using java.nio.file.Paths * Offline mode as fallback when service fetch fails * Resetting VIPCfg and I18nFactory instances for each test * Resetting VIPCfg and I18nFactory after test * Fixing tests * Limit to wiremock test logging * Decreasing unit test log * this test is timing out and trying to connect 70+ times * Adding comments to code * Adding timestamp to cache fromn local bundle * Deprecating methods in TranslationMessage; adding new method getMessage * Added tests for TranslationMessage.getMessage * Fixing test * Fixing test * Fixing test * Removing comment field because source collection is not supported anymore; cleaning up tests; adding comments for javadoc * Code clean up * Changes from code review * Code clean up * Optional SourceOpt in initialization Signed-off-by: Jessie <jessiejuachon@gmail.com> * Fixing test * Adding comments to code * Adding comment for javadoc * Cleaning up code * Code clean up * Fixing test * Removing source message fallback from this PR * Default locale in config file instead of hardcoded; get supported locales for offline mode; fixing some bugs in getting supported locales * Fixing test * Fixing tests * Default locale to Locale.ENGLISH if not set in config file * Changed after code review: code clean up, bug fix * Update src/main/java/com/vmware/vipclient/i18n/messages/api/opt/local/LocalLocaleOpt.java Co-authored-by: Xiaochao Li <48587632+Xiaochao8@users.noreply.github.com> * Update src/main/java/com/vmware/vipclient/i18n/messages/api/opt/local/LocalLocaleOpt.java Co-authored-by: Xiaochao Li <48587632+Xiaochao8@users.noreply.github.com> * code clean up, error logging, bug fix * code clean up * code clean up * Using messages_source.json for source locale messages. * code clean up * Commenting out a test * code clean up * code clean up * Error logging when fetch failed * bug fix * code clean up * Updating sample application * fixing failing smoke test * code clean up * fixing code scan * Fixing code scan * Adding prodMode configuration * code clean up * Setting default prodMode to true * Removing prodMode configuration and logic. Throwing exception if source key not found. Returning default locale message if locale not supported. * Updating javadoc * Fixing bug: Fallback shall apply to both TranslationMessage.getMessage and TranslationMessage.getMessages * Adding test for Translateion.getMessages, locale not supported * code comments * code clean up * Fix issue: #622 * code clean up * code clean up * code clean up * code clean up * code clean up * code clean up * code clean up * Fix for #661 * adding license header * changes after code review * Update src/main/java/com/vmware/vipclient/i18n/messages/api/opt/local/LocalComponentOpt.java Co-authored-by: Xiaochao Li <48587632+Xiaochao8@users.noreply.github.com> * Update src/main/java/com/vmware/vipclient/i18n/messages/service/ProductService.java Co-authored-by: Xiaochao Li <48587632+Xiaochao8@users.noreply.github.com> * changes after code review * changes after code review * fix for issues: 664, 662, 686 * code clean up * code clean up * Adding LocaleDTO * code clean up * code clean up * changes after code review * Bug fix #604, #664, #662 * code clean up * Mapping to the fallback locale's cache * code clean up * changes after code review * code clean up * code clean up * code clean up * code clean up * code clean up * Fixing bug on reading offline bundles in jar file. * sample shared library * sample application with shared library * Adding license header * Fix for #746 MsgOriginsQueue cannot be cleared once initializing VIPCfg * Fix for bug 781 - L3's CacheService.getSupportedLocalesFromCache is incorrectly using L2's data. * code clean up * code clean up * Fix for issue 781: CacheService.getCacheOfComponent cannot get "matchedLocale" properly if L2 supported locale list cache is not yet populated. * adding test * code clean up * code clean up * code clean up * code clean up * code clean up * code clean up * adding test * fixing test * fixing test * fixing test * fixing test * code clean up * code clean up * code cleanup * code clean up * Update src/main/java/com/vmware/vipclient/i18n/messages/service/CacheService.java Co-authored-by: Xiaochao Li <48587632+Xiaochao8@users.noreply.github.com> * adding comments to code * clean up code * code clean up * code clean up * Adding list of supported locales used by L3 in cache * Removing logic of adding a cacheItem with an empty dataMap to cache * code clean up * code clean up * code clean up * Removing locale property from MessageCacheItem * Update src/main/java/com/vmware/vipclient/i18n/messages/service/ComponentService.java Co-authored-by: Xiaochao Li <48587632+Xiaochao8@users.noreply.github.com> * changes based on review comments * Enablling locale fallback for matched locale * merging changes * Fixing bug 754 - Performance impact on the very first L3 fetch for a non-supported locale * more test cases * fixing intermittently failing test * code clean up for readability * fixing incorrect if statement * code optimization * Update src/main/java/com/vmware/vipclient/i18n/util/LocaleUtility.java Co-authored-by: Xiaochao Li <48587632+Xiaochao8@users.noreply.github.com> * rolling back change * changing Chinese locale matching rule * correcting incorrect merge * Do Locale matching first in Componentservice.getMessages Co-authored-by: Xiaochao Li <48587632+Xiaochao8@users.noreply.github.com>
Describe the bug
Online or Mixed mode: When getMessages() returns to service default locale's translation, cache can't get updated translation(default locale) after it is expired.
To Reproduce
Steps to reproduce the behavior:
Still get the original translation of default locale rather than the updated translation in step 4.
Expected behavior
Should get the updated translation of default locale once cache is expired and request is sent.
The text was updated successfully, but these errors were encountered: