44694 - HPSF: Support for property sets without sections

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@643670 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Rainer Klute 2008-04-02 00:50:45 +00:00
parent 0a50fa99fe
commit af1ef87ac7
5 changed files with 11 additions and 4 deletions

View File

@ -37,7 +37,7 @@
<!-- Don't forget to update status.xml too! --> <!-- Don't forget to update status.xml too! -->
<release version="3.0.3-beta1" date="2008-04-??"> <release version="3.0.3-beta1" date="2008-04-??">
<action dev="POI-DEVELOPERS" type="add">Implement Sheet.removeShape(Shape shape) in HSLF</action> <action dev="RK" type="add">44694 - HPSF: Support for property sets without sections</action>
<action dev="POI-DEVELOPERS" type="add">Various fixes: Recognising var-arg built-in functions #44675, ExternalNameRecord serialisation bug #44695, PMT() bug #44691</action> <action dev="POI-DEVELOPERS" type="add">Various fixes: Recognising var-arg built-in functions #44675, ExternalNameRecord serialisation bug #44695, PMT() bug #44691</action>
<action dev="POI-DEVELOPERS" type="add">30311 - More work on Conditional Formatting</action> <action dev="POI-DEVELOPERS" type="add">30311 - More work on Conditional Formatting</action>
<action dev="POI-DEVELOPERS" type="add">Move the Formula Evaluator code out of scratchpad</action> <action dev="POI-DEVELOPERS" type="add">Move the Formula Evaluator code out of scratchpad</action>

View File

@ -34,6 +34,7 @@
<!-- Don't forget to update changes.xml too! --> <!-- Don't forget to update changes.xml too! -->
<changes> <changes>
<release version="3.0.3-beta1" date="2008-04-??"> <release version="3.0.3-beta1" date="2008-04-??">
<action dev="RK" type="add">44694 - HPSF: Support for property sets without sections</action>
<action dev="POI-DEVELOPERS" type="add">Implement Sheet.removeShape(Shape shape) in HSLF</action> <action dev="POI-DEVELOPERS" type="add">Implement Sheet.removeShape(Shape shape) in HSLF</action>
<action dev="POI-DEVELOPERS" type="add">Various fixes: Recognising var-arg built-in functions #44675, ExternalNameRecord serialisation bug #44695, PMT() bug #44691</action> <action dev="POI-DEVELOPERS" type="add">Various fixes: Recognising var-arg built-in functions #44675, ExternalNameRecord serialisation bug #44695, PMT() bug #44691</action>
<action dev="POI-DEVELOPERS" type="add">30311 - More work on Conditional Formatting</action> <action dev="POI-DEVELOPERS" type="add">30311 - More work on Conditional Formatting</action>

View File

@ -92,6 +92,8 @@ public class MutablePropertySet extends PropertySet
osVersion = ps.getOSVersion(); osVersion = ps.getOSVersion();
setClassID(ps.getClassID()); setClassID(ps.getClassID());
clearSections(); clearSections();
if (sections == null)
sections = new LinkedList();
for (final Iterator i = ps.getSections().iterator(); i.hasNext();) for (final Iterator i = ps.getSections().iterator(); i.hasNext();)
{ {
final MutableSection s = new MutableSection((Section) (i.next())); final MutableSection s = new MutableSection((Section) (i.next()));

View File

@ -387,7 +387,7 @@ public class PropertySet
o += ClassID.LENGTH; o += ClassID.LENGTH;
final long sectionCount = LittleEndian.getUInt(src, o); final long sectionCount = LittleEndian.getUInt(src, o);
o += LittleEndian.INT_SIZE; o += LittleEndian.INT_SIZE;
if (sectionCount < 1) if (sectionCount < 0)
return false; return false;
return true; return true;
} }
@ -426,9 +426,9 @@ public class PropertySet
o += ClassID.LENGTH; o += ClassID.LENGTH;
final int sectionCount = LittleEndian.getInt(src, o); final int sectionCount = LittleEndian.getInt(src, o);
o += LittleEndian.INT_SIZE; o += LittleEndian.INT_SIZE;
if (sectionCount <= 0) if (sectionCount < 0)
throw new HPSFRuntimeException("Section count " + sectionCount + throw new HPSFRuntimeException("Section count " + sectionCount +
" must be greater than 0."); " is negative.");
/* /*
* Read the sections, which are following the header. They * Read the sections, which are following the header. They
@ -468,6 +468,8 @@ public class PropertySet
*/ */
public boolean isSummaryInformation() public boolean isSummaryInformation()
{ {
if (sections.size() <= 0)
return false;
return Util.equal(((Section) sections.get(0)).getFormatID().getBytes(), return Util.equal(((Section) sections.get(0)).getFormatID().getBytes(),
SectionIDMap.SUMMARY_INFORMATION_ID); SectionIDMap.SUMMARY_INFORMATION_ID);
} }
@ -483,6 +485,8 @@ public class PropertySet
*/ */
public boolean isDocumentSummaryInformation() public boolean isDocumentSummaryInformation()
{ {
if (sections.size() <= 0)
return false;
return Util.equal(((Section) sections.get(0)).getFormatID().getBytes(), return Util.equal(((Section) sections.get(0)).getFormatID().getBytes(),
SectionIDMap.DOCUMENT_SUMMARY_INFORMATION_ID[0]); SectionIDMap.DOCUMENT_SUMMARY_INFORMATION_ID[0]);
} }