Record Class Limits
- Record Components:
maxDepth- maximum nesting depth (reference default: 200)maxNodeCount- maximum materialized node count (reference default: 1 000 000)maxIntegerDigits- maximum decimal digits in an integer literal (reference default: 4 300)maxInputBytes- maximum input size in bytes, counted before a byte-order mark is stripped and before decoding (default:DEFAULT_MAX_INPUT_BYTES, 64 MiB)
Enforced by every untrusted-input entry point: OmlLexer,
OsdReader, and each format codec's reader. Not by
Node/Edge construction itself, which stays unconditionally trusting
(a document already built in memory has no "input" left to bound).
Every reader that accepts a Limits applies all four bounds (D-9, D-23, E-4a): the OML
reader through OmlReader.read(String, Limits), and the JSON, TOML and XML
codecs through their readWithLimits methods (YAML through
YamlCodec.readWithLimits(String, dev.omnist.codec.YamlLimits, Limits)).
An over-limit input is refused with the OML reader's diagnostic whatever the format:
document.limit.depth and document.limit.nodes at $,
document.limit.int-digits at the Document path of the integer, which counts the decimal
digits of the value (D-28), not of a hexadecimal, octal or binary spelling.
A value that is not positive is refused with IllegalArgumentException, never quietly
replaced by the default or read as "no limit" (D-10: every bound is finite). maxInputBytes
is also refused above MAX_INPUT_BYTES_CEILING.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final LimitsNormative reference default limits per omnist-spec §2.4, plus this port's input-size default.static final intThis implementation's default maximum input size (D-23, D-24): 64 MiB.static final intLargest acceptedmaxInputBytes: 1 GiB, well inside a JavaStringand a heap. -
Constructor Summary
ConstructorsConstructorDescriptionLimits(int maxDepth, int maxNodeCount, int maxIntegerDigits) The limits of releases before the input-size bound existed: the given three, and the defaultDEFAULT_MAX_INPUT_BYTESinput size.Limits(int maxDepth, int maxNodeCount, int maxIntegerDigits, int maxInputBytes) Creates an instance, validating its components. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intmaxDepth()Returns the value of themaxDepthrecord component.intReturns the value of themaxInputBytesrecord component.intReturns the value of themaxIntegerDigitsrecord component.intReturns the value of themaxNodeCountrecord component.final StringtoString()Returns a string representation of this record class.withMaxInputBytes(int bytes) Returns these limits with another input-size maximum.
-
Field Details
-
DEFAULT_MAX_INPUT_BYTES
public static final int DEFAULT_MAX_INPUT_BYTESThis implementation's default maximum input size (D-23, D-24): 64 MiB. The spec names no reference number; seedocs/limitations.mdfor what was measured behind this one.- See Also:
-
MAX_INPUT_BYTES_CEILING
public static final int MAX_INPUT_BYTES_CEILINGLargest acceptedmaxInputBytes: 1 GiB, well inside a JavaStringand a heap.- See Also:
-
DEFAULT
Normative reference default limits per omnist-spec §2.4, plus this port's input-size default.
-
-
Constructor Details
-
Limits
public Limits(int maxDepth, int maxNodeCount, int maxIntegerDigits) The limits of releases before the input-size bound existed: the given three, and the defaultDEFAULT_MAX_INPUT_BYTESinput size.- Parameters:
maxDepth- maximum nesting depthmaxNodeCount- maximum materialized node countmaxIntegerDigits- maximum decimal digits in an integer literal- Throws:
IllegalArgumentException- if any limit is not positive
-
Limits
public Limits(int maxDepth, int maxNodeCount, int maxIntegerDigits, int maxInputBytes) Creates an instance, validating its components.- Throws:
IllegalArgumentException- if any limit is not positive, ormaxInputBytesis aboveMAX_INPUT_BYTES_CEILING
-
-
Method Details
-
withMaxInputBytes
Returns these limits with another input-size maximum.- Parameters:
bytes- the newmaxInputBytes- Returns:
- a copy with
maxInputBytesreplaced - Throws:
IllegalArgumentException- ifbytesis not positive or is above the ceiling
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='. -
maxDepth
public int maxDepth()Returns the value of themaxDepthrecord component.- Returns:
- the value of the
maxDepthrecord component
-
maxNodeCount
public int maxNodeCount()Returns the value of themaxNodeCountrecord component.- Returns:
- the value of the
maxNodeCountrecord component
-
maxIntegerDigits
public int maxIntegerDigits()Returns the value of themaxIntegerDigitsrecord component.- Returns:
- the value of the
maxIntegerDigitsrecord component
-
maxInputBytes
public int maxInputBytes()Returns the value of themaxInputBytesrecord component.- Returns:
- the value of the
maxInputBytesrecord component
-