File tree 3 files changed +23
-4
lines changed
main/java/com/fasterxml/jackson/core/util
test/java/com/fasterxml/jackson/core/util
3 files changed +23
-4
lines changed Original file line number Diff line number Diff line change 1
1
Project: jackson-core
2
- Version: 2.3.4 (17-Jul -2014)
2
+ Version: 2.3.5 (xx-xxx -2014)
3
3
4
- No changes.
4
+ #152: Exception for property names longer than 256k
5
5
6
6
------------------------------------------------------------------------
7
7
=== History: ===
8
8
------------------------------------------------------------------------
9
9
10
+ 2.3.4 (17-Jul-2014)
10
11
2.3.3 (10-Apr-2014)
11
12
12
13
No changes since 2.3.2.
Original file line number Diff line number Diff line change @@ -575,8 +575,11 @@ public char[] expandCurrentSegment()
575
575
final char [] curr = _currentSegment ;
576
576
// Let's grow by 50%
577
577
final int len = curr .length ;
578
- // Must grow by at least 1 char, no matter what
579
- int newLen = (len == MAX_SEGMENT_LEN ) ? (MAX_SEGMENT_LEN +1 ) : Math .min (MAX_SEGMENT_LEN , len + (len >> 1 ));
578
+ int newLen = len + (len >> 1 );
579
+ // but above intended maximum, slow to increase by 25%
580
+ if (newLen > MAX_SEGMENT_LEN ) {
581
+ newLen = len + (len >> 2 );
582
+ }
580
583
return (_currentSegment = ArraysCompat .copyOf (curr , newLen ));
581
584
}
582
585
Original file line number Diff line number Diff line change @@ -62,4 +62,19 @@ public void testLongAppend()
62
62
assertEquals (len +2 , tb .size ());
63
63
assertEquals (EXP , tb .contentsAsString ());
64
64
}
65
+
66
+ // [Core#152]
67
+ public void testExpand ()
68
+ {
69
+ TextBuffer tb = new TextBuffer (new BufferRecycler ());
70
+ char [] buf = tb .getCurrentSegment ();
71
+
72
+ while (buf .length < 500 * 1000 ) {
73
+ char [] old = buf ;
74
+ buf = tb .expandCurrentSegment ();
75
+ if (old .length >= buf .length ) {
76
+ fail ("Expected buffer of " +old .length +" to expand, did not, length now " +buf .length );
77
+ }
78
+ }
79
+ }
65
80
}
You can’t perform that action at this time.
0 commit comments