0

I'm working on a back-end application deployed on RedHat OpenShift server. I've some trouble about dates management:

Regarding the type Date

 @XmlAttribute
 private Date date;

for example sending this json by rest:

 Payload: {"date_reservation":"2010-12-31"}

I can see on the server log that the date received is decrease by one day:

 Taking informations for resevations of: 2010-12-30

Locally everything works fine.

The server is working on Tomcat 7 (JBoss EWS 2.0). I tried modifying catalina.properties and the server date. The first operation doesn't seem to work, and second one isn't possible.

How can I solve this issue, or maybe find some type of workaround? Any advice is appreciated.

Request:

ID: 6
Address: **
Encoding: ISO-8859-1
Http-Method: POST
Content-Type: application/json
Headers: **
Payload: {"date_reservation":"2010-12-31"}

Server side logs:

2016-01-13 05:30:08 INFO  NightTimeGetAllReservationsAction:21 - Taking    reservations for date: 2010-12-30
2016-01-13 05:30:08 INFO  LoggingOutInterceptor:233 - Outbound Message

Server Response:

ID: 6
Response-Code: 200
Content-Type: application/json
Headers: {Date=[Wed, 13 Jan 2016 10:30:08 GMT]}
Payload: {"reservationList":[],"message":null}
Daniel Higueras
  • 2,404
  • 22
  • 34
ivoruJavaBoy
  • 1,307
  • 2
  • 19
  • 39
  • Your json data will not change unless you actually modified it. Something had to change it before your logging. – fat fantasma Jan 13 '16 at 16:19
  • Yep.. for sure. it has been changed automatically due to Openshift Server Configuration or Application Server configuration...but i need to understand how avoid it for testing purposes... – ivoruJavaBoy Jan 13 '16 at 16:29
  • I have never had Openshift change my json data. Are you sure you are not changing server-side yourself? If you are using OS in the US the server will have an East Coast timezone date. – fat fantasma Jan 13 '16 at 20:56
  • I'm in Italy, so it's normal dat the timezone is converted.... And moreover the same back end deployed locally does not give me this trouble... just when deployed on remote OpenShift server it converts any data... – ivoruJavaBoy Jan 14 '16 at 09:28
  • Please include the actual json data received by the server in your question. – fat fantasma Jan 14 '16 at 13:20
  • Thanks "fat fantasma"... i've added request, log and response – ivoruJavaBoy Jan 14 '16 at 13:43
  • I would actually like to see your json "payload" object right when your server receives it. Log that and post in your question. – fat fantasma Jan 14 '16 at 17:16
  • Phantoms, these logs are taken from JBOSS, defined by the Apache-CXF logs interceptors. – ivoruJavaBoy Jan 15 '16 at 09:43
  • I think it's about time zones. The Date class seems to be instantiated with no time zone information (UTC time) and when you're accessing it while generating the log message using something like `Date.toString()`, it will create a Calendar instance (this use the local server time zone) to interpret the Unix timestamp which is in the Date object. [This](http://stackoverflow.com/questions/4199217/what-time-zone-does-date-tostring-display) may help. – Jiri Fiala Jan 15 '16 at 13:17
  • For sure it's about timezones. But if I understand his question he is saying that the json data is changing when it is initially received by the server. That can't happen. His code/framework is changing it somewhere. – fat fantasma Jan 15 '16 at 15:46

0 Answers0