Class ValidationError


  • public class ValidationError
    extends java.lang.Object
    Holds information about a single validation problem with a reference to the certificate chain. Each error may refer to particular certificate in the chain, contains an unique code and a coarse grained category.
    Author:
    K. Benedyczak
    See Also:
    ValidationResult, ValidationErrorListener, ValidationErrorCategory
    • Constructor Detail

      • ValidationError

        public ValidationError​(java.security.cert.X509Certificate[] chain,
                               int position,
                               ValidationErrorCode errorCode,
                               java.lang.Object... params)
    • Method Detail

      • makeReasonFromStack

        public static java.lang.String makeReasonFromStack​(java.lang.Throwable t)
      • makeReason

        public static java.lang.String makeReason​(java.lang.Throwable t)
      • getPosition

        public int getPosition()
        Returns position in chain of the certificate causing the error. If the error is related to chain inconsistency (so more then one certificate is involved) then the lowest number of the certificate involved must be returned.
        Returns:
        position of the erroneous certificate in chain or -1 if not defied.
      • getMessage

        public java.lang.String getMessage()
        Returns human readable message describing this error. The message is formatted in accordance to the current locale settings.
        Returns:
        the error message
      • getErrorCode

        public ValidationErrorCode getErrorCode()
        Gets the unique error code. Error codes are defined in bundle with messages (in a properties file).
        Returns:
        the error code
      • getParameters

        public java.lang.Object[] getParameters()
        Gets the error parameters.
        Returns:
        the error parameters
      • getErrorCategory

        public ValidationErrorCategory getErrorCategory()
        Returns a coarse grained error category.
        Returns:
        error category
      • getChain

        public java.security.cert.X509Certificate[] getChain()
        Returns:
        the certificate chain which caused the validation error
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object