Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
None
-
None
-
None
Description
Regression found during comparison of 1.14 trunk and 1.13. I added a call to the new MAPIMessage.close() after the parse. This causes problems if an MSG file has multiple MSG files attached. They may all be in the same directory. When the first child MSG is parsed, MAPIMessage.close() closes the directory and the other children can't be read:
Caused by: java.lang.RuntimeException: java.nio.channels.ClosedChannelException at org.apache.poi.poifs.filesystem.NPOIFSStream$StreamBlockByteBufferIterator.<init>(NPOIFSStream.java:151) at org.apache.poi.poifs.filesystem.NPOIFSStream.getBlockIterator(NPOIFSStream.java:95) at org.apache.poi.poifs.filesystem.NPOIFSMiniStore.getBlockAt(NPOIFSMiniStore.java:67) at org.apache.poi.poifs.filesystem.NPOIFSStream$StreamBlockByteBufferIterator.next(NPOIFSStream.java:169) at org.apache.poi.poifs.filesystem.NPOIFSStream$StreamBlockByteBufferIterator.next(NPOIFSStream.java:142) at org.apache.poi.poifs.filesystem.NDocumentInputStream.readFully(NDocumentInputStream.java:248) at org.apache.poi.poifs.filesystem.NDocumentInputStream.read(NDocumentInputStream.java:150) at org.apache.poi.poifs.filesystem.DocumentInputStream.read(DocumentInputStream.java:125) at org.apache.poi.util.IOUtils.toByteArray(IOUtils.java:84) at org.apache.poi.util.IOUtils.toByteArray(IOUtils.java:72) at org.apache.poi.hsmf.datatypes.ByteChunk.readValue(ByteChunk.java:51) at org.apache.poi.hsmf.parsers.POIFSChunkParser.process(POIFSChunkParser.java:211) at org.apache.poi.hsmf.parsers.POIFSChunkParser.processChunks(POIFSChunkParser.java:112) at org.apache.poi.hsmf.parsers.POIFSChunkParser.parse(POIFSChunkParser.java:84) at org.apache.poi.hsmf.MAPIMessage.<init>(MAPIMessage.java:142) at org.apache.tika.parser.microsoft.OutlookExtractor.<init>(OutlookExtractor.java:82) at org.apache.tika.parser.microsoft.OfficeParser.parse(OfficeParser.java:190) at org.apache.tika.parser.microsoft.OfficeParser.parse(OfficeParser.java:130) at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:280) ... 30 more Caused by: java.nio.channels.ClosedChannelException at sun.nio.ch.FileChannelImpl.ensureOpen(FileChannelImpl.java:110) at sun.nio.ch.FileChannelImpl.size(FileChannelImpl.java:300) at org.apache.poi.poifs.nio.FileBackedDataSource.size(FileBackedDataSource.java:133) at org.apache.poi.poifs.filesystem.NPOIFSFileSystem.getChainLoopDetector(NPOIFSFileSystem.java:634) at org.apache.poi.poifs.filesystem.NPOIFSStream$StreamBlockByteBufferIterator.<init>(NPOIFSStream.java:149) ... 48 more