01: /*
02: * Enhydra Java Application Server Project
03: *
04: * The contents of this file are subject to the Enhydra Public License
05: * Version 1.1 (the "License"); you may not use this file except in
06: * compliance with the License. You may obtain a copy of the License on
07: * the Enhydra web site ( http://www.enhydra.org/ ).
08: *
09: * Software distributed under the License is distributed on an "AS IS"
10: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11: * the License for the specific terms governing rights and limitations
12: * under the License.
13: *
14: * The Initial Developer of the Enhydra Application Server is Lutris
15: * Technologies, Inc. The Enhydra Application Server and portions created
16: * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
17: * All Rights Reserved.
18: *
19: * Contributor(s):
20: *
21: * $Id: MimeException.java,v 1.2 2006-06-15 13:40:47 sinisa Exp $
22: */
23:
24: package com.lutris.mime;
25:
26: /**
27: * Public exception class to indicate an error in Mime data.
28: * This is never thrown by <code>MultiparMimeInputStream</code> since
29: * that class needs to look exactly like an <code>InputStream</code>.
30: */
31: public class MimeException extends Exception {
32: /**
33: * Indicates a general error in parsing Mime data.
34: */
35: public static final int GENERIC = 0;
36:
37: /**
38: * Indicates incorrect Mime header syntax or illegal parameters.
39: */
40: public static final int INVALID_HEADER = 1;
41:
42: /**
43: * Indicates an illegal Mime type for a particular operation. For
44: * example, this code is generated if an attempt is made to create
45: * a <code>MultipartMimeInput</code> object with a Mime type other than
46: * <b>multipart/*</b>.
47: */
48: public static final int INVALID_MIME_TYPE = 2;
49:
50: /**
51: * Holds the reason code for this exception instance.
52: */
53: public int reason = GENERIC;
54:
55: /**
56: * Creates a MimeException object with informational string
57: * <code>s</code> and reason code <code>reason</code>.
58: *
59: * @param s Informational string.
60: * @param reason Reason code.
61: */
62: MimeException(String s, int reason) {
63: super (s);
64: this .reason = reason;
65: }
66:
67: /**
68: * Creates a MimeException object with informational string
69: * <code>s</code> and the default reason code, <code>GENERIC</code>.
70: *
71: * @param s Informational string.
72: */
73: MimeException(String s) {
74: super (s);
75: reason = GENERIC;
76: }
77:
78: /**
79: * Creates a MimeException object with informational string
80: * <code>s</code> and the default reason code, <code>GENERIC</code>.
81: *
82: * @param s Informational string.
83: */
84: MimeException() {
85: super();
86: reason = GENERIC;
87: }
88: }
|