Here are my modifications: in the class org.apache.poi.openxml4j.opc.internal.ContentType: @Override public boolean equals(Object obj) { return (obj instanceof ContentType) &&(this.toString().equalsIgnoreCase(obj.toString())); } ----------------------------------------- Potential bugs in method equals () and hashCode() of the class org.apache.poi.openxml4j.opc.PackageRelationship.I don't know if the following changes are appropriate: in the class PackageRelationship: @Override public boolean equals(Object obj) { if (!(obj instanceof PackageRelationship)) { return false; } PackageRelationship rel = (PackageRelationship) obj; return this.relationshipType.equals(rel.relationshipType) && (rel.source != null?rel.source.equals(this.source):this.source == null ) && this.targetMode == rel.targetMode && this.targetUri.equals(rel.targetUri); } @Override public int hashCode() { return this.relationshipType.hashCode() + (this.source == null ? 0 : this.source.hashCode()) + this.targetMode.hashCode() + this.targetUri.hashCode(); } and I removed id compared in method equals () and hashCode().I don't think that if there are duplicate relationship types in the *.rels file, ID should not be compared.In addition, add equals() and hashCode() methods to the class org.apache.poi.openxml4j.opc.PackagePart. @Override public int hashCode() { return partName.hashCode() + contentType.hashCode(); } @Override public boolean equals(Object obj) { return obj instanceof PackagePart &&this.partName.equals(((PackagePart) obj).partName) &&this.contentType.equals(((PackagePart) obj).contentType); }