[rhmessaging-commits] rhmessaging commits: r1281 - in store/trunk/cpp: lib/jrnl and 1 other directories.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Sat Nov 10 00:09:44 EST 2007


Author: kpvdr
Date: 2007-11-10 00:09:44 -0500 (Sat, 10 Nov 2007)
New Revision: 1281

Modified:
   store/trunk/cpp/lib/BdbMessageStore.cpp
   store/trunk/cpp/lib/JournalImpl.cpp
   store/trunk/cpp/lib/TxnCtxt.h
   store/trunk/cpp/lib/jrnl/data_tok.cpp
   store/trunk/cpp/lib/jrnl/deq_rec.cpp
   store/trunk/cpp/lib/jrnl/enq_map.cpp
   store/trunk/cpp/lib/jrnl/enq_rec.cpp
   store/trunk/cpp/lib/jrnl/file_hdr.cpp
   store/trunk/cpp/lib/jrnl/jcntl.cpp
   store/trunk/cpp/lib/jrnl/jdir.cpp
   store/trunk/cpp/lib/jrnl/jerrno.cpp
   store/trunk/cpp/lib/jrnl/jerrno.hpp
   store/trunk/cpp/lib/jrnl/jexception.cpp
   store/trunk/cpp/lib/jrnl/jexception.hpp
   store/trunk/cpp/lib/jrnl/jinf.cpp
   store/trunk/cpp/lib/jrnl/jrec.cpp
   store/trunk/cpp/lib/jrnl/nlfh.cpp
   store/trunk/cpp/lib/jrnl/pmgr.cpp
   store/trunk/cpp/lib/jrnl/rmgr.cpp
   store/trunk/cpp/lib/jrnl/txn_map.cpp
   store/trunk/cpp/lib/jrnl/txn_rec.cpp
   store/trunk/cpp/lib/jrnl/wmgr.cpp
   store/trunk/cpp/tests/jrnl/JournalUnitTests.cpp
   store/trunk/cpp/tests/jrnl/jtest.cpp
   store/trunk/cpp/tests/jrnl/msg_consumer.cpp
   store/trunk/cpp/tests/jrnl/msg_producer.cpp
Log:
Clean-up and simplification of jexception class

Modified: store/trunk/cpp/lib/BdbMessageStore.cpp
===================================================================
--- store/trunk/cpp/lib/BdbMessageStore.cpp	2007-11-10 01:48:38 UTC (rev 1280)
+++ store/trunk/cpp/lib/BdbMessageStore.cpp	2007-11-10 05:09:44 UTC (rev 1281)
@@ -190,7 +190,7 @@
         journal::jdir::delete_dir(getJrnlBaseDir(),true);
     }    
 	catch ( journal::jexception& e) {
-        THROW_STORE_EXCEPTION("Truncate clean up failed: " +e.to_string() );
+        THROW_STORE_EXCEPTION(std::string("Truncate clean up failed: ") + e.what() );
     } 
 }
 
@@ -207,7 +207,7 @@
 	     	// init will create the deque's for the init...
 	     	jQueue->initialize();
 		} catch (journal::jexception& e) {
-            THROW_STORE_EXCEPTION(e.to_string() + queue.getName());
+            THROW_STORE_EXCEPTION(e.what() + queue.getName());
         }
     }
 
@@ -388,7 +388,7 @@
                   recoverMessages(txn, registry, queue, prepared, messages); 
 				  jQueue->recover_complete(); // start journal.
 	          } catch (const journal::jexception& e) {
-                  THROW_STORE_EXCEPTION(e.to_string() + queueName);
+                  THROW_STORE_EXCEPTION(std::string(e.what()) + queueName);
               }
 			  //read all messages: done on a per queue basis if using Journal
         }
@@ -855,7 +855,7 @@
 		    jc->flush();
 		}
     }catch ( journal::jexception& e) {
-       THROW_STORE_EXCEPTION("Flush failed: " + e.to_string() );
+       THROW_STORE_EXCEPTION(std::string("Flush failed: ") + e.what() );
 	}
 }
 
@@ -980,7 +980,7 @@
       }
     }catch ( journal::jexception& e) {
 //	   std::cout << "-------------" << e << std::endl;
-       THROW_STORE_EXCEPTION("Enqueue failed: " +e.to_string() );
+       THROW_STORE_EXCEPTION(std::string("Enqueue failed: ") + e.what() );
     }catch (DbException& e) {
         THROW_STORE_EXCEPTION_2("Error storing message", e);
     }
@@ -1075,7 +1075,7 @@
 			  	  dres = jc->dequeue_txn_data_record(ddtokp.get(), tid);
 			  }
          } catch (rhm::journal::jexception& e) { 
-			  THROW_STORE_EXCEPTION("Error dequeuing message" + e.to_string());
+			  THROW_STORE_EXCEPTION(std::string("Error dequeuing message") + e.what());
 	     }
          switch (dres)
          {

Modified: store/trunk/cpp/lib/JournalImpl.cpp
===================================================================
--- store/trunk/cpp/lib/JournalImpl.cpp	2007-11-10 01:48:38 UTC (rev 1280)
+++ store/trunk/cpp/lib/JournalImpl.cpp	2007-11-10 05:09:44 UTC (rev 1281)
@@ -143,12 +143,12 @@
                     std::stringstream ss;
                     ss << "read_data_record() returned " << journal::pmgr::iores_str(res);
                     ss << "; exceeded maximum wait time";
-                    throw jexception(ss.str());
+                    throw jexception(0, ss.str().c_str(), "JournalImpl", "loadMsgContent");
                 }
             } else {
                 std::stringstream ss;
                 ss << "read_data_record() returned " << journal::pmgr::iores_str(res);
-                throw jexception(ss.str());
+                throw jexception(0, ss.str().c_str(), "JournalImpl", "loadMsgContent");
             }
         }
     }
@@ -157,7 +157,7 @@
     if (offset + length > _dlen) {
         std::stringstream ss;
         ss << "loadMsgContent(): offset + length exceeds available message size";
-        throw jexception(ss.str());
+        throw jexception(0, ss.str().c_str(), "JournalImpl", "loadMsgContent");
     }
     data.append((const char*)_datap + offset, length);
     return true;

Modified: store/trunk/cpp/lib/TxnCtxt.h
===================================================================
--- store/trunk/cpp/lib/TxnCtxt.h	2007-11-10 01:48:38 UTC (rev 1280)
+++ store/trunk/cpp/lib/TxnCtxt.h	2007-11-10 05:09:44 UTC (rev 1281)
@@ -77,7 +77,7 @@
                 	}
 				} catch (rhm::journal::jexception& e) { 
 //std::cout << "Error commit" << e << std::endl;
-			  		THROW_STORE_EXCEPTION("Error commit" + e.to_string());
+			  		THROW_STORE_EXCEPTION(std::string("Error commit") + e.what());
 	     		}
 			
 			}
@@ -117,7 +117,7 @@
 					}
 				}catch (rhm::journal::jexception& e) { 
 //std::cout << " TxnCtxt: Error sync 3" << e << std::flush;
-			  		THROW_STORE_EXCEPTION("Error sync" + e.to_string());
+			  		THROW_STORE_EXCEPTION(std::string("Error sync") + e.what());
 	     		}
 			}
 			firstloop = false;

Modified: store/trunk/cpp/lib/jrnl/data_tok.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/data_tok.cpp	2007-11-10 01:48:38 UTC (rev 1280)
+++ store/trunk/cpp/lib/jrnl/data_tok.cpp	2007-11-10 05:09:44 UTC (rev 1281)
@@ -162,7 +162,8 @@
         std::stringstream ss;
         ss << "Attempted to change read state to " << rstate_str(rstate);
         ss << " while write state is not enqueued (wstate ENQ); wstate=" << wstate_str() << ".";
-        throw new jexception(jerrno::JERR_DTOK_ILLEGALSTATE, ss.str(), "data_tok","set_rstate");
+        throw new jexception(jerrno::JERR_DTOK_ILLEGALSTATE, ss.str().c_str(), "data_tok",
+                "set_rstate");
     }
     _rstate = rstate;
 }

Modified: store/trunk/cpp/lib/jrnl/deq_rec.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/deq_rec.cpp	2007-11-10 01:48:38 UTC (rev 1280)
+++ store/trunk/cpp/lib/jrnl/deq_rec.cpp	2007-11-10 05:09:44 UTC (rev 1281)
@@ -277,7 +277,7 @@
             {
                 std::stringstream ss;
                 ss << "_buff malloc(): errno=" << errno;
-                throw jexception(jerrno::JERR__MALLOC, ss.str(), "deq_rec", "decode");
+                throw jexception(jerrno::JERR__MALLOC, ss.str().c_str(), "deq_rec", "decode");
             }
             const u_int32_t hdr_xid_dblks = size_dblks(deq_hdr::size() + _deq_hdr._xidsize);
             const u_int32_t hdr_xid_tail_dblks = size_dblks(deq_hdr::size() +  _deq_hdr._xidsize +
@@ -350,7 +350,7 @@
             {
                 std::stringstream ss;
                 ss << "_buff malloc(): errno=" << errno;
-                throw jexception(jerrno::JERR__MALLOC, ss.str(), "deq_rec", "decode");
+                throw jexception(jerrno::JERR__MALLOC, ss.str().c_str(), "deq_rec", "rcv_decode");
             }
             // Decode xid
             ifsp->read((char*)_buff, _deq_hdr._xidsize);
@@ -416,7 +416,7 @@
         ss << "deq magic: rid=0x" << std::setw(16) << _deq_hdr._hdr._rid;
         ss << ": expected=0x" << std::setw(8) << RHM_JDAT_DEQ_MAGIC;
         ss << " read=0x" << std::setw(2) << (int)_deq_hdr._hdr._magic;
-        throw jexception(jerrno::JERR_DREC_INVRHDR, ss.str(), "deq_rec", "chk_hdr");
+        throw jexception(jerrno::JERR_JREC_BADRECHDR, ss.str().c_str(), "deq_rec", "chk_hdr");
     }
 }
 

Modified: store/trunk/cpp/lib/jrnl/enq_map.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/enq_map.cpp	2007-11-10 01:48:38 UTC (rev 1280)
+++ store/trunk/cpp/lib/jrnl/enq_map.cpp	2007-11-10 05:09:44 UTC (rev 1281)
@@ -69,7 +69,7 @@
     {
         std::stringstream ss;
         ss << std::hex << "rid=0x" << rid << " fid=0x" << fid;
-        throw jexception(jerrno::JERR_MAP_DUPLICATE, ss.str(), "enq_map", "insert");
+        throw jexception(jerrno::JERR_MAP_DUPLICATE, ss.str().c_str(), "enq_map", "insert");
     }
 }
 
@@ -83,13 +83,13 @@
     {
         std::stringstream ss;
         ss << std::hex << "rid=0x" << rid;
-        throw jexception(jerrno::JERR_MAP_NOTFOUND, ss.str(), "enq_map", "get_fid");
+        throw jexception(jerrno::JERR_MAP_NOTFOUND, ss.str().c_str(), "enq_map", "get_fid");
     }
     if (itr->second.second) // locked
     {
         std::stringstream ss;
         ss << std::hex << "rid=0x" << rid;
-        throw jexception(jerrno::JERR_MAP_LOCKED, ss.str(), "enq_map", "get_fid");
+        throw jexception(jerrno::JERR_MAP_LOCKED, ss.str().c_str(), "enq_map", "get_fid");
     }
     return itr->second.first;
 }
@@ -104,14 +104,14 @@
         pthread_mutex_unlock(&_mutex);
         std::stringstream ss;
         ss << std::hex << "rid=0x" << rid;
-        throw jexception(jerrno::JERR_MAP_NOTFOUND, ss.str(), "enq_map", "get_remove_fid");
+        throw jexception(jerrno::JERR_MAP_NOTFOUND, ss.str().c_str(), "enq_map", "get_remove_fid");
     }
     if (itr->second.second && !txn_flag) // locked, but not a commit/abort
     {
         pthread_mutex_unlock(&_mutex);
         std::stringstream ss;
         ss << std::hex << "rid=0x" << rid;
-        throw jexception(jerrno::JERR_MAP_LOCKED, ss.str(), "enq_map", "get_remove_fid");
+        throw jexception(jerrno::JERR_MAP_LOCKED, ss.str().c_str(), "enq_map", "get_remove_fid");
     }
     u_int16_t fid = itr->second.first;
     _map.erase(itr);
@@ -142,7 +142,7 @@
         pthread_mutex_unlock(&_mutex);
         std::stringstream ss;
         ss << std::hex << "rid=0x" << rid;
-        throw jexception(jerrno::JERR_MAP_NOTFOUND, ss.str(), "enq_map", "get_remove_fid");
+        throw jexception(jerrno::JERR_MAP_NOTFOUND, ss.str().c_str(), "enq_map", "get_remove_fid");
     }
     itr->second.second = true;
     pthread_mutex_unlock(&_mutex);
@@ -158,7 +158,7 @@
         pthread_mutex_unlock(&_mutex);
         std::stringstream ss;
         ss << std::hex << "rid=0x" << rid;
-        throw jexception(jerrno::JERR_MAP_NOTFOUND, ss.str(), "enq_map", "get_remove_fid");
+        throw jexception(jerrno::JERR_MAP_NOTFOUND, ss.str().c_str(), "enq_map", "get_remove_fid");
     }
     itr->second.second = false;
     pthread_mutex_unlock(&_mutex);
@@ -174,7 +174,7 @@
     {
         std::stringstream ss;
         ss << std::hex << "rid=0x" << rid;
-        throw jexception(jerrno::JERR_MAP_NOTFOUND, ss.str(), "enq_map", "get_fid");
+        throw jexception(jerrno::JERR_MAP_NOTFOUND, ss.str().c_str(), "enq_map", "get_fid");
     }
     return itr->second.second;
 }

Modified: store/trunk/cpp/lib/jrnl/enq_rec.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/enq_rec.cpp	2007-11-10 01:48:38 UTC (rev 1280)
+++ store/trunk/cpp/lib/jrnl/enq_rec.cpp	2007-11-10 05:09:44 UTC (rev 1281)
@@ -355,7 +355,7 @@
             {
                 std::stringstream ss;
                 ss << "_buff malloc(): errno=" << errno;
-                throw jexception(jerrno::JERR__MALLOC, ss.str(), "deq_rec", "decode");
+                throw jexception(jerrno::JERR__MALLOC, ss.str().c_str(), "enq_rec", "decode");
             }
 
             const u_int32_t hdr_xid_dblks = size_dblks(enq_hdr::size() + _enq_hdr._xidsize);
@@ -469,7 +469,7 @@
             {
                 std::stringstream ss;
                 ss << "_buff malloc(): errno=" << errno;
-                throw jexception(jerrno::JERR__MALLOC, ss.str(), "deq_rec", "decode");
+                throw jexception(jerrno::JERR__MALLOC, ss.str().c_str(), "enq_rec", "rcv_decode");
             }
             // Decode xid
             ifsp->read((char*)_buff, _enq_hdr._xidsize);
@@ -565,7 +565,7 @@
         ss << "enq magic: rid=0x" << std::setw(16) << _enq_hdr._hdr._rid;
         ss << ": expected=0x" << std::setw(8) << RHM_JDAT_ENQ_MAGIC;
         ss << " read=0x" << std::setw(2) << (int)_enq_hdr._hdr._magic;
-        throw jexception(jerrno::JERR_DREC_INVRHDR, ss.str(), "enq_rec", "chk_hdr");
+        throw jexception(jerrno::JERR_JREC_BADRECHDR, ss.str().c_str(), "enq_rec", "chk_hdr");
     }
 }
 

Modified: store/trunk/cpp/lib/jrnl/file_hdr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/file_hdr.cpp	2007-11-10 01:48:38 UTC (rev 1280)
+++ store/trunk/cpp/lib/jrnl/file_hdr.cpp	2007-11-10 05:09:44 UTC (rev 1281)
@@ -173,7 +173,7 @@
     {
         std::stringstream ss;
         ss << "errno=" << errno;
-        throw jexception(jerrno::JERR__RTCLOCK, ss.str(), "file_hdr", "set_time");
+        throw jexception(jerrno::JERR__RTCLOCK, ss.str().c_str(), "file_hdr", "set_time");
     }
     _ts_sec = ts.tv_sec;
     _ts_nsec = ts.tv_nsec;

Modified: store/trunk/cpp/lib/jrnl/jcntl.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.cpp	2007-11-10 01:48:38 UTC (rev 1280)
+++ store/trunk/cpp/lib/jrnl/jcntl.cpp	2007-11-10 05:09:44 UTC (rev 1281)
@@ -290,7 +290,7 @@
         {
             std::stringstream ss;
             ss << "pthread_mutex_trylock() returned " << errno << " (" << strerror(errno) << ")";
-            throw jexception(jerrno::JERR__PTHREAD, ss.str(), "jcntl", "get_wr_events");
+            throw jexception(jerrno::JERR__PTHREAD, ss.str().c_str(), "jcntl", "get_wr_events");
         }
         return 0; // already locked, return immediately
     }
@@ -361,14 +361,14 @@
     {
         std::stringstream ss;
         ss << "errno=" << errno;
-        throw jexception(jerrno::JERR__RTCLOCK, ss.str(), "jcntl", "write_infofile");
+        throw jexception(jerrno::JERR__RTCLOCK, ss.str().c_str(), "jcntl", "write_infofile");
     }
     jinf ji(_jid, _jdir.dirname(), _base_filename, ts);
     std::stringstream fn;
     fn << _jdir << "/" << _base_filename << "." << JRNL_INFO_EXTENSION;
     std::ofstream of(fn.str().c_str(), std::ofstream::out | std::ofstream::trunc);
     if (!of.good())
-        throw jexception(jerrno::JERR__FILEIO, fn.str(), "jcntl", "write_infofile");
+        throw jexception(jerrno::JERR__FILEIO, fn.str().c_str(), "jcntl", "write_infofile");
     std::string s;
     of << ji.xml_str(s);
     of.close();
@@ -581,7 +581,7 @@
         default:
             std::stringstream ss;
             ss << std::hex << std::setfill('0') << "Magic=0x" << std::setw(8) << h._magic;
-            throw jexception(jerrno::JERR_JCNTL_UNKNOWNMAGIC, ss.str(), "jcntl",
+            throw jexception(jerrno::JERR_JCNTL_UNKNOWNMAGIC, ss.str().c_str(), "jcntl",
                     "rcvr_get_next_record");
     }
 
@@ -610,7 +610,7 @@
         ss << std::setfill('0') << std::setw(4) << fid << "." << JRNL_DATA_EXTENSION;
         ifsp->open(ss.str().c_str());
         if (!ifsp->good())
-            throw jexception(jerrno::JERR__FILEIO, ss.str(), "jcntl", "rcvr_get_next_record");
+            throw jexception(jerrno::JERR__FILEIO, ss.str().c_str(), "jcntl", "jfile_cycle");
 
         // Read file header
         file_hdr fhdr;

Modified: store/trunk/cpp/lib/jrnl/jdir.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jdir.cpp	2007-11-10 01:48:38 UTC (rev 1280)
+++ store/trunk/cpp/lib/jrnl/jdir.cpp	2007-11-10 05:09:44 UTC (rev 1281)
@@ -84,7 +84,7 @@
         {
             std::stringstream ss;
             ss << "dir=\"" << dirname << "\" errno=" << errno;
-            throw jexception(jerrno::JERR_JDIR_MKDIR, ss.str(), "jdir", "create_dir");
+            throw jexception(jerrno::JERR_JDIR_MKDIR, ss.str().c_str(), "jdir", "create_dir");
         }
     }
 }
@@ -123,7 +123,7 @@
         }
         std::stringstream ss;
         ss << "dir=\"" << dirname << "\" errno=" << errno;
-        throw jexception(jerrno::JERR_JDIR_OPENDIR, ss.str(), "jdir", "clear_dir");
+        throw jexception(jerrno::JERR_JDIR_OPENDIR, ss.str().c_str(), "jdir", "clear_dir");
     }
 #ifndef RHM_JOWRITE
     struct dirent* entry;
@@ -152,7 +152,8 @@
                         std::stringstream ss;
                         ss << "file=\"" << oldname.str() << "\" dest=\"" <<
                                 newname.str() << "\" errno=" << errno;
-                        throw jexception(jerrno::JERR_JDIR_FMOVE, ss.str(), "jdir", "clear_dir");
+                        throw jexception(jerrno::JERR_JDIR_FMOVE, ss.str().c_str(), "jdir",
+                                "clear_dir");
                     }
                 }
             }
@@ -165,14 +166,14 @@
 //         std::stringstream ss;
 //         ss << "dir=\"" << dirname << "\" errno=" << errno;
 //         ::closedir(dir); // Try to close, it makes no sense to trap errors here...
-//         throw jexception(jerrno::JERR_JDIR_READDIR, ss.str(), "jdir", "clear_dir");
+//         throw jexception(jerrno::JERR_JDIR_READDIR, ss.str().c_str(), "jdir", "clear_dir");
 //     }
 #endif
     if (::closedir(dir))
     {
         std::stringstream ss;
         ss << "dir=\"" << dirname << "\" errno=" << errno;
-        throw jexception(jerrno::JERR_JDIR_CLOSEDIR, ss.str(), "jdir", "clear_dir");
+        throw jexception(jerrno::JERR_JDIR_CLOSEDIR, ss.str().c_str(), "jdir", "clear_dir");
     }
 }
 
@@ -199,7 +200,7 @@
     {
         std::stringstream ss;
         ss << "dir=\"" << dirname << "\"";
-        throw jexception(jerrno::JERR_JDIR_NOTDIR, ss.str(), "jdir", "verify_dir");
+        throw jexception(jerrno::JERR_JDIR_NOTDIR, ss.str().c_str(), "jdir", "verify_dir");
     }
     
     // Read jinf file, then verify all journal files are present
@@ -211,7 +212,7 @@
         ss << std::setw(4) << std::setfill('0') << std::hex << fnum;
         ss << "." << JRNL_DATA_EXTENSION;
         if (!exists(ss.str()))
-            throw jexception(jerrno::JERR_JDIR_NOSUCHFILE, ss.str(), "jdir", "verify_dir");
+            throw jexception(jerrno::JERR_JDIR_NOSUCHFILE, ss.str().c_str(), "jdir", "verify_dir");
     }
 }
 
@@ -243,7 +244,7 @@
     
          std::stringstream ss;
          ss << "dir=\"" << dirname << "\" errno=" << errno;
-         throw jexception(jerrno::JERR_JDIR_OPENDIR, ss.str(), "jdir", "delete_dir");
+         throw jexception(jerrno::JERR_JDIR_OPENDIR, ss.str().c_str(), "jdir", "delete_dir");
     }
     else
     {
@@ -257,7 +258,8 @@
                 {
                     std::stringstream ss;
                     ss << "stat: file=\"" << full_name << "\" errno=" << errno;
-                    throw jexception(jerrno::JERR_JDIR_STAT, ss.str(), "jdir", "delete_dir");
+                    throw jexception(jerrno::JERR_JDIR_STAT, ss.str().c_str(), "jdir",
+                            "delete_dir");
                 }
                 // FIXME: This fn does not handle symbolic links correctly and throws up
                 // For some reason, S_ISLNK() fails to identify links correctly.
@@ -267,7 +269,8 @@
                     {
                         std::stringstream ss;
                         ss << "unlink: file=\"" << entry->d_name << "\" errno=" << errno;
-                        throw jexception(jerrno::JERR_JDIR_UNLINK, ss.str(), "jdir", "delete_dir");
+                        throw jexception(jerrno::JERR_JDIR_UNLINK, ss.str().c_str(), "jdir",
+                                "delete_dir");
                     }
                 }
                 else if (S_ISDIR(s.st_mode)) // This is a dir
@@ -279,7 +282,8 @@
                     std::stringstream ss;
                     ss << "file=\"" << entry->d_name << "\" is not a dir, file or slink.";
                     ss << " (mode=0x" << std::hex << s.st_mode << std::dec << ")";
-                    throw jexception(jerrno::JERR_JDIR_BADFTYPE, ss.str(), "jdir", "delete_dir");
+                    throw jexception(jerrno::JERR_JDIR_BADFTYPE, ss.str().c_str(), "jdir",
+                            "delete_dir");
                 }
             }
         }
@@ -290,7 +294,7 @@
 //             std::stringstream ss;
 //             ss << "dir=\"" << dirname << "\" errno=" << errno;
 //             ::closedir(dir); // Try to close, it makes no sense to trap errors here...
-//             throw jexception(jerrno::JERR_JDIR_READDIR, ss.str(), "jdir", "delete_dir");
+//             throw jexception(jerrno::JERR_JDIR_READDIR, ss.str().c_str(), "jdir", "delete_dir");
 //         }
     }
     // Now dir is empty, close and delete it
@@ -298,7 +302,7 @@
     {
         std::stringstream ss;
         ss << "dir=\"" << dirname << "\" errno=" << errno;
-        throw jexception(jerrno::JERR_JDIR_CLOSEDIR, ss.str(), "jdir", "delete_dir");
+        throw jexception(jerrno::JERR_JDIR_CLOSEDIR, ss.str().c_str(), "jdir", "delete_dir");
     }
     
     if (!children_only)
@@ -306,7 +310,7 @@
         {
             std::stringstream ss;
             ss << "dir=\"" << dirname << "\" errno=" << errno;
-            throw jexception(jerrno::JERR_JDIR_RMDIR, ss.str(), "jdir", "delete_dir");
+            throw jexception(jerrno::JERR_JDIR_RMDIR, ss.str().c_str(), "jdir", "delete_dir");
         }
 }
 
@@ -321,7 +325,7 @@
     {
         std::stringstream ss;
         ss << "dir=\"" << dirname << "\" errno=" << errno;
-        throw jexception(jerrno::JERR_JDIR_OPENDIR, ss.str(), "jdir", "create_bak_dir");
+        throw jexception(jerrno::JERR_JDIR_OPENDIR, ss.str().c_str(), "jdir", "create_bak_dir");
     }
     struct dirent* entry;
     while ((entry = ::readdir(dir)) != NULL)
@@ -349,13 +353,13 @@
 //         std::stringstream ss;
 //         ss << "dir=\"" << dirname << "\" errno=" << errno;
 //         ::closedir(dir); // Try to close, it makes no sense to trap errors here...
-//         throw jexception(jerrno::JERR_JDIR_READDIR, ss.str(), "jdir", "clear_dir");
+//         throw jexception(jerrno::JERR_JDIR_READDIR, ss.str().c_str(), "jdir", "clear_dir");
 //     }
     if (::closedir(dir))
     {
         std::stringstream ss;
         ss << "dir=\"" << dirname << "\" errno=" << errno;
-        throw jexception(jerrno::JERR_JDIR_CLOSEDIR, ss.str(), "jdir", "create_bak_dir");
+        throw jexception(jerrno::JERR_JDIR_CLOSEDIR, ss.str().c_str(), "jdir", "create_bak_dir");
     }
     std::stringstream dn;
     dn << dirname << "/_" << base_filename << ".bak." << std::hex << std::setw(4) <<
@@ -364,7 +368,7 @@
     {
         std::stringstream ss;
         ss << "dir=\"" << dn.str() << "\" errno=" << errno;
-        throw jexception(jerrno::JERR_JDIR_MKDIR, ss.str(), "jdir", "create_bak_dir");
+        throw jexception(jerrno::JERR_JDIR_MKDIR, ss.str().c_str(), "jdir", "create_bak_dir");
     }
     return std::string(dn.str());
 }
@@ -377,7 +381,7 @@
     {
         std::stringstream ss;
         ss << "file=\"" << name << "\" errno=" << errno;
-        throw jexception(jerrno::JERR_JDIR_STAT, ss.str(), "jdir", "is_dir");
+        throw jexception(jerrno::JERR_JDIR_STAT, ss.str().c_str(), "jdir", "is_dir");
     }
     return S_ISDIR(s.st_mode);
 }
@@ -399,7 +403,7 @@
         // Throw for any other condition
         std::stringstream ss;
         ss << "file=\"" << name << "\" errno=" << errno;
-        throw jexception(jerrno::JERR_JDIR_STAT, ss.str(), "jdir", "is_dir");
+        throw jexception(jerrno::JERR_JDIR_STAT, ss.str().c_str(), "jdir", "is_dir");
     }
     return true;
 }

Modified: store/trunk/cpp/lib/jrnl/jerrno.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jerrno.cpp	2007-11-10 01:48:38 UTC (rev 1280)
+++ store/trunk/cpp/lib/jrnl/jerrno.cpp	2007-11-10 05:09:44 UTC (rev 1281)
@@ -39,8 +39,8 @@
 namespace journal
 {
 
-std::map<u_int32_t, std::string> jerrno::_err_map;
-std::map<u_int32_t, std::string>::iterator jerrno::_err_map_itr;
+std::map<u_int32_t, const char*> jerrno::_err_map;
+std::map<u_int32_t, const char*>::iterator jerrno::_err_map_itr;
 bool jerrno::_initialized = jerrno::__init();
 
 // generic errors
@@ -63,7 +63,7 @@
 const u_int32_t jerrno::JERR_JDIR_NOTDIR        = 0x0300;
 const u_int32_t jerrno::JERR_JDIR_MKDIR         = 0x0301;
 const u_int32_t jerrno::JERR_JDIR_OPENDIR       = 0x0302;
-const u_int32_t jerrno::JERR_JDIR_READDIR       = 0x0303;
+//const u_int32_t jerrno::JERR_JDIR_READDIR       = 0x0303;
 const u_int32_t jerrno::JERR_JDIR_CLOSEDIR      = 0x0304;
 const u_int32_t jerrno::JERR_JDIR_RMDIR         = 0x0305;
 const u_int32_t jerrno::JERR_JDIR_NOSUCHFILE    = 0x0306;
@@ -83,12 +83,10 @@
 
 // class file_hdr
 
-// class jrec
-const u_int32_t jerrno::JERR_JREC_INVRTAIL      = 0x0600;
+// class jrec, enq_rec, deq_rec, txn_rec
+const u_int32_t jerrno::JERR_JREC_BADRECHDR     = 0x0600;
+const u_int32_t jerrno::JERR_JREC_BADRECTAIL    = 0x0601;
 
-// class data_rec
-const u_int32_t jerrno::JERR_DREC_INVRHDR       = 0x0701;
-
 // class wmgr
 const u_int32_t jerrno::JERR_WMGR_BADPGSTATE    = 0x0801;
 const u_int32_t jerrno::JERR_WMGR_BADDTOKSTATE  = 0x0802;
@@ -98,13 +96,13 @@
 // class rmgr
 const u_int32_t jerrno::JERR_RMGR_UNKNOWNMAGIC  = 0x0900;
 const u_int32_t jerrno::JERR_RMGR_RIDMISMATCH   = 0x0901;
-const u_int32_t jerrno::JERR_RMGR_FIDMISMATCH   = 0x0902;
+//const u_int32_t jerrno::JERR_RMGR_FIDMISMATCH   = 0x0902;
 const u_int32_t jerrno::JERR_RMGR_ENQSTATE      = 0x0903;
 const u_int32_t jerrno::JERR_RMGR_BADRECTYPE    = 0x0904;
 
 // class data_tok
 const u_int32_t jerrno::JERR_DTOK_ILLEGALSTATE  = 0x0a00;
-const u_int32_t jerrno::JERR_DTOK_RIDNOTSET     = 0x0a01;
+// const u_int32_t jerrno::JERR_DTOK_RIDNOTSET     = 0x0a01;
 
 // class enq_map, txn_map
 const u_int32_t jerrno::JERR_MAP_DUPLICATE      = 0x0b00;
@@ -118,119 +116,112 @@
 const u_int32_t jerrno::JERR_JINF_JDATEMPTY     = 0x0c03;
 
 
+// static initialization fn
+
 bool
 jerrno::__init()
 {
     // generic errors
-    _err_map[JERR__MALLOC] = std::string("JERR__MALLOC: Buffer memory allocation failed.");
-    _err_map[JERR__UNDERFLOW] = std::string("JERR__UNDERFLOW: Underflow error");
-    _err_map[JERR__NINIT] = std::string("JERR__NINIT: Operation on uninitialized class.");
-    _err_map[JERR__AIO] = std::string("JERR__AIO: AIO error.");
-    _err_map[JERR__FILEIO] = std::string("JERR__FILEIO: File read or write failure.");
-    _err_map[JERR__RTCLOCK] = std::string("JERR__RTCLOCK: Reading real-time clock failed.");
-    _err_map[JERR__PTHREAD] = std::string("JERR__PTHREAD: pthread failure.");
+    _err_map[JERR__MALLOC] = "JERR__MALLOC: Buffer memory allocation failed.";
+    _err_map[JERR__UNDERFLOW] = "JERR__UNDERFLOW: Underflow error";
+    _err_map[JERR__NINIT] = "JERR__NINIT: Operation on uninitialized class.";
+    _err_map[JERR__AIO] = "JERR__AIO: AIO error.";
+    _err_map[JERR__FILEIO] = "JERR__FILEIO: File read or write failure.";
+    _err_map[JERR__RTCLOCK] = "JERR__RTCLOCK: Reading real-time clock failed.";
+    _err_map[JERR__PTHREAD] = "JERR__PTHREAD: pthread failure.";
 
     // class jcntl
-    _err_map[JERR_JCNTL_STOPPED] = std::string("JERR_JCNTL_STOPPED: Operation on stopped journal.");
-    _err_map[JERR_JCNTL_READONLY] = std::string("JERR_JCNTL_READONLY: "
-            "Write operation on read-only journal (during recovery).");
-    _err_map[JERR_JCNTL_AIOCMPLWAIT] = std::string("JERR_JCNTL_AIOCMPLWAIT: "
-            "Timeout waiting for AIOs to complete.");
-    _err_map[JERR_JCNTL_UNKNOWNMAGIC] = std::string("JERR_JCNTL_UNKNOWNMAGIC: "
-            "Found record with unknown magic.");
-    _err_map[JERR_JCNTL_NOTRECOVERED] = std::string("JERR_JCNTL_NOTRECOVERED: "
-            "Operation requires recover() to be run first.");
+    _err_map[JERR_JCNTL_STOPPED] = "JERR_JCNTL_STOPPED: Operation on stopped journal.";
+    _err_map[JERR_JCNTL_READONLY] = "JERR_JCNTL_READONLY: "
+            "Write operation on read-only journal (during recovery).";
+    _err_map[JERR_JCNTL_AIOCMPLWAIT] = "JERR_JCNTL_AIOCMPLWAIT: "
+            "Timeout waiting for AIOs to complete.";
+    _err_map[JERR_JCNTL_UNKNOWNMAGIC] = "JERR_JCNTL_UNKNOWNMAGIC: Found record with unknown magic.";
+    _err_map[JERR_JCNTL_NOTRECOVERED] = "JERR_JCNTL_NOTRECOVERED: "
+            "Operation requires recover() to be run first.";
 
     // class jdir
-    _err_map[JERR_JDIR_NOTDIR] = std::string("JERR_JDIR_NOTDIR: "
-            "Directory name exists but is not a directory.");
-    _err_map[JERR_JDIR_MKDIR] = std::string("JERR_JDIR_MKDIR: Directory creation failed.");
-    _err_map[JERR_JDIR_OPENDIR] = std::string("JERR_JDIR_OPENDIR: Directory open failed.");
-    _err_map[JERR_JDIR_READDIR] = std::string("JERR_JDIR_READDIR: Directory read failed.");
-    _err_map[JERR_JDIR_CLOSEDIR] = std::string("JERR_JDIR_CLOSEDIR: Directory close failed.");
-    _err_map[JERR_JDIR_RMDIR] = std::string("JERR_JDIR_RMDIR: Directory delete failed.");
-    _err_map[JERR_JDIR_NOSUCHFILE] = std::string("JERR_JDIR_NOSUCHFILE: File does not exist.");
-    _err_map[JERR_JDIR_FMOVE] = std::string("JERR_JDIR_FMOVE: File move failed.");
-    _err_map[JERR_JDIR_STAT] = std::string("JERR_JDIR_STAT: File stat failed.");
-    _err_map[JERR_JDIR_UNLINK] = std::string("JERR_JDIR_UNLINK: File delete failed.");
-    _err_map[JERR_JDIR_BADFTYPE] = std::string("JERR_JDIR_BADFTYPE: "
-            "Bad or unknown file type (stat mode).");
+    _err_map[JERR_JDIR_NOTDIR] = "JERR_JDIR_NOTDIR: Directory name exists but is not a directory.";
+    _err_map[JERR_JDIR_MKDIR] = "JERR_JDIR_MKDIR: Directory creation failed.";
+    _err_map[JERR_JDIR_OPENDIR] = "JERR_JDIR_OPENDIR: Directory open failed.";
+    //_err_map[JERR_JDIR_READDIR] = "JERR_JDIR_READDIR: Directory read failed.";
+    _err_map[JERR_JDIR_CLOSEDIR] = "JERR_JDIR_CLOSEDIR: Directory close failed.";
+    _err_map[JERR_JDIR_RMDIR] = "JERR_JDIR_RMDIR: Directory delete failed.";
+    _err_map[JERR_JDIR_NOSUCHFILE] = "JERR_JDIR_NOSUCHFILE: File does not exist.";
+    _err_map[JERR_JDIR_FMOVE] = "JERR_JDIR_FMOVE: File move failed.";
+    _err_map[JERR_JDIR_STAT] = "JERR_JDIR_STAT: File stat failed.";
+    _err_map[JERR_JDIR_UNLINK] = "JERR_JDIR_UNLINK: File delete failed.";
+    _err_map[JERR_JDIR_BADFTYPE] = "JERR_JDIR_BADFTYPE: Bad or unknown file type (stat mode).";
 
     // class nlfh
-    _err_map[JERR_NLFH_OPENRD] = std::string("JERR_JNLFH_OPENRD: Unable to open file for read.");
-    _err_map[JERR_NLFH_OPENWR] = std::string("JERR_JNLFH_OPENWR: Unable to open file for write.");
-    _err_map[JERR_NLFH_WRITE] = std::string("JERR_JNLFH_WRITE: Unable to write to file.");
-    _err_map[JERR_NLFH_CLOSE] = std::string("JERR_JNLFH_CLOSE: File close failed.");
-    _err_map[JERR_NLFH_FILEOFFSOVFL] = std::string("JERR_NLFH_FILEOFFSOVFL: "
-            "Attempted increase file offset past file size.");
-    _err_map[JERR_NFLH_CMPLOFFSOVFL] = std::string("JERR_NFLH_CMPLOFFSOVFL: "
-            "Attempted increase completed file offset past submitted offset.");
-    _err_map[JERR_NFLH_RDOFFSOVFL] = std::string("JERR_NFLH_RDOFFSOVFL: "
-            "Attempted increase read offset past write offset.");
+    _err_map[JERR_NLFH_OPENRD] = "JERR_JNLFH_OPENRD: Unable to open file for read.";
+    _err_map[JERR_NLFH_OPENWR] = "JERR_JNLFH_OPENWR: Unable to open file for write.";
+    _err_map[JERR_NLFH_WRITE] = "JERR_JNLFH_WRITE: Unable to write to file.";
+    _err_map[JERR_NLFH_CLOSE] = "JERR_JNLFH_CLOSE: File close failed.";
+    _err_map[JERR_NLFH_FILEOFFSOVFL] = "JERR_NLFH_FILEOFFSOVFL: "
+            "Attempted increase file offset past file size.";
+    _err_map[JERR_NFLH_CMPLOFFSOVFL] = "JERR_NFLH_CMPLOFFSOVFL: "
+            "Attempted increase completed file offset past submitted offset.";
+    _err_map[JERR_NFLH_RDOFFSOVFL] = "JERR_NFLH_RDOFFSOVFL: "
+            "Attempted increase read offset past write offset.";
 
 
     // class file_hdr
 
-    // class jrec
-    _err_map[JERR_JREC_INVRTAIL] = std::string("JERR_JREC_INVRTAIL: Invalid data record tail.");
+    // class jrec, enq_rec, deq_rec, txn_rec
+    _err_map[JERR_JREC_BADRECHDR] = "JERR_JREC_BADRECHDR: Invalid data record header.";
+    _err_map[JERR_JREC_BADRECTAIL] = "JERR_JREC_BADRECTAIL: Invalid data record tail.";
 
-    // class data_rec
-    _err_map[JERR_DREC_INVRHDR] = std::string("JERR_DREC_INVRHDR: Invalid data record header.");
-
     // class wmgr
-    _err_map[JERR_WMGR_BADPGSTATE] = std::string("JERR_WMGR_BADPGSTATE: "
-            "Page buffer in illegal state for operation.");
-    _err_map[JERR_WMGR_BADDTOKSTATE] = std::string("JERR_WMGR_BADDTOKSTATE: "
-            "Data token in illegal state for operation.");
-    _err_map[JERR_WMGR_ENQDISCONT] = std::string("JERR_WMGR_ENQDISCONT: "
-            "Enqueued new dtok when previous enqueue returned partly completed (state ENQ_PART).");
-    _err_map[JERR_WMGR_DEQDISCONT] = std::string("JERR_WMGR_DEQDISCONT: "
-            "Dequeued new dtok when previous dequeue returned partly completed (state DEQ_PART).");
+    _err_map[JERR_WMGR_BADPGSTATE] = "JERR_WMGR_BADPGSTATE: "
+            "Page buffer in illegal state for operation.";
+    _err_map[JERR_WMGR_BADDTOKSTATE] = "JERR_WMGR_BADDTOKSTATE: "
+            "Data token in illegal state for operation.";
+    _err_map[JERR_WMGR_ENQDISCONT] = "JERR_WMGR_ENQDISCONT: "
+            "Enqueued new dtok when previous enqueue returned partly completed (state ENQ_PART).";
+    _err_map[JERR_WMGR_DEQDISCONT] = "JERR_WMGR_DEQDISCONT: "
+            "Dequeued new dtok when previous dequeue returned partly completed (state DEQ_PART).";
 
     // class rmgr
-    _err_map[JERR_RMGR_UNKNOWNMAGIC] = std::string("JERR_RMGR_UNKNOWNMAGIC: "
-            "Found record with unknown magic.");
-    _err_map[JERR_RMGR_RIDMISMATCH] = std::string("JERR_RMGR_RIDMISMATCH: "
-            "RID mismatch between current record and dtok RID");
-    _err_map[JERR_RMGR_FIDMISMATCH] = std::string("JERR_RMGR_FIDMISMATCH: "
-            "FID mismatch between emap and rrfc");
-    _err_map[JERR_RMGR_ENQSTATE] = std::string("JERR_RMGR_ENQSTATE: "
-            "Attempted read when data token wstate was not ENQ");
-    _err_map[JERR_RMGR_BADRECTYPE] = std::string("JERR_RMGR_BADRECTYPE: "
-            "Attempted operation on inappropriate record type");
+    _err_map[JERR_RMGR_UNKNOWNMAGIC] = "JERR_RMGR_UNKNOWNMAGIC: Found record with unknown magic.";
+    _err_map[JERR_RMGR_RIDMISMATCH] = "JERR_RMGR_RIDMISMATCH: "
+            "RID mismatch between current record and dtok RID";
+    //_err_map[JERR_RMGR_FIDMISMATCH] = "JERR_RMGR_FIDMISMATCH: FID mismatch between emap and rrfc";
+    _err_map[JERR_RMGR_ENQSTATE] = "JERR_RMGR_ENQSTATE: "
+            "Attempted read when data token wstate was not ENQ";
+    _err_map[JERR_RMGR_BADRECTYPE] = "JERR_RMGR_BADRECTYPE: "
+            "Attempted operation on inappropriate record type";
 
     // class data_tok
-    _err_map[JERR_DTOK_ILLEGALSTATE] = std::string("JERR_MTOK_ILLEGALSTATE: "
-            "Attempted to change to illegal state.");
-    _err_map[JERR_DTOK_RIDNOTSET] = std::string("JERR_DTOK_RIDNOTSET: Record ID not set.");
+    _err_map[JERR_DTOK_ILLEGALSTATE] = "JERR_MTOK_ILLEGALSTATE: "
+            "Attempted to change to illegal state.";
+    //_err_map[JERR_DTOK_RIDNOTSET] = "JERR_DTOK_RIDNOTSET: Record ID not set.";
 
     // class enq_map, txn_map
-    _err_map[JERR_MAP_DUPLICATE] = std::string("JERR_MAP_DUPLICATE: "
-            "Attempted to insert record into map using duplicate key.");
-    _err_map[JERR_MAP_NOTFOUND] = std::string("JERR_MAP_NOTFOUND: Key not found in map.");
-    _err_map[JERR_MAP_LOCKED] = std::string("JERR_MAP_LOCKED: "
-            "Record ID locked by a pending transaction.");
+    _err_map[JERR_MAP_DUPLICATE] = "JERR_MAP_DUPLICATE: "
+            "Attempted to insert record into map using duplicate key.";
+    _err_map[JERR_MAP_NOTFOUND] = "JERR_MAP_NOTFOUND: Key not found in map.";
+    _err_map[JERR_MAP_LOCKED] = "JERR_MAP_LOCKED: Record ID locked by a pending transaction.";
 
     // class jinf
-    _err_map[JERR_JINF_CVALIDFAIL] = std::string("JERR_JINF_CVALIDFAIL: "
-            "Compatibility validation failure.");
-    _err_map[JERR_JINF_NOVALUESTR] = std::string("JERR_JINF_NOVALUESTR: "
-            "No value attribute found in jinf file");
-    _err_map[JERR_JINF_BADVALUESTR] = std::string("JERR_JINF_BADVALUESTR: "
-            "Bad format for value attribute in jinf file");
-    _err_map[JERR_JINF_JDATEMPTY] = std::string("JERR_JINF_JDATEMPTY: Journal data files empty.");
+    _err_map[JERR_JINF_CVALIDFAIL] = "JERR_JINF_CVALIDFAIL: "
+            "Journal compatibility validation failure.";
+    _err_map[JERR_JINF_NOVALUESTR] = "JERR_JINF_NOVALUESTR: No value attribute found in jinf file.";
+    _err_map[JERR_JINF_BADVALUESTR] = "JERR_JINF_BADVALUESTR: "
+            "Bad format for value attribute in jinf file";
+    _err_map[JERR_JINF_JDATEMPTY] = "JERR_JINF_JDATEMPTY: Journal data files empty.";
 
-    //_err_map[] = std::string("");
+    //_err_map[] = "";
 
     return true;
 }
 
-const std::string&
-jerrno::err_msg(const u_int32_t err_no) throw (int)
+const char*
+jerrno::err_msg(const u_int32_t err_no) throw ()
 {
     _err_map_itr = _err_map.find(err_no);
     if (_err_map_itr == _err_map.end())
-        throw -1; // not found
+        return "<Unknown error code>";
     return _err_map_itr->second;
 }
 

Modified: store/trunk/cpp/lib/jrnl/jerrno.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jerrno.hpp	2007-11-10 01:48:38 UTC (rev 1280)
+++ store/trunk/cpp/lib/jrnl/jerrno.hpp	2007-11-10 05:09:44 UTC (rev 1281)
@@ -55,8 +55,8 @@
     */
     class jerrno
     {
-        static std::map<u_int32_t, std::string> _err_map; ///< Map of error messages
-        static std::map<u_int32_t, std::string>::iterator _err_map_itr; ///< Iterator
+        static std::map<u_int32_t, const char*> _err_map; ///< Map of error messages
+        static std::map<u_int32_t, const char*>::iterator _err_map_itr; ///< Iterator
         static bool _initialized;                       ///< Dummy flag, used to initialise map.
 
     public:
@@ -80,7 +80,7 @@
         static const u_int32_t JERR_JDIR_NOTDIR;        ///< Exists but is not a directory
         static const u_int32_t JERR_JDIR_MKDIR;         ///< Directory creation failed
         static const u_int32_t JERR_JDIR_OPENDIR;       ///< Directory open failed
-        static const u_int32_t JERR_JDIR_READDIR;       ///< Directory read failed
+        //static const u_int32_t JERR_JDIR_READDIR;       ///< Directory read failed
         static const u_int32_t JERR_JDIR_CLOSEDIR;      ///< Directory close failed
         static const u_int32_t JERR_JDIR_RMDIR;         ///< Directory delete failed
         static const u_int32_t JERR_JDIR_NOSUCHFILE;    ///< File does not exist
@@ -100,12 +100,10 @@
 
         // class file_hdr
 
-        // class jrec
-        static const u_int32_t JERR_JREC_INVRTAIL;      ///< Invalid data record tail
-
-        // class data_rec
-        static const u_int32_t JERR_DREC_INVRHDR;       ///< Invalid data record header
-
+        // class jrec, enq_rec, deq_rec, txn_rec
+        static const u_int32_t JERR_JREC_BADRECHDR;       ///< Invalid data record header
+        static const u_int32_t JERR_JREC_BADRECTAIL;      ///< Invalid data record tail
+ 
         // class wmgr
         static const u_int32_t JERR_WMGR_BADPGSTATE;    ///< Page buffer in illegal state.
         static const u_int32_t JERR_WMGR_BADDTOKSTATE;  ///< Data token in illegal state.
@@ -115,13 +113,13 @@
         // class rmgr
         static const u_int32_t JERR_RMGR_UNKNOWNMAGIC;  ///< Found record with unknown magic
         static const u_int32_t JERR_RMGR_RIDMISMATCH;   ///< RID mismatch between rec and dtok
-        static const u_int32_t JERR_RMGR_FIDMISMATCH;   ///< FID mismatch between emap and rrfc
+        //static const u_int32_t JERR_RMGR_FIDMISMATCH;   ///< FID mismatch between emap and rrfc
         static const u_int32_t JERR_RMGR_ENQSTATE;      ///< Attempted read when wstate not ENQ
         static const u_int32_t JERR_RMGR_BADRECTYPE;    ///< Attempted op on incorrect rec type
 
         // class data_tok
         static const u_int32_t JERR_DTOK_ILLEGALSTATE;  ///< Attempted to change to illegal state
-        static const u_int32_t JERR_DTOK_RIDNOTSET;     ///< Record ID not set
+//         static const u_int32_t JERR_DTOK_RIDNOTSET;     ///< Record ID not set
 
         // class enq_map, txn_map
         static const u_int32_t JERR_MAP_DUPLICATE;      ///< Attempted to insert using duplicate key
@@ -137,7 +135,7 @@
         /**
         * \brief Method to access error message from known error number.
         */
-        static const std::string& err_msg(const u_int32_t err_no) throw (int);
+        static const char* err_msg(const u_int32_t err_no) throw ();
 
     private:
         /**

Modified: store/trunk/cpp/lib/jrnl/jexception.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jexception.cpp	2007-11-10 01:48:38 UTC (rev 1280)
+++ store/trunk/cpp/lib/jrnl/jexception.cpp	2007-11-10 05:09:44 UTC (rev 1281)
@@ -42,38 +42,51 @@
 namespace journal
 {
 
-jexception::jexception(const u_int32_t err_code):
+jexception::jexception() throw ():
+        std::exception(),
+        _err_code(0),
+        _additional_info(NULL),
+        _throwing_class(NULL),
+        _throwing_fn(NULL)
+{}
+
+jexception::jexception(const u_int32_t err_code) throw ():
+        std::exception(),
         _err_code(err_code),
-        _additional_info(),
-        _throwing_class(),
-        _throwing_fn()
+        _additional_info(NULL),
+        _throwing_class(NULL),
+        _throwing_fn(NULL)
 
 {}
 
-jexception::jexception(const std::string& additional_info):
+jexception::jexception(const char* additional_info) throw ():
+        std::exception(),
         _err_code(0),
         _additional_info(additional_info),
-        _throwing_class(),
-        _throwing_fn()
+        _throwing_class(NULL),
+        _throwing_fn(NULL)
 {}
 
-jexception::jexception(const u_int32_t err_code, const std::string& additional_info):
+jexception::jexception(const u_int32_t err_code, const char* additional_info) throw ():
+        std::exception(),
         _err_code(err_code),
         _additional_info(additional_info),
-        _throwing_class(),
-        _throwing_fn()
+        _throwing_class(NULL),
+        _throwing_fn(NULL)
 {}
 
-jexception::jexception(const u_int32_t err_code, const std::string& throwing_class,
-        const std::string& throwing_fn):
+jexception::jexception(const u_int32_t err_code, const char* throwing_class,
+        const char* throwing_fn) throw ():
+        std::exception(),
         _err_code(err_code),
-        _additional_info(),
+        _additional_info(NULL),
         _throwing_class(throwing_class),
         _throwing_fn(throwing_fn)
 {}
 
-jexception::jexception(const u_int32_t err_code, const std::string& additional_info,
-        const std::string& throwing_class, const std::string& throwing_fn):
+jexception::jexception(const u_int32_t err_code, const char* additional_info,
+        const char* throwing_class, const char* throwing_fn) throw ():
+        std::exception(),
         _err_code(err_code),
         _additional_info(additional_info),
         _throwing_class(throwing_class),
@@ -83,40 +96,30 @@
 jexception::~jexception() throw ()
 {}
 
-const std::string
-jexception::to_string() const
+const char*
+jexception::what() const throw ()
 {
     std::stringstream ss;
-    if (!_throwing_class.empty() && !_throwing_fn.empty())
+    if (_throwing_class && _throwing_fn)
         ss << _throwing_class << "::" << _throwing_fn << "() threw ";
-    std::string err_msg;
-    try { err_msg = jerrno::err_msg(_err_code); }
-    catch (int) { err_msg.assign("<Unknown error code>"); }
     ss << "jexception: 0x" << std::hex << std::setw(4) << std::setfill('0') << _err_code;
-    ss << " " << err_msg;
-    if (!_additional_info.empty())
+    ss << " " << jerrno::err_msg(_err_code);
+    if (_additional_info)
         ss << " (" << _additional_info << ")";
-    return ss.str();
+    return ss.str().c_str();
 }
 
-const char*
-jexception::what() const throw ()
-{
-//    return _additional_info.c_str();
-    return to_string().c_str();
-}
-
 std::ostream&
 operator<<(std::ostream& os, const jexception& je)
 {
-    os << je.to_string();
+    os << je.what();
     return os;
 }
 
 std::ostream&
 operator<<(std::ostream& os, const jexception* jePtr)
 {
-    os << jePtr->to_string();
+    os << jePtr->what();
     return os;
 }
 

Modified: store/trunk/cpp/lib/jrnl/jexception.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jexception.hpp	2007-11-10 01:48:38 UTC (rev 1280)
+++ store/trunk/cpp/lib/jrnl/jexception.hpp	2007-11-10 05:09:44 UTC (rev 1281)
@@ -59,26 +59,26 @@
     {
     private:
         u_int32_t _err_code;
-        std::string _additional_info;
-        std::string _throwing_class;
-        std::string _throwing_fn;
+        const char* _additional_info;
+        const char* _throwing_class;
+        const char* _throwing_fn;
 
     public:
-        jexception(const u_int32_t err_code);
-        jexception(const std::string& additional_info);
-        jexception(const u_int32_t err_code, const std::string& additional_info);
-        jexception(const u_int32_t err_code, const std::string& throwing_class,
-                const std::string& throwing_fn);
-        jexception(const u_int32_t err_code, const std::string& additional_info,
-                const std::string& throwing_class, const std::string& throwing_fn);
+        jexception() throw ();
+        jexception(const u_int32_t err_code) throw ();
+        jexception(const char* additional_info) throw ();
+        jexception(const u_int32_t err_code, const char* additional_info) throw ();
+        jexception(const u_int32_t err_code, const char* throwing_class, const char* throwing_fn)
+                throw ();
+        jexception(const u_int32_t err_code, const char* additional_info,
+                const char* throwing_class, const char* throwing_fn) throw ();
         virtual ~jexception() throw ();
-        const std::string to_string() const;
         virtual const char* what() const throw (); // override std::exception::what()
 
-        inline const u_int32_t err_code() const { return _err_code; }
-        inline const std::string& additional_info() const { return _additional_info; }
-        inline const std::string& throwing_class() const { return _throwing_class; }
-        inline const std::string& throwing_fn() const { return _throwing_fn; }
+        inline const u_int32_t err_code() const throw () { return _err_code; }
+        inline const char* additional_info() const throw () { return _additional_info; }
+        inline const char* throwing_class() const throw () { return _throwing_class; }
+        inline const char* throwing_fn() const throw () { return _throwing_fn; }
 
         friend std::ostream& operator<<(std::ostream& os, const jexception& je);
         friend std::ostream& operator<<(std::ostream& os, const jexception* jePtr);

Modified: store/trunk/cpp/lib/jrnl/jinf.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jinf.cpp	2007-11-10 01:48:38 UTC (rev 1280)
+++ store/trunk/cpp/lib/jrnl/jinf.cpp	2007-11-10 05:09:44 UTC (rev 1281)
@@ -147,7 +147,7 @@
         err = true;
     }
     if (err)
-        throw jexception(jerrno::JERR_JINF_CVALIDFAIL, ss.str(), "jinf", "validate");
+        throw jexception(jerrno::JERR_JINF_CVALIDFAIL, ss.str().c_str(), "jinf", "validate");
     _valid_flag = true;
 }
 
@@ -167,7 +167,7 @@
         ss << "." << JRNL_DATA_EXTENSION;
         std::ifstream jifs(ss.str().c_str());
         if (!jifs.good())
-            throw jexception(jerrno::JERR__FILEIO, ss.str(), "jinf", "analyze");
+            throw jexception(jerrno::JERR__FILEIO, ss.str().c_str(), "jinf", "analyze");
         file_hdr fhdr;
         jifs.read((char*)&fhdr, sizeof(fhdr));
         if (fhdr._hdr._magic != RHM_JDAT_FILE_MAGIC)
@@ -267,7 +267,7 @@
     char buff[1024];
     std::ifstream jinfs(jinf_filename.c_str());
     if (!jinfs.good())
-        throw jexception(jerrno::JERR__FILEIO, jinf_filename, "jinf", "read");
+        throw jexception(jerrno::JERR__FILEIO, jinf_filename.c_str(), "jinf", "read");
     while (jinfs.good())
     {
         jinfs.getline(buff, 1024);

Modified: store/trunk/cpp/lib/jrnl/jrec.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jrec.cpp	2007-11-10 01:48:38 UTC (rev 1280)
+++ store/trunk/cpp/lib/jrnl/jrec.cpp	2007-11-10 05:09:44 UTC (rev 1281)
@@ -71,7 +71,7 @@
         std::stringstream ss;
         ss << std::hex << std::setfill('0');
         ss << "enq magic NULL: rid=0x" << std::setw(16) << hdr._rid;
-        throw jexception(jerrno::JERR_DREC_INVRHDR, ss.str(), "jrec", "chk_hdr");
+        throw jexception(jerrno::JERR_JREC_BADRECHDR, ss.str().c_str(), "jrec", "chk_hdr");
     }
     if (hdr._version != RHM_JDAT_VERSION)
     {
@@ -80,7 +80,7 @@
         ss << "version: rid=0x" << std::setw(16) << hdr._rid;
         ss << ": expected=0x" << std::setw(2) << (int)RHM_JDAT_VERSION;
         ss << " read=0x" << std::setw(2) << (int)hdr._version;
-        throw jexception(jerrno::JERR_DREC_INVRHDR, ss.str(), "jrec", "chk_hdr");
+        throw jexception(jerrno::JERR_JREC_BADRECHDR, ss.str().c_str(), "jrec", "chk_hdr");
     }
 #if defined (JRNL_LITTLE_ENDIAN)
     u_int8_t endian_flag = RHM_LENDIAN_FLAG;
@@ -94,7 +94,7 @@
         ss << "endian_flag: rid=" << std::setw(16) << hdr._rid;
         ss << ": expected=0x" << std::setw(2) << (int)endian_flag;
         ss << " read=0x" << std::setw(2) << (int)hdr._eflag;
-        throw jexception(jerrno::JERR_DREC_INVRHDR, ss.str(), "jrec", "chk_hdr");
+        throw jexception(jerrno::JERR_JREC_BADRECHDR, ss.str().c_str(), "jrec", "chk_hdr");
     }
 }
 
@@ -107,7 +107,7 @@
         ss << std::hex << std::setfill('0');
         ss << "rid mismatch: expected=0x" << std::setw(16) << rid;
         ss << " read=0x" << std::setw(16) << hdr._rid;
-        throw jexception(jerrno::JERR_DREC_INVRHDR, ss.str(), "jrec", "chk_hdr");
+        throw jexception(jerrno::JERR_JREC_BADRECHDR, ss.str().c_str(), "jrec", "chk_hdr");
     }
 }
 
@@ -121,7 +121,7 @@
         ss << "magic: rid=0x" << std::setw(16) << hdr._rid;
         ss << ": expected=0x" << std::setw(8) << ~hdr._magic;
         ss << " read=0x" << std::setw(8) << tail._xmagic;
-        throw jexception(jerrno::JERR_JREC_INVRTAIL, ss.str(), "jrec", "chk_tail");
+        throw jexception(jerrno::JERR_JREC_BADRECTAIL, ss.str().c_str(), "jrec", "chk_tail");
     }
     if (tail._rid != hdr._rid)
     {
@@ -129,7 +129,7 @@
         ss << std::hex << std::setfill('0');
         ss << "rid: rid=0x" << std::setw(16) << hdr._rid;
         ss << ": read=0x" << std::setw(16) << tail._rid;
-        throw jexception(jerrno::JERR_JREC_INVRTAIL, ss.str(), "jrec", "chk_tail");
+        throw jexception(jerrno::JERR_JREC_BADRECTAIL, ss.str().c_str(), "jrec", "chk_tail");
     }
 }
 

Modified: store/trunk/cpp/lib/jrnl/nlfh.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/nlfh.cpp	2007-11-10 01:48:38 UTC (rev 1280)
+++ store/trunk/cpp/lib/jrnl/nlfh.cpp	2007-11-10 05:09:44 UTC (rev 1281)
@@ -143,7 +143,7 @@
             {
                 ss << ": posix_memalign() failed: size=" << writesize << " blk_size=" << sblksize;
                 ss << " errno=" << errno;
-                throw jexception(jerrno::JERR__MALLOC, ss.str(), "nlfh", "initialize");
+                throw jexception(jerrno::JERR__MALLOC, ss.str().c_str(), "nlfh", "initialize");
             }
             ::memset(nullbuf, 0, writesize);
 
@@ -153,7 +153,7 @@
             {
                 ss << ": open() failed:" << "\" errno=" << errno;
                 ::free(nullbuf);
-                throw jexception(jerrno::JERR_NLFH_OPENWR, ss.str(), "nlfh", "initialize");
+                throw jexception(jerrno::JERR_NLFH_OPENWR, ss.str().c_str(), "nlfh", "initialize");
             }
 
             while (nsblks > 0)
@@ -166,7 +166,8 @@
                     ss << ": wr_size=" << (this_write_sblks * sblksize) << " errno=" << errno;
                     ::close(fh);
                     ::free(nullbuf);
-                    throw jexception(jerrno::JERR_NLFH_WRITE, ss.str(), "nlfh", "initialize");
+                    throw jexception(jerrno::JERR_NLFH_WRITE, ss.str().c_str(), "nlfh",
+                            "initialize");
                 }
                 nsblks -= this_write_sblks;
             }
@@ -176,7 +177,7 @@
             if (::close(fh))
             {
                 ss << ": errno=" << errno;
-                throw jexception(jerrno::JERR_NLFH_CLOSE, ss.str(), "jcntl", "initialize");
+                throw jexception(jerrno::JERR_NLFH_CLOSE, ss.str().c_str(), "nlfh", "initialize");
             }
         }
 #ifdef RHM_JOWRITE
@@ -246,7 +247,7 @@
     {
         std::stringstream ss;
         ss << "_rec_enqcnt=" << _rec_enqcnt << " decr=" << s;
-        throw jexception (jerrno::JERR__UNDERFLOW, ss.str(), "nlfh", "decr_enqcnt");
+        throw jexception (jerrno::JERR__UNDERFLOW, ss.str().c_str(), "nlfh", "subtr_enqcnt");
     }
     _rec_enqcnt -= s;
     return _rec_enqcnt;
@@ -260,7 +261,8 @@
         std::stringstream ss;
         ss << "_rd_subm_cnt_dblks=" << _rd_subm_cnt_dblks;
         ss << " _wr_subm_cnt_dblks=" << _wr_subm_cnt_dblks;
-        throw jexception(jerrno::JERR_NFLH_RDOFFSOVFL, ss.str(), "nlfh", "incr_rd_subm_cnt_dblks");
+        throw jexception(jerrno::JERR_NFLH_RDOFFSOVFL, ss.str().c_str(), "nlfh",
+                "incr_rd_subm_cnt_dblks");
     }
     return ++_rd_subm_cnt_dblks;
 }
@@ -273,7 +275,8 @@
         std::stringstream ss;
         ss << "_rd_subm_cnt_dblks=" << _rd_subm_cnt_dblks << " incr=" << a;
         ss << " _wr_subm_cnt_dblks=" << _wr_subm_cnt_dblks;
-        throw jexception(jerrno::JERR_NFLH_RDOFFSOVFL, ss.str(), "nlfh", "add_rd_subm_cnt_dblks");
+        throw jexception(jerrno::JERR_NFLH_RDOFFSOVFL, ss.str().c_str(), "nlfh",
+                "add_rd_subm_cnt_dblks");
     }
     _rd_subm_cnt_dblks += a;
     return _rd_subm_cnt_dblks;
@@ -287,7 +290,7 @@
         std::stringstream ss;
         ss << "_rd_cmpl_cnt_dblks=" << _rd_cmpl_cnt_dblks;
         ss << " _rd_subm_cnt_dblks=" << _rd_subm_cnt_dblks;
-        throw jexception(jerrno::JERR_NFLH_CMPLOFFSOVFL, ss.str(), "nlfh",
+        throw jexception(jerrno::JERR_NFLH_CMPLOFFSOVFL, ss.str().c_str(), "nlfh",
                 "incr_rd_cmpl_cnt_dblks");
     }
     return ++_rd_cmpl_cnt_dblks;
@@ -301,7 +304,7 @@
         std::stringstream ss;
         ss << "_rd_cmpl_cnt_dblks=" << _rd_cmpl_cnt_dblks << " incr=" << a;
         ss << " _rd_subm_cnt_dblks=" << _rd_subm_cnt_dblks;
-        throw jexception(jerrno::JERR_NFLH_CMPLOFFSOVFL, ss.str(), "nlfh",
+        throw jexception(jerrno::JERR_NFLH_CMPLOFFSOVFL, ss.str().c_str(), "nlfh",
                 "add_rd_cmpl_cnt_dblks");
     }
     _rd_cmpl_cnt_dblks += a;
@@ -316,7 +319,7 @@
         std::stringstream ss;
         ss << "_wr_subm_cnt_dblks=" << _wr_subm_cnt_dblks;
         ss << " fsize=" << JRNL_SBLK_SIZE * (JRNL_FILE_SIZE + 1) << " dblks";
-        throw jexception(jerrno::JERR_NLFH_FILEOFFSOVFL, ss.str(), "nlfh",
+        throw jexception(jerrno::JERR_NLFH_FILEOFFSOVFL, ss.str().c_str(), "nlfh",
                 "incr_wr_subm_cnt_dblks");
     }
     return ++_wr_subm_cnt_dblks;
@@ -330,7 +333,7 @@
         std::stringstream ss;
         ss << "_wr_subm_cnt_dblks=" << _wr_subm_cnt_dblks << " incr=" << a;
         ss << " fsize=" << JRNL_SBLK_SIZE * (JRNL_FILE_SIZE + 1) << " dblks";
-        throw jexception(jerrno::JERR_NLFH_FILEOFFSOVFL, ss.str(), "nlfh",
+        throw jexception(jerrno::JERR_NLFH_FILEOFFSOVFL, ss.str().c_str(), "nlfh",
                 "add_wr_subm_cnt_dblks");
     }
     _wr_subm_cnt_dblks += a;
@@ -345,7 +348,7 @@
         std::stringstream ss;
         ss << "_wr_cmpl_cnt_dblks=" << _wr_cmpl_cnt_dblks;
         ss << " _wr_subm_cnt_dblks=" << _wr_subm_cnt_dblks;
-        throw jexception(jerrno::JERR_NFLH_CMPLOFFSOVFL, ss.str(), "nlfh",
+        throw jexception(jerrno::JERR_NFLH_CMPLOFFSOVFL, ss.str().c_str(), "nlfh",
                 "incr_wr_cmpl_cnt_dblks");
     }
     return ++_wr_cmpl_cnt_dblks;
@@ -359,7 +362,7 @@
         std::stringstream ss;
         ss << "_wr_cmpl_cnt_dblks=" << _wr_cmpl_cnt_dblks << " incr=" << a;
         ss << " _wr_subm_cnt_dblks=" << _wr_subm_cnt_dblks;
-        throw jexception(jerrno::JERR_NFLH_CMPLOFFSOVFL, ss.str(), "nlfh",
+        throw jexception(jerrno::JERR_NFLH_CMPLOFFSOVFL, ss.str().c_str(), "nlfh",
                 "add_wr_cmpl_cnt_dblks");
     }
     _wr_cmpl_cnt_dblks += a;
@@ -387,7 +390,7 @@
     {
         std::stringstream ss;
         ss << "file=\"" << _fname << "\" errno=" << errno;
-        throw jexception(jerrno::JERR_NLFH_OPENRD, ss.str(), "nlfh", "open");
+        throw jexception(jerrno::JERR_NLFH_OPENRD, ss.str().c_str(), "nlfh", "open");
     }
     _wr_fh = ::open(_fname.c_str(), O_WRONLY | O_DIRECT,
             S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); // 0644 -rw-r--r--
@@ -395,7 +398,7 @@
     {
         std::stringstream ss;
         ss << "file=\"" << _fname << "\" errno=" << errno;
-        throw jexception(jerrno::JERR_NLFH_OPENWR, ss.str(), "nlfh", "open");
+        throw jexception(jerrno::JERR_NLFH_OPENWR, ss.str().c_str(), "nlfh", "open");
     }
 }
 

Modified: store/trunk/cpp/lib/jrnl/pmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/pmgr.cpp	2007-11-10 01:48:38 UTC (rev 1280)
+++ store/trunk/cpp/lib/jrnl/pmgr.cpp	2007-11-10 05:09:44 UTC (rev 1281)
@@ -147,7 +147,7 @@
         clean();
         ss << "posix_memalign(): blksize=" << _sblksize << " size=" << pagesize;
         ss << " errno=" << errno;
-        throw jexception(jerrno::JERR__MALLOC, ss.str(), "pmgr", "initialize");
+        throw jexception(jerrno::JERR__MALLOC, ss.str().c_str(), "pmgr", "initialize");
     }
     // 2. Allocate array of page pointers
     _page_ptr_arr = (void**)::malloc(_pages * sizeof(void*));
@@ -155,7 +155,7 @@
     {
         clean();
         ss << "_page_ptr_arr malloc(): errno=" << errno;
-        throw jexception(jerrno::JERR__MALLOC, ss.str(), "pmgr", "initialize");
+        throw jexception(jerrno::JERR__MALLOC, ss.str().c_str(), "pmgr", "initialize");
     }
 
     // 3. Allocate and initilaize page control block (page_cb) array
@@ -164,7 +164,7 @@
     {
         clean();
         ss << "_page_cb_arr malloc(): errno=" << errno;
-        throw jexception(jerrno::JERR__MALLOC, ss.str(), "pmgr", "initialize");
+        throw jexception(jerrno::JERR__MALLOC, ss.str().c_str(), "pmgr", "initialize");
     }
     ::memset(_page_cb_arr, 0, _pages * sizeof(page_cb));
 
@@ -174,7 +174,7 @@
     {
         clean();
         ss << "_iocb_arr malloc(): errno=" << errno;
-        throw jexception(jerrno::JERR__MALLOC, ss.str(), "pmgr", "initialize");
+        throw jexception(jerrno::JERR__MALLOC, ss.str().c_str(), "pmgr", "initialize");
     }
 
     // 6. Set page pointers in _page_ptr_arr, _page_cb_arr and iocbs to pages within page block
@@ -196,14 +196,14 @@
     {
         clean();
         ss << "_ioevt_arr malloc(): errno=" << errno;
-        throw jexception(jerrno::JERR__MALLOC, ss.str(), "pmgr", "initialize");
+        throw jexception(jerrno::JERR__MALLOC, ss.str().c_str(), "pmgr", "initialize");
     }
 
     // 8. Initialize AIO context
     if (int ret = ::io_queue_init(max_aio_evts, &_ioctx))
     {
         ss << "io_queue_init() failed: " << strerror(-ret) << " (" << ret << ")";
-        throw jexception(jerrno::JERR__AIO, ss.str(), "pmgr", "initialize");
+        throw jexception(jerrno::JERR__AIO, ss.str().c_str(), "pmgr", "initialize");
     }
 }
 

Modified: store/trunk/cpp/lib/jrnl/rmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/rmgr.cpp	2007-11-10 01:48:38 UTC (rev 1280)
+++ store/trunk/cpp/lib/jrnl/rmgr.cpp	2007-11-10 05:09:44 UTC (rev 1281)
@@ -78,88 +78,88 @@
 
     return RHM_IORES_NOTIMPL;
 
-// TODO - untangle this...
-//     _hdr.reset();
-//     // Read header, determine next record type
-//     while (true)
-//     {
-//         if(dblks_rem() == 0 && _rrfc.is_compl() && !_rrfc.is_wr_aio_outstanding())
-//         {
-//             aio_cycle();   // check if any AIOs have returned
-//             return RHM_IORES_EMPTY;
-//         }
-//         if (_page_cb_arr[_pg_index]._state != AIO_COMPLETE)
-//         {
-//             aio_cycle();
-//             return RHM_IORES_AIO_WAIT;
-//         }
-//         void* rptr = (void*)((char*)_page_ptr_arr[_pg_index] +
-//                 (_pg_offset_dblks * JRNL_DBLK_SIZE));
-//         ::memcpy(&_hdr, rptr, sizeof(hdr));
-//         switch (_hdr._magic)
-//         {
-//             case RHM_JDAT_ENQ_MAGIC:
-//                 {
-//                     size_t xid_size = *((size_t*)((char*)rptr + sizeof(hdr) 
-// #if defined(JRNL_BIG_ENDIAN) && defined(JRNL_32_BIT)
-//                             + sizeof(u_int32_t) // filler0
-// #endif
-//                             ));
-//                     size_t data_size = *((size_t*)((char*)rptr + sizeof(hdr) + sizeof(u_int64_t)
-// #if defined(JRNL_BIG_ENDIAN) && defined(JRNL_32_BIT)
-//                             + sizeof(u_int32_t) // filler1
-// #endif
-//                             ));
-//                     // TODO: Check if transaction is still in transaction map. If so, block read
-//                     // (unless in recovery, in whcih case return info normally
-// //                     std::string xid = ?? (decode xid here)
-// //                     if (xid_size && !readonly && tx_map.exists(xid))
-// //                         return RHM_IORES_TXPENDING;
-//                     rid = _hdr._rid;
-//                     dsize = data_size;
-// 
-//                     // Analyze how much of message is available
-//                     void* data_ptr = (char*)rptr + sizeof(enq_hdr) + xid_size;
-//                     void* page_end_ptr = (char*)_page_base_ptr + _pagesize * _sblksize * _pages;
-//                     u_int16_t data_start_pg_index = _pg_index;
-//                     u_int16_t data_start_pg_index = _pg_index;
-//                     for (u_int16_t i=0; i<_pages; i++)
-//                     {
-//                         pi = (i + _pg_index) % _pages;
-//                         if (data_ptr >= _page_ptr_arr[pi] &&
-//                                 data_ptr < (char*)_page_ptr_arr[pi] + _pagesize * _sblksize)
-//                             data_end_pg_index = pi; // found start page index
-//                         
-//                     }
-//                     u_int16_t data_end_pg_index;
-//                     u_int16_t last_pg_avail_index;
-//                     
-//                     void* data_ptr = (char*)rptr + sizeof(enq_hdr) + xid_size;
-//                     void* page_end_ptr = (char*)_page_base_ptr + _pagesize * _sblksize * _pages;
-//                     if (data_ptr >= page_end_ptr) // folded, go back to first page...
-//                         data_ptr = (char*)_page_base_ptr + data_ptr - page_end_ptr;
-//                     void* data_end_ptr = (char*)data_ptr + data_size;
-//                     if (data_end_ptr >= page_end_ptr) // folded, go back to first page...
-//                         data_end_ptr = (char*)_page_base_ptr + data_end_ptr - page_end_ptr;
-//                     dsize_avail = ??;
-//                     if(data_ptr folded)
-//                     else
-//                         *data = data_ptr;
-//                 }
-//                 break;
-//             case RHM_JDAT_DEQ_MAGIC:
-//                 consume_deq();
-//                 break;
-//             case RHM_JDAT_EMPTY_MAGIC:
-//                 consume_filler();
-//                 break;
-//             default:
-//                 std::stringstream ss;
-//                 ss << std::hex << std::setfill('0');
-//                 ss << "Magic=0x" << std::setw(8) << _hdr._magic << std::dec;
-//                 throw jexception(jerrno::JERR_RMGR_UNKNOWNMAGIC, ss.str(), "rmgr", "read");
-//         } // switch(_hdr._magic)
-//     } // while
+//TODO - untangle this...
+/*     _hdr.reset();
+    // Read header, determine next record type
+    while (true)
+    {
+        if(dblks_rem() == 0 && _rrfc.is_compl() && !_rrfc.is_wr_aio_outstanding())
+        {
+            aio_cycle();   // check if any AIOs have returned
+            return RHM_IORES_EMPTY;
+        }
+        if (_page_cb_arr[_pg_index]._state != AIO_COMPLETE)
+        {
+            aio_cycle();
+            return RHM_IORES_AIO_WAIT;
+        }
+        void* rptr = (void*)((char*)_page_ptr_arr[_pg_index] +
+                (_pg_offset_dblks * JRNL_DBLK_SIZE));
+        ::memcpy(&_hdr, rptr, sizeof(hdr));
+        switch (_hdr._magic)
+        {
+            case RHM_JDAT_ENQ_MAGIC:
+                {
+                    size_t xid_size = *((size_t*)((char*)rptr + sizeof(hdr) 
+#if defined(JRNL_BIG_ENDIAN) && defined(JRNL_32_BIT)
+                            + sizeof(u_int32_t) // filler0
+#endif
+                            ));
+                    size_t data_size = *((size_t*)((char*)rptr + sizeof(hdr) + sizeof(u_int64_t)
+#if defined(JRNL_BIG_ENDIAN) && defined(JRNL_32_BIT)
+                            + sizeof(u_int32_t) // filler1
+#endif
+                            ));
+                    // TODO: Check if transaction is still in transaction map. If so, block read
+                    // (unless in recovery, in whcih case return info normally
+//                     std::string xid = ?? (decode xid here)
+//                     if (xid_size && !readonly && tx_map.exists(xid))
+//                         return RHM_IORES_TXPENDING;
+                    rid = _hdr._rid;
+                    dsize = data_size;
+
+                    // Analyze how much of message is available
+                    void* data_ptr = (char*)rptr + sizeof(enq_hdr) + xid_size;
+                    void* page_end_ptr = (char*)_page_base_ptr + _pagesize * _sblksize * _pages;
+                    u_int16_t data_start_pg_index = _pg_index;
+                    u_int16_t data_start_pg_index = _pg_index;
+                    for (u_int16_t i=0; i<_pages; i++)
+                    {
+                        pi = (i + _pg_index) % _pages;
+                        if (data_ptr >= _page_ptr_arr[pi] &&
+                                data_ptr < (char*)_page_ptr_arr[pi] + _pagesize * _sblksize)
+                            data_end_pg_index = pi; // found start page index
+                        
+                    }
+                    u_int16_t data_end_pg_index;
+                    u_int16_t last_pg_avail_index;
+                    
+                    void* data_ptr = (char*)rptr + sizeof(enq_hdr) + xid_size;
+                    void* page_end_ptr = (char*)_page_base_ptr + _pagesize * _sblksize * _pages;
+                    if (data_ptr >= page_end_ptr) // folded, go back to first page...
+                        data_ptr = (char*)_page_base_ptr + data_ptr - page_end_ptr;
+                    void* data_end_ptr = (char*)data_ptr + data_size;
+                    if (data_end_ptr >= page_end_ptr) // folded, go back to first page...
+                        data_end_ptr = (char*)_page_base_ptr + data_end_ptr - page_end_ptr;
+                    dsize_avail = ??;
+                    if(data_ptr folded)
+                    else
+                        *data = data_ptr;
+                }
+                break;
+            case RHM_JDAT_DEQ_MAGIC:
+                consume_deq();
+                break;
+            case RHM_JDAT_EMPTY_MAGIC:
+                consume_filler();
+                break;
+            default:
+                std::stringstream ss;
+                ss << std::hex << std::setfill('0');
+                ss << "Magic=0x" << std::setw(8) << _hdr._magic << std::dec;
+                throw jexception(jerrno::JERR_RMGR_UNKNOWNMAGIC, ss.str().c_str(), "rmgr", "get");
+        } // switch(_hdr._magic)
+    } // while */
 }
 
 const iores
@@ -172,43 +172,44 @@
 
     return RHM_IORES_NOTIMPL;
 
-// TODO - untangle this...
-//     _hdr.reset();
-//     // Read header, determine next record type
-//     while (true)
-//     {
-//         if(dblks_rem() == 0 && _rrfc.is_compl() && !_rrfc.is_wr_aio_outstanding())
-//         {
-//             aio_cycle();   // check if any AIOs have returned
-//             return RHM_IORES_EMPTY;
-//         }
-//         if (_page_cb_arr[_pg_index]._state != AIO_COMPLETE)
-//         {
-//             aio_cycle();
-//             return RHM_IORES_AIO_WAIT;
-//         }
-//         void* rptr = (void*)((char*)_page_ptr_arr[_pg_index] +
-//                 (_pg_offset_dblks * JRNL_DBLK_SIZE));
-//         ::memcpy(&_hdr, rptr, sizeof(hdr));
-//         switch (_hdr._magic)
-//         {
-//             case RHM_JDAT_ENQ_MAGIC:
-//                 {
-//                 }
-//                 break;
-//             case RHM_JDAT_DEQ_MAGIC:
-//                 consume_deq();
-//                 break;
-//             case RHM_JDAT_EMPTY_MAGIC:
-//                 consume_filler();
-//                 break;
-//             default:
-//                 std::stringstream ss;
-//                 ss << std::hex << std::setfill('0');
-//                 ss << "Magic=0x" << std::setw(8) << _hdr._magic << std::dec;
-//                 throw jexception(jerrno::JERR_RMGR_UNKNOWNMAGIC, ss.str(), "rmgr", "read");
-//         } // switch
-//     } // while
+/* TODO - untangle this...
+    _hdr.reset();
+    // Read header, determine next record type
+    while (true)
+    {
+        if(dblks_rem() == 0 && _rrfc.is_compl() && !_rrfc.is_wr_aio_outstanding())
+        {
+            aio_cycle();   // check if any AIOs have returned
+            return RHM_IORES_EMPTY;
+        }
+        if (_page_cb_arr[_pg_index]._state != AIO_COMPLETE)
+        {
+            aio_cycle();
+            return RHM_IORES_AIO_WAIT;
+        }
+        void* rptr = (void*)((char*)_page_ptr_arr[_pg_index] +
+                (_pg_offset_dblks * JRNL_DBLK_SIZE));
+        ::memcpy(&_hdr, rptr, sizeof(hdr));
+        switch (_hdr._magic)
+        {
+            case RHM_JDAT_ENQ_MAGIC:
+                {
+                }
+                break;
+            case RHM_JDAT_DEQ_MAGIC:
+                consume_deq();
+                break;
+            case RHM_JDAT_EMPTY_MAGIC:
+                consume_filler();
+                break;
+            default:
+                std::stringstream ss;
+                ss << std::hex << std::setfill('0');
+                ss << "Magic=0x" << std::setw(8) << _hdr._magic << std::dec;
+                throw jexception(jerrno::JERR_RMGR_UNKNOWNMAGIC, ss.str().c_str(), "rmgr",
+                        "discard");
+        } // switch
+    } // while */
 }
 
 const iores
@@ -345,7 +346,7 @@
                             ss << "rid=0x" << std::setw(16) << _hdr._rid;
                             ss << "; dtok_rid=" << std::setw(16) << dtokp->rid();
                             ss << "; dtok_id=0x" << std::setw(8) << dtokp->id();
-                            throw jexception(jerrno::JERR_RMGR_RIDMISMATCH, ss.str(), "rmgr",
+                            throw jexception(jerrno::JERR_RMGR_RIDMISMATCH, ss.str().c_str(), "rmgr",
                                     "read");
                         }
                     }
@@ -362,7 +363,8 @@
 //                         ss << "rid=0x" << std::setw(16) << _hdr._rid;
 //                         ss << "; emap_fid=0x" << std::setw(4) << fid;
 //                         ss << "; current_fid=" << _rrfc.fid();
-//                         throw jexception(jerrno::JERR_RMGR_FIDMISMATCH, ss.str(), "rmgr", "read");
+//                         throw jexception(jerrno::JERR_RMGR_FIDMISMATCH, ss.str().c_str(), "rmgr",
+//                              "read");
 //                     }
 #endif
                     const iores res = read_enq(_hdr, rptr, dtokp);
@@ -399,7 +401,7 @@
                 std::stringstream ss;
                 ss << std::hex << std::setfill('0');
                 ss << "Magic=0x" << std::setw(8) << _hdr._magic << std::dec;
-                throw jexception(jerrno::JERR_RMGR_UNKNOWNMAGIC, ss.str(), "rmgr", "read");
+                throw jexception(jerrno::JERR_RMGR_UNKNOWNMAGIC, ss.str().c_str(), "rmgr", "read");
         }
     }
 }
@@ -414,7 +416,7 @@
             return 0;
         std::stringstream ss;
         ss << "io_getevents() failed: " << strerror(-ret) << " (" << ret << ")";
-        throw jexception(jerrno::JERR__AIO, ss.str(), "rmgr", "get_events");
+        throw jexception(jerrno::JERR__AIO, ss.str().c_str(), "rmgr", "get_events");
     }
 
     u_int32_t tot_data_toks = 0;
@@ -424,7 +426,7 @@
         {
             std::stringstream ss;
             ss << "_aio_evt_rem; evt " << (i + 1) << " of " << ret;
-            throw jexception(jerrno::JERR__UNDERFLOW, ss.str(), "rmgr", "get_events");
+            throw jexception(jerrno::JERR__UNDERFLOW, ss.str().c_str(), "rmgr", "get_events");
         }
         _aio_evt_rem--;
         iocb* iocbp = _ioevt_arr[i].obj; // This I/O control block (iocb)
@@ -436,7 +438,7 @@
             ss << "AIO read operation failed: " << strerror(-aioret) << " (" << aioret << ")";
             ss << " [pg=" << pcbp->_index << " size=" << iocbp->u.c.nbytes;
             ss << " offset=" << iocbp->u.c.offset << " fh=" << iocbp->aio_fildes << "]";
-            throw jexception(jerrno::JERR__AIO, ss.str(), "rmgr", "get_events");
+            throw jexception(jerrno::JERR__AIO, ss.str().c_str(), "rmgr", "get_events");
         }
 
         // Transfer all data tokens
@@ -500,7 +502,8 @@
             ss << "dtok_id=0x" << std::setw(8) << dtokp->id();
             ss << "; dtok_rid=0x" << std::setw(16) << dtokp->rid();
             ss << "; dtok_wstate=" << dtokp->wstate_str();
-            throw jexception(jerrno::JERR_RMGR_ENQSTATE, ss.str(), "rmgr", "read");
+            throw jexception(jerrno::JERR_RMGR_ENQSTATE, ss.str().c_str(), "rmgr",
+                    "pre_read_check");
         }
     }
 
@@ -586,7 +589,7 @@
     {
         std::stringstream ss;
         ss << "Record type found = \"" << (char*)&h._magic << "\"";
-        throw jexception(jerrno::JERR_RMGR_BADRECTYPE, ss.str(), "rmgr", "consume_xid_rec");
+        throw jexception(jerrno::JERR_RMGR_BADRECTYPE, ss.str().c_str(), "rmgr", "consume_xid_rec");
     }
     dtokp->set_dblocks_read(0);
     skip(dtokp);

Modified: store/trunk/cpp/lib/jrnl/txn_map.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/txn_map.cpp	2007-11-10 01:48:38 UTC (rev 1280)
+++ store/trunk/cpp/lib/jrnl/txn_map.cpp	2007-11-10 05:09:44 UTC (rev 1281)
@@ -93,7 +93,7 @@
     {
         std::stringstream ss;
         ss << std::hex << "xid=\"" << xid << "\"";
-        throw jexception(jerrno::JERR_MAP_NOTFOUND, ss.str(), "txn_map", "get_tdata_list");
+        throw jexception(jerrno::JERR_MAP_NOTFOUND, ss.str().c_str(), "txn_map", "get_tdata_list");
     }
     return itr->second;
 }
@@ -108,7 +108,8 @@
         pthread_mutex_unlock(&_mutex);
         std::stringstream ss;
         ss << std::hex << "xid=\"" << xid << "\"";
-        throw jexception(jerrno::JERR_MAP_NOTFOUND, ss.str(), "txn_map", "get_remove_tdata_list");
+        throw jexception(jerrno::JERR_MAP_NOTFOUND, ss.str().c_str(), "txn_map",
+                "get_remove_tdata_list");
     }
     txn_data_list list = itr->second;
     _map.erase(itr);
@@ -126,7 +127,7 @@
     {
         std::stringstream ss;
         ss << std::hex << "xid=\"" << xid << "\"";
-        throw jexception(jerrno::JERR_MAP_NOTFOUND, ss.str(), "txn_map", "get_rid_count");
+        throw jexception(jerrno::JERR_MAP_NOTFOUND, ss.str().c_str(), "txn_map", "get_rid_count");
     }
     return itr->second.size();
 }
@@ -141,7 +142,7 @@
         pthread_mutex_unlock(&_mutex);
         std::stringstream ss;
         ss << std::hex << "xid=\"" << xid << "\"";
-        throw jexception(jerrno::JERR_MAP_NOTFOUND, ss.str(), "txn_map", "is_txn_synced");
+        throw jexception(jerrno::JERR_MAP_NOTFOUND, ss.str().c_str(), "txn_map", "is_txn_synced");
     }
 //std::cout << " its: found XID" << std::flush;
     bool is_synced = true;
@@ -191,7 +192,7 @@
     {
         std::stringstream ss;
         ss << std::hex << "xid=\"" << xid << "\" rid=" << rid;
-        throw jexception(jerrno::JERR_MAP_NOTFOUND, ss.str(), "txn_map", "set_aio_compl");
+        throw jexception(jerrno::JERR_MAP_NOTFOUND, ss.str().c_str(), "txn_map", "set_aio_compl");
     }
     return ok;
 }

Modified: store/trunk/cpp/lib/jrnl/txn_rec.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/txn_rec.cpp	2007-11-10 01:48:38 UTC (rev 1280)
+++ store/trunk/cpp/lib/jrnl/txn_rec.cpp	2007-11-10 05:09:44 UTC (rev 1281)
@@ -273,7 +273,7 @@
         {
             std::stringstream ss;
             ss << "_buff malloc(): errno=" << errno;
-            throw jexception(jerrno::JERR__MALLOC, ss.str(), "txn_rec", "decode");
+            throw jexception(jerrno::JERR__MALLOC, ss.str().c_str(), "txn_rec", "decode");
         }
         const u_int32_t hdr_xid_dblks = size_dblks(txn_hdr::size() + _txn_hdr._xidsize);
         const u_int32_t hdr_xid_tail_dblks = size_dblks(txn_hdr::size() + _txn_hdr._xidsize +
@@ -342,7 +342,7 @@
         {
             std::stringstream ss;
             ss << "_buff malloc(): errno=" << errno;
-            throw jexception(jerrno::JERR__MALLOC, ss.str(), "deq_rec", "decode");
+            throw jexception(jerrno::JERR__MALLOC, ss.str().c_str(), "deq_rec", "rcv_decode");
         }
         // Decode xid
         ifsp->read((char*)_buff, _txn_hdr._xidsize);
@@ -409,7 +409,7 @@
         ss << ": expected=(0x" << std::setw(8) << RHM_JDAT_TXA_MAGIC;
         ss << " or 0x" << RHM_JDAT_TXC_MAGIC;
         ss << ") read=0x" << std::setw(2) << (int)_txn_hdr._hdr._magic;
-        throw jexception(jerrno::JERR_DREC_INVRHDR, ss.str(), "txn_rec", "chk_hdr");
+        throw jexception(jerrno::JERR_JREC_BADRECHDR, ss.str().c_str(), "txn_rec", "chk_hdr");
     }
 }
 

Modified: store/trunk/cpp/lib/jrnl/wmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/wmgr.cpp	2007-11-10 01:48:38 UTC (rev 1280)
+++ store/trunk/cpp/lib/jrnl/wmgr.cpp	2007-11-10 05:09:44 UTC (rev 1281)
@@ -119,7 +119,7 @@
         {
             std::stringstream ss;
             ss << "This data_tok: id=" << dtokp->id() << " state=" << dtokp->wstate_str();
-            throw jexception(jerrno::JERR_WMGR_ENQDISCONT, ss.str(), "wmgr", "enqueue");
+            throw jexception(jerrno::JERR_WMGR_ENQDISCONT, ss.str().c_str(), "wmgr", "enqueue");
         }
     }
     else
@@ -254,7 +254,7 @@
         {
             std::stringstream ss;
             ss << "This data_tok: id=" << dtokp->id() << " state=" << dtokp->wstate_str();
-            throw jexception(jerrno::JERR_WMGR_DEQDISCONT, ss.str(), "wmgr", "dequeue");
+            throw jexception(jerrno::JERR_WMGR_DEQDISCONT, ss.str().c_str(), "wmgr", "dequeue");
         }
     }
     else
@@ -402,7 +402,7 @@
         {
             std::stringstream ss;
             ss << "This data_tok: id=" << dtokp->id() << " state=" << dtokp->wstate_str();
-            throw jexception(jerrno::JERR_WMGR_DEQDISCONT, ss.str(), "wmgr", "abort");
+            throw jexception(jerrno::JERR_WMGR_DEQDISCONT, ss.str().c_str(), "wmgr", "abort");
         }
     }
     else
@@ -460,7 +460,7 @@
             {
                 std::stringstream ss;
                 ss << std::hex << "_txn_pending_set: xid=\"" << xid << "\"";
-                throw jexception(jerrno::JERR_MAP_DUPLICATE, ss.str(), "wmgr", "abort");
+                throw jexception(jerrno::JERR_MAP_DUPLICATE, ss.str().c_str(), "wmgr", "abort");
             }
 #endif
 
@@ -545,7 +545,7 @@
         {
             std::stringstream ss;
             ss << "This data_tok: id=" << dtokp->id() << " state=" << dtokp->wstate_str();
-            throw jexception(jerrno::JERR_WMGR_DEQDISCONT, ss.str(), "wmgr", "commit");
+            throw jexception(jerrno::JERR_WMGR_DEQDISCONT, ss.str().c_str(), "wmgr", "commit");
         }
     }
     else
@@ -602,7 +602,7 @@
             {
                 std::stringstream ss;
                 ss << std::hex << "_txn_pending_set: xid=\"" << xid << "\"";
-                throw jexception(jerrno::JERR_MAP_DUPLICATE, ss.str(), "wmgr", "commit");
+                throw jexception(jerrno::JERR_MAP_DUPLICATE, ss.str().c_str(), "wmgr", "commit");
             }
 #endif
 
@@ -693,7 +693,8 @@
             {
                 std::stringstream ss;
                 ss << "pg_index=" << _pg_index << " state=" << _page_cb_arr[_pg_index].state_str();
-                throw jexception(jerrno::JERR_WMGR_BADPGSTATE, ss.str(), "wmgr", "write_flush");
+                throw jexception(jerrno::JERR_WMGR_BADPGSTATE, ss.str().c_str(), "wmgr",
+                        "write_flush");
             }
 
             // Send current page using AIO
@@ -747,7 +748,7 @@
             return 0;
         std::stringstream ss;
         ss << "io_getevents() failed: " << strerror(-ret) << " (" << ret << ")";
-        throw jexception(jerrno::JERR__AIO, ss.str(), "wmgr", "get_events");
+        throw jexception(jerrno::JERR__AIO, ss.str().c_str(), "wmgr", "get_events");
     }
 
     u_int32_t tot_data_toks = 0;
@@ -757,7 +758,7 @@
         {
             std::stringstream ss;
             ss << "_aio_evt_rem; evt " << (i + 1) << " of " << ret;
-            throw jexception(jerrno::JERR__UNDERFLOW, ss.str(), "wmgr", "get_events");
+            throw jexception(jerrno::JERR__UNDERFLOW, ss.str().c_str(), "wmgr", "get_events");
         }
         _aio_evt_rem--;
         iocb* iocbp = _ioevt_arr[i].obj; // This I/O control block (iocb)
@@ -769,7 +770,7 @@
             ss << "AIO write operation failed: " << strerror(-aioret) << " (" << aioret << ")";
             ss << " [pg=" << pcbp->_index << " size=" << iocbp->u.c.nbytes;
             ss << " offset=" << iocbp->u.c.offset << " fh=" << iocbp->aio_fildes << "]";
-            throw jexception(jerrno::JERR__AIO, ss.str(), "wmgr", "get_events");
+            throw jexception(jerrno::JERR__AIO, ss.str().c_str(), "wmgr", "get_events");
         }
         if (pcbp) // Page writes have pcb
         {
@@ -802,7 +803,8 @@
                     {
                         std::stringstream ss;
                         ss << std::hex << "_txn_pending_set: abort xid=\"" << dtp->xid() << "\"";
-                        throw jexception(jerrno::JERR_MAP_NOTFOUND, ss.str(), "wmgr", "get_events");
+                        throw jexception(jerrno::JERR_MAP_NOTFOUND, ss.str().c_str(), "wmgr",
+                                "get_events");
                     }
                     _txn_pending_set.erase(it);
 #endif
@@ -816,7 +818,8 @@
                     {
                         std::stringstream ss;
                         ss << std::hex << "_txn_pending_set: commit xid=\"" << dtp->xid() << "\"";
-                        throw jexception(jerrno::JERR_MAP_NOTFOUND, ss.str(), "wmgr", "get_events");
+                        throw jexception(jerrno::JERR_MAP_NOTFOUND, ss.str().c_str(), "wmgr",
+                                "get_events");
                     }
                     _txn_pending_set.erase(it);
 #endif
@@ -824,7 +827,7 @@
                 default:
                     std::stringstream ss;
                     ss << "dtok_id=" << dtp->id() << "dtok_state=" << dtp->wstate_str();
-                    throw jexception(jerrno::JERR_WMGR_BADDTOKSTATE, ss.str(), "wmgr",
+                    throw jexception(jerrno::JERR_WMGR_BADDTOKSTATE, ss.str().c_str(), "wmgr",
                             "get_events");
                 }
                 _dtokl->push_back(dtp);
@@ -887,7 +890,7 @@
         std::stringstream ss;
         ss << "posix_memalign(): blksize=" << _sblksize << " size=" << _sblksize;
         ss << " errno=" << errno;
-        throw jexception(jerrno::JERR__MALLOC, ss.str(), "wmgr", "initialize");
+        throw jexception(jerrno::JERR__MALLOC, ss.str().c_str(), "wmgr", "initialize");
     }
     _fhdr_ptr_arr = (void**)::malloc(_pages * sizeof(void*));
     if (_fhdr_ptr_arr == NULL)
@@ -895,7 +898,7 @@
         clean();
         std::stringstream ss;
         ss << "_fhdr_ptr_arr malloc(): errno=" << errno;
-        throw jexception(jerrno::JERR__MALLOC, ss.str(), "wmgr", "initialize");
+        throw jexception(jerrno::JERR__MALLOC, ss.str().c_str(), "wmgr", "initialize");
     }
     _iocba = (iocb**)::malloc(sizeof(iocb*) * JRNL_NUM_FILES);
     if (_iocba == NULL)
@@ -903,7 +906,7 @@
         clean();
         std::stringstream ss;
         ss << "_iocba new(): errno=" << errno;
-        throw jexception(jerrno::JERR__MALLOC, ss.str(), "wmgr", "initialize");
+        throw jexception(jerrno::JERR__MALLOC, ss.str().c_str(), "wmgr", "initialize");
     }
     ::memset(_iocba, 0, sizeof(iocb*) * JRNL_NUM_FILES);
     for (u_int16_t i=0; i<JRNL_NUM_FILES; i++)
@@ -939,7 +942,8 @@
             std::stringstream ss;
             ss << "op=" << _op_str[op] << " index=" << _pg_index << " state=";
             ss << _page_cb_arr[_pg_index].state_str();
-            throw jexception(jerrno::JERR_WMGR_BADPGSTATE, ss.str(), "wmgr", "pre_write_check");
+            throw jexception(jerrno::JERR_WMGR_BADPGSTATE, ss.str().c_str(), "wmgr",
+                    "pre_write_check");
         }
     }
 
@@ -952,7 +956,7 @@
                 std::stringstream ss;
                 ss << "op=" << _op_str[op] << " dtok_id=" << dtokp->id();
                 ss << " dtok_state=" << dtokp->wstate_str();
-                throw jexception(jerrno::JERR_WMGR_BADDTOKSTATE, ss.str(), "wmgr",
+                throw jexception(jerrno::JERR_WMGR_BADDTOKSTATE, ss.str().c_str(), "wmgr",
                         "pre_write_check");
             }
             break;
@@ -962,7 +966,7 @@
                 std::stringstream ss;
                 ss << "op=" << _op_str[op] << " dtok_id=" << dtokp->id();
                 ss << " dtok_state=" << dtokp->wstate_str();
-                throw jexception(jerrno::JERR_WMGR_BADDTOKSTATE, ss.str(), "wmgr",
+                throw jexception(jerrno::JERR_WMGR_BADDTOKSTATE, ss.str().c_str(), "wmgr",
                         "pre_write_check");
             }
             break;

Modified: store/trunk/cpp/tests/jrnl/JournalUnitTests.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/JournalUnitTests.cpp	2007-11-10 01:48:38 UTC (rev 1280)
+++ store/trunk/cpp/tests/jrnl/JournalUnitTests.cpp	2007-11-10 05:09:44 UTC (rev 1281)
@@ -46,74 +46,55 @@
 
     void JournalExceptionTest()
     {
-        jexception e1(1);
-        CPPUNIT_ASSERT_MESSAGE("e1: Error code bad.", e1.err_code() == 1);
-        CPPUNIT_ASSERT_MESSAGE("e1: Additional information bad.", e1.additional_info().empty());
-        CPPUNIT_ASSERT_MESSAGE("e1: Throwing class bad.", e1.throwing_class().empty());
-        CPPUNIT_ASSERT_MESSAGE("e1: Throwing function bad.", e1.throwing_fn().empty());
-
-        jexception e2("exception2");
-        CPPUNIT_ASSERT_MESSAGE("e2: Error code bad.", e2.err_code() == 0);
-        CPPUNIT_ASSERT_MESSAGE("e2: Additional information bad.",
-                e2.additional_info().compare("exception2") == 0);
-        CPPUNIT_ASSERT_MESSAGE("e2: Throwing class bad.", e2.throwing_class().empty());
-        CPPUNIT_ASSERT_MESSAGE("e2: Throwing function bad.", e2.throwing_fn().empty());
-
-        string msg3("exception3");
-        jexception e3(msg3);
-        CPPUNIT_ASSERT_MESSAGE("e3: Error code bad.", e3.err_code() == 0);
-        CPPUNIT_ASSERT_MESSAGE("e3: Additional information bad.",
-                e3.additional_info().compare(msg3) == 0);
-        CPPUNIT_ASSERT_MESSAGE("e3: Throwing class bad.", e3.throwing_class().empty());
-        CPPUNIT_ASSERT_MESSAGE("e3: Throwing function bad.", e3.throwing_fn().empty());
-
-        jexception e4(4, "exception4");
-        CPPUNIT_ASSERT_MESSAGE("e4: Error code bad.", e4.err_code() == 4);
-        CPPUNIT_ASSERT_MESSAGE("e4: Additional information bad.",
-                e4.additional_info().compare("exception4") == 0);
-        CPPUNIT_ASSERT_MESSAGE("e4: Throwing class bad.", e4.throwing_class().empty());
-        CPPUNIT_ASSERT_MESSAGE("e4: Throwing function bad.", e4.throwing_fn().empty());
-
-        string msg5("exception5");
-        jexception e5(5, msg5);
-        CPPUNIT_ASSERT_MESSAGE("e5: Error code bad.", e5.err_code() == 5);
-        CPPUNIT_ASSERT_MESSAGE("e5: Additional information bad.",
-                e5.additional_info().compare(msg5) == 0);
-        CPPUNIT_ASSERT_MESSAGE("e5: Throwing class bad.", e5.throwing_class().empty());
-        CPPUNIT_ASSERT_MESSAGE("e5: Throwing function bad.", e5.throwing_fn().empty());
-
-        jexception e6(6, "class6", "fn6");
-        CPPUNIT_ASSERT_MESSAGE("e6: Error code bad.", e6.err_code() == 6);
-        CPPUNIT_ASSERT_MESSAGE("e6: Additional information bad.", e6.additional_info().empty());
-        CPPUNIT_ASSERT_MESSAGE("e6: Throwing class bad.",
-                e6.throwing_class().compare("class6") == 0);
-        CPPUNIT_ASSERT_MESSAGE("e6: Throwing function bad.", e6.throwing_fn().compare("fn6") == 0);
-
-        string cls7("class7");
-        string fn7("fn7");
-        jexception e7(7, cls7, fn7);
-        CPPUNIT_ASSERT_MESSAGE("e7: Error code bad.", e7.err_code() == 7);
-        CPPUNIT_ASSERT_MESSAGE("e7: Additional information bad.", e7.additional_info().empty());
-        CPPUNIT_ASSERT_MESSAGE("e7: Throwing class bad.", e7.throwing_class().compare(cls7) == 0);
-        CPPUNIT_ASSERT_MESSAGE("e7: Throwing function bad.", e7.throwing_fn().compare(fn7) == 0);
-
-        jexception e8(8, "exception8", "class8", "fn8");
-        CPPUNIT_ASSERT_MESSAGE("e8: Error code bad.", e8.err_code() == 8);
-        CPPUNIT_ASSERT_MESSAGE("e8: Additional information bad.",
-                e8.additional_info().compare("exception8") == 0);
-        CPPUNIT_ASSERT_MESSAGE("e8: Throwing class bad.",
-                e8.throwing_class().compare("class8") == 0);
-        CPPUNIT_ASSERT_MESSAGE("e8: Throwing function bad.", e8.throwing_fn().compare("fn8") == 0);
-
-        string msg9("exception9");
-        string cls9("class9");
-        string fn9("fn9");
-        jexception e9(9, msg9, cls9, fn9);
-        CPPUNIT_ASSERT_MESSAGE("e9: Error code bad.", e9.err_code() == 9);
-        CPPUNIT_ASSERT_MESSAGE("e9: Additional information bad.",
-                e9.additional_info().compare(msg9) == 0);
-        CPPUNIT_ASSERT_MESSAGE("e9: Throwing class bad.", e9.throwing_class().compare(cls9) == 0);
-        CPPUNIT_ASSERT_MESSAGE("e9: Throwing function bad.", e9.throwing_fn().compare(fn9) == 0);
+        {
+            jexception e0;
+            CPPUNIT_ASSERT_MESSAGE("e1: Error code bad.", e0.err_code() == 0);
+            CPPUNIT_ASSERT_MESSAGE("e1: Additional information bad.", e0.additional_info() == NULL);
+            CPPUNIT_ASSERT_MESSAGE("e1: Throwing class bad.", e0.throwing_class() == NULL);
+            CPPUNIT_ASSERT_MESSAGE("e1: Throwing function bad.", e0.throwing_fn() == NULL);
+        }
+        {
+            jexception e1(1);
+            CPPUNIT_ASSERT_MESSAGE("e1: Error code bad.", e1.err_code() == 1);
+            CPPUNIT_ASSERT_MESSAGE("e1: Additional information bad.", e1.additional_info() == NULL);
+            CPPUNIT_ASSERT_MESSAGE("e1: Throwing class bad.", e1.throwing_class() == NULL);
+            CPPUNIT_ASSERT_MESSAGE("e1: Throwing function bad.", e1.throwing_fn() == NULL);
+        }
+        {
+            jexception e2("exception2");
+            CPPUNIT_ASSERT_MESSAGE("e2: Error code bad.", e2.err_code() == 0);
+            CPPUNIT_ASSERT_MESSAGE("e2: Additional information bad.",
+                    ::strcmp(e2.additional_info(), "exception2") == 0);
+            CPPUNIT_ASSERT_MESSAGE("e2: Throwing class bad.", e2.throwing_class() == NULL);
+            CPPUNIT_ASSERT_MESSAGE("e2: Throwing function bad.", e2.throwing_fn() == NULL);
+        }
+        {
+            jexception e3(3, "exception3");
+            CPPUNIT_ASSERT_MESSAGE("e3: Error code bad.", e3.err_code() == 3);
+            CPPUNIT_ASSERT_MESSAGE("e3: Additional information bad.",
+                    ::strcmp(e3.additional_info(), "exception3") == 0);
+            CPPUNIT_ASSERT_MESSAGE("e3: Throwing class bad.", e3.throwing_class() == NULL);
+            CPPUNIT_ASSERT_MESSAGE("e3: Throwing function bad.", e3.throwing_fn() == NULL);
+        }
+        {
+            jexception e4(4, "class4", "fn4");
+            CPPUNIT_ASSERT_MESSAGE("e4: Error code bad.", e4.err_code() == 4);
+            CPPUNIT_ASSERT_MESSAGE("e4: Additional information bad.", e4.additional_info() == NULL);
+            CPPUNIT_ASSERT_MESSAGE("e4: Throwing class bad.",
+                    ::strcmp(e4.throwing_class(), "class4") == 0);
+            CPPUNIT_ASSERT_MESSAGE("e4: Throwing function bad.",
+                    ::strcmp(e4.throwing_fn(), "fn4") == 0);
+        }
+        {
+            jexception e5(5, "exception5", "class5", "fn5");
+            CPPUNIT_ASSERT_MESSAGE("e5: Error code bad.", e5.err_code() == 5);
+            CPPUNIT_ASSERT_MESSAGE("e5: Additional information bad.",
+                    ::strcmp(e5.additional_info(), "exception5") == 0);
+            CPPUNIT_ASSERT_MESSAGE("e5: Throwing class bad.",
+                    ::strcmp(e5.throwing_class(), "class5") == 0);
+            CPPUNIT_ASSERT_MESSAGE("e5: Throwing function bad.",
+                    ::strcmp(e5.throwing_fn(), "fn5") == 0);
+        }
     }
 
 private:

Modified: store/trunk/cpp/tests/jrnl/jtest.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/jtest.cpp	2007-11-10 01:48:38 UTC (rev 1280)
+++ store/trunk/cpp/tests/jrnl/jtest.cpp	2007-11-10 05:09:44 UTC (rev 1281)
@@ -285,7 +285,7 @@
     {
         ss << "Illegal number of args: expected 2, found " << (argc - 1) <<
                 " (Hint: use \"jtest [test_def_file] [testnum]\")";
-        throw rhm::journal::jexception(EXCEPTION_BASE+0, ss.str());
+        throw rhm::journal::jexception(EXCEPTION_BASE+0, ss.str().c_str());
     }
     *test_file_name = argv[1];
     if (argv[2][0] == '-')
@@ -293,7 +293,7 @@
         if (strcspn(argv[2], num_chars) != 1)
         {
             ss << "Test number argument \"" << argv[2] << "\" not a valid number.";
-            throw rhm::journal::jexception(EXCEPTION_BASE+1, ss.str());
+            throw rhm::journal::jexception(EXCEPTION_BASE+1, ss.str().c_str());
         }
     }
     else
@@ -301,14 +301,14 @@
         if (strcspn(argv[2], num_chars) != 0)
         {
             ss << "Test number argument \"" << argv[2] << "\" not a valid number.";
-            throw rhm::journal::jexception(EXCEPTION_BASE+2, ss.str());
+            throw rhm::journal::jexception(EXCEPTION_BASE+2, ss.str().c_str());
         }
     }
     *test_num = atoi(argv[2]);
     if (*test_num < 0)
     {
         ss << "Illegal test number \""<< test_num << "\"";
-        throw rhm::journal::jexception(EXCEPTION_BASE+3, ss.str());
+        throw rhm::journal::jexception(EXCEPTION_BASE+3, ss.str().c_str());
     }
 }
 

Modified: store/trunk/cpp/tests/jrnl/msg_consumer.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/msg_consumer.cpp	2007-11-10 01:48:38 UTC (rev 1280)
+++ store/trunk/cpp/tests/jrnl/msg_consumer.cpp	2007-11-10 05:09:44 UTC (rev 1281)
@@ -240,7 +240,8 @@
             ss << " is valid, but exptected size must lie between " << min_msg_size;
             ss << " and " << max_msg_size;
         }
-        throw rhm::journal::jexception(EXCEPTION_BASE+3, ss.str(), "msg_consumer", "check_msg");
+        throw rhm::journal::jexception(EXCEPTION_BASE+3, ss.str().c_str(), "msg_consumer",
+                "check_msg");
     }
     if (chk_data)
     {
@@ -253,7 +254,7 @@
                 std::stringstream ss;
                 ss << "Message " << msgCntr << " failed content check at char " << i;
                 ss << ": found \'" << found << "\'; expected \'" << expected << "\'";
-                throw rhm::journal::jexception(EXCEPTION_BASE+4, ss.str(), "msg_consumer",
+                throw rhm::journal::jexception(EXCEPTION_BASE+4, ss.str().c_str(), "msg_consumer",
                         "check_msg");
             }
         }
@@ -276,7 +277,8 @@
             ss << " is valid, but exptected size must lie between " << min_xid_size;
             ss << " and " << max_xid_size;
         }
-        throw rhm::journal::jexception(EXCEPTION_BASE+5, ss.str(), "msg_consumer", "check_xid");
+        throw rhm::journal::jexception(EXCEPTION_BASE+5, ss.str().c_str(), "msg_consumer",
+                "check_xid");
     }
     if (chk_xid_data)
     {
@@ -289,7 +291,7 @@
                 std::stringstream ss;
                 ss << "Message " << msgCntr << " failed XID check at char " << i;
                 ss << ": found \'" << found << "\'; expected \'" << expected << "\'";
-                throw rhm::journal::jexception(EXCEPTION_BASE+6, ss.str(), "msg_consumer",
+                throw rhm::journal::jexception(EXCEPTION_BASE+6, ss.str().c_str(), "msg_consumer",
                         "check_xid");
             }
         }
@@ -307,7 +309,7 @@
         ss << "Message " << msgCntr << " failed transience check: found ";
         ss << (transient_flag?"transient":"persistent") << "; expected ";
         ss << (transient_expected_flag?"transient":"persistent") << ".";
-        throw rhm::journal::jexception(EXCEPTION_BASE+7, ss.str(), "msg_consumer",
+        throw rhm::journal::jexception(EXCEPTION_BASE+7, ss.str().c_str(), "msg_consumer",
                 "check_transience");
     }
 }
@@ -323,7 +325,7 @@
         ss << "Message " << msgCntr << " failed external check: found ";
         ss << (external_flag?"external":"internal") << "; expected ";
         ss << (external_expected_flag?"external":"internal") << ".";
-        throw rhm::journal::jexception(EXCEPTION_BASE+8, ss.str(), "msg_consumer",
+        throw rhm::journal::jexception(EXCEPTION_BASE+8, ss.str().c_str(), "msg_consumer",
                 "check_transience");
     }
 }

Modified: store/trunk/cpp/tests/jrnl/msg_producer.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/msg_producer.cpp	2007-11-10 01:48:38 UTC (rev 1280)
+++ store/trunk/cpp/tests/jrnl/msg_producer.cpp	2007-11-10 05:09:44 UTC (rev 1281)
@@ -212,8 +212,8 @@
                         std::stringstream ss;
                         ss << "msg_producer::produce() Unexpected msg state: id=" <<
                             dtokp->id() << " ws=" << wsstr << " res=" << iores_str[eres];
-                        throw rhm::journal::jexception(EXCEPTION_BASE+4, ss.str(), "msg_producer",
-                                "produce");
+                        throw rhm::journal::jexception(EXCEPTION_BASE+4, ss.str().c_str(),
+                                "msg_producer", "produce");
                 }
             
                 //print_dbug(msgCntr, size, (char*)msg, true);
@@ -355,8 +355,8 @@
                         std::stringstream ss;
                         ss << "msg_producer::send_deferred_dequeues() Unexpected msg state: id=" <<
                             ddtokp->id() << " ws=" << wsstr << " res=" << iores_str[dres];
-                        throw rhm::journal::jexception(EXCEPTION_BASE+7, ss.str(), "msg_producer",
-                                "send_deferred_dequeues");
+                        throw rhm::journal::jexception(EXCEPTION_BASE+7, ss.str().c_str(),
+                                "msg_producer", "send_deferred_dequeues");
                 }
             }
 
@@ -398,7 +398,7 @@
                             ss << "msg_producer::send_deferred_dequeues() "
                                     "Unexpected msg state: id=" << ddtokp->id() << " ws=" <<
                                     wsstr << " res=" << iores_str[dres];
-                            throw rhm::journal::jexception(EXCEPTION_BASE+9, ss.str(),
+                            throw rhm::journal::jexception(EXCEPTION_BASE+9, ss.str().c_str(),
                                     "msg_producer", "send_deferred_dequeues");
                     }
                 }
@@ -428,7 +428,7 @@
                 std::stringstream ss;
                 ss << "Journal flush phase 1 failed, _num_msgs_enq=" << _num_msgs_enq;
                 ss << " num_msgs_sent=" << num_msgs_sent;
-                throw rhm::journal::jexception(EXCEPTION_BASE+10, ss.str(), "msg_producer",
+                throw rhm::journal::jexception(EXCEPTION_BASE+10, ss.str().c_str(), "msg_producer",
                         "jrnl_flush"); 
             }
 //std::cout << "+" << std::flush;
@@ -469,8 +469,8 @@
                     std::stringstream ss;
                     ss << "Journal flush phase 2 failed, _num_msgs_deq=" << _num_msgs_deq;
                     ss << " num_msgs_sent=" << num_msgs_sent;
-                    throw rhm::journal::jexception(EXCEPTION_BASE+12, ss.str(), "msg_producer",
-                            "jrnl_flush"); 
+                    throw rhm::journal::jexception(EXCEPTION_BASE+12, ss.str().c_str(),
+                            "msg_producer", "jrnl_flush"); 
                 }
 //std::cout << "*" << std::flush;
                 jc.get_wr_events();




More information about the rhmessaging-commits mailing list