Details
-
Type: Bug
-
Status: Closed
-
Priority: Default
-
Resolution: Fixed
-
Affects Version/s: 1.3.1
-
Fix Version/s: 1.3.3
-
Component/s: Message Generation
-
Labels:None
-
Environment:Java 6, Windows XP
Description
The FIXMessageDecoder.startsWith method has a bug, and the other functions in FIXMessageDecoder do not properly handle percolating the case back up to the caller. Specifically, if the pattern is matching against the end of a ByteBuffer it only matches the first character of the pattern. If the pattern doesn't match, there is no way to percolate a MessageDecoderResult.NOT_OK back up to the caller, it will just send back NEED_DATA.
It is best illustrated by running the following JUnit test
Paste into the FIXMessageDecoderTest class
public void testPatternMatching() throws Exception
{ decoder = new FIXMessageDecoder("UTF-16"); setUpBuffer("8=FIX.4.2\0019=12\00135=X\001108=30\0011wmyadz"); MessageDecoderResult decoderResult = decoder.decode(null, buffer, decoderOutput); assertEquals("wrong decoder result", MessageDecoderResult.NOT_OK, decoderResult); }