001 /*
002 * Copyright 2003-2004 The Apache Software Foundation
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package org.apache.commons.net.telnet;
017
018 /***
019 * The InvalidTelnetOptionException is the exception that is
020 * thrown whenever a TelnetOptionHandler with an invlaid
021 * option code is registered in TelnetClient with addOptionHandler.
022 * <p>
023 * @author Bruno D'Avanzo
024 ***/
025 public class InvalidTelnetOptionException extends Exception
026 {
027
028 /***
029 * Option code
030 ***/
031 private int optionCode = -1;
032
033 /***
034 * Error message
035 ***/
036 private String msg;
037
038 /***
039 * Constructor for the exception.
040 * <p>
041 * @param message - Error message.
042 * @param optcode - Option code.
043 ***/
044 public InvalidTelnetOptionException(String message, int optcode)
045 {
046 optionCode = optcode;
047 msg = message;
048 }
049
050 /***
051 * Gets the error message of ths exception.
052 * <p>
053 * @return the error message.
054 ***/
055 public String getMessage()
056 {
057 return (msg + ": " + optionCode);
058 }
059 }