wieseljonas / java-libpst

Automatically exported from code.google.com/p/java-libpst
1 stars 1 forks source link

PSTFolder.getEmailCount() and Unable to find 8751 in PST data. #29

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When I use PSTFolder.getEmailCount() method from old version of code
with last java-libpst (method added to new version) I've got an exception: 
"Unable to find 8751 in PST data".
The link to PST file:

http://datassimilate.com/download/cara_semperger_000.rar (~12Mb)

What steps will reproduce the problem?
Loop through all folders and call getEmailCount() on each. The method code is 
below:

    /**
     * the number of emails in this folder
     * this is the count of emails made by the library and will therefore should be more accurate than getContentCount
     * @return number of emails in this folder (as counted)
     * @throws IOException
     * @throws PSTException
     */
    public int getEmailCount()
        throws IOException, PSTException
    {
        processChildren();
        return this.emails.size();
    }

I use this function because of description.

What is the expected output? What do you see instead?

I hope to remove exception.

What version of the product are you using? On what operating system?

Last version, updated with old function.

Regards,
Maxim

Original issue reported on code.google.com by justpdat...@gmail.com on 21 Feb 2011 at 9:37

GoogleCodeExporter commented 9 years ago
This sounds like it is related to the work I've been trying to sort out in 
relation to the Descriptor items.

Are you working from SVN? if so, try the code from the 0.5 release.

Original comment by rjohnson...@gmail.com on 21 Feb 2011 at 9:55

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Today I've got last release of pff 0.5.
After that I uncomment "PSTFolder.getEmailCount()" method and insert its call 
to your "Test.java" sample. (Thanks for it. It's very useful.)
The application fails with java.lang.NullPointerException.

To find what happens I uncomment line 131 in "PSTFolder.initEmailsTable()":
System.out.println("Can't get children for folder 
"+this.getDisplayName()+"("+this.getDescriptorNodeId()+") child count: 
"+this.getContentCount()+ " - "+err.toString());

and get the following output:
================================================
java Test cara_semperger_000.pst
cara_semperger_000
 |- SPAM Search Folder 2
Can't get children for folder SPAM Search Folder 2(8739) child count: 0 - com.pf
f.PSTException: Unable to find 8751
================================================
I know that I can count e-mails in folders one-by-one in while() cycle, but is 
it possible to return calculation of its number to the PST API?

Regards,
Maxim

Original comment by justpdat...@gmail.com on 22 Feb 2011 at 11:16

GoogleCodeExporter commented 9 years ago
The way you are meant to get the number of emails in a folder is to use 
PSTFolder.getContentCount()

I see what the problem is now you have added that debugging message.  You are 
trying to get the children of a folder that doesn't have any!  The SPAM Search 
Folder is a special type of index folder with no direct children, we are unsure 
how to deal with Search folders.

Most folders have an associated content table at NodeId+12, which lists the 
child emails and this is missing for the SPAM search folder.

Was there a reason you wanted to use the deprecated and commented out 
getEmailCount instead of the getContentCount?  I understand the comment for the 
function is a little misleading, but it was written at the very beginning of 
the project when we weren't quite sure how the whole thing worked.

I'm closing this issue for now, but please let me know if there is an issue 
with getContentCount.

Original comment by rjohnson...@gmail.com on 22 Feb 2011 at 11:28

GoogleCodeExporter commented 9 years ago
When I didn't change code I have no exceptions with "SPAM Search Folder", but 
have one with another search folder. I use "Test.java" sample.

>java Test cara_semperger_000.pst

The output is:

cara_semperger_000
 |- SPAM Search Folder 2
 |- Top of Personal Folders
 |  |- Deleted Items
 |  |- Inbox
 |  |- Outbox
 |  |- Sent Items

.....
The bottom of the output:

 |- Search Root
 |  |- ??? ?????????
Can't get children for folder ??? ?????????(1827) child count: 1264 - 
com.pff.PSTException: Unable to find 1839
 |- IPM_VIEWS
 |- IPM_COMMON_VIEWS

Regards,
Maxim

Original comment by justpdat...@gmail.com on 10 Mar 2011 at 7:45