diff --git a/src/java/org/apache/poi/hpsf/PropertySet.java b/src/java/org/apache/poi/hpsf/PropertySet.java index 30b682392..8095ab19a 100644 --- a/src/java/org/apache/poi/hpsf/PropertySet.java +++ b/src/java/org/apache/poi/hpsf/PropertySet.java @@ -673,7 +673,7 @@ public class PropertySet b.append(getOSVersion()); b.append(", sectionCount: "); b.append(sectionCount); - b.append(", sections: ["); + b.append(", sections: [\n"); final List sections = getSections(); for (int i = 0; i < sectionCount; i++) b.append(((Section) sections.get(0)).toString()); diff --git a/src/java/org/apache/poi/hpsf/Section.java b/src/java/org/apache/poi/hpsf/Section.java index fd9e020c4..913fc9116 100644 --- a/src/java/org/apache/poi/hpsf/Section.java +++ b/src/java/org/apache/poi/hpsf/Section.java @@ -448,7 +448,24 @@ public class Section /** - *

Checks whether this section is equal to another object.

+ *

Checks whether this section is equal to another object. The result is + * false if one of the the following conditions holds:

+ * + * * * @param o The object to compare this section with * @return true if the objects are equal, false if @@ -461,8 +478,6 @@ public class Section final Section s = (Section) o; if (!s.getFormatID().equals(getFormatID())) return false; - if (s.getPropertyCount() != getPropertyCount()) - return false; /* Compare all properties except 0 and 1 as they must be handled * specially. */ @@ -508,6 +523,12 @@ public class Section } } + /* If the number of properties (not counting property 1) is unequal the + * sections are unequal. */ + if (pa1.length != pa2.length) + return false; + + /* If the dictionaries are unequal the sections are unequal. */ boolean dictionaryEqual = true; if (p10 != null && p20 != null) dictionaryEqual = p10.getValue().equals(p20.getValue());