You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-commits@lucene.apache.org by ro...@apache.org on 2005/06/02 07:25:31 UTC
svn commit: r179515 - /incubator/lucene4c/trunk/src/util/exception.cxx
Author: rooneg
Date: Wed Jun 1 22:25:31 2005
New Revision: 179515
URL: http://svn.apache.org/viewcvs?rev=179515&view=rev
Log:
Apparently Java exceptions can have null messages...
* src/util/exception.cxx
(error_create): if reason is NULL make a dummy message for the error.
Modified:
incubator/lucene4c/trunk/src/util/exception.cxx
Modified: incubator/lucene4c/trunk/src/util/exception.cxx
URL: http://svn.apache.org/viewcvs/incubator/lucene4c/trunk/src/util/exception.cxx?rev=179515&r1=179514&r2=179515&view=diff
==============================================================================
--- incubator/lucene4c/trunk/src/util/exception.cxx (original)
+++ incubator/lucene4c/trunk/src/util/exception.cxx Wed Jun 1 22:25:31 2005
@@ -41,14 +41,22 @@
err->pool = pool;
err->code = code;
- jsize length = JvGetStringUTFLength (reason);
+ if (reason)
+ {
+ jsize length = JvGetStringUTFLength (reason);
- err->message = static_cast<char *>(apr_palloc (pool, length + 1));
+ err->message = static_cast<char *>(apr_palloc (pool, length + 1));
+
+ JvGetStringUTFRegion (reason,
+ 0,
+ reason->length(),
+ const_cast<char *>(err->message));
+ }
+ else
+ {
+ err->message = apr_pstrdup (pool, "no message provided");
+ }
- JvGetStringUTFRegion (reason,
- 0,
- reason->length(),
- const_cast<char *>(err->message));
return err;
}