Hi,
I have replicated the behavior (as I was suspecting, it's happening only with 
XML) via this simple snippet:

https://paste.apache.org/308ln

Essentially, dropping ".000" is part of the default JAXB date serialization.

To change this, the approach described in

https://www.baeldung.com/jaxb#complex-data-types

should be taken.

However, I'd see it as an improvement rather than an actual bug; anyway, please 
go and open an issue on JIRA (don't forget to link to this discussion).

Regards.

On 11/02/20 09:32, [email protected] wrote:
> Hi Francesco,
>
> This problem is NOT happening every time...  In fact, it has only occurred 
> ONCE so far, and I have been doing a LOT of testing since then, to try to 
> reproduce it, but so far, I have not been able to replicate the problem.
>
> Luckily I did save off the response where we saw the original problem, and am 
> pasting a snippet here:
>
> <?xml version="1.0" encoding="UTF-8"?><syncope21:execs 
> xmlns:syncope21="http://syncope.apache.org/2.1";><syncope21:exec 
> xmlns:syncope21="http://syncope.apache.org/2.1";><end>2020-02-10T15:44:34.398Z</end><start>2020-02-10T15:44:31Z</start><jobType>TASK</jobType><key>40af81b0-55e5-49eb-af81-b055e509ebf6</key><message>Users
>  [created/failures]: 0/0 [updated/failures]: 10/0 [deleted/failures]: 0/0 [no 
> operation/ignored]: 0/0
> Groups [created/failures]: 0/0 [updated/failures]: 0/0 [deleted/failures]: 
> 0/0 [no operation/ignored]: 0/0
>
> Users updated:
> UPDATE SUCCESS (key/name): 1e3bda54-10f5-42df-bbda-5410f592df92/newfimtest80
> UPDATE SUCCESS (key/name): 45defb26-d1da-4f28-9efb-26d1dabf28c1/newfimtest81
> ...
> UPDATE SUCCESS (key/name): a480aa66-031d-43e7-80aa-66031dd3e7ce/newfimtest89
> </message><refDesc>PULL Task 6cef6cfd-4c73-4224-af6c-fd4c733224c7 
> 1_Add_New_Users_To_Active</refDesc><refKey>6cef6cfd-4c73-4224-af6c-fd4c733224c7</refKey><status>SUCCESS</status></syncope21:exec></syncope21:execs>
>
>
> Note the <start> and <end> timestamps and the missing millisecs component of 
> the timestamp in the <start> time (but not in the <end> time):
>
> <start>2020-02-10T15:44:31Z</start>
>
> vs.
>
> <end>2020-02-10T15:44:34.398Z</end>
>
> I *SUSPECT* that something in the Syncope code, or maybe in some library you 
> are using, is dropping the millesecs part of the timestamp, and if I had to 
> get, this may possibly be happening when the millisecs component of the 
> timestamp is ".000". 
>
> For now, we are modifying our code that is processing the responses, by 
> detecting the missing millisecs component of the timestamp, and then 
> replacing it with ".000Z", but in order to confirm that we are working on the 
> correct "assumption" (i.e., that in this case, the millisecs should be 
> .000Z), we want to confirm with you if what we suspect (that the millisecs 
> should be like ".000Z") is correct?
>
> As you may infer, if our guess is correct, I think that it would be very 
> difficult to replicate the problem at-will, so I think that the answer to 
> that would probably has to come from the Syncope code (or some library that 
> is being used), rather in a test.
>
> Thanks,
> Jim
>
>
>
>
> On Tuesday, February 11, 2020, 7:32:21 AM UTC, Francesco Chicchiriccò 
> <[email protected]> wrote:
>
>
> Hi,
> when calling the public demo (2.1.6-SNAPSHOT) as follows:
>
> curl -X GET 
> "https://syncope-vm.apache.org/syncope/rest/tasks/executions/recent?max=1"; 
> <https://syncope-vm.apache.org/syncope/rest/tasks/executions/recent?max=1> -H 
> "accept: application/json"
>
> response is
>
> [
>   {
>     "start": "2020-02-11T04:01:20.034+0000",
>     "end": "2020-02-11T04:01:20.411+0000",
>     "key": "3f227324-b763-4c2f-a273-24b7634c2f7e",
>     "jobType": "TASK",
>     "refKey": "e1e520f0-2cbd-4e11-9a89-ea58a0f957e7",
>     "refDesc": "NOTIFICATION Task e1e520f0-2cbd-4e11-9a89-ea58a0f957e7 ",
>     "status": "SENT",
>     "message": "FROM: [email protected]\nTO <mailto:[email protected]\nTO>: 
> [email protected]\nSUBJECT <mailto:[email protected]\nSUBJECT>: 
> Notification for SYNCOPE-81\n\nNOTIFICATION-81\n\nNOTIFICATION-81\n"
>   }
> ]
>
> e.g. start timestamp has milliseconds, as expected.
>
> Same happens with application/xml:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <syncope21:execs xmlns:syncope21="http://syncope.apache.org/2.1"; 
> <http://syncope.apache.org/2.1>>
>   <syncope21:exec xmlns:syncope21="http://syncope.apache.org/2.1"; 
> <http://syncope.apache.org/2.1>>
>     <end>2020-02-11T04:01:20.411Z</end>
>     <start>2020-02-11T04:01:20.034Z</start>
>     <jobType>TASK</jobType>
>     <key>3f227324-b763-4c2f-a273-24b7634c2f7e</key>
>     <message>FROM: [email protected] <mailto:[email protected]>
> TO: [email protected] <mailto:[email protected]>
> SUBJECT: Notification for SYNCOPE-81
>
> NOTIFICATION-81
>
> NOTIFICATION-81
> </message>
>     <refDesc>NOTIFICATION Task e1e520f0-2cbd-4e11-9a89-ea58a0f957e7 </refDesc>
>     <refKey>e1e520f0-2cbd-4e11-9a89-ea58a0f957e7</refKey>
>     <status>SENT</status>
>   </syncope21:exec>
> </syncope21:execs>
>
> and application/yaml:
>
> ---
> - start: 1581393680034
>   end: 1581393680411
>   key: "3f227324-b763-4c2f-a273-24b7634c2f7e"
>   jobType: "TASK"
>   refKey: "e1e520f0-2cbd-4e11-9a89-ea58a0f957e7"
>   refDesc: "NOTIFICATION Task e1e520f0-2cbd-4e11-9a89-ea58a0f957e7 "
>   status: "SENT"
>   message: "FROM: [email protected]\nTO <mailto:[email protected]\nTO>: 
> [email protected]\nSUBJECT <mailto:[email protected]\nSUBJECT>: 
> Notification\
>     \ for SYNCOPE-81\n\nNOTIFICATION-81\n\nNOTIFICATION-81\n"
>
> Regards.
>
> On 10/02/20 19:07, [email protected] <mailto:[email protected]> wrote:
> Hi,
>
> We are using the Syncope 2.1.5 API, and we send a GET request to the 
> tasks/executions/recent/?max=1 URI, and we get a response message that 
> includes the <start> and <end> elements, which have the start and ending 
> timestamps.  These ending part of these timestamps are supposed to be 
> formatted:
>
> H:M:S.fZ
>
> e.g.:
>
> ...T13:02:35.12345Z
>
> but we noticed in one case so far at least we got a response that had this 
> format
>
> ...T13:02:35Z
>
> In other words, the msecs part was completely missing!
>
> Is this (dropping the msecs part of the timestamp) intentional? 
>
> I am guessing (just a guess) that it is being dropped because possibly the 
> msecs part is like ".00000"? 
>
> Is that the correct?
>
> Or is this a bug in Syncope 2.1.5 REST API?
>
> Thanks,
> Jim

-- 
Francesco Chicchiriccò

Tirasa - Open Source Excellence
http://www.tirasa.net/

Member at The Apache Software Foundation
Syncope, Cocoon, Olingo, CXF, OpenJPA, PonyMail
http://home.apache.org/~ilgrosso/

Reply via email to