Package com.orbit.engine
Class MatchTimeoutException
java.lang.Object
java.lang.Throwable
java.lang.Exception
com.orbit.engine.MatchTimeoutException
- All Implemented Interfaces:
Serializable
Thrown by
BoundedBacktrackEngine when the number of
operations performed during a single match invocation exceeds the configured backtrack
budget.
This exception provides ReDoS protection: a pattern that exhibits catastrophic backtracking on a given input will be interrupted rather than running indefinitely.
Instances are safe to catch and handle; the engine is left in a clean state after throwing.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionMatchTimeoutException(String patternString, int inputLength, int budget) Creates a newMatchTimeoutExceptionwith structured diagnostic context. -
Method Summary
Modifier and TypeMethodDescriptionintbudget()Returns the backtrack budget that was exceeded.intReturns the length of the input against which the match was attempted.Returns the pattern string associated with the timed-out match.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
MatchTimeoutException
Creates a newMatchTimeoutExceptionwith structured diagnostic context.- Parameters:
patternString- the compiled pattern string, or"<unknown>"if unavailable; must not be nullinputLength- the length of the input string being matched; must be >= 0budget- the backtrack budget that was exceeded; must be > 0
-
-
Method Details
-
patternString
Returns the pattern string associated with the timed-out match.- Returns:
- the pattern string; never null
-
inputLength
public int inputLength()Returns the length of the input against which the match was attempted.- Returns:
- the input length; >= 0
-
budget
public int budget()Returns the backtrack budget that was exceeded.- Returns:
- the budget; > 0
-