bug 60288: remove defensive copy for internal relationships. Patch from Tim Helmstedt. This closes #38.

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1765935 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Javen O'Neal 2016-10-21 07:29:40 +00:00
parent f648c23daa
commit 359820ba80
2 changed files with 4 additions and 7 deletions

View File

@ -1409,7 +1409,7 @@ public abstract class OPCPackage implements RelationshipSource, Closeable {
*/
@Override
public boolean isRelationshipExists(PackageRelationship rel) {
for (PackageRelationship r : this.getRelationships()) {
for (PackageRelationship r : relationships) {
if (r == rel) {
return true;
}

View File

@ -447,12 +447,9 @@ public abstract class PackagePart implements RelationshipSource, Comparable<Pack
* @see org.apache.poi.openxml4j.opc.RelationshipSource#isRelationshipExists(org.apache.poi.openxml4j.opc.PackageRelationship)
*/
public boolean isRelationshipExists(PackageRelationship rel) {
try {
for (PackageRelationship r : this.getRelationships()) {
if (r == rel)
return true;
}
} catch (InvalidFormatException e){
for (PackageRelationship r : _relationships) {
if (r == rel)
return true;
}
return false;
}