EgorBaranovEnjoysTyping commented on code in PR #13262:
URL: https://github.com/apache/ignite/pull/13262#discussion_r3481945809
##########
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);
Review Comment:
It already can't NPE. There're tests for this. When head is already filled,
then tail already exists. When head is not filled, but insert in tail is
called, it's problem of previous logic.
--
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]