Contents
Class DepthLimitedJsonReader
java.lang.Object
org.bson.AbstractBsonReader
org.bson.json.JsonReader
com.hypixel.hytale.server.core.util.DepthLimitedJsonReader
- All Implemented Interfaces:
Closeable, AutoCloseable, org.bson.BsonReader
public final class DepthLimitedJsonReader
extends org.bson.json.JsonReader
A
JsonReader that aborts once JSON nests deeper than maxDepth levels.
org.bson decodes documents and arrays by recursing once per nesting level
(BsonDocumentCodec.decode -> readValue -> decode); with no depth bound,
deeply nested input overflows the JVM stack. Every real document/array boundary passes through the
overridden readStart*/readEnd* methods, so incrementing on entry and throwing past
the limit halts the codec's recursion with a controlled exception well before the stack is
exhausted. The extended-JSON lookahead ($oid, $date, ...) is token-level and opens
no document context, so it does not affect the count.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classThrown when the JSON input nests deeper than the reader's configured limit.Nested classes/interfaces inherited from class org.bson.AbstractBsonReader
org.bson.AbstractBsonReader.State -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidvoidvoidMethods inherited from class org.bson.json.JsonReader
doReadDecimal128, getMark, readBsonTypeMethods inherited from class org.bson.AbstractBsonReader
close, getCurrentBsonType, getCurrentName, getState, peekBinarySize, peekBinarySubType, readBinaryData, readBinaryData, readBoolean, readBoolean, readDateTime, readDateTime, readDBPointer, readDBPointer, readDecimal128, readDecimal128, readDouble, readDouble, readInt32, readInt32, readInt64, readInt64, readJavaScript, readJavaScript, readJavaScriptWithScope, readJavaScriptWithScope, readMaxKey, readMaxKey, readMinKey, readMinKey, readName, readName, readNull, readNull, readObjectId, readObjectId, readRegularExpression, readRegularExpression, readString, readString, readSymbol, readSymbol, readTimestamp, readTimestamp, readUndefined, readUndefined, skipName, skipValue
-
Constructor Details
-
DepthLimitedJsonReader
-
-
Method Details
-
readStartDocument
public void readStartDocument()- Specified by:
readStartDocumentin interfaceorg.bson.BsonReader- Overrides:
readStartDocumentin classorg.bson.AbstractBsonReader
-
readStartArray
public void readStartArray()- Specified by:
readStartArrayin interfaceorg.bson.BsonReader- Overrides:
readStartArrayin classorg.bson.AbstractBsonReader
-
readEndDocument
public void readEndDocument()- Specified by:
readEndDocumentin interfaceorg.bson.BsonReader- Overrides:
readEndDocumentin classorg.bson.AbstractBsonReader
-
readEndArray
public void readEndArray()- Specified by:
readEndArrayin interfaceorg.bson.BsonReader- Overrides:
readEndArrayin classorg.bson.AbstractBsonReader
-