Class MatchTimeoutException

java.lang.Object
java.lang.Throwable
java.lang.Exception
com.orbit.engine.MatchTimeoutException
All Implemented Interfaces:
Serializable

public class MatchTimeoutException extends Exception
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 Details

    • MatchTimeoutException

      public MatchTimeoutException(String patternString, int inputLength, int budget)
      Creates a new MatchTimeoutException with structured diagnostic context.
      Parameters:
      patternString - the compiled pattern string, or "<unknown>" if unavailable; must not be null
      inputLength - the length of the input string being matched; must be >= 0
      budget - the backtrack budget that was exceeded; must be > 0
  • Method Details

    • patternString

      public String 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