Tika
  1. Tika
  2. TIKA-351

MediaType.parse should be more forgiving of broken input

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.6
    • Component/s: None
    • Labels:
      None

      Description

      Currently MediaType.parse will throw a null pointer exception if you pass it something like "text; charset=utf-8", instead of returning null.

      Also, it should handle the "charset first" form that some broken servers return, i.e. "charset=utf-8; text/html"

      1. TIKA-351.patch
        11 kB
        Ken Krugler

        Activity

        Hide
        Ken Krugler added a comment -

        This patch also moves MediaTypeTest.java from tika-parsers to tika-core, since it tests the MediaType class that's in tika-core.

        Show
        Ken Krugler added a comment - This patch also moves MediaTypeTest.java from tika-parsers to tika-core, since it tests the MediaType class that's in tika-core.
        Hide
        Jukka Zitting added a comment -

        Agreed, good point. Patch committed in revision 891078.

        Show
        Jukka Zitting added a comment - Agreed, good point. Patch committed in revision 891078.

          People

          • Assignee:
            Jukka Zitting
            Reporter:
            Ken Krugler
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development