summaryrefslogtreecommitdiffstats
path: root/bcprov/src/main/java/org/bouncycastle/x509/CertPathReviewerException.java
blob: 173d478901d868dfef71600584a13470f6d8c057 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package org.bouncycastle.x509;

import java.security.cert.CertPath;

import org.bouncycastle.i18n.ErrorBundle;
import org.bouncycastle.i18n.LocalizedException;

public class CertPathReviewerException extends LocalizedException
{

    private int index = -1;
    
    private CertPath certPath = null;
    
    public CertPathReviewerException(ErrorBundle errorMessage, Throwable throwable)
    {
        super(errorMessage, throwable);
    }

    public CertPathReviewerException(ErrorBundle errorMessage)
    {
        super(errorMessage);
    }

    public CertPathReviewerException(
            ErrorBundle errorMessage, 
            Throwable throwable,
            CertPath certPath,
            int index)
    {
        super(errorMessage, throwable);
        if (certPath == null || index == -1)
        {
            throw new IllegalArgumentException();
        }
        if (index < -1 || (certPath != null && index >= certPath.getCertificates().size()))
        {
            throw new IndexOutOfBoundsException();
        }
        this.certPath = certPath;
        this.index = index;
    }
    
    public CertPathReviewerException(
            ErrorBundle errorMessage, 
            CertPath certPath,
            int index)
    {
        super(errorMessage);
        if (certPath == null || index == -1)
        {
            throw new IllegalArgumentException();
        }
        if (index < -1 || (certPath != null && index >= certPath.getCertificates().size()))
        {
            throw new IndexOutOfBoundsException();
        }
        this.certPath = certPath;
        this.index = index;
    }
    
    public CertPath getCertPath()
    {
        return certPath;
    }
    
    public int getIndex()
    {
        return index;
    }

}