Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Oct 31, 2024
1 parent 646aebe commit f2c9a07
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/main/java/com/fasterxml/jackson/core/JsonPointer.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public class JsonPointer implements Serializable
* We will retain representation of the pointer, as a String,
* so that {@link #toString} should be as efficient as possible.
*<p>
* NOTE: starting with 2.14, there is no accompanying
* NOTE: starting with 2.14, there is now accompanying
* {@link #_asStringOffset} that MUST be considered with this String;
* this {@code String} may contain preceding path, as it is now full path
* of parent pointer, except for the outermost pointer instance.
Expand Down Expand Up @@ -836,6 +836,7 @@ protected JsonPointer _constructHead()
ArrayList<JsonPointer> pointers = new ArrayList<>();

JsonPointer current = this;

while (current != last) {
String str = current.toString();
JsonPointer nextSegment = new JsonPointer(str.substring(0, str.length() - suffixLength), 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,13 @@ void deepHead()

private final static String repeat(String part, int count) {
StringBuilder sb = new StringBuilder(count * part.length());
int index = 0;
while (--count >= 0) {
sb.append(part);
// Add variation so we'll have "a0" .. "a8"; this to try
// to avoid possibility of accidentally "working" with
// super-repetitive paths
sb.append(part).append(index % 9);
++index;
}
return sb.toString();
}
Expand Down

0 comments on commit f2c9a07

Please sign in to comment.