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

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


The following commit(s) were added to refs/heads/trunk by this push:
     new 59ddcf447e OAK-10873: store-spi: remove use of Guava CharMatcher in 
test case (#1516)
59ddcf447e is described below

commit 59ddcf447ee9ff489ce6d9bcbd096c0d785330f6
Author: Julian Reschke <[email protected]>
AuthorDate: Wed Jun 12 10:48:03 2024 +0200

    OAK-10873: store-spi: remove use of Guava CharMatcher in test case (#1516)
    
    * OAK-10873: store-spi: remove use of Guava CharMatcher in test case
    
    * OAK-10873: store-spi: remove use of Guava CharMatcher in test case - use 
less expensive detection
    
    * OAK-10873: store-spi: remove use of Guava CharMatcher in test case - off 
by one
    
    * Revert "OAK-10873: store-spi: remove use of Guava CharMatcher in test 
case - off by one"
    
    This reverts commit d78fe0af400f23ac4f1885b5cca6635981ebb94b.
---
 .../org/apache/jackrabbit/oak/json/JsonDeserializer.java   | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git 
a/oak-store-spi/src/main/java/org/apache/jackrabbit/oak/json/JsonDeserializer.java
 
b/oak-store-spi/src/main/java/org/apache/jackrabbit/oak/json/JsonDeserializer.java
index 99ac2958e0..03696af631 100644
--- 
a/oak-store-spi/src/main/java/org/apache/jackrabbit/oak/json/JsonDeserializer.java
+++ 
b/oak-store-spi/src/main/java/org/apache/jackrabbit/oak/json/JsonDeserializer.java
@@ -24,7 +24,6 @@ import java.util.Set;
 
 import javax.jcr.PropertyType;
 
-import org.apache.jackrabbit.guava.common.base.CharMatcher;
 import org.apache.jackrabbit.guava.common.collect.Lists;
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.api.Type;
@@ -240,9 +239,16 @@ public class JsonDeserializer {
         }
 
         private boolean hasSingleColon(String jsonString) {
-            //In case the primaryType was encoded then it would be like 
nam:oak:Unstructured
-            //So check if there is only one occurrence of ';'
-            return CharMatcher.is(':').countIn(jsonString) == 1;
+            // In case the primaryType was encoded then it would be like
+            // "nam:oak:Unstructured". So check if there is only one occurrence
+            // of ':'.
+            int colonCount = 0;
+            for (int i = 0; i < jsonString.length() && colonCount < 2; i++) {
+                if (jsonString.charAt(i) == ':') {
+                    colonCount += 1;
+                }
+            }
+            return colonCount == 1;
         }
     }
 

Reply via email to