You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When autogenerating Java classes from a CRD yaml using maven plugin, the format being added in the JSON parser is this.
This, however, is not sufficient and fails for some of the valid timestamps with timezone offset like 2023-07-07T06:43:19+00:00, which would need the format to be yyyy-MM-dd'T'HH:mm:ssXXX(RFC standard).
Can we please either correct this to include more formats, or add an option to pass additional formats?
Fabric8 Kubernetes Client version
6.8.0
Steps to reproduce
Use the maven plugin to autogenerate classes from a CRD yaml with the following type for field:
type: string
format: date-time
Now try to parse resources with timestamps of format yyyy-MM-dd'T'HH:mm:ssXXX with these classes.
The following exception is thrown:
Caused by: com.fasterxml.jackson.databind.exc.InvalidFormatException: Cannot deserialize value of type `java.time.ZonedDateTime` from String "2023-07-07T06:43:19+00:00":
Failed to deserialize java.time.ZonedDateTime: (java.time.format.DateTimeParseException) Text '2023-07-07T06:43:19+00:00' could not be parsed, unparsed text found at index 22
Expected behavior
The timestamp should get parsed successfully into the relevant field.
Runtime
Kubernetes (vanilla)
Kubernetes API Server version
1.25.3@latest
Environment
Linux
Fabric8 Kubernetes Client Logs
com.fasterxml.jackson.databind.exc.InvalidFormatException: Cannot deserialize value of type`java.time.ZonedDateTime` from String "2023-08-07T06:43:19+00:00": Failed to deserialize java.time.ZonedDateTime: (java.time.format.DateTimeParseException) Text '2023-08-07T06:43:19+00:00' could not be parsed, unparsed text found at index 22
[1:18 pm, 11/08/2023]: org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:108)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88)
Caused by: com.fasterxml.jackson.databind.exc.InvalidFormatException: Cannot deserialize value of type`java.time.ZonedDateTime` from String "2023-08-07T06:43:19+00:00": Failed to deserialize java.time.ZonedDateTime: (java.time.format.DateTimeParseException) Text '2023-08-07T06:43:19+00:00' could not be parsed, unparsed text found at index 22
at [Source: (BufferedInputStream); line: 1, column: 3077] (through reference chain: io.fabric8.kubernetes.api.model.DefaultKubernetesResourceList["items"]->java.util.ArrayList[0]->com.example.v1.MyCRD["status"]-com.example.v1.mycrdstatus.Pod["last_updated"])
at com.fasterxml.jackson.databind.exc.InvalidFormatException.from(InvalidFormatException.java:67)
at com.fasterxml.jackson.databind.DeserializationContext.weirdStringException(DeserializationContext.java:1549)
at com.fasterxml.jackson.databind.DeserializationContext.handleWeirdStringValue(DeserializationContext.java:911)
at com.fasterxml.jackson.datatype.jsr310.deser.JSR310DeserializerBase._handleDateTimeException(JSR310DeserializerBase.java:80)
at com.fasterxml.jackson.datatype.jsr310.deser.InstantDeserializer.deserialize(InstantDeserializer.java:212)
at com.fasterxml.jackson.datatype.jsr310.deser.InstantDeserializer.deserialize(InstantDeserializer.java:50)
at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:127)
at io.fabric8.kubernetes.model.jackson.SettableBeanPropertyDelegate.deserializeAndSet(SettableBeanPropertyDelegate.java:134)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:288)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:127)
at io.fabric8.kubernetes.model.jackson.SettableBeanPropertyDelegate.deserializeAndSet(SettableBeanPropertyDelegate.java:134)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:288)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:127)
at io.fabric8.kubernetes.model.jackson.SettableBeanPropertyDelegate.deserializeAndSet(SettableBeanPropertyDelegate.java:134)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:288)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:286)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:245)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:27)
at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:127)
at io.fabric8.kubernetes.model.jackson.SettableBeanPropertyDelegate.deserializeAndSet(SettableBeanPropertyDelegate.java:134)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:288)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
at com.fasterxml.jackson.databind.ObjectReader._bindAndClose(ObjectReader.java:1611)
at com.fasterxml.jackson.databind.ObjectReader.readValue(ObjectReader.java:1188)
at io.fabric8.kubernetes.client.utils.KubernetesSerialization.unmarshal(KubernetesSerialization.java:254)
... 18 common frames omitted
Caused by: java.time.format.DateTimeParseException: Text '2023-08-07T06:43:19+00:00' could not be parsed, unparsed text found at index 22
at java.base/java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:2049)
at java.base/java.time.format.DateTimeFormatter.parse(DateTimeFormatter.java:1874)
at com.fasterxml.jackson.datatype.jsr310.deser.InstantDeserializer.deserialize(InstantDeserializer.java:206)
Additional context
No response
The text was updated successfully, but these errors were encountered:
Thanks a lot for taking the time to file this issue @sangeetas123 !
This is the second report of this kind (the other on SO), re-reading the spec again and now I understand that using an offset expressed with e.g. +00:00 is indeed valid.
Let me fix this!
Describe the bug
When autogenerating Java classes from a CRD yaml using maven plugin, the format being added in the JSON parser is this.
This, however, is not sufficient and fails for some of the valid timestamps with timezone offset like
2023-07-07T06:43:19+00:00
, which would need the format to beyyyy-MM-dd'T'HH:mm:ssXXX
(RFC standard).Can we please either correct this to include more formats, or add an option to pass additional formats?
Fabric8 Kubernetes Client version
6.8.0
Steps to reproduce
Use the maven plugin to autogenerate classes from a CRD yaml with the following type for field:
type: string
format: date-time
Now try to parse resources with timestamps of format
yyyy-MM-dd'T'HH:mm:ssXXX
with these classes.The following exception is thrown:
Expected behavior
The timestamp should get parsed successfully into the relevant field.
Runtime
Kubernetes (vanilla)
Kubernetes API Server version
1.25.3@latest
Environment
Linux
Fabric8 Kubernetes Client Logs
Additional context
No response
The text was updated successfully, but these errors were encountered: