001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017:
018: /**
019: * @author Vera Y. Petrashkova
020: * @version $Revision$
021: */package java.security.cert;
022:
023: import java.security.GeneralSecurityException;
024:
025: import org.apache.harmony.security.internal.nls.Messages;
026:
027: /**
028: * @com.intel.drl.spec_ref
029: *
030: */
031: public class CertPathValidatorException extends
032: GeneralSecurityException {
033: /**
034: * @com.intel.drl.spec_ref
035: */
036: private static final long serialVersionUID = -3083180014971893139L;
037:
038: /**
039: * @com.intel.drl.spec_ref
040: *
041: * Serialized field for storing certPath which is defined in constructor
042: * CertPathValidatorException(msg, cause, certPath, index)
043: */
044: private CertPath certPath;
045:
046: /**
047: * @com.intel.drl.spec_ref
048: *
049: * Serialized field for storing index which is defined in constructor
050: * CertPathValidatorException(msg, cause, certPath, index)
051: */
052: private int index = -1;
053:
054: /**
055: * @com.intel.drl.spec_ref
056: */
057: public CertPathValidatorException(String msg, Throwable cause,
058: CertPath certPath, int index) {
059: super (msg, cause);
060: // check certPath and index parameters
061: if ((certPath == null) && (index != -1)) {
062: throw new IllegalArgumentException(Messages
063: .getString("security.53")); //$NON-NLS-1$
064: }
065: if ((certPath != null)
066: && ((index < -1) || (index >= certPath
067: .getCertificates().size()))) {
068: throw new IndexOutOfBoundsException(Messages
069: .getString("security.54")); //$NON-NLS-1$
070: }
071: this .certPath = certPath;
072: this .index = index;
073: }
074:
075: /**
076: * @com.intel.drl.spec_ref
077: */
078: public CertPathValidatorException(String msg, Throwable cause) {
079: super (msg, cause);
080: }
081:
082: /**
083: * @com.intel.drl.spec_ref
084: */
085: public CertPathValidatorException(Throwable cause) {
086: super (cause);
087: }
088:
089: /**
090: * @com.intel.drl.spec_ref
091: */
092: public CertPathValidatorException(String msg) {
093: super (msg);
094: }
095:
096: /**
097: * @com.intel.drl.spec_ref
098: */
099: public CertPathValidatorException() {
100: }
101:
102: /**
103: * @com.intel.drl.spec_ref
104: */
105: public CertPath getCertPath() {
106: return certPath;
107: }
108:
109: /**
110: * @com.intel.drl.spec_ref
111: */
112: public int getIndex() {
113: return index;
114: }
115: }
|