EgorBaranovEnjoysTyping commented on code in PR #13262:
URL: https://github.com/apache/ignite/pull/13262#discussion_r3481973427


##########
modules/commons/src/main/java/org/apache/ignite/internal/util/tostring/SBLimitedLength.java:
##########
@@ -270,6 +264,124 @@ private GridStringBuilder onWrite(int lenBeforeWrite) {
         return onWrite(curLen);
     }
 
+    /** {@inheritDoc} */
+    @Override public GridStringBuilder i(int offset, String str) {
+        str = GridToStringNode.recoverObject(str);
+        int headLengthLimit = lenLimit.getHeadLengthLimit();
+        if (offset < headLengthLimit) {
+            impl().insert(offset, str);
+            if (lenLimit.overflowed(this)) {
+                String tailCandidate = impl().substring(headLengthLimit);
+                if (tail == null)
+                    tail = lenLimit.createTail();
+                tail.insert(0, tailCandidate);
+                impl().setLength(headLengthLimit);
+            }
+            return this;
+        }
+        tail.insert(offset - headLengthLimit, str);
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public GridStringBuilder i(int idx, char[] str, int off, int 
len) {
+        StringBuilder strBuilder = new StringBuilder();
+        for (int i = 0; i < len; i++)
+            strBuilder.append(str[i + off]);
+        return i(idx, strBuilder.toString());
+    }
+
+    /** {@inheritDoc} */
+    @Override public GridStringBuilder i(int off, Object obj) {
+        return i(off, String.valueOf(obj));
+    }
+
+    /** {@inheritDoc} */
+    @Override public GridStringBuilder i(int off, char[] str) {
+        return i(off, new String(str));
+    }
+
+    /** {@inheritDoc} */
+    @Override public GridStringBuilder i(int dstOff, CharSequence s) {
+        s = GridToStringNode.recoverObject(s);
+        StringBuilder strBuilder = new StringBuilder();
+        for (int i = 0; i < s.length(); i++)
+            strBuilder.append(s.charAt(i));
+        return i(dstOff, strBuilder.toString());
+    }
+
+    /** {@inheritDoc} */
+    @Override public GridStringBuilder i(int dstOff, CharSequence s, int 
start, int end) {
+        s = GridToStringNode.recoverObject(s);
+        StringBuilder strBuilder = new StringBuilder();
+        for (int i = start; i < end; i++)
+            strBuilder.append(s.charAt(i));
+        return i(dstOff, strBuilder.toString());
+    }
+
+    /** {@inheritDoc} */
+    @Override public GridStringBuilder i(int off, boolean b) {
+        return super.i(off, String.valueOf(b));
+    }
+
+    /** {@inheritDoc} */
+    @Override public GridStringBuilder i(int off, char c) {
+        return super.i(off, String.valueOf(c));
+    }
+
+    /** {@inheritDoc} */
+    @Override public GridStringBuilder i(int off, int i) {
+        return super.i(off, String.valueOf(i));
+    }
+
+    /** {@inheritDoc} */
+    @Override public GridStringBuilder i(int off, long l) {
+        return super.i(off, String.valueOf(l));
+    }
+
+    /** {@inheritDoc} */
+    @Override public GridStringBuilder i(int off, float f) {
+        return super.i(off, String.valueOf(f));
+    }
+
+    /** {@inheritDoc} */
+    @Override public GridStringBuilder i(int off, double d) {
+        return super.i(off, String.valueOf(d));
+    }
+
+    /** {@inheritDoc} */
+    @Override public GridStringBuilder d(int start, int end) {
+        throw new UnsupportedOperationException("Not supported by this 
implementation");

Review Comment:
   Yes, it is behavior change. Now SBLimitedLength should not reduce it's 
length in any way. 
   Example:
   head: foo skipped 3; tail = bar
   reduce to 4-6 digits will result in foo and 1-3 skipped
   reduce to 7 digits will result in foo + 3 skipped + b
   so if we loose skipped chars, we can't reduce length. 



-- 
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]

Reply via email to