Uploaded image for project: 'James Server'
  1. James Server
  2. JAMES-499

Inconsistent usage of the lastUpdated field for Mail objects

    Details

      Description

      Currently the MailImpl object update its own lastUpdated everytime the writeObject is called:
      private void writeObject(java.io.ObjectOutputStream out) throws IOException {
      lastUpdated = new Date();
      out.writeObject(sender);
      ....
      }

      Imho this is NOT correct: writeObject is a serialization method. If I write an object and then I read it again I should have an equal object. THis is not the case having updated the lastUpdated.

      Furthermore this is not consistent in James because writeObject is called only when storing mails in file repositories but not when storing mails in db repositories.

      Currently the only places we update the date is in temporary failures of the RemoteDelivery.

      In 2.3 I moved lastUpdated to the Mailet's Mail object, so we should make it clear what the usage should be and we should decide when this field is updated and when it's not updated.

      Updating it in the SpoolRepository.store would make sense but we loose the ability to change the lastUpdated field and to keep track of it. So we should manage it at an higher level.

      I think that we should at least remote the lastUpdate change from the writeObject.

      We should also add a lastUpdated "update" when the remote delivery store messages to the outgoing spool and when spoolmanager updates messages in the spool.

      Any hint on this?

        Issue Links

          Activity

          Hide
          bago Stefano Bagnara added a comment -

          Fixed both in trunk and v2.3.
          Hope this doesn't introduce backward compatibility problems.

          Show
          bago Stefano Bagnara added a comment - Fixed both in trunk and v2.3. Hope this doesn't introduce backward compatibility problems.
          Hide
          danny@apache.org Danny Angus added a comment -

          Closing issue fixed in released version.

          Show
          danny@apache.org Danny Angus added a comment - Closing issue fixed in released version.

            People

            • Assignee:
              bago Stefano Bagnara
              Reporter:
              bago Stefano Bagnara
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development