Rainer, On 10/3/13 7:01 PM, Rainer Jung wrote: > On 04.10.2013 00:37, Christopher Schultz wrote: >> Rainer, >> >> On 10/3/13 5:40 PM, Rainer Jung wrote: >>> On 03.10.2013 21:52, Mark Thomas wrote: >>>> On 03/10/2013 17:34, Christopher Schultz wrote: >>>>> On 10/3/13 11:42 AM, Mark Thomas wrote: >>> >>>> I was thinking maybe an APR function that gave a textual error message >>>> for a given error code. Currently, the APR Java code reports just the >>>> error number. It would be nice to include a meaningful text message. >>> >>> The function is apr_strerror() and already wired via >>> >>> public static native org.apache.tomcat.jni.Error.strerror(int statcode) >> >> There's also void tcn_ThrowAPRException(JNIEnv *e, apr_status_t err) >> which throws an exception (actually, java.lang.Error) with the >> appropriate error message. > > I think it throws org.apache.tomcat.jni.Error which extends Exception.
Ah, yes. I had traced the definition of TCN_ERROR_CLASS to here: #define TCN_ERROR_CLASS TCN_CLASS_PATH "Error" ...and foolishly ignored the TCN_CLASS_PATH constant. >> I think it would be useful to have a TomcatNativeException instead of >> throwing java.lang.Error or maybe even be smart about converting certain >> error codes (e.g. APR_EOF) to Java exception types (e.g. >> java.io.EOFException). >> >> On the other hand, Mladen wants tcnative to be a thin wrapper around >> APR, so maybe he doesn't want exceptions to be thrown directly from >> native. I think if you're gonna use JNI, you may as well make it as nice >> as possible. > > There are already several places whre tcnative calls > tcn_ThrowAPRException() or other tcn_Throw...Exception(). Yup. I was just suggesting that maybe we could improve upon that. -chris
signature.asc
Description: OpenPGP digital signature