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

ExcelExtractor: cannot choose listening to the selected records only

Attach filesAttach ScreenshotVotersStop watchingWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • 1.17
    • 1.18, 2.0.0
    • parser
    • None

    Description

      The listenForAllRecords argument is being always reset to 'true', so the 'else' branch is never reached. It may cause incorrect text extraction when records with certain unsupported types (e.g. SharedFormula) are present in a file.

              public void processFile(DirectoryNode root, boolean listenForAllRecords)
                      throws IOException, SAXException, TikaException {
      
                  // Set up listener and register the records we want to process
                  HSSFRequest hssfRequest = new HSSFRequest();
                  listenForAllRecords = true;
                  if (listenForAllRecords) {
                      hssfRequest.addListenerForAllRecords(formatListener);
                  } else {
                      hssfRequest.addListener(formatListener, BOFRecord.sid);
                      hssfRequest.addListener(formatListener, EOFRecord.sid);
                      hssfRequest.addListener(formatListener, DateWindow1904Record.sid);
                      hssfRequest.addListener(formatListener, CountryRecord.sid);
                      hssfRequest.addListener(formatListener, BoundSheetRecord.sid);
                      hssfRequest.addListener(formatListener, SSTRecord.sid);
                      hssfRequest.addListener(formatListener, FormulaRecord.sid);
                      hssfRequest.addListener(formatListener, LabelRecord.sid);
                      hssfRequest.addListener(formatListener, LabelSSTRecord.sid);
                      hssfRequest.addListener(formatListener, NumberRecord.sid);
                      hssfRequest.addListener(formatListener, RKRecord.sid);
                      hssfRequest.addListener(formatListener, StringRecord.sid);
                      hssfRequest.addListener(formatListener, HyperlinkRecord.sid);
                      hssfRequest.addListener(formatListener, TextObjectRecord.sid);
                      hssfRequest.addListener(formatListener, SeriesTextRecord.sid);
                      hssfRequest.addListener(formatListener, FormatRecord.sid);
                      hssfRequest.addListener(formatListener, ExtendedFormatRecord.sid);
                      hssfRequest.addListener(formatListener, DrawingGroupRecord.sid);
                      if (extractor.officeParserConfig.getIncludeHeadersAndFooters()) {
                          hssfRequest.addListener(formatListener, HeaderRecord.sid);
                          hssfRequest.addListener(formatListener, FooterRecord.sid);
                      }
      }
      

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            galekseev Grigoriy Alekseev
            Votes:
            0 Vote for this issue
            Watchers:
            3 Stop watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment