Contents
- Description
- Constructor Summary
- Method Summary
- Constructor Details
- Method Details
- arrayTooLong(String, int, int)
- stringTooLong(String, int, int)
- dictionaryTooLarge(String, int, int)
- bufferTooSmall(String, int, int)
- invalidVarInt(String)
- nonAdvancingEntry(String, int)
- invalidOffset(String, int, int)
- nonCanonicalLayout(String, int, int)
- unknownPolymorphicType(String, int)
- nestingTooDeep(String, int)
- duplicateKey(String, Object)
- invalidEnumValue(String, int)
- arrayTooShort(String, int, int)
- stringTooShort(String, int, int)
- dictionaryTooSmall(String, int, int)
- valueOutOfRange(String, Object, double, double)
- valueBelowMinimum(String, Object, double)
- valueAboveMaximum(String, Object, double)
- invalidAsciiString(String)
- malformedString(String)
- valueNotFinite(String, Object)
Class ProtocolException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
com.hypixel.hytale.protocol.io.ProtocolException
- All Implemented Interfaces:
Serializable
Exception thrown when protocol data is malformed or exceeds defined limits.
Used for both read-side validation (untrusted input) and write-side validation (defense in depth).
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionProtocolException(String message) ProtocolException(String message, Throwable cause) -
Method Summary
Modifier and TypeMethodDescriptionstatic ProtocolExceptionarrayTooLong(String fieldName, int actual, int max) Creates an exception for array length exceeding the maximum allowed.static ProtocolExceptionarrayTooShort(String fieldName, int actual, int min) Creates an exception for array length below the minimum required.static ProtocolExceptionbufferTooSmall(String fieldName, int required, int available) Creates an exception for buffer being too small to read the expected data.static ProtocolExceptiondictionaryTooLarge(String fieldName, int actual, int max) Creates an exception for dictionary count exceeding the maximum allowed.static ProtocolExceptiondictionaryTooSmall(String fieldName, int actual, int min) Creates an exception for dictionary count below the minimum required.static ProtocolExceptionduplicateKey(String fieldName, Object key) Creates an exception for duplicate dictionary key.static ProtocolExceptioninvalidAsciiString(String fieldName) Creates an exception for a string containing non-ASCII bytes.static ProtocolExceptioninvalidEnumValue(String enumName, int value) Creates an exception for invalid enum value.static ProtocolExceptioninvalidOffset(String fieldName, int offset, int bufferLength) Creates an exception for invalid offset values.static ProtocolExceptioninvalidVarInt(String fieldName) Creates an exception for invalid VarInt encoding.static ProtocolExceptionmalformedString(String fieldName) Creates an exception for a string whose bytes are not well-formed in its declared charset.static ProtocolExceptionnestingTooDeep(String typeName, int max) Creates an exception for a value nested deeper than the decoder allows.static ProtocolExceptionnonAdvancingEntry(String fieldName, int offset) Creates an exception for a collection entry that consumes no bytes.static ProtocolExceptionnonCanonicalLayout(String fieldName, int actual, int expected) A writer lays the variable block out contiguously in field order, so a present field's offset slot equals the end of the previous one and an absent field's slot is -1.static ProtocolExceptionstringTooLong(String fieldName, int actual, int max) Creates an exception for string length exceeding the maximum allowed.static ProtocolExceptionstringTooShort(String fieldName, int actual, int min) Creates an exception for string length below the minimum required.static ProtocolExceptionunknownPolymorphicType(String typeName, int typeId) Creates an exception for unknown polymorphic type ID.static ProtocolExceptionvalueAboveMaximum(String fieldName, Object value, double max) Creates an exception for numeric value above the maximum.static ProtocolExceptionvalueBelowMinimum(String fieldName, Object value, double min) Creates an exception for numeric value below the minimum.static ProtocolExceptionvalueNotFinite(String fieldName, Object value) Creates an exception for a non-finite (NaN or +/-Infinity) floating-point value.static ProtocolExceptionvalueOutOfRange(String fieldName, Object value, double min, double max) Creates an exception for numeric value outside the allowed range.Methods inherited from class Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
ProtocolException
-
ProtocolException
-
-
Method Details
-
arrayTooLong
@Nonnull public static ProtocolException arrayTooLong(@Nonnull String fieldName, int actual, int max) Creates an exception for array length exceeding the maximum allowed. -
stringTooLong
@Nonnull public static ProtocolException stringTooLong(@Nonnull String fieldName, int actual, int max) Creates an exception for string length exceeding the maximum allowed. -
dictionaryTooLarge
@Nonnull public static ProtocolException dictionaryTooLarge(@Nonnull String fieldName, int actual, int max) Creates an exception for dictionary count exceeding the maximum allowed. -
bufferTooSmall
@Nonnull public static ProtocolException bufferTooSmall(@Nonnull String fieldName, int required, int available) Creates an exception for buffer being too small to read the expected data. -
invalidVarInt
Creates an exception for invalid VarInt encoding. -
nonAdvancingEntry
Creates an exception for a collection entry that consumes no bytes. -
invalidOffset
@Nonnull public static ProtocolException invalidOffset(@Nonnull String fieldName, int offset, int bufferLength) Creates an exception for invalid offset values. -
nonCanonicalLayout
@Nonnull public static ProtocolException nonCanonicalLayout(@Nonnull String fieldName, int actual, int expected) A writer lays the variable block out contiguously in field order, so a present field's offset slot equals the end of the previous one and an absent field's slot is -1. Element loops advance by the re-encoded size, which only equals the occupied span while that holds. -
unknownPolymorphicType
@Nonnull public static ProtocolException unknownPolymorphicType(@Nonnull String typeName, int typeId) Creates an exception for unknown polymorphic type ID. -
nestingTooDeep
Creates an exception for a value nested deeper than the decoder allows. -
duplicateKey
@Nonnull public static ProtocolException duplicateKey(@Nonnull String fieldName, @Nonnull Object key) Creates an exception for duplicate dictionary key. -
invalidEnumValue
Creates an exception for invalid enum value. -
arrayTooShort
@Nonnull public static ProtocolException arrayTooShort(@Nonnull String fieldName, int actual, int min) Creates an exception for array length below the minimum required. -
stringTooShort
@Nonnull public static ProtocolException stringTooShort(@Nonnull String fieldName, int actual, int min) Creates an exception for string length below the minimum required. -
dictionaryTooSmall
@Nonnull public static ProtocolException dictionaryTooSmall(@Nonnull String fieldName, int actual, int min) Creates an exception for dictionary count below the minimum required. -
valueOutOfRange
@Nonnull public static ProtocolException valueOutOfRange(@Nonnull String fieldName, @Nonnull Object value, double min, double max) Creates an exception for numeric value outside the allowed range. -
valueBelowMinimum
@Nonnull public static ProtocolException valueBelowMinimum(@Nonnull String fieldName, @Nonnull Object value, double min) Creates an exception for numeric value below the minimum. -
valueAboveMaximum
@Nonnull public static ProtocolException valueAboveMaximum(@Nonnull String fieldName, @Nonnull Object value, double max) Creates an exception for numeric value above the maximum. -
invalidAsciiString
Creates an exception for a string containing non-ASCII bytes. -
malformedString
Creates an exception for a string whose bytes are not well-formed in its declared charset. -
valueNotFinite
@Nonnull public static ProtocolException valueNotFinite(@Nonnull String fieldName, @Nonnull Object value) Creates an exception for a non-finite (NaN or +/-Infinity) floating-point value.
-