Source code: com/enterprisedt/net/ftp/FTPException.java
1 /**
2 *
3 * Java FTP client library.
4 *
5 * Copyright (C) 2000 Enterprise Distributed Technologies Ltd
6 *
7 * www.enterprisedt.com
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
13 *
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *
23 * Bug fixes, suggestions and comments should be sent to:
24 *
25 * bruceb@cryptsoft.com
26 *
27 * or by snail mail to:
28 *
29 * Bruce P. Blackshaw
30 * 53 Wakehurst Road
31 * London SW11 6DB
32 * United Kingdom
33 *
34 * Change Log:
35 *
36 * $Log: FTPException.java,v $
37 * Revision 1.3 2001/10/09 20:54:08 bruceb
38 * No change
39 *
40 * Revision 1.1 2001/10/05 14:42:04 bruceb
41 * moved from old project
42 *
43 */
44
45 package com.enterprisedt.net.ftp;
46
47 /**
48 * FTP specific exceptions
49 *
50 * @author Bruce Blackshaw
51 * @version $Revision: 1.3 $
52 *
53 */
54 public class FTPException extends Exception {
55
56 /**
57 * Revision control id
58 */
59 private static String cvsId = "$Id: FTPException.java,v 1.3 2001/10/09 20:54:08 bruceb Exp $";
60
61
62 /**
63 * Integer reply code
64 */
65 private int replyCode = -1;
66
67 /**
68 * Constructor. Delegates to super.
69 *
70 * @param msg Message that the user will be
71 * able to retrieve
72 */
73 public FTPException(String msg) {
74 super(msg);
75 }
76
77 /**
78 * Constructor. Permits setting of reply code
79 *
80 * @param msg message that the user will be
81 * able to retrieve
82 * @param replyCode string form of reply code
83 */
84 public FTPException(String msg, String replyCode) {
85
86 super(msg);
87
88 // extract reply code if possible
89 try {
90 this.replyCode = Integer.parseInt(replyCode);
91 }
92 catch (NumberFormatException ex) {
93 this.replyCode = -1;
94 }
95 }
96
97
98 /**
99 * Get the reply code if it exists
100 *
101 * @return reply if it exists, -1 otherwise
102 */
103 public int getReplyCode() {
104 return replyCode;
105 }
106
107 }