[rhmessaging-commits] rhmessaging commits: r1609 - store/trunk/cpp/tests/jrnl/jtt.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Fri Jan 25 07:27:56 EST 2008


Author: kpvdr
Date: 2008-01-25 07:27:56 -0500 (Fri, 25 Jan 2008)
New Revision: 1609

Modified:
   store/trunk/cpp/tests/jrnl/jtt/jfile_chk.py
Log:
Additional improvements to jfile_chk.py, last change to use hex for non-alphanumeric was too strict.

Modified: store/trunk/cpp/tests/jrnl/jtt/jfile_chk.py
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/jfile_chk.py	2008-01-24 21:43:39 UTC (rev 1608)
+++ store/trunk/cpp/tests/jrnl/jtt/jfile_chk.py	2008-01-25 12:27:56 UTC (rev 1609)
@@ -23,6 +23,7 @@
 
 import sys
 import getopt
+import string
 import xml.parsers.expat
 from struct import unpack, calcsize
 from time import gmtime, strftime
@@ -76,12 +77,15 @@
 def file_full(f):
     return f.tell() >= jfsize
 
+def isprintable(s):
+    return s.strip(string.printable) == ''
+
 def print_xid(xidsize, xid):
     if xid == None:
         if xidsize > 0:
             raise Exception('Inconsistent XID size: xidsize=%d, xid=None' % xidsize)
         return ''
-    if xid.isalnum():
+    if isprintable(xid):
         xidstr = split_str(xid)
     else:
         xidstr = hex_split_str(xid)
@@ -92,7 +96,7 @@
 def print_data(dsize, data):
     if data == None:
         return ''
-    if data.isalnum():
+    if isprintable(data):
         datastr = split_str(data)
     else:
         datastr = hex_split_str(data)
@@ -191,9 +195,9 @@
         if self.empty():
             return '0x%08x: <empty>' % (self.foffs)
         if self.magic[-1] == 'x':
-            return '0x%08x: \"%s\"' % (self.foffs, self.magic)
+            return '0x%08x: [\"%s\"]' % (self.foffs, self.magic)
         if self.magic[-1] in ['a', 'c', 'd', 'e', 'f', 'x']:
-            return '0x%08x: \"%s\" v=%d e=%d f=0x%04x rid=0x%x' % (self.foffs, self.magic, self.ver, self.end, self.flags, self.rid)
+            return '0x%08x: [\"%s\" v=%d e=%d f=0x%04x rid=0x%x]' % (self.foffs, self.magic, self.ver, self.end, self.flags, self.rid)
         return '0x%08x: <error, unknown magic \"%s\" (possible overwrite boundary?)>' %  (self.foffs, self.magic)
 
     def empty(self):
@@ -282,7 +286,7 @@
         return self.xid_complete and self.tail_complete
 
     def __str__(self):
-        return '%s %sdrid=%d' % (Hdr.__str__(self), print_xid(self.xidsize, self.xid), self.deq_rid)
+        return '%s %sdrid=0x%x' % (Hdr.__str__(self), print_xid(self.xidsize, self.xid), self.deq_rid)
 
 
 #== class TxnHdr ===============================================================




More information about the rhmessaging-commits mailing list