Scarab commit: svn commit: r10920 - trunk/src/java/org/tigris/scarab/services/email/TemplateHtmlEmail.java

Hussayn Dabbous <[email protected]>
Newsgroups gmane.comp.java.scarab.cvs
Message-ID <[email protected]>
Author: dabbous
Date: 2010-02-24 13:50:53-0800
New Revision: 10920

Modified:
   trunk/src/java/org/tigris/scarab/services/email/TemplateHtmlEmail.java

Log:
tracked (and possibly fixed) an NPE in the context dump method

Modified: trunk/src/java/org/tigris/scarab/services/email/TemplateHtmlEmail.java
Url: http://scarab.tigris.org/source/browse/scarab/trunk/src/java/org/tigris/scarab/services/email/TemplateHtmlEmail.java?view=diff&pathrev=10920&r1=10919&r2=10920
==============================================================================
--- trunk/src/java/org/tigris/scarab/services/email/TemplateHtmlEmail.java	(original)
+++ trunk/src/java/org/tigris/scarab/services/email/TemplateHtmlEmail.java	2010-02-24 13:50:53-0800
@@ -315,22 +315,26 @@
         return mimeMessageId;
     }
 
-    private void dumpContextToLog(Exception e) {
-        log.error(e.getMessage());
-        log.error("This was the Email context:");
+    private void dumpContextToLog(Exception e) 
+    {
+        log.error("context dump after exception ["+ e.getMessage()+"]");
+        String keystring=null;
+        Object val = null;
         try
         {
             Object[] keys = context.getKeys();
             for(int i=0; i < keys.length; i++)
             {
-                String keystring = keys[i].toString();
-                Object val = context.get(keystring);
-                log.error("    " + keystring + "=" + val.toString());                 
+                keystring = keys[i].toString();
+                val = context.get(keystring);
+                log.error("    " + keystring + "=" + ((val==null)? "null (no value in context)":val.toString()) );                 
             }
         }
         catch(Exception ex)
         {
-            log.error("Double error: Can not dump Email context. ");
+            log.error("Double error: Can not dump Email context. ("+ex.getMessage()+")");
+            log.error("key["+keystring+"]");
+            log.error("val["+val+"]");
         }
         log.error("End of Email context dump");
     }

------------------------------------------------------
http://scarab.tigris.org/ds/viewMessage.do?dsForumId=3577&dsMessageId=2451721
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.