Skip to content

Commit f0a6cb3

Browse files
committed
PDFBOX-5660: avoid potential ClassCastException
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1930094 13f79535-47bb-0310-9956-ffa450edef68
1 parent 3fc5a03 commit f0a6cb3

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

xmpbox/src/main/java/org/apache/xmpbox/type/AbstractStructuredType.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,12 @@ protected void addSimpleProperty(String propertyName, Object value)
111111

112112
protected String getPropertyValueAsString(String fieldName)
113113
{
114-
AbstractSimpleProperty absProp = (AbstractSimpleProperty) getProperty(fieldName);
115-
if (absProp == null)
114+
AbstractField absProp = getProperty(fieldName);
115+
if (absProp instanceof AbstractSimpleProperty)
116116
{
117-
return null;
118-
}
119-
else
120-
{
121-
return absProp.getStringValue();
117+
return ((AbstractSimpleProperty) absProp).getStringValue();
122118
}
119+
return null;
123120
}
124121

125122
protected Calendar getDatePropertyAsCalendar(String fieldName)

0 commit comments

Comments
 (0)