int n = 0; try  { n = Integer.valueOf(num).intValue(); } catch (Exception e) {} if (n != 0) valid = true;
try { Integer.valueOf(num).intValue(); valid = true; } catch (Exception e) { String hdr = msgs[i].getHeader().toString(); Logging.getLogger(MailMessageCache.class).error ("Invalid email msg num: " +hdr); }
  public synchronized void addMessages (MailMessage msgs[])  {    if (msgs == null) return;    //  Filter the messages a bit.  May want to do more here in the future.    int nMsgs = 0;    for (int i=0; i<msgs.length; i++)    {      //  A valid message number string is a non-zero integer or the string "-"      String num = getMessageNum (msgs[i]);      boolean valid = false;      if (num != null)      {        if (num.equals ("-"))         {          valid = true;        }        else         {          int n = 0;          try  { n = Integer.valueOf(num).intValue(); } catch (Exception e) {}          if (n != 0) valid = true;        }      }      if (valid) nMsgs++;      else msgs[i] = null;    }    //  Sort the messages by their sent date    if (nMsgs > 1) Arrays.sort (msgs, MessageDateSort.getInstance());    //  Add the messages to the cache.  Note that we do not include    //  the messages in the cache in the sort above because typically    //  we will not be adding messages to the cache until it is empty.    for (int i=0; i<nMsgs; i++) if (msgs[i] != null) cache.add (msgs[i]);  }