diff --git a/src/java/org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java b/src/java/org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java index efa195e23..53cb4b365 100644 --- a/src/java/org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java +++ b/src/java/org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java @@ -530,7 +530,9 @@ public class NPOIFSFileSystem extends BlockStore if(xbat == null) { // Oh joy, we need a new XBAT too... xbat = createBAT(offset+1, false); + // Allocate our new BAT as the first block in the XBAT xbat.setValueAt(0, offset); + // And allocate the XBAT in the BAT bat.setValueAt(1, POIFSConstants.DIFAT_SECTOR_BLOCK); // Will go one place higher as XBAT added in @@ -546,12 +548,14 @@ public class NPOIFSFileSystem extends BlockStore } _xbat_blocks.add(xbat); _header.setXBATCount(_xbat_blocks.size()); - } - // Allocate us in the XBAT - for(int i=0; i