Details
-
Bug
-
Status: Closed
-
Blocker
-
Resolution: Fixed
-
2.0.32, 3.0.2 PDFBox
-
None
Description
The bug fix for PDFBOX-5784 created another issue.
In AppearanceGeneratorHelper line 676 is assumed, that fields have non-empty values:
font.getStringWidth(value.substring(0, 1))
resulting in this exceptions for empty fields, for example when refreshAppearances is called:
java.lang.StringIndexOutOfBoundsException: begin 0, end 1, length 0 at java.base/java.lang.String.checkBoundsBeginEnd(String.java:4602) at java.base/java.lang.String.substring(String.java:2705) at org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.insertGeneratedCombAppearance(AppearanceGeneratorHelper.java:676) at org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.insertGeneratedAppearance(AppearanceGeneratorHelper.java:569) at org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.setAppearanceContent(AppearanceGeneratorHelper.java:441) at org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.setAppearanceValue(AppearanceGeneratorHelper.java:248) at org.apache.pdfbox.pdmodel.interactive.form.PDTextField.constructAppearances(PDTextField.java:264) at org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm.refreshAppearances(PDAcroForm.java:361)
Attachments
Issue Links
- is duplicated by
-
PDFBOX-5860 StringIndexOutOfBoundsException in AppearanceGeneratorHelper
- Closed
- relates to
-
PDFBOX-5784 AppearanceGeneratorHelper assumes fontscale 1000
- Closed