Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-4947

UnsupportedOperationException when using FontMapperImpl.addSubstitute()

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.21
    • 2.0.22, 3.0.0 PDFBox
    • None
    • None

    Description

      I tried to add an additional substitue mapping however it throws an exception:

      java.lang.UnsupportedOperationException
       at java.util.AbstractList.add(AbstractList.java:148)
       at java.util.AbstractList.add(AbstractList.java:108)
       at org.apache.pdfbox.pdmodel.font.FontMapperImpl.addSubstitute(FontMapperImpl.java:210)

      => Thus the addSubstitute() method is useless

      The reason is that for instantiating the mapping only a skeleton list from "Arrays.asList()" is used. This list doesn't support many methods of List interface and throws the exception.

      Solution:

      Replace the " Arrays.asList()" with the real list like new ArrayList() or the like.

       

      Attachments

        Activity

          People

            tilman Tilman Hausherr
            tom_1st Lonzak
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: