You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by le...@apache.org on 2021/03/20 16:59:44 UTC
svn commit: r1887869 - in
/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel:
PDDocument.java PDDocumentCatalog.java PDDocumentNameDictionary.java
PDPage.java PDResources.java
documentinterchange/logicalstructure/PDObjectReference.java
Author: lehmi
Date: Sat Mar 20 16:59:44 2021
New Revision: 1887869
URL: http://svn.apache.org/viewvc?rev=1887869&view=rev
Log:
PDFBOX-4892: use convenience methods to simplify code
Modified:
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocumentCatalog.java
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocumentNameDictionary.java
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPage.java
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDResources.java
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDObjectReference.java
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java?rev=1887869&r1=1887868&r2=1887869&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java Sat Mar 20 16:59:44 2021
@@ -566,7 +566,7 @@ public class PDDocument implements Close
private void assignSignatureRectangle(PDSignatureField signatureField, COSDictionary annotDict)
{
// Read and set the rectangle for visual signature
- COSArray rectArray = (COSArray) annotDict.getDictionaryObject(COSName.RECT);
+ COSArray rectArray = annotDict.getCOSArray(COSName.RECT);
PDRectangle existingRectangle = signatureField.getWidgets().get(0).getRectangle();
//in case of an existing field keep the original rect
@@ -588,10 +588,9 @@ public class PDDocument implements Close
private void assignAcroFormDefaultResource(PDAcroForm acroForm, COSDictionary newDict)
{
// read and set/update AcroForm default resource dictionary /DR if available
- COSBase newBase = newDict.getDictionaryObject(COSName.DR);
- if (newBase instanceof COSDictionary)
+ COSDictionary newDR = newDict.getCOSDictionary(COSName.DR);
+ if (newDR != null)
{
- COSDictionary newDR = (COSDictionary) newBase;
PDResources defaultResources = acroForm.getDefaultResources();
if (defaultResources == null)
{
@@ -602,12 +601,11 @@ public class PDDocument implements Close
else
{
COSDictionary oldDR = defaultResources.getCOSObject();
- COSBase newXObjectBase = newDR.getItem(COSName.XOBJECT);
- COSBase oldXObjectBase = oldDR.getItem(COSName.XOBJECT);
- if (newXObjectBase instanceof COSDictionary &&
- oldXObjectBase instanceof COSDictionary)
+ COSDictionary newXObject = newDR.getCOSDictionary(COSName.XOBJECT);
+ COSDictionary oldXObject = oldDR.getCOSDictionary(COSName.XOBJECT);
+ if (newXObject != null && oldXObject != null)
{
- ((COSDictionary) oldXObjectBase).addAll((COSDictionary) newXObjectBase);
+ oldXObject.addAll(newXObject);
oldDR.setNeedToBeUpdated(true);
}
}
@@ -752,10 +750,10 @@ public class PDDocument implements Close
if (documentCatalog == null)
{
COSDictionary trailer = document.getTrailer();
- COSBase dictionary = trailer.getDictionaryObject(COSName.ROOT);
- if (dictionary instanceof COSDictionary)
+ COSDictionary dictionary = trailer.getCOSDictionary(COSName.ROOT);
+ if (dictionary != null)
{
- documentCatalog = new PDDocumentCatalog(this, (COSDictionary) dictionary);
+ documentCatalog = new PDDocumentCatalog(this, dictionary);
}
else
{
@@ -851,10 +849,10 @@ public class PDDocument implements Close
List<PDSignature> signatures = new ArrayList<>();
for (PDSignatureField field : getSignatureFields())
{
- COSBase value = field.getCOSObject().getDictionaryObject(COSName.V);
- if (value instanceof COSDictionary)
+ COSDictionary value = field.getCOSObject().getCOSDictionary(COSName.V);
+ if (value != null)
{
- signatures.add(new PDSignature((COSDictionary)value));
+ signatures.add(new PDSignature(value));
}
}
return signatures;
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocumentCatalog.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocumentCatalog.java?rev=1887869&r1=1887868&r2=1887869&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocumentCatalog.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocumentCatalog.java Sat Mar 20 16:59:44 2021
@@ -139,7 +139,7 @@ public class PDDocumentCatalog implement
}
if (cachedAcroForm == null)
{
- COSDictionary dict = (COSDictionary)root.getDictionaryObject(COSName.ACRO_FORM);
+ COSDictionary dict = root.getCOSDictionary(COSName.ACRO_FORM);
cachedAcroForm = dict == null ? null : new PDAcroForm(document, dict);
}
return cachedAcroForm;
@@ -162,7 +162,7 @@ public class PDDocumentCatalog implement
public PDPageTree getPages()
{
// todo: cache me?
- return new PDPageTree((COSDictionary)root.getDictionaryObject(COSName.PAGES), document);
+ return new PDPageTree(root.getCOSDictionary(COSName.PAGES), document);
}
/**
@@ -172,8 +172,8 @@ public class PDDocumentCatalog implement
*/
public PDViewerPreferences getViewerPreferences()
{
- COSBase base = root.getDictionaryObject(COSName.VIEWER_PREFERENCES);
- return base instanceof COSDictionary ? new PDViewerPreferences((COSDictionary) base) : null;
+ COSDictionary viewerPref = root.getCOSDictionary(COSName.VIEWER_PREFERENCES);
+ return viewerPref != null ? new PDViewerPreferences(viewerPref) : null;
}
/**
@@ -193,8 +193,8 @@ public class PDDocumentCatalog implement
*/
public PDDocumentOutline getDocumentOutline()
{
- COSBase cosObj = root.getDictionaryObject(COSName.OUTLINES);
- return cosObj instanceof COSDictionary ? new PDDocumentOutline((COSDictionary)cosObj) : null;
+ COSDictionary outlineDict = root.getCOSDictionary(COSName.OUTLINES);
+ return outlineDict != null ? new PDDocumentOutline(outlineDict) : null;
}
/**
@@ -212,7 +212,7 @@ public class PDDocumentCatalog implement
*/
public List<PDThread> getThreads()
{
- COSArray array = (COSArray)root.getDictionaryObject(COSName.THREADS);
+ COSArray array = root.getCOSArray(COSName.THREADS);
if (array == null)
{
array = new COSArray();
@@ -244,12 +244,8 @@ public class PDDocumentCatalog implement
*/
public PDMetadata getMetadata()
{
- COSBase metaObj = root.getDictionaryObject(COSName.METADATA);
- if (metaObj instanceof COSStream)
- {
- return new PDMetadata((COSStream) metaObj);
- }
- return null;
+ COSStream metaObj = root.getCOSStream(COSName.METADATA);
+ return metaObj != null ? new PDMetadata(metaObj) : null;
}
/**
@@ -299,7 +295,7 @@ public class PDDocumentCatalog implement
*/
public PDDocumentCatalogAdditionalActions getActions()
{
- COSDictionary addAction = (COSDictionary) root.getDictionaryObject(COSName.AA);
+ COSDictionary addAction = root.getCOSDictionary(COSName.AA);
if (addAction == null)
{
addAction = new COSDictionary();
@@ -323,7 +319,7 @@ public class PDDocumentCatalog implement
*/
public PDDocumentNameDictionary getNames()
{
- COSDictionary names = (COSDictionary) root.getDictionaryObject(COSName.NAMES);
+ COSDictionary names = root.getCOSDictionary(COSName.NAMES);
return names == null ? null : new PDDocumentNameDictionary(this, names);
}
@@ -332,13 +328,8 @@ public class PDDocumentCatalog implement
*/
public PDDocumentNameDestinationDictionary getDests()
{
- PDDocumentNameDestinationDictionary nameDic = null;
- COSDictionary dests = (COSDictionary) root.getDictionaryObject(COSName.DESTS);
- if (dests != null)
- {
- nameDic = new PDDocumentNameDestinationDictionary(dests);
- }
- return nameDic;
+ COSDictionary dests = root.getCOSDictionary(COSName.DESTS);
+ return dests != null ? new PDDocumentNameDestinationDictionary(dests) : null;
}
/**
@@ -391,7 +382,7 @@ public class PDDocumentCatalog implement
*/
public PDMarkInfo getMarkInfo()
{
- COSDictionary dic = (COSDictionary)root.getDictionaryObject(COSName.MARK_INFO);
+ COSDictionary dic = root.getCOSDictionary(COSName.MARK_INFO);
return dic == null ? null : new PDMarkInfo(dic);
}
@@ -413,7 +404,7 @@ public class PDDocumentCatalog implement
public List<PDOutputIntent> getOutputIntents()
{
List<PDOutputIntent> retval = new ArrayList<>();
- COSArray array = (COSArray)root.getDictionaryObject(COSName.OUTPUT_INTENTS);
+ COSArray array = root.getCOSArray(COSName.OUTPUT_INTENTS);
if (array != null)
{
for (COSBase cosBase : array)
@@ -437,7 +428,7 @@ public class PDDocumentCatalog implement
*/
public void addOutputIntent(PDOutputIntent outputIntent)
{
- COSArray array = (COSArray)root.getDictionaryObject(COSName.OUTPUT_INTENTS);
+ COSArray array = root.getCOSArray(COSName.OUTPUT_INTENTS);
if (array == null)
{
array = new COSArray();
@@ -527,7 +518,7 @@ public class PDDocumentCatalog implement
*/
public PDURIDictionary getURI()
{
- COSDictionary uri = (COSDictionary)root.getDictionaryObject(COSName.URI);
+ COSDictionary uri = root.getCOSDictionary(COSName.URI);
return uri == null ? null : new PDURIDictionary(uri);
}
@@ -606,7 +597,7 @@ public class PDDocumentCatalog implement
*/
public PDPageLabels getPageLabels() throws IOException
{
- COSDictionary dict = (COSDictionary) root.getDictionaryObject(COSName.PAGE_LABELS);
+ COSDictionary dict = root.getCOSDictionary(COSName.PAGE_LABELS);
return dict == null ? null : new PDPageLabels(document, dict);
}
@@ -627,7 +618,7 @@ public class PDDocumentCatalog implement
*/
public PDOptionalContentProperties getOCProperties()
{
- COSDictionary dict = (COSDictionary)root.getDictionaryObject(COSName.OCPROPERTIES);
+ COSDictionary dict = root.getCOSDictionary(COSName.OCPROPERTIES);
return dict == null ? null : new PDOptionalContentProperties(dict);
}
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocumentNameDictionary.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocumentNameDictionary.java?rev=1887869&r1=1887868&r2=1887869&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocumentNameDictionary.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocumentNameDictionary.java Sat Mar 20 16:59:44 2021
@@ -16,7 +16,6 @@
*/
package org.apache.pdfbox.pdmodel;
-import org.apache.pdfbox.cos.COSBase;
import org.apache.pdfbox.cos.COSDictionary;
import org.apache.pdfbox.cos.COSName;
import org.apache.pdfbox.pdmodel.common.COSObjectable;
@@ -38,16 +37,13 @@ public class PDDocumentNameDictionary im
*/
public PDDocumentNameDictionary( PDDocumentCatalog cat )
{
- COSBase names = cat.getCOSObject().getDictionaryObject(COSName.NAMES);
- if (names != null)
+ COSDictionary names = cat.getCOSObject().getCOSDictionary(COSName.NAMES);
+ if (names == null)
{
- nameDictionary = (COSDictionary)names;
- }
- else
- {
- nameDictionary = new COSDictionary();
- cat.getCOSObject().setItem(COSName.NAMES, nameDictionary);
+ names = new COSDictionary();
+ cat.getCOSObject().setItem(COSName.NAMES, names);
}
+ nameDictionary = names;
catalog = cat;
}
@@ -82,23 +78,14 @@ public class PDDocumentNameDictionary im
*/
public PDDestinationNameTreeNode getDests()
{
- PDDestinationNameTreeNode dests = null;
-
- COSDictionary dic = (COSDictionary)nameDictionary.getDictionaryObject( COSName.DESTS );
-
+ COSDictionary dic = nameDictionary.getCOSDictionary(COSName.DESTS);
//The document catalog also contains the Dests entry sometimes
//so check there as well.
if( dic == null )
{
- dic = (COSDictionary)catalog.getCOSObject().getDictionaryObject( COSName.DESTS );
+ dic = catalog.getCOSObject().getCOSDictionary(COSName.DESTS);
}
-
- if( dic != null )
- {
- dests = new PDDestinationNameTreeNode( dic );
- }
-
- return dests;
+ return dic != null ? new PDDestinationNameTreeNode(dic) : null;
}
/**
@@ -125,16 +112,8 @@ public class PDDocumentNameDictionary im
*/
public PDEmbeddedFilesNameTreeNode getEmbeddedFiles()
{
- PDEmbeddedFilesNameTreeNode retval = null;
-
- COSDictionary dic = (COSDictionary)nameDictionary.getDictionaryObject( COSName.EMBEDDED_FILES );
-
- if( dic != null )
- {
- retval = new PDEmbeddedFilesNameTreeNode( dic );
- }
-
- return retval;
+ COSDictionary dic = nameDictionary.getCOSDictionary(COSName.EMBEDDED_FILES);
+ return dic != null ? new PDEmbeddedFilesNameTreeNode(dic) : null;
}
/**
@@ -156,16 +135,8 @@ public class PDDocumentNameDictionary im
*/
public PDJavascriptNameTreeNode getJavaScript()
{
- PDJavascriptNameTreeNode retval = null;
-
- COSDictionary dic = (COSDictionary) nameDictionary.getDictionaryObject(COSName.JAVA_SCRIPT);
-
- if( dic != null )
- {
- retval = new PDJavascriptNameTreeNode( dic );
- }
-
- return retval;
+ COSDictionary dic = nameDictionary.getCOSDictionary(COSName.JAVA_SCRIPT);
+ return dic != null ? new PDJavascriptNameTreeNode(dic) : null;
}
/**
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPage.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPage.java?rev=1887869&r1=1887868&r2=1887869&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPage.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPage.java Sat Mar 20 16:59:44 2021
@@ -379,15 +379,8 @@ public class PDPage implements COSObject
*/
public PDRectangle getBleedBox()
{
- COSBase base = page.getDictionaryObject(COSName.BLEED_BOX);
- if (base instanceof COSArray)
- {
- return clipToMediaBox(new PDRectangle((COSArray) base));
- }
- else
- {
- return getCropBox();
- }
+ COSArray bleedBox = page.getCOSArray(COSName.BLEED_BOX);
+ return bleedBox != null ? clipToMediaBox(new PDRectangle(bleedBox)) : getCropBox();
}
/**
@@ -415,15 +408,8 @@ public class PDPage implements COSObject
*/
public PDRectangle getTrimBox()
{
- COSBase base = page.getDictionaryObject(COSName.TRIM_BOX);
- if (base instanceof COSArray)
- {
- return clipToMediaBox(new PDRectangle((COSArray) base));
- }
- else
- {
- return getCropBox();
- }
+ COSArray trimBox = page.getCOSArray(COSName.TRIM_BOX);
+ return trimBox != null ? clipToMediaBox(new PDRectangle(trimBox)) : null;
}
/**
@@ -452,15 +438,8 @@ public class PDPage implements COSObject
*/
public PDRectangle getArtBox()
{
- COSBase base = page.getDictionaryObject(COSName.ART_BOX);
- if (base instanceof COSArray)
- {
- return clipToMediaBox(new PDRectangle((COSArray) base));
- }
- else
- {
- return getCropBox();
- }
+ COSArray artBox = page.getCOSArray(COSName.ART_BOX);
+ return artBox != null ? clipToMediaBox(new PDRectangle(artBox)) : getCropBox();
}
/**
@@ -557,7 +536,7 @@ public class PDPage implements COSObject
*/
public List<PDThreadBead> getThreadBeads()
{
- COSArray beads = (COSArray) page.getDictionaryObject(COSName.B);
+ COSArray beads = page.getCOSArray(COSName.B);
if (beads == null)
{
beads = new COSArray();
@@ -595,13 +574,8 @@ public class PDPage implements COSObject
*/
public PDMetadata getMetadata()
{
- PDMetadata retval = null;
- COSBase base = page.getDictionaryObject(COSName.METADATA);
- if (base instanceof COSStream)
- {
- retval = new PDMetadata((COSStream) base);
- }
- return retval;
+ COSStream metadata = page.getCOSStream(COSName.METADATA);
+ return metadata != null ? new PDMetadata(metadata) : null;
}
/**
@@ -621,13 +595,8 @@ public class PDPage implements COSObject
*/
public PDPageAdditionalActions getActions()
{
- COSDictionary addAct;
- COSBase base = page.getDictionaryObject(COSName.AA);
- if (base instanceof COSDictionary)
- {
- addAct = (COSDictionary) base;
- }
- else
+ COSDictionary addAct = page.getCOSDictionary(COSName.AA);
+ if (addAct == null)
{
addAct = new COSDictionary();
page.setItem(COSName.AA, addAct);
@@ -650,8 +619,8 @@ public class PDPage implements COSObject
*/
public PDTransition getTransition()
{
- COSBase base = page.getDictionaryObject(COSName.TRANS);
- return base instanceof COSDictionary ? new PDTransition((COSDictionary) base) : null;
+ COSDictionary transition = page.getCOSDictionary(COSName.TRANS);
+ return transition != null ? new PDTransition(transition) : null;
}
/**
@@ -699,10 +668,9 @@ public class PDPage implements COSObject
*/
public List<PDAnnotation> getAnnotations(AnnotationFilter annotationFilter) throws IOException
{
- COSBase base = page.getDictionaryObject(COSName.ANNOTS);
- if (base instanceof COSArray)
+ COSArray annots = page.getCOSArray(COSName.ANNOTS);
+ if (annots != null)
{
- COSArray annots = (COSArray) base;
List<PDAnnotation> actuals = new ArrayList<>();
for (int i = 0; i < annots.size(); i++)
{
@@ -759,12 +727,11 @@ public class PDPage implements COSObject
*/
public List<PDViewportDictionary> getViewports()
{
- COSBase base = page.getDictionaryObject(COSName.VP);
- if (!(base instanceof COSArray))
+ COSArray array = page.getCOSArray(COSName.VP);
+ if (array == null)
{
return null;
}
- COSArray array = (COSArray) base;
List<PDViewportDictionary> viewports = new ArrayList<>();
for (int i = 0; i < array.size(); ++i)
{
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDResources.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDResources.java?rev=1887869&r1=1887868&r2=1887869&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDResources.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDResources.java Sat Mar 20 16:59:44 2021
@@ -419,11 +419,10 @@ public final class PDResources implement
{
if (xobject instanceof PDImageXObject)
{
- COSBase colorSpace = xobject.getCOSObject().getDictionaryObject(COSName.COLORSPACE);
- if (colorSpace instanceof COSName)
+ COSName colorSpaceName = xobject.getCOSObject().getCOSName(COSName.COLORSPACE);
+ if (colorSpaceName != null)
{
// don't cache if it might use page resources, see PDFBOX-2370 and PDFBOX-3484
- COSName colorSpaceName = (COSName) colorSpace;
if (colorSpaceName.equals(COSName.DEVICECMYK) && hasColorSpace(COSName.DEFAULT_CMYK))
{
return false;
@@ -450,7 +449,7 @@ public final class PDResources implement
*/
private COSObject getIndirect(COSName kind, COSName name)
{
- COSDictionary dict = (COSDictionary)resources.getDictionaryObject(kind);
+ COSDictionary dict = resources.getCOSDictionary(kind);
if (dict == null)
{
return null;
@@ -469,12 +468,8 @@ public final class PDResources implement
*/
private COSBase get(COSName kind, COSName name)
{
- COSDictionary dict = (COSDictionary)resources.getDictionaryObject(kind);
- if (dict == null)
- {
- return null;
- }
- return dict.getDictionaryObject(name);
+ COSDictionary dict = resources.getCOSDictionary(kind);
+ return dict != null ? dict.getDictionaryObject(name) : null;
}
/**
@@ -538,12 +533,8 @@ public final class PDResources implement
*/
private Iterable<COSName> getNames(COSName kind)
{
- COSDictionary dict = (COSDictionary)resources.getDictionaryObject(kind);
- if (dict == null)
- {
- return Collections.emptySet();
- }
- return dict.keySet();
+ COSDictionary dict = resources.getCOSDictionary(kind);
+ return dict != null ? dict.keySet() : Collections.emptySet();
}
/**
@@ -668,7 +659,7 @@ public final class PDResources implement
private COSName add(COSName kind, String prefix, COSObjectable object)
{
// return the existing key if the item exists already
- COSDictionary dict = (COSDictionary)resources.getDictionaryObject(kind);
+ COSDictionary dict = resources.getCOSDictionary(kind);
if (dict != null && dict.containsValue(object.getCOSObject()))
{
return dict.getKeyForValue(object.getCOSObject());
@@ -699,7 +690,7 @@ public final class PDResources implement
*/
private COSName createKey(COSName kind, String prefix)
{
- COSDictionary dict = (COSDictionary)resources.getDictionaryObject(kind);
+ COSDictionary dict = resources.getCOSDictionary(kind);
if (dict == null)
{
return COSName.getPDFName(prefix + 1);
@@ -722,7 +713,7 @@ public final class PDResources implement
*/
private void put(COSName kind, COSName name, COSObjectable object)
{
- COSDictionary dict = (COSDictionary)resources.getDictionaryObject(kind);
+ COSDictionary dict = resources.getCOSDictionary(kind);
if (dict == null)
{
dict = new COSDictionary();
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDObjectReference.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDObjectReference.java?rev=1887869&r1=1887868&r2=1887869&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDObjectReference.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDObjectReference.java Sat Mar 20 16:59:44 2021
@@ -113,7 +113,7 @@ public class PDObjectReference implement
* what else can be the target of the object reference?
*/
if (!(annotation instanceof PDAnnotationUnknown)
- || COSName.ANNOT.equals(objDictionary.getDictionaryObject(COSName.TYPE)))
+ || COSName.ANNOT.equals(objDictionary.getCOSName(COSName.TYPE)))
{
return annotation;
}