1 package com
.easysw
.cups
;
4 * @version 1.00 06-NOV-2002
7 * Internet Printing Protocol definitions for the Common UNIX Printing
10 * Copyright 2007 by Apple Inc.
11 * Copyright 1997-2002 by Easy Software Products.
13 * These coded instructions, statements, and computer programs are the
14 * property of Apple Inc. and are protected by Federal copyright
15 * law. Distribution and use rights are outlined in the file "LICENSE.txt"
16 * which should have been included with this file. If this file is
17 * file is missing or damaged, see the license at "http://www.cups.org/".
21 * An <code>IPPError</code> object is used for error conversion.
34 private int error_number
;
35 private String error_string
;
39 * Constructor that sets <code>error_string</code> after creation.
41 * @param <code>error_number</code> Error number to convert.
42 * @see <code>IPPDefs</code>
44 public IPPError(int p_error
)
46 error_number
= p_error
;
47 error_string
= ippErrorString( error_number
);
52 * Get the string associated with an error number.
54 * @param <code>error</code> Error number to convert.
55 * @see <code>IPPDefs</code>
57 private String
ippErrorString( int error
)
60 String status_oks
[] = // "OK" status codes
63 "successful-ok-ignored-or-substituted-attributes",
64 "successful-ok-conflicting-attributes",
65 "successful-ok-ignored-subscriptions",
66 "successful-ok-ignored-notifications",
67 "successful-ok-too-many-events",
68 "successful-ok-but-cancel-subscription"
71 String status_400s
[] = // Client errors
73 "client-error-bad-request",
74 "client-error-forbidden",
75 "client-error-not-authenticated",
76 "client-error-not-authorized",
77 "client-error-not-possible",
78 "client-error-timeout",
79 "client-error-not-found",
81 "client-error-request-entity-too-large",
82 "client-error-request-value-too-long",
83 "client-error-document-format-not-supported",
84 "client-error-attributes-or-values-not-supported",
85 "client-error-uri-scheme-not-supported",
86 "client-error-charset-not-supported",
87 "client-error-conflicting-attributes",
88 "client-error-compression-not-supported",
89 "client-error-compression-error",
90 "client-error-document-format-error",
91 "client-error-document-access-error",
92 "client-error-attributes-not-settable",
93 "client-error-ignored-all-subscriptions",
94 "client-error-too-many-subscriptions",
95 "client-error-ignored-all-notifications",
96 "client-error-print-support-file-not-found"
99 String status_500s
[] = // Server errors
101 "server-error-internal-error",
102 "server-error-operation-not-supported",
103 "server-error-service-unavailable",
104 "server-error-version-not-supported",
105 "server-error-device-error",
106 "server-error-temporary-error",
107 "server-error-not-accepting-jobs",
109 "server-error-job-canceled",
110 "server-error-multiple-document-jobs-not-supported",
111 "server-error-printer-is-deactivated"
116 // See if the error code is a known value...
118 if ((error
>= IPPDefs
.OK
) && (error
<= IPPDefs
.OK_BUT_CANCEL_SUBSCRIPTION
))
120 return (status_oks
[error
]);
122 else if (error
== IPPDefs
.REDIRECTION_OTHER_SITE
)
124 return ("redirection-other-site");
126 else if ((error
>= IPPDefs
.BAD_REQUEST
) &&
127 (error
<= IPPDefs
.PRINT_SUPPORT_FILE_NOT_FOUND
))
129 return (status_400s
[error
- IPPDefs
.BAD_REQUEST
]);
131 else if ((error
>= IPPDefs
.INTERNAL_ERROR
) &&
132 (error
<= IPPDefs
.PRINTER_IS_DEACTIVATED
))
134 return (status_500s
[error
- IPPDefs
.INTERNAL_ERROR
]);
138 // No, build an "unknown-xxxx" error string...
141 unknown
= "unknown" + error
;
147 } // End of IPPError class