Login | Register
My pages Projects Community openCollabNet

Discussions > cvs > CVS update: /eyebrowse/src/java/org/tigris/eyebrowse/core/ReadMsg.java

eyebrowse
Discussion topic

Back to topic list

CVS update: /eyebrowse/src/java/org/tigris/eyebrowse/core/ReadMsg.java

Reply

Author dlr
Full name Daniel Rall
Date 2006-07-13 10:46:54 PDT
Message User: dlr
Date: 2006-07-13 10:46:54-0700
Log:
 Fix NullPointerException triggered if a message or list has been
 deleted or is otherwise unavailable (e.g. its identifier is bogus).
 
 * src/java/org/tigris/​eyebrowse/core/ReadM​sg.java
   (core): Add null checks before using a list or message, and throw a
    meaningful exception if either cannot be identified in the DB.
 
 CollabNet issue: PCN48825

File Changes:

Directory: /eyebrowse/src/java/​org/tigris/eyebrowse​/core/
====================​====================​=================

File [changed]: ReadMsg.java
Url: http://eyebrowse.tig​ris.org/source/brows​e/eyebrowse/src/java​/org/tigris/eyebrows​e/core/ReadMsg.java?​r1=1.38&r2=1.39
Delta lines: +18 -5
--------------------
--- ReadMsg.java 2005-03-30 16:19:38-0700 1.38
+++ ReadMsg.java 2006-07-13 10:46:52-0700 1.39
@@ -401,14 +401,20 @@
             {
                 if (listId == -1)
                 {
- if (listName.equals(""))
+ if (!listName.equals(""))
                     {
- // Neither list id nor name is available.
+ listInfo = con.List_get(listName);
+ }
+
+ if (listInfo == null)
+ {
+ // Neither list ID nor name is available, or
+ // the specified name was bogus.
                         throw new UnknownListException
                             (LocalizationTool.get(context,
                                                   "InvalidListIdentifier"));
                     }
- listInfo = con.List_get(listName);
+
                     listId = listInfo.getListId();
                 }
                 else
@@ -418,10 +424,9 @@
 
                 msgInfo = con.MessageExt_getByNo(listId, msgNo);
             }
- else
+ else // We have the message ID rather than number.
             {
                 msgInfo = con.MessageExt_get(msgId);
- listInfo = con.List_get(msgInfo​.getListId());
             }
 
             if (msgInfo == null)
@@ -431,6 +436,14 @@
                     (LocalizationTool.get(context, "MessageNotAvailable") +
                      ": " + msgNo);
             }
+
+ if (listInfo == null)
+ {
+ // When retrieving the message directly by ID, we
+ // won't have already looked up its list.
+ listInfo = con.List_get(msgInfo​.getListId());
+ }
+
             Integer[] listIds = null;
             ListFilter filter = (ListFilter)context.​get(FILTER_KEY);
             if (filter != null)

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

CVS update: /eyebrowse/src/java/org/tigris/eyebrowse/core/ReadMsg.java dlr Daniel Rall 2006-07-13 10:46:54 PDT
Messages per page: