01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: package org.apache.tomcat.jni;
19:
20: /** Error
21: *
22: * @author Mladen Turk
23: * @version $Revision: 467222 $, $Date: 2006-10-24 05:17:11 +0200 (mar., 24 oct. 2006) $
24: */
25:
26: public class Error extends Exception {
27:
28: /**
29: * APR error type.
30: */
31: private int error;
32:
33: /**
34: * A description of the problem.
35: */
36: private String description;
37:
38: /**
39: * Construct an APRException.
40: *
41: * @param error one of the value in Error
42: * @param description error message
43: */
44: private Error(int error, String description) {
45: super (description);
46: this .error = error;
47: this .description = description;
48: }
49:
50: /**
51: * Get the APR error code of the exception.
52: *
53: * @return error of the Exception
54: */
55: public int getError() {
56: return error;
57: }
58:
59: /**
60: * Get the APR description of the exception.
61: *
62: * @return description of the Exception
63: */
64: public String getDescription() {
65: return description;
66: }
67:
68: /**
69: * Get the last platform error.
70: * @return apr_status_t the last platform error, folded into apr_status_t, on most platforms
71: * This retrieves errno, or calls a GetLastError() style function, and
72: * folds it with APR_FROM_OS_ERROR. Some platforms (such as OS2) have no
73: * such mechanism, so this call may be unsupported. Do NOT use this
74: * call for socket errors from socket, send, recv etc!
75: */
76: public static native int osError();
77:
78: /**
79: * Get the last platform socket error.
80: * @return the last socket error, folded into apr_status_t, on all platforms
81: * This retrieves errno or calls a GetLastSocketError() style function,
82: * and folds it with APR_FROM_OS_ERROR.
83: */
84: public static native int netosError();
85:
86: /**
87: * Return a human readable string describing the specified error.
88: * @param statcode The error code the get a string for.
89: * @return The error string.
90: */
91: public static native String strerror(int statcode);
92:
93: }
|