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. * The InvalidTelnetOptionException is the exception that is
  19. * thrown whenever a TelnetOptionHandler with an invlaid
  20. * option code is registered in TelnetClient with addOptionHandler.
  21. * <p>
  22. * @author Bruno D'Avanzo
  23. ***/
  24. public class InvalidTelnetOptionException extends Exception
  25. {
  26. /***
  27. * Option code
  28. ***/
  29. private int optionCode = -1;
  30. /***
  31. * Error message
  32. ***/
  33. private String msg;
  34. /***
  35. * Constructor for the exception.
  36. * <p>
  37. * @param message - Error message.
  38. * @param optcode - Option code.
  39. ***/
  40. public InvalidTelnetOptionException(String message, int optcode)
  41. {
  42. optionCode = optcode;
  43. msg = message;
  44. }
  45. /***
  46. * Gets the error message of ths exception.
  47. * <p>
  48. * @return the error message.
  49. ***/
  50. public String getMessage()
  51. {
  52. return (msg + ": " + optionCode);
  53. }
  54. }