DO NOT SUBMIT HELP REQUESTS TO JIRA.  INSTEAD USE THE MAILING LIST TO ASK FOR HELP.

QuickFIX/J

Potential null pointer in DataDictionary.isMsgField

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Trivial Trivial
  • Resolution: Fixed
  • Affects Version/s: 1.1.0
  • Fix Version/s: 1.2.1
  • Component/s: Metadata/Specs
  • Labels:
    None

Description

isMsgField uses single & after a null check - since & doesn't short circuit it throws null pointer if fields is null.

Change from:

    public boolean isMsgField(String msgType, int field) {
        Set fields = (Set) messageFields.get(msgType);
        return fields != null & fields.contains(new Integer(field));
    }

to

    public boolean isMsgField(String msgType, int field) {
        Set fields = (Set) messageFields.get(msgType);
        return fields != null && fields.contains(new Integer(field));
    }


Unit test - add the following to DataDictionaryTest.testDictionary()

        assertFalse(dd.isMsgField("UNKNOWN_TYPE", 1));


Activity

Hide
Toli Kuznets added a comment - 20/Jun/07 4:36 PM

Great catch, Brad!
fixed in rev 684

Show
Toli Kuznets added a comment - 20/Jun/07 4:36 PM Great catch, Brad! fixed in rev 684
Hide
Brad Harvey added a comment - 21/Jun/07 10:14 AM

Credit for the catch goes to IntelliJ IDEA's code analysis

Show
Brad Harvey added a comment - 21/Jun/07 10:14 AM Credit for the catch goes to IntelliJ IDEA's code analysis

People

Vote (0)
Watch (0)

Dates

  • Created:
    20/Jun/07 1:58 PM
    Updated:
    11/Feb/09 5:24 PM
    Resolved:
    20/Jun/07 4:36 PM