Author: mturk
Date: Fri Feb 17 04:13:21 2006
New Revision: 378494
URL: http://svn.apache.org/viewcvs?rev=378494&view=rev
Log:
Add custom messages for our custom return values.
Without that the apr_strerror returns
"APR does not understand this error code."
Modified:
tomcat/connectors/trunk/jni/native/src/error.c
Modified: tomcat/connectors/trunk/jni/native/src/error.c
URL:
http://svn.apache.org/viewcvs/tomcat/connectors/trunk/jni/native/src/error.c?rev=378494&r1=378493&r2=378494&view=diff
==============================================================================
--- tomcat/connectors/trunk/jni/native/src/error.c (original)
+++ tomcat/connectors/trunk/jni/native/src/error.c Fri Feb 17 04:13:21 2006
@@ -21,6 +21,16 @@
#include "tcn.h"
+static const char *tcn_errors[] = {
+ "Unknown user error",
+ /* TCN_TIMEUP */ "Operation timed out",
+ /* TCN_EAGAIN */ "There is no data ready",
+ /* TCN_EINTR */ "Interrupted system call",
+ /* TCN_EINPROGRESS */ "Operation in prrogress",
+ /* TCN_ETIMEDOUT */ "Connection timed out",
+ NULL,
+};
+
/* Merge IS_ETIMEDOUT with APR_TIMEUP
*/
#define TCN_STATUS_IS_ETIMEDOUT(x) (APR_STATUS_IS_ETIMEDOUT((x)) || ((x) ==
APR_TIMEUP))
@@ -121,9 +131,14 @@
jstring jerr;
UNREFERENCED(o);
- apr_strerror(err, serr, 512);
-
- jerr = AJP_TO_JSTRING(serr);
+ if (err >= TCN_TIMEUP && err <= TCN_ETIMEDOUT) {
+ err -= TCN_TIMEUP;
+ jerr = AJP_TO_JSTRING(tcn_errors[err]);
+ }
+ else {
+ apr_strerror(err, serr, 512);
+ jerr = AJP_TO_JSTRING(serr);
+ }
return jerr;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]