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

possible NPE in ExtractText tool of trunk

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.8.8, 1.8.9, 2.0.0
    • Fix Version/s: 1.8.9, 2.0.0
    • Component/s: Text extraction
    • Labels:
      None

      Description

      With some PDFs an NPE is thrown.
      Here's the patch for it (referring to trunk):

      Index: tools/src/main/java/org/apache/pdfbox/tools/ExtractText.java
      ===================================================================
      --- tools/src/main/java/org/apache/pdfbox/tools/ExtractText.java	(Revision 1658905)
      +++ tools/src/main/java/org/apache/pdfbox/tools/ExtractText.java	(Working Copy)
      @@ -252,7 +252,7 @@
                                       }
                                       PDComplexFileSpecification spec = (PDComplexFileSpecification) ent.getValue();
                                       PDEmbeddedFile file = spec.getEmbeddedFile();
      -                                if (file != null && file.getSubtype().equals("application/pdf"))
      +                                if (file != null && file.getSubtype() != null && file.getSubtype().equals("application/pdf"))
                                       {
                                           if (debug)
                                           {
      

        Attachments

          Activity

            People

            • Assignee:
              tilman Tilman Hausherr
              Reporter:
              nullpointer7 nullpointer
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 5m
                5m
                Remaining:
                Remaining Estimate - 5m
                5m
                Logged:
                Time Spent - Not Specified
                Not Specified