Fixed invalid expiration date bug in Create/Update Legal Tag API calls
Compare changes
Files
4@@ -2,13 +2,17 @@ package org.opengroup.osdu.legal.tags.dto;
@@ -32,8 +36,10 @@ public class UpdateLegalTag {
\ No newline at end of file
When given a long number for ExpirationDate e.g. 5555555555555555 deserializer converts it in a date (178018-07-19) with 6 digit year value. Although Legal tags get created with this date value but Get call later fails because the method expects the date to be in the "yyyy-mm-dd" format. Please refer the link below for details of issue.
Added method to validate length of year part in deserialized expiration date passed for create/update legal tag. If the year length is not equal to 4 request fails with code 400 and Message ""Expiration Date has invalid year <year part>."
Annotation to deserialize the date was missing in model used for Update Legal Tag. so added that as well.
Added unit test to test the expected behavior if a large numeric value is passed for ExpirationDate.
Added unit test for model UpdateLegalTag to test ExpirationDateDeserializer is correctly deserializing the expiration date and @JsonFormat annotation correctly formats the expiration date during deserialization.
(If it’s long, please paste to https://ghostbin.com/ and insert the link here.)