lucene-c-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From roo...@apache.org
Subject svn commit: r179515 - /incubator/lucene4c/trunk/src/util/exception.cxx
Date Thu, 02 Jun 2005 05:25:31 GMT
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;
 }
 



Mime
View raw message