01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: /**
19: * @author Alexander Y. Kleymenov
20: * @version $Revision$
21: */package org.apache.harmony.xnet.provider.jsse;
22:
23: import javax.net.ssl.SSLException;
24:
25: /**
26: * This exception is used to signalize the fatal alert
27: * occured during the work of protocol.
28: */
29: public class AlertException extends RuntimeException {
30:
31: // SSLException to be thrown to application side
32: private final SSLException reason;
33: // alert description code
34: private final byte description;
35:
36: /**
37: * Constructs the instance.
38: * @param description: The alert description code.
39: * @see org.apache.harmony.xnet.provider.jsse.AlertProtocol
40: * @param reason: The SSLException to be thrown to application
41: * side after alert processing (sending the record with alert,
42: * shoutdown work, etc).
43: */
44: protected AlertException(byte description, SSLException reason) {
45: super (reason);
46: this .reason = reason;
47: this .description = description;
48: }
49:
50: /**
51: * Returns the reason of alert. This reason should be rethrown
52: * after alert protcessin.
53: * @return the reason of alert.
54: */
55: protected SSLException getReason() {
56: return reason;
57: }
58:
59: /**
60: * Returns alert's description code.
61: * @return byte value describing the occured alert.
62: * @see org.apache.harmony.xnet.provider.jsse.AlertProtocol for more information about possible
63: * reason codes.
64: */
65: protected byte getDescriptionCode() {
66: return description;
67: }
68: }
|