Uploaded image for project: 'James Mime4j'
  1. James Mime4j
  2. MIME4J-200

Uninitialized Static Parser Fields Causes Class Cast & Null Pointer Exceptions

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.6.1
    • 0.7
    • parser (core)
    • None
    • Linux & Windows in Java

    Description

      The main problem is that e.g. the class ContentTypeField contains a static variable called 'PARSER' which is used by the class DefaultFieldParser. An instance of DefaultFieldParser is created and stored in a static variable in the class AbstractField. The class AbstractField is the base class of the class ContentTypeField. The effect of this is that under certain circumstances (since the static initialization in the base class happens first) the static variable 'PARSER' will be null (not yet initialized) when the class created in the base class reads the value of it.

      The above description is valid for all the different field classes that have a static 'PARSER' variable in them.

      This does not always manifest itself since it seems that in certain combinations of Java versions and/or operating systems the static variable initialization in the same inheritance hierarchy works differently.

      Attachments

        Activity

          People

            Unassigned Unassigned
            rekeroth Rickard Ekeroth
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: