Skip to content

Commit 4c1cbc4

Browse files
committed
Sync with core/1304 changes
1 parent 61905f0 commit 4c1cbc4

File tree

4 files changed

+9
-41
lines changed

4 files changed

+9
-41
lines changed

cbor/src/main/java/com/fasterxml/jackson/dataformat/cbor/CBORParser.java

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -182,11 +182,6 @@ public int getFirstTag() {
182182
*/
183183
protected final IOContext _ioContext;
184184

185-
/**
186-
* @since 2.17
187-
*/
188-
protected final StreamReadConstraints _streamReadConstraints;
189-
190185
/**
191186
* Flag that indicates whether parser is closed or not. Gets
192187
* set when parser is either closed by explicit call
@@ -519,7 +514,7 @@ public CBORParser(IOContext ctxt, int parserFeatures, int cborFeatures,
519514
InputStream in, byte[] inputBuffer, int start, int end,
520515
boolean bufferRecyclable)
521516
{
522-
super(parserFeatures);
517+
super(parserFeatures, ctxt.streamReadConstraints());
523518
_ioContext = ctxt;
524519
_objectCodec = codec;
525520
_symbols = sym;
@@ -537,13 +532,6 @@ public CBORParser(IOContext ctxt, int parserFeatures, int cborFeatures,
537532

538533
_tokenInputRow = -1;
539534
_tokenInputCol = -1;
540-
541-
_streamReadConstraints = ctxt.streamReadConstraints();
542-
}
543-
544-
@Override
545-
public StreamReadConstraints streamReadConstraints() {
546-
return _streamReadConstraints;
547535
}
548536

549537
@Override

ion/src/main/java/com/fasterxml/jackson/dataformat/ion/IonParser.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ public IonParser(IonReader r, IOContext ctxt, ObjectCodec codec) {
163163
* @since 2.13
164164
*/
165165
IonParser(IonReader r, IonSystem system, IOContext ctxt, ObjectCodec codec, int ionParserFeatures) {
166+
super(ctxt.streamReadConstraints());
166167
this._reader = r;
167168
this._ioContext = ctxt;
168169
this._objectCodec = codec;
@@ -171,11 +172,6 @@ public IonParser(IonReader r, IOContext ctxt, ObjectCodec codec) {
171172
this._formatFeatures = ionParserFeatures;
172173
}
173174

174-
@Override
175-
public StreamReadConstraints streamReadConstraints() {
176-
return _ioContext.streamReadConstraints();
177-
}
178-
179175
@Override
180176
public void setCodec(ObjectCodec c) {
181177
_objectCodec = c;

protobuf/src/main/java/com/fasterxml/jackson/dataformat/protobuf/ProtobufParser.java

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ public ProtobufParser(IOContext ctxt, int parserFeatures,
297297
InputStream in, byte[] inputBuffer, int start, int end,
298298
boolean bufferRecyclable)
299299
{
300-
super(parserFeatures);
300+
super(parserFeatures, ctxt.streamReadConstraints());
301301
_ioContext = ctxt;
302302
_objectCodec = codec;
303303

@@ -313,11 +313,6 @@ public ProtobufParser(IOContext ctxt, int parserFeatures,
313313
_tokenInputCol = -1;
314314
}
315315

316-
@Override
317-
public StreamReadConstraints streamReadConstraints() {
318-
return _ioContext.streamReadConstraints();
319-
}
320-
321316
public void setSchema(ProtobufSchema schema)
322317
{
323318
if (_schema == schema) {
@@ -610,7 +605,7 @@ public JsonToken nextToken() throws IOException
610605

611606
case STATE_ARRAY_START:
612607
_parsingContext = _parsingContext.createChildArrayContext(_currentField);
613-
streamReadConstraints().validateNestingDepth(_parsingContext.getNestingDepth());
608+
_streamReadConstraints.validateNestingDepth(_parsingContext.getNestingDepth());
614609
_state = STATE_ARRAY_VALUE_FIRST;
615610
return (_currToken = JsonToken.START_ARRAY);
616611

@@ -628,7 +623,7 @@ public JsonToken nextToken() throws IOException
628623
}
629624
_currentEndOffset = newEnd;
630625
_parsingContext = _parsingContext.createChildArrayContext(_currentField, newEnd);
631-
streamReadConstraints().validateNestingDepth(_parsingContext.getNestingDepth());
626+
_streamReadConstraints.validateNestingDepth(_parsingContext.getNestingDepth());
632627
_state = STATE_ARRAY_VALUE_PACKED;
633628
return (_currToken = JsonToken.START_ARRAY);
634629

@@ -949,7 +944,7 @@ private JsonToken _readNextValue(FieldType t, int nextState) throws IOException
949944
_currentEndOffset = newEnd;
950945
_state = STATE_NESTED_KEY;
951946
_parsingContext = _parsingContext.createChildObjectContext(msg, _currentField, newEnd);
952-
streamReadConstraints().validateNestingDepth(_parsingContext.getNestingDepth());
947+
_streamReadConstraints.validateNestingDepth(_parsingContext.getNestingDepth());
953948
_currentField = msg.firstField();
954949
}
955950
return JsonToken.START_OBJECT;
@@ -1799,7 +1794,7 @@ protected void convertNumberToBigInteger() throws IOException
17991794
{
18001795
if ((_numTypesValid & NR_BIGDECIMAL) != 0) {
18011796
// here it'll just get truncated, no exceptions thrown
1802-
streamReadConstraints().validateBigIntegerScale(_numberBigDecimal.scale());
1797+
_streamReadConstraints.validateBigIntegerScale(_numberBigDecimal.scale());
18031798
_numberBigInt = _numberBigDecimal.toBigInteger();
18041799
} else if ((_numTypesValid & NR_LONG) != 0) {
18051800
_numberBigInt = BigInteger.valueOf(_numberLong);
@@ -1863,7 +1858,7 @@ protected void convertNumberToBigDecimal() throws IOException
18631858
// Let's parse from String representation, to avoid rounding errors that
18641859
//non-decimal floating operations would incur
18651860
final String text = getText();
1866-
streamReadConstraints().validateFPLength(text.length());
1861+
_streamReadConstraints.validateFPLength(text.length());
18671862
_numberBigDecimal = NumberInput.parseBigDecimal(
18681863
text, isEnabled(StreamReadFeature.USE_FAST_BIG_NUMBER_PARSER));
18691864
} else if ((_numTypesValid & NR_BIGINT) != 0) {

smile/src/main/java/com/fasterxml/jackson/dataformat/smile/SmileParserBase.java

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,6 @@ public abstract class SmileParserBase extends ParserMinimalBase
7171
*/
7272
protected final IOContext _ioContext;
7373

74-
/**
75-
* @since 2.17
76-
*/
77-
protected final StreamReadConstraints _streamReadConstraints;
78-
7974
/**
8075
* Flag that indicates whether parser is closed or not. Gets
8176
* set when parser is either closed by explicit call
@@ -254,10 +249,9 @@ public abstract class SmileParserBase extends ParserMinimalBase
254249
protected SmileParserBase(IOContext ctxt, int parserFeatures, int formatFeatures,
255250
ByteQuadsCanonicalizer sym)
256251
{
257-
super(parserFeatures);
252+
super(parserFeatures, ctxt.streamReadConstraints());
258253
_formatFeatures = formatFeatures;
259254
_ioContext = ctxt;
260-
_streamReadConstraints = ctxt.streamReadConstraints();
261255
_symbols = sym;
262256
_symbolsCanonical = sym.isCanonicalizing();
263257
DupDetector dups = Feature.STRICT_DUPLICATE_DETECTION.enabledIn(parserFeatures)
@@ -266,11 +260,6 @@ protected SmileParserBase(IOContext ctxt, int parserFeatures, int formatFeatures
266260
_textBuffer = ctxt.constructReadConstrainedTextBuffer();
267261
}
268262

269-
@Override
270-
public StreamReadConstraints streamReadConstraints() {
271-
return _streamReadConstraints;
272-
}
273-
274263
/*
275264
/**********************************************************
276265
/* Versioned

0 commit comments

Comments
 (0)