]> source.dussan.org Git - poi.git/commitdiff
44694 - HPSF: Support for property sets without sections
authorRainer Klute <klute@apache.org>
Wed, 2 Apr 2008 00:50:45 +0000 (00:50 +0000)
committerRainer Klute <klute@apache.org>
Wed, 2 Apr 2008 00:50:45 +0000 (00:50 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@643670 13f79535-47bb-0310-9956-ffa450edef68

src/documentation/content/xdocs/changes.xml
src/documentation/content/xdocs/status.xml
src/java/org/apache/poi/hpsf/MutablePropertySet.java
src/java/org/apache/poi/hpsf/PropertySet.java
src/testcases/org/apache/poi/hpsf/data/Test_Humor-Generation.ppt [new file with mode: 0644]

index 5722a7be458761b55cc06067a0d218ca06dbd004..256538dabb2a06d97dcd51ed8f1db996733aab37 100644 (file)
@@ -37,7 +37,7 @@
 
                <!-- Don't forget to update status.xml too! -->
         <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">30311 - More work on Conditional Formatting</action>
            <action dev="POI-DEVELOPERS" type="add">Move the Formula Evaluator code out of scratchpad</action>
index 9d35cb7fd10d8c89485891087d5932ce8469f9b6..5e963e484cefdde258687204c1ead63d546e595e 100644 (file)
@@ -34,6 +34,7 @@
        <!-- Don't forget to update changes.xml too! -->
     <changes>
         <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">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>
index 34281b90c13dad9fe60708096c13b8f28d495afb..5ecbfeee3d9a3181312ef10d6d26b13bff1e0224 100644 (file)
@@ -92,6 +92,8 @@ public class MutablePropertySet extends PropertySet
         osVersion = ps.getOSVersion();
         setClassID(ps.getClassID());
         clearSections();
+        if (sections == null)
+            sections = new LinkedList();
         for (final Iterator i = ps.getSections().iterator(); i.hasNext();)
         {
             final MutableSection s = new MutableSection((Section) (i.next()));
index 0bfbb8f32f528e20cd5cd6d02e36c40a2eb6fe2a..b39ba08bfa95caaa5cfe3f7d65bbe5d6a001e7ff 100644 (file)
@@ -387,7 +387,7 @@ public class PropertySet
         o += ClassID.LENGTH;
         final long sectionCount = LittleEndian.getUInt(src, o);
         o += LittleEndian.INT_SIZE;
-        if (sectionCount < 1)
+        if (sectionCount < 0)
             return false;
         return true;
     }
@@ -426,9 +426,9 @@ public class PropertySet
         o += ClassID.LENGTH;
         final int sectionCount = LittleEndian.getInt(src, o);
         o += LittleEndian.INT_SIZE;
-        if (sectionCount <= 0)
+        if (sectionCount < 0)
             throw new HPSFRuntimeException("Section count " + sectionCount +
-                                           " must be greater than 0.");
+                                           " is negative.");
 
         /*
          * Read the sections, which are following the header. They
@@ -468,6 +468,8 @@ public class PropertySet
      */
     public boolean isSummaryInformation()
     {
+        if (sections.size() <= 0)
+            return false;
         return Util.equal(((Section) sections.get(0)).getFormatID().getBytes(),
                           SectionIDMap.SUMMARY_INFORMATION_ID);
     }
@@ -483,6 +485,8 @@ public class PropertySet
      */
     public boolean isDocumentSummaryInformation()
     {
+        if (sections.size() <= 0)
+            return false;
         return Util.equal(((Section) sections.get(0)).getFormatID().getBytes(),
                           SectionIDMap.DOCUMENT_SUMMARY_INFORMATION_ID[0]);
     }
diff --git a/src/testcases/org/apache/poi/hpsf/data/Test_Humor-Generation.ppt b/src/testcases/org/apache/poi/hpsf/data/Test_Humor-Generation.ppt
new file mode 100644 (file)
index 0000000..e5763cc
Binary files /dev/null and b/src/testcases/org/apache/poi/hpsf/data/Test_Humor-Generation.ppt differ