nfsantos commented on code in PR #1516:
URL: https://github.com/apache/jackrabbit-oak/pull/1516#discussion_r1633795354


##########
oak-store-spi/src/main/java/org/apache/jackrabbit/oak/json/JsonDeserializer.java:
##########
@@ -240,9 +239,10 @@ boolean hasOrderableChildren(NodeBuilder builder) {
         }
 
         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 ':'.
+            return jsonString.replace(":", "").length() == jsonString.length() 
- 1;

Review Comment:
   This is going to create an intermediate String, which could have a negative 
performance impact if this method is called very often. Couldn't this be 
rewritten without creating intermediate objects?



-- 
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: dev-unsubscr...@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to