diff options
author | Nick Burch <nick@apache.org> | 2010-02-19 17:55:32 +0000 |
---|---|---|
committer | Nick Burch <nick@apache.org> | 2010-02-19 17:55:32 +0000 |
commit | a95e0cd7d77cb0a8d07c08aaf23e852a6b197566 (patch) | |
tree | 79e5553d80f261a9bb80c6ee89994d28c85212bd /src/scratchpad | |
parent | 213b7d035b0d047aff8e99ff7e93143c4d6a91e2 (diff) | |
download | poi-a95e0cd7d77cb0a8d07c08aaf23e852a6b197566.tar.gz poi-a95e0cd7d77cb0a8d07c08aaf23e852a6b197566.zip |
Fix an issue with the HSMF tests working on some machines but not others - Make poifs.filesystem.DirectoryNode preserve the original ordering of its files, which HSMF needs to be able
to correctly match up chunks
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@911878 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/scratchpad')
3 files changed, 18 insertions, 20 deletions
diff --git a/src/scratchpad/src/org/apache/poi/hsmf/datatypes/AttachmentChunks.java b/src/scratchpad/src/org/apache/poi/hsmf/datatypes/AttachmentChunks.java index 9e5f7f8be0..5bc00c4b0f 100644 --- a/src/scratchpad/src/org/apache/poi/hsmf/datatypes/AttachmentChunks.java +++ b/src/scratchpad/src/org/apache/poi/hsmf/datatypes/AttachmentChunks.java @@ -105,7 +105,6 @@ public class AttachmentChunks implements ChunkGroup { * Orders by the attachment number. */ public static class AttachmentChunksSorter implements Comparator<AttachmentChunks> { - @Override public int compare(AttachmentChunks a, AttachmentChunks b) { return a.poifsName.compareTo(b.poifsName); } diff --git a/src/scratchpad/src/org/apache/poi/hsmf/datatypes/RecipientChunks.java b/src/scratchpad/src/org/apache/poi/hsmf/datatypes/RecipientChunks.java index b20aba8a39..d04ec18b54 100644 --- a/src/scratchpad/src/org/apache/poi/hsmf/datatypes/RecipientChunks.java +++ b/src/scratchpad/src/org/apache/poi/hsmf/datatypes/RecipientChunks.java @@ -197,7 +197,6 @@ public final class RecipientChunks implements ChunkGroup { * Orders by the recipient number. */ public static class RecipientChunksSorter implements Comparator<RecipientChunks> { - @Override public int compare(RecipientChunks a, RecipientChunks b) { if(a.recipientNumber < b.recipientNumber) return -1; diff --git a/src/scratchpad/testcases/org/apache/poi/hsmf/parsers/TestPOIFSChunkParser.java b/src/scratchpad/testcases/org/apache/poi/hsmf/parsers/TestPOIFSChunkParser.java index 68094e2ee8..8dcc6bf5fd 100644 --- a/src/scratchpad/testcases/org/apache/poi/hsmf/parsers/TestPOIFSChunkParser.java +++ b/src/scratchpad/testcases/org/apache/poi/hsmf/parsers/TestPOIFSChunkParser.java @@ -151,10 +151,10 @@ public final class TestPOIFSChunkParser extends TestCase { assertEquals(9, groups.length); assertTrue(groups[0] instanceof Chunks); assertTrue(groups[1] instanceof RecipientChunks); - assertTrue(groups[2] instanceof AttachmentChunks); + assertTrue(groups[2] instanceof RecipientChunks); assertTrue(groups[3] instanceof RecipientChunks); assertTrue(groups[4] instanceof RecipientChunks); - assertTrue(groups[5] instanceof RecipientChunks); + assertTrue(groups[5] instanceof AttachmentChunks); assertTrue(groups[6] instanceof RecipientChunks); assertTrue(groups[7] instanceof RecipientChunks); assertTrue(groups[8] instanceof NameIdChunks); @@ -162,33 +162,33 @@ public final class TestPOIFSChunkParser extends TestCase { // In FS order initially RecipientChunks[] chunks = new RecipientChunks[] { (RecipientChunks)groups[1], + (RecipientChunks)groups[2], (RecipientChunks)groups[3], (RecipientChunks)groups[4], - (RecipientChunks)groups[5], (RecipientChunks)groups[6], (RecipientChunks)groups[7], }; assertEquals(6, chunks.length); assertEquals(0, chunks[0].recipientNumber); - assertEquals(4, chunks[1].recipientNumber); - assertEquals(3, chunks[2].recipientNumber); - assertEquals(2, chunks[3].recipientNumber); - assertEquals(1, chunks[4].recipientNumber); - assertEquals(5, chunks[5].recipientNumber); + assertEquals(2, chunks[1].recipientNumber); + assertEquals(4, chunks[2].recipientNumber); + assertEquals(5, chunks[3].recipientNumber); + assertEquals(3, chunks[4].recipientNumber); + assertEquals(1, chunks[5].recipientNumber); // Check assertEquals("'Ashutosh Dandavate'", chunks[0].getRecipientName()); assertEquals("ashutosh.dandavate@alfresco.com", chunks[0].getRecipientEmailAddress()); - assertEquals("nick.burch@alfresco.com", chunks[1].getRecipientName()); - assertEquals("nick.burch@alfresco.com", chunks[1].getRecipientEmailAddress()); - assertEquals("nickb@alfresco.com", chunks[2].getRecipientName()); - assertEquals("nickb@alfresco.com", chunks[2].getRecipientEmailAddress()); - assertEquals("'Mike Farman'", chunks[3].getRecipientName()); - assertEquals("mikef@alfresco.com", chunks[3].getRecipientEmailAddress()); - assertEquals("'Paul Holmes-Higgin'", chunks[4].getRecipientName()); - assertEquals("paul.hh@alfresco.com", chunks[4].getRecipientEmailAddress()); - assertEquals("'Roy Wetherall'", chunks[5].getRecipientName()); - assertEquals("roy.wetherall@alfresco.com", chunks[5].getRecipientEmailAddress()); + assertEquals("'Mike Farman'", chunks[1].getRecipientName()); + assertEquals("mikef@alfresco.com", chunks[1].getRecipientEmailAddress()); + assertEquals("nick.burch@alfresco.com", chunks[2].getRecipientName()); + assertEquals("nick.burch@alfresco.com", chunks[2].getRecipientEmailAddress()); + assertEquals("'Roy Wetherall'", chunks[3].getRecipientName()); + assertEquals("roy.wetherall@alfresco.com", chunks[3].getRecipientEmailAddress()); + assertEquals("nickb@alfresco.com", chunks[4].getRecipientName()); + assertEquals("nickb@alfresco.com", chunks[4].getRecipientEmailAddress()); + assertEquals("'Paul Holmes-Higgin'", chunks[5].getRecipientName()); + assertEquals("paul.hh@alfresco.com", chunks[5].getRecipientEmailAddress()); // Now sort, and re-check Arrays.sort(chunks, new RecipientChunksSorter()); |