Skip to content

Commit

Permalink
PDFBOX-5637: use cache as suggested by Andreas Lehmkühler
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1911632 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
THausherr committed Aug 14, 2023
1 parent 1e86e2d commit 27e0325
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -687,9 +687,10 @@ public void setAppendOnly(boolean appendOnly)
* Return the calculation order in which field values should be recalculated when the value of
* any field changes. (Read about "Trigger Events" in the PDF specification)
*
* @return field list. Note these objects are not identical to PDField objects
* retrieved from other methods, you'd need to call {@link #getCOSObject()} to check for
* identity; and the list is not backed by the /CO COSArray in the document.
* @return field list. Note these objects may not be identical to PDField objects retrieved from
* other methods (depending on cache setting). The best strategie is to call
* {@link #getCOSObject()} to check for identity. The list is not backed by the /CO COSArray in
* the document.
*/
public List<PDField> getCalcOrder()
{
Expand All @@ -699,13 +700,13 @@ public List<PDField> getCalcOrder()
return Collections.emptyList();
}

PDFieldTree fieldTree = getFieldTree();
Iterable<PDField> fields = isCachingFields() ? fieldCache.values() : getFieldTree();

List<PDField> actuals = new ArrayList<>();
for (int i = 0; i < co.size(); i++)
{
COSBase item = co.getObject(i);
for (PDField field : fieldTree)
for (PDField field : fields)
{
if (field.getCOSObject() == item)
{
Expand Down

0 comments on commit 27e0325

Please sign in to comment.