Skip to content

Commit b20dc7a

Browse files
committed
PDFBOX-5660: avoid NPE, as suggested by Valery Bokov
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1929807 13f79535-47bb-0310-9956-ffa450edef68
1 parent d048354 commit b20dc7a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDLineAppearanceHandler.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ public void generateNormalAppearance()
169169
float contentLength = 0;
170170
try
171171
{
172-
contentLength = font.getStringWidth(annotation.getContents()) / 1000 * FONT_SIZE;
172+
contentLength = font.getStringWidth(contents) / 1000 * FONT_SIZE;
173173

174174
//TODO How to decide the size of the font?
175175
// 9 seems to be standard, but if the text doesn't fit, a scaling is done
@@ -178,7 +178,7 @@ public void generateNormalAppearance()
178178
catch (IllegalArgumentException ex)
179179
{
180180
// Adobe Reader displays placeholders instead
181-
LOG.error(() -> "line text '" + annotation.getContents() + "' can't be shown", ex);
181+
LOG.error("line text '" + contents + "' can't be shown", ex);
182182
}
183183
float xOffset = (lineLength - contentLength) / 2;
184184
float yOffset;
@@ -230,7 +230,7 @@ public void generateNormalAppearance()
230230
cs.setFont(font, FONT_SIZE);
231231
cs.newLineAtOffset(xOffset + captionHorizontalOffset,
232232
y + yOffset + captionVerticalOffset);
233-
cs.showText(annotation.getContents());
233+
cs.showText(contents);
234234
cs.endText();
235235
}
236236

0 commit comments

Comments
 (0)