Menu

Problem Setting Folder Mold

Help
rich
2005-04-25
2013-05-01
  • rich

    rich - 2005-04-25

    Hello,
      I'm trying to set my mstor mail folder as READ_WRITE (folder.open (Folder.READ_WRITE) or folder.open (2)). When I execute folder.getMode (), I receive a -1. I've hard code different numbers (-10, 2, 4) in the folder.open () command. I do not receive an error when I use -10 or 4 when openning the folder.

      I have seven messages I'm using to test my application. After I read the email, I set the delete flag. Before I close the folder, I execute a folder.expunge (). Only one email is removed even though all seven are marked for deletion. I can not open the "modified" mail file in a mail tool. I believe the incorrect mode setting (-1) is causing this error.

      How can I get the folder mode set to 2?

      I am running the following versions:
         mstor 0.9.3
         java 1.4.2-03
         javamail 1.3.1

    Thank you

     
    • Ben Fortuna

      Ben Fortuna - 2005-04-25

      Hi Rich,

      You are correct - the mode variable wasn't being updated when opening an mstor folder. I've fixed this now and updated it in cvs. Its unclear whether this value should be unset upon closing a folder, so I've not bothered to unset at this stage. I think it shouldn't matter anyway as the getMode() method should throw an exception on a closed folder.

      That said, I don't think it is the mode setting that is causing your expunging problems. The mstor implementation of Folder.expunge() doesn't rely on the mode setting at all. (perhaps it should?)

      Although I'm pretty sure the 0.9.3 implementation of MstorFolder.expunge() works, I can't really verify this at the moment as I've made quite a few changes since then. If possible you can retrieve the latest changes from the cvs repository, otherwise I'll be releasing a 0.9.4 version soon (hopefully!) that may help.

      regards,
      ben

       
    • rich

      rich - 2005-04-25

      Hi Ben,
        Thanks for the update. I believe Folder.expunge () method should check the folder mode. If the folder is openned as READ_ONLY, than no modifications should be allowed on the folder.

        When you close a folder with "true" as the parameter, should this delete all the emails marked as deleted? I tried this and only one email is deleted; even though, I have all 7 test emails marked as deleted. The Folder.close () method should also check for the folder mode. Same reason as above.

      Cheers,
        Rich

       
      • Ben Fortuna

        Ben Fortuna - 2005-04-26

        Rich,

        It certainly makes sense that you shouldn't be allowed to expunge a read-only folder, the only problem is that the JavaMail spec doesn't specify what should occur in such a case. It states:

        Throws:
            FolderNotFoundException - if this folder does not exist
            IllegalStateException - if this folder is not opened.
            MessagingException - 

        The question is whether it should throw an IllegalStateException or a MessagingException. I think for now I will just throw a MessagingException and we can update it later if need be.

        Note that Folder.close() will just call the expunge() method if required, so functionality is always consistent.

        regards,
        ben

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.