Skip to content

Commit 1f31cff

Browse files
authored
fixing bug when checking tag 10 existence during tests (#552)
1 parent 0ef1963 commit 1f31cff

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

artio-system-tests/src/test/java/uk/co/real_logic/artio/system_tests/FixConnection.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ public final class FixConnection implements AutoCloseable
5757

5858
public static final String PROXY_V2_IPV6_SOURCE_IP = "fdaa:bbcc:ddee:0:5e8:349b:d23d:f168";
5959
public static final int PROXY_V2_IPV6_SOURCE_PORT = 44858;
60+
public static final int CHECKSUM_LENGTH = 3;
61+
public static final int TAG10_VALUE_OFFSET = 4;
6062

6163
private final ByteBuffer writeBuffer = ByteBuffer.allocateDirect(BUFFER_SIZE);
6264
private final MutableAsciiBuffer writeAsciiBuffer = new MutableAsciiBuffer(writeBuffer);
@@ -427,7 +429,9 @@ public <T extends Decoder> T readMessage(final T decoder)
427429
private static int getEndOfTag10(final String ascii)
428430
{
429431
final int tag10Index = ascii.indexOf("\00110=");
430-
return tag10Index == -1 ? -1 : ascii.indexOf("\001", tag10Index + 4) + 1;
432+
return tag10Index == -1 || tag10Index + TAG10_VALUE_OFFSET + CHECKSUM_LENGTH > ascii.length() ?
433+
-1 :
434+
ascii.indexOf("\001", tag10Index + TAG10_VALUE_OFFSET) + 1;
431435
}
432436

433437
int pollData() throws IOException

0 commit comments

Comments
 (0)