/** Override toString method to provide information on nested exceptions. */
 public synchronized String toString() {
   String s = super.toString();
   Exception n = next;
   if (n == null) return s;
   StringBuffer sb = new StringBuffer(s == null ? "" : s);
   while (n != null) {
     sb.append(";\n  nested exception is:\n\t");
     if (n instanceof MessagingException) {
       MessagingException mex = (MessagingException) n;
       sb.append(mex.superToString());
       n = mex.next;
     } else {
       sb.append(n.toString());
       n = null;
     }
   }
   return sb.toString();
 }