Class IllegalThrowsCheck

  • All Implemented Interfaces:
    Configurable, Contextualizable

    public final class IllegalThrowsCheck
    extends AbstractCheck

    Throwing java.lang.Error or java.lang.RuntimeException is almost never acceptable.

    Check has following properties:

    illegalClassNames - throw class names to reject.

    ignoredMethodNames - names of methods to ignore.

    ignoreOverriddenMethods - ignore checking overridden methods (marked with Override or java.lang.Override annotation) default value is true.

    Author:
    Oliver Burn, John Sirois, Aleksey Nesterenko
    • Method Detail

      • setIllegalClassNames

        public void setIllegalClassNames​(String... classNames)
        Set the list of illegal classes.
        Parameters:
        classNames - array of illegal exception classes
      • getAcceptableTokens

        public int[] getAcceptableTokens()
        Description copied from class: AbstractCheck
        The configurable token set. Used to protect Checks against malicious users who specify an unacceptable token set in the configuration file. The default implementation returns the check's default tokens.
        Specified by:
        getAcceptableTokens in class AbstractCheck
        Returns:
        the token set this check is designed for.
        See Also:
        TokenTypes
      • setIgnoredMethodNames

        public void setIgnoredMethodNames​(String... methodNames)
        Set the list of ignore method names.
        Parameters:
        methodNames - array of ignored method names
      • setIgnoreOverriddenMethods

        public void setIgnoreOverriddenMethods​(boolean ignoreOverriddenMethods)
        Sets ignoreOverriddenMethods property value.
        Parameters:
        ignoreOverriddenMethods - Check's property.