Uploaded image for project: 'Tika'
  1. Tika
  2. TIKA-2919

NullPointerException when parsing PDF with OCR and ToXMLContentHandler

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Not A Bug
    • Affects Version/s: 1.21
    • Fix Version/s: None
    • Component/s: handler, ocr
    • Labels:
      None

      Description

      When parsing a pdf document the handler creates a structure (and fires appropriate SAX exents) that each page is wrapped into two <div> elements. The outer one of these has no parent element, so when the subsequent endElement method is called for "html", a NPE occurs when currentElement.parent is referenced:

      java class ToXMLContentHandler:
      
      public void endElement(String uri, String localName, String qName) throws SAXException {
          if (this.inStartElement) {
              this.write(" />");
              this.inStartElement = false;
          } else {
              this.write("</");
              this.write(qName);
              this.write('>');
          }
      
          this.namespaces.clear();
          this.currentElement = this.currentElement.parent;
      }
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              McAviti Klemens Dickbauer
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: