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

AudioParser Fails with NPE on fileFormat.properties

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 0.8
    • 0.9
    • parser
    • None
    • ALL

    Description

      AudioParserTests fail because the AudioParser does not check for existence of properties on the fileFormat. (In the parse method, about line 110. The code is:
      for (Entry<String, Object> entry : fileFormat.properties().entrySet())

      { metadata.set(entry.getKey(), entry.getValue().toString()); }
      for (Entry<String, Object> entry : audioFormat.properties().entrySet()) { metadata.set(entry.getKey(), entry.getValue().toString()); }

      Method throws NPE on fileFormat.properties().entrySet() when there are no properties.
      should be something like:
      if( fileFormat.properties() != null && fileFormat.properties().size() > 0) {
      for (Entry<String, Object> entry : fileFormat.properties().entrySet())

      { metadata.set(entry.getKey(), entry.getValue().toString()); }
      }
      if( audioFormat.properties() != null && audioFormat.properties().size() > 0) {
      for (Entry<String, Object> entry : audioFormat.properties().entrySet()) { metadata.set(entry.getKey(), entry.getValue().toString()); }

      }
      Or am i missing something?

      Attachments

        Activity

          People

            jukkaz Jukka Zitting
            cvringer Cyriel Vringer
            Votes:
            0 Vote for this issue
            Watchers:
            0 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