1/*
2 * reserved comment block
3 * DO NOT REMOVE OR ALTER!
4 */
5/**
6 * Licensed to the Apache Software Foundation (ASF) under one
7 * or more contributor license agreements. See the NOTICE file
8 * distributed with this work for additional information
9 * regarding copyright ownership. The ASF licenses this file
10 * to you under the Apache License, Version 2.0 (the
11 * "License"); you may not use this file except in compliance
12 * with the License. You may obtain a copy of the License at
13 *
14 * http://www.apache.org/licenses/LICENSE-2.0
15 *
16 * Unless required by applicable law or agreed to in writing,
17 * software distributed under the License is distributed on an
18 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19 * KIND, either express or implied. See the License for the
20 * specific language governing permissions and limitations
21 * under the License.
22 */
23package com.sun.org.apache.xml.internal.security.signature;
24
25/**
26 * Thrown by {@link com.sun.org.apache.xml.internal.security.signature.SignedInfo#verify()} when
27 * testing the signature fails because of uninitialized
28 * {@link com.sun.org.apache.xml.internal.security.signature.Reference}s.
29 *
30 * @author Christian Geuer-Pollmann
31 * @see ReferenceNotInitializedException
32 */
33public class MissingResourceFailureException extends XMLSignatureException {
34
35    /**
36     *
37     */
38    private static final long serialVersionUID = 1L;
39
40    /** Field uninitializedReference */
41    private Reference uninitializedReference = null;
42
43    /**
44     * MissingKeyResourceFailureException constructor.
45     * @param msgID
46     * @param reference
47     * @see #getReference
48     */
49    public MissingResourceFailureException(String msgID, Reference reference) {
50        super(msgID);
51
52        this.uninitializedReference = reference;
53    }
54
55    /**
56     * Constructor MissingResourceFailureException
57     *
58     * @param msgID
59     * @param exArgs
60     * @param reference
61     * @see #getReference
62     */
63    public MissingResourceFailureException(String msgID, Object exArgs[], Reference reference) {
64        super(msgID, exArgs);
65
66        this.uninitializedReference = reference;
67    }
68
69    /**
70     * Constructor MissingResourceFailureException
71     *
72     * @param msgID
73     * @param originalException
74     * @param reference
75     * @see #getReference
76     */
77    public MissingResourceFailureException(
78        String msgID, Exception originalException, Reference reference
79    ) {
80        super(msgID, originalException);
81
82        this.uninitializedReference = reference;
83    }
84
85    /**
86     * Constructor MissingResourceFailureException
87     *
88     * @param msgID
89     * @param exArgs
90     * @param originalException
91     * @param reference
92     * @see #getReference
93     */
94    public MissingResourceFailureException(
95        String msgID, Object exArgs[], Exception originalException, Reference reference
96    ) {
97        super(msgID, exArgs, originalException);
98
99        this.uninitializedReference = reference;
100    }
101
102    /**
103     * used to set the uninitialized {@link com.sun.org.apache.xml.internal.security.signature.Reference}
104     *
105     * @param reference the Reference object
106     * @see #getReference
107     */
108    public void setReference(Reference reference) {
109        this.uninitializedReference = reference;
110    }
111
112    /**
113     * used to get the uninitialized {@link com.sun.org.apache.xml.internal.security.signature.Reference}
114     *
115     * This allows to supply the correct {@link com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput}
116     * to the {@link com.sun.org.apache.xml.internal.security.signature.Reference} to try again verification.
117     *
118     * @return the Reference object
119     * @see #setReference
120     */
121    public Reference getReference() {
122        return this.uninitializedReference;
123    }
124}
125