01: /*
02: * Copyright 2003-2004 The Apache Software Foundation
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.apache.commons.net.telnet;
17:
18: /***
19: * The InvalidTelnetOptionException is the exception that is
20: * thrown whenever a TelnetOptionHandler with an invlaid
21: * option code is registered in TelnetClient with addOptionHandler.
22: * <p>
23: * @author Bruno D'Avanzo
24: ***/
25: public class InvalidTelnetOptionException extends Exception {
26:
27: /***
28: * Option code
29: ***/
30: private int optionCode = -1;
31:
32: /***
33: * Error message
34: ***/
35: private String msg;
36:
37: /***
38: * Constructor for the exception.
39: * <p>
40: * @param message - Error message.
41: * @param optcode - Option code.
42: ***/
43: public InvalidTelnetOptionException(String message, int optcode) {
44: optionCode = optcode;
45: msg = message;
46: }
47:
48: /***
49: * Gets the error message of ths exception.
50: * <p>
51: * @return the error message.
52: ***/
53: public String getMessage() {
54: return (msg + ": " + optionCode);
55: }
56: }
|