wieseljonas / java-libpst

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

Sporadic failures in concurrent processing of PST files #53

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Get 2 PST files.
2. Create 2 threads, in each of them start processing a separate file
   - e.g. using readFolder().

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

java.lang.ArrayIndexOutOfBoundsException: 55
        at sun.util.calendar.BaseCalendar.getCalendarDateFromFixedDate(BaseCalendar.java:436)
        at java.util.GregorianCalendar.computeFields(GregorianCalendar.java:2081)
        at java.util.GregorianCalendar.computeFields(GregorianCalendar.java:1996)
        at java.util.Calendar.setTimeInMillis(Calendar.java:1110)
        at java.util.Calendar.setTime(Calendar.java:1076)
        at java.text.SimpleDateFormat.format(SimpleDateFormat.java:875)
        at java.text.SimpleDateFormat.format(SimpleDateFormat.java:868)
        at java.text.DateFormat.format(DateFormat.java:316)
        at com.pff.PSTTableItem.toString(PSTTableItem.java:170)
        at com.pff.PSTTableBCItem.toString(PSTTableBCItem.java:44)
        at com.pff.PSTTableBC.<init>(PSTTableBC.java:170)
        at com.pff.PSTObject.detectAndLoadPSTObject(PSTObject.java:628)
        at com.pff.PSTFolder.getNextChild(PSTFolder.java:289)
        at com.dcsemap.jimport.pst.PSTFileReader.readFolder(PSTFileReader.java:102)
        at com.dcsemap.jimport.pst.PSTFileReader.readFolder(PSTFileReader.java:96)
        at com.dcsemap.jimport.pst.PSTFileReader.readFolder(PSTFileReader.java:96)
        at com.dcsemap.jimport.pst.PSTFileReader.readFile(PSTFileReader.java:72)
        at com.dcsemap.jimport.MailArchiveImporter.importMessages(MailArchiveImporter.java:316)
        at com.dcsemap.jimport.MailArchiveImporter.importMailArchive(MailArchiveImporter.java:181)
        at com.dcsemap.jimport.MailArchiveImporter.importMailArchive(MailArchiveImporter.java:155)
        at com.dcsemap.jimport.QueryJob.run(QueryJob.java:77)
        at com.dcsemap.jimport.QueryJob.execute(QueryJob.java:43)
        at org.quartz.core.JobRunShell.run(JobRunShell.java:213)
        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:557)

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

Reproducible on v0.7 - the latest one, I suppose?

Please provide any additional information below.

Well, I understand that enabling concurrent processing of a single PST file can 
be a lot of pain,
but concurrent processing of independent archives doesn't require that much of 
an effort. 
This particular issue can be fixed this way:

In com.pff.PSTTableItem:

Go to the line

    private static SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyyMMdd'T'HHmmss'Z'");

and remove "static" modifier:

    private SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyyMMdd'T'HHmmss'Z'");

You know, SimpleDateFormat isn't MT-safe.

Original issue reported on code.google.com by andy.bel...@gmail.com on 3 Feb 2012 at 10:45

GoogleCodeExporter commented 9 years ago
I can even fix this myself, given write access.

Original comment by andy.bel...@gmail.com on 3 Feb 2012 at 10:45

GoogleCodeExporter commented 9 years ago
Awesome, thanks for identifying this and fixing it, I've made your change in 
SVN and will attempt to get a new version released with this over the next few 
days.

Original comment by rjohnson...@gmail.com on 4 Feb 2012 at 10:49