diff --git a/artio-codecs/src/main/java/uk/co/real_logic/artio/dictionary/generation/DecoderGenerator.java b/artio-codecs/src/main/java/uk/co/real_logic/artio/dictionary/generation/DecoderGenerator.java index 6c44c2f7cc..e49867b68f 100644 --- a/artio-codecs/src/main/java/uk/co/real_logic/artio/dictionary/generation/DecoderGenerator.java +++ b/artio-codecs/src/main/java/uk/co/real_logic/artio/dictionary/generation/DecoderGenerator.java @@ -2117,7 +2117,7 @@ protected boolean hasFlag(final Entry entry, final Field field) protected String resetTemporalValue(final String name) { - return resetNothing(name); + return resetStringBasedData(name); } protected String resetComponents(final List entries, final StringBuilder methods) diff --git a/artio-codecs/src/main/java/uk/co/real_logic/artio/dictionary/generation/Generator.java b/artio-codecs/src/main/java/uk/co/real_logic/artio/dictionary/generation/Generator.java index c0fd251f89..b4a77265dc 100644 --- a/artio-codecs/src/main/java/uk/co/real_logic/artio/dictionary/generation/Generator.java +++ b/artio-codecs/src/main/java/uk/co/real_logic/artio/dictionary/generation/Generator.java @@ -405,15 +405,6 @@ protected String hasField(final Entry entry) String.format(" %2$s boolean has%1$s;\n\n", name, scope); } - protected String resetNothing(final String name) - { - return String.format( - " public void %1$s()\n" + - " {\n" + - " }\n\n", - nameOfResetMethod(name)); - } - private boolean isNotResettableField(final String name) { return isDerivedField(name) || isPreCalculatedField(name); diff --git a/artio-codecs/src/test/java/uk/co/real_logic/artio/dictionary/ExampleDictionary.java b/artio-codecs/src/test/java/uk/co/real_logic/artio/dictionary/ExampleDictionary.java index 44d50ac6fd..f9bf351d36 100644 --- a/artio-codecs/src/test/java/uk/co/real_logic/artio/dictionary/ExampleDictionary.java +++ b/artio-codecs/src/test/java/uk/co/real_logic/artio/dictionary/ExampleDictionary.java @@ -102,6 +102,7 @@ public final class ExampleDictionary public static final String INT_ENUM_RF = "IntEnumRF"; public static final String CHAR_ENUM_RF = "CharEnumRF"; public static final String CURRENCY_ENUM_RF = "CurrencyEnumRF"; + public static final String UTC_TIMESTAMP_RF = "UtcTimestampRF"; public static final String STRING_ENUM_REQ = "stringEnumReq"; public static final String INT_ENUM_REQ = "intEnumReq"; @@ -454,7 +455,7 @@ public final class ExampleDictionary public static final String RF_ALL_FIELDS = "8=FIX.4.4\0019=0057\00135=Z\001700=one\001701=10\001702=b\001703=123.456\001" + - "704=one\001705=10\001706=b\001707=GBP\00110=209\001"; + "704=one\001705=10\001706=b\001707=GBP\001708=20240611-14:35:58.012\00110=209\001"; public static final String RF_NO_FIELDS = "8=FIX.4.4\0019=0049\00135=Z\00110=209\001"; @@ -706,6 +707,7 @@ private static Dictionary buildMessageExample() .addValue("a", "APPLE").addValue("b", "BANANA")); allReqFieldTypesMessage.requiredEntry(registerField(messageEgFields, 707, CURRENCY_ENUM_RF, CURRENCY) .addValue("USD", "US_Dollar").addValue("GBP", "Pound")); + allReqFieldTypesMessage.requiredEntry(registerField(messageEgFields, 708, UTC_TIMESTAMP_RF, UTCTIMESTAMP)); final Message anyFieldsMessage = new Message(ANY_FIELDS_MESSAGE_NAME, ANY_FIELDS_MESSAGE_TYPE, "app"); anyFieldsMessage.requiredEntry(registerField(messageEgFields, 5005, "LongField2", LONG)); diff --git a/artio-codecs/src/test/java/uk/co/real_logic/artio/dictionary/generation/AbstractDecoderGeneratorTest.java b/artio-codecs/src/test/java/uk/co/real_logic/artio/dictionary/generation/AbstractDecoderGeneratorTest.java index 72fd13eaf1..466bf8d716 100644 --- a/artio-codecs/src/test/java/uk/co/real_logic/artio/dictionary/generation/AbstractDecoderGeneratorTest.java +++ b/artio-codecs/src/test/java/uk/co/real_logic/artio/dictionary/generation/AbstractDecoderGeneratorTest.java @@ -198,6 +198,18 @@ public void shouldNotRetainStringFromPreviousMessagesForRequiredFieldsWhenReset( assertEquals("", getMethod(decoder, STRING_RF + "AsString")); } + @Test + public void shouldNotRetainUtcTimestampFromPreviousMessagesForRequiredFieldsWhenReset() throws Throwable + { + final Decoder decoder = createRequiredFieldMessageDecoder(); + decode(RF_ALL_FIELDS, decoder); + assertEquals("20240611-14:35:58.012", getMethod(decoder, UTC_TIMESTAMP_RF + "AsString")); + + decoder.reset(); + decode(RF_NO_FIELDS, decoder); + assertEquals("", getMethod(decoder, UTC_TIMESTAMP_RF + "AsString")); + } + @Test public void shouldNotRetainIntegerFromPreviousMessagesForRequiredFieldsWhenReset() throws Throwable {