View Javadoc

    1   /*
    2    * Copyright 2003-2004 The Apache Software Foundation
    3    *
    4    * Licensed under the Apache License, Version 2.0 (the "License");
    5    * you may not use this file except in compliance with the License.
    6    * You may obtain a copy of the License at
    7    *
    8    *     http://www.apache.org/licenses/LICENSE-2.0
    9    *
    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      /****
    29       * Option code
    30       ***/
    31      private int optionCode = -1;
    32
    33      /****
    34       * Error message
    35       ***/
    36      private String msg;
    37
    38      /****
    39       * Constructor for the exception.
    40       * <p>
    41       * @param message - Error message.
    42       * @param optcode - Option code.
    43       ***/
    44      public InvalidTelnetOptionException(String message, int optcode)
    45      {
    46          optionCode = optcode;
    47          msg = message;
    48      }
    49
    50      /****
    51       * Gets the error message of ths exception.
    52       * <p>
    53       * @return the error message.
    54       ***/
    55      public String getMessage()
    56      {
    57          return (msg + ": " + optionCode);
    58      }
    59  }