Adrian Nistor created PDFBOX-1644:
-------------------------------------
Summary: Wasted work in XMPSchema.merge()
Key: PDFBOX-1644
URL: https://issues.apache.org/jira/browse/PDFBOX-1644
Project: PDFBox
Issue Type: Bug
Components: XmpBox
Affects Versions: 1.8.2
Environment: any
Reporter: Adrian Nistor
The problem appears in version 1.8.2 and in revision 1493964. I
attached a two-line patch that fixes it. This problem and the
attached patch are similar the previously fixed PDFBOX-1456,
PDFBOX-1457, and PDFBOX-1583, and their patches.
In method "org.apache.xmpbox.schema.XMPSchema.merge", the loops over
"itNewValues" and "itActualEmbeddedProperties" should break
immediately after "alreadyPresent" is set to "true". All the
iterations after "alreadyPresent" is set to "true" do not perform any
useful work because the only side effect is:
"((ArrayProperty)tmpEmbeddedProperty).getContainer().addProperty(tmpNewValue);",
which is executed only when "if (!alreadyPresent)" is "true", i.e., it
is never executed once "alreadyPresent" is set to "true" because
"alreadyPresent" cannot become "false" again.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira