You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by re...@apache.org on 2025/02/03 12:10:03 UTC

(jackrabbit-filevault) branch master updated: JCRVLT-788: use of 'toUppercase' with default locale should be avoided (#356)

This is an automated email from the ASF dual-hosted git repository.

reschke pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jackrabbit-filevault.git


The following commit(s) were added to refs/heads/master by this push:
     new 0dfef254 JCRVLT-788: use of 'toUppercase' with default locale should be avoided (#356)
0dfef254 is described below

commit 0dfef254492d1f0bd2576265a6d9f5f6c1d1fed3
Author: Julian Reschke <ju...@gmx.de>
AuthorDate: Mon Feb 3 13:09:58 2025 +0100

    JCRVLT-788: use of 'toUppercase' with default locale should be avoided (#356)
    
    * JCRVLT-788: use of 'toUppercase' with default locale should be avoided - add failing test
    
    * JCRVLT-788: add explanation in the test case
---
 .../packaging/registry/impl/FSPackageRegistryTest.java    | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/vault-core/src/test/java/org/apache/jackrabbit/vault/packaging/registry/impl/FSPackageRegistryTest.java b/vault-core/src/test/java/org/apache/jackrabbit/vault/packaging/registry/impl/FSPackageRegistryTest.java
index 12ede04a..2cb4cf4d 100644
--- a/vault-core/src/test/java/org/apache/jackrabbit/vault/packaging/registry/impl/FSPackageRegistryTest.java
+++ b/vault-core/src/test/java/org/apache/jackrabbit/vault/packaging/registry/impl/FSPackageRegistryTest.java
@@ -30,6 +30,7 @@ import java.nio.file.Paths;
 import java.nio.file.StandardCopyOption;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.Locale;
 import java.util.Map;
 
 import org.apache.jackrabbit.vault.packaging.NoSuchPackageException;
@@ -112,6 +113,20 @@ public class FSPackageRegistryTest {
         assertEquals(Collections.singleton(TEST_PACKAGE_ID), registry.packages());
     }
 
+    @Test
+    public void testCacheInitializedAfterOSGiActivateLocaleTr() throws IOException {
+        Locale defaultLocale = Locale.getDefault();
+        try {
+            // see JCRVLT-788; this verifies that switching to a locale where
+            // uppercase("i") != 'I' does not cause failures
+            Locale.setDefault(new Locale("tr", "TR"));
+            testCacheInitializedAfterOSGiActivate();
+        }
+        finally {
+            Locale.setDefault(defaultLocale);
+        }
+    }
+
     private FSPackageRegistry createRegistryWithDefaultConstructor(Path homePath) throws IOException {
         FSPackageRegistry registry = new FSPackageRegistry();
         BundleContext context = Mockito.mock(BundleContext.class);