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

UnsupportedOperationException when using FontMapperImpl.addSubstitute()

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.21
    • Fix Version/s: 2.0.22, 3.0.0 PDFBox
    • Component/s: None
    • Labels:
      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

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

              Dates

              • Created:
                Updated:
                Resolved: