git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1147183 13f79535-47bb-0310-9956-ffa450edef68tags/REL_3_8_BETA4
@@ -34,6 +34,7 @@ | |||
<changes> | |||
<release version="3.8-beta4" date="2011-??-??"> | |||
<action dev="poi-developers" type="fix">51514 - allow HSSFObjectData to work with both POIFS and NPOIFS</action> | |||
<action dev="poi-developers" type="fix">51514 - avoid NPE when copying nodes from one HSSF workbook to a new one, when opened from NPOIFS</action> | |||
<action dev="poi-developers" type="fix">51504 - avoid NPE when DefaultRowHeight or DefaultColumnWidth records are missing</action> | |||
<action dev="poi-developers" type="fix">51502 - Correct Subtotal function javadoc entry</action> |
@@ -26,7 +26,6 @@ import org.apache.poi.hssf.record.ObjRecord; | |||
import org.apache.poi.hssf.record.SubRecord; | |||
import org.apache.poi.poifs.filesystem.DirectoryEntry; | |||
import org.apache.poi.poifs.filesystem.Entry; | |||
import org.apache.poi.poifs.filesystem.POIFSFileSystem; | |||
import org.apache.poi.util.HexDump; | |||
/** | |||
@@ -41,20 +40,20 @@ public final class HSSFObjectData { | |||
private final ObjRecord _record; | |||
/** | |||
* Reference to the filesystem, required for retrieving the object data. | |||
* Reference to the filesystem root, required for retrieving the object data. | |||
*/ | |||
private final POIFSFileSystem _poifs; | |||
private final DirectoryEntry _root; | |||
/** | |||
* Constructs object data by wrapping a lower level object record. | |||
* | |||
* @param record the low-level object record. | |||
* @param poifs the filesystem, required for retrieving the object data. | |||
* @param root the root of the filesystem, required for retrieving the object data. | |||
*/ | |||
public HSSFObjectData(ObjRecord record, POIFSFileSystem poifs) | |||
public HSSFObjectData(ObjRecord record, DirectoryEntry root) | |||
{ | |||
_record = record; | |||
_poifs = poifs; | |||
_root = root; | |||
} | |||
/** | |||
@@ -77,7 +76,7 @@ public final class HSSFObjectData { | |||
int streamId = subRecord.getStreamId().intValue(); | |||
String streamName = "MBD" + HexDump.toHex(streamId); | |||
Entry entry = _poifs.getRoot().getEntry(streamName); | |||
Entry entry = _root.getEntry(streamName); | |||
if (entry instanceof DirectoryEntry) { | |||
return (DirectoryEntry) entry; | |||
} |
@@ -1726,27 +1726,24 @@ public final class HSSFWorkbook extends POIDocument implements org.apache.poi.ss | |||
* @param records the list of records to search. | |||
* @param objects the list of embedded objects to populate. | |||
*/ | |||
private void getAllEmbeddedObjects(List records, List<HSSFObjectData> objects) | |||
private void getAllEmbeddedObjects(List<RecordBase> records, List<HSSFObjectData> objects) | |||
{ | |||
Iterator recordIter = records.iterator(); | |||
while (recordIter.hasNext()) | |||
{ | |||
Object obj = recordIter.next(); | |||
if (obj instanceof ObjRecord) | |||
{ | |||
// TODO: More convenient way of determining if there is stored binary. | |||
// TODO: Link to the data stored in the other stream. | |||
Iterator subRecordIter = ((ObjRecord) obj).getSubRecords().iterator(); | |||
while (subRecordIter.hasNext()) | |||
for (RecordBase obj : records) { | |||
if (obj instanceof ObjRecord) | |||
{ | |||
// TODO: More convenient way of determining if there is stored binary. | |||
// TODO: Link to the data stored in the other stream. | |||
Iterator<SubRecord> subRecordIter = ((ObjRecord) obj).getSubRecords().iterator(); | |||
while (subRecordIter.hasNext()) | |||
{ | |||
SubRecord sub = subRecordIter.next(); | |||
if (sub instanceof EmbeddedObjectRefSubRecord) | |||
{ | |||
Object sub = subRecordIter.next(); | |||
if (sub instanceof EmbeddedObjectRefSubRecord) | |||
{ | |||
objects.add(new HSSFObjectData((ObjRecord) obj, directory.getFileSystem())); | |||
} | |||
objects.add(new HSSFObjectData((ObjRecord) obj, directory)); | |||
} | |||
} | |||
} | |||
} | |||
} | |||
} | |||
} | |||
public HSSFCreationHelper getCreationHelper() { |