Skip to content

Commit f3f1f78

Browse files
committed
minor comment improvements
1 parent d4d97a6 commit f3f1f78

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/main/java/com/fasterxml/jackson/core/JsonPointer.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,10 @@ public static JsonPointer forPath(JsonStreamContext context,
174174
if (context == null) {
175175
return EMPTY;
176176
}
177+
// Otherwise if context was just created but is not advanced -- like,
178+
// opening START_ARRAY/START_OBJECT returned -- drop the empty context.
177179
if (!context.hasPathSegment()) {
178-
// one special case; do not prune root if we need it
180+
// Except one special case: do not prune root if we need it
179181
if (!(includeRoot && context.inRoot() && context.hasCurrentIndex())) {
180182
context = context.getParent();
181183
}

src/test/java/com/fasterxml/jackson/failing/JsonPointerOOME736Test.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ public class JsonPointerOOME736Test extends BaseTest
88
// such as https://github.com/nst/JSONTestSuite/blob/master/test_parsing/n_structure_100000_opening_arrays.json
99
public void testDeepJsonPointer() throws Exception {
1010
int MAX_DEPTH = 100000;
11+
// Create nesting of 100k arrays
1112
String INPUT = new String(new char[MAX_DEPTH]).replace("\0", "[");
1213
JsonParser parser = createParser(MODE_READER, INPUT);
1314
try {

0 commit comments

Comments
 (0)