Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Not A Problem
    • Affects Version/s: 1.8.4
    • Fix Version/s: 1.8.7
    • Component/s: Parsing
    • Labels:
      None
    • Environment:
      Ubuntu

      Description

      PDF parsing fails for attached PDF.
      Stack trace of failure:

      Exception in thread "main" org.apache.tika.exception.TikaException: Unexpected RuntimeException from org.apache.tika.parser.pdf.PDFParser@1747c
      	at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:244)
      	at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:242)
      	at org.apache.tika.parser.AutoDetectParser.parse(AutoDetectParser.java:120)
      	at com.sabax.extraction.FileExtractionHandler.getFileData(FileExtractionHandler.java:145)
      	at GenerateIndex.main(GenerateIndex.java:59)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      	at java.lang.reflect.Method.invoke(Unknown Source)
      	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
      Caused by: java.lang.NullPointerException
      	at org.apache.pdfbox.pdmodel.interactive.form.PDCheckbox.getOnValue(PDCheckbox.java:141)
      	at org.apache.pdfbox.pdmodel.interactive.form.PDCheckbox.isChecked(PDCheckbox.java:79)
      	at org.apache.pdfbox.pdmodel.interactive.form.PDRadioCollection.getValue(PDRadioCollection.java:128)
      	at org.apache.tika.parser.pdf.PDF2XHTML.addFieldString(PDF2XHTML.java:507)
      	at org.apache.tika.parser.pdf.PDF2XHTML.processAcroField(PDF2XHTML.java:461)
      	at org.apache.tika.parser.pdf.PDF2XHTML.processAcroField(PDF2XHTML.java:479)
      	at org.apache.tika.parser.pdf.PDF2XHTML.extractAcroForm(PDF2XHTML.java:447)
      	at org.apache.tika.parser.pdf.PDF2XHTML.endDocument(PDF2XHTML.java:195)
      	at org.apache.pdfbox.util.PDFTextStripper.writeText(PDFTextStripper.java:341)
      	at org.apache.tika.parser.pdf.PDF2XHTML.process(PDF2XHTML.java:106)
      	at org.apache.tika.parser.pdf.PDFParser.parse(PDFParser.java:143)
      	at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:242)
      	... 9 more
      

      Sample code use to parse

      TikaInputStream tikaStream = TikaInputStream.get(stream);
          TikaResultWrapper result;
          try {
            long streamSize = tikaStream.getLength();
            Metadata metadata =
              constructMetadata(fileName, mimeType, streamSize);
            if (streamSize < maxFileSize) {
              SamplingSaxHandler handler =
                new SamplingSaxHandler(samplingSize, metadata);
              handler.setBufferLimit(bufferSize);
              parser.parse(tikaStream, handler, metadata, new ParseContext());
              result = handler.getResult();
            } else {
              result = new TikaResultWrapper(null, metadata);
            }
          } finally {
            tikaStream.close();
          }
          return result;
      

        Attachments

        1. SCJP Sun Certified Programmer for Java 6-0071591060.pdf
          2.97 MB
          Mohmed
        2. pdf_parsing_stack_trace
          2 kB
          Mohmed
        3. printfields.txt
          33 kB
          Tilman Hausherr

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                mdhussain Mohmed
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: