• Post Reply Bookmark Topic Watch Topic
  • New Topic

XML Messages sends incorrect date  RSS feed

 
Fred Victa
Ranch Hand
Posts: 206
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a web service that sends XML messages to clients and I noticed that for a certain date/time tag, the date sometimes looks like the following: 0002-05-22. As you can see, the year is incorrect. Does anyone here know what could cause the year to look like that? My web service is getting the date from a database table and the dates in the database table are correct so it could not be bad data in the table.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Post the relevant code sections that are involved in transforming the date from the DB data into XML, if possible with one example each of a date that gets transformed correctly, and one that gets transformed incorrectly.
 
Fred Victa
Ranch Hand
Posts: 206
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:Post the relevant code sections that are involved in transforming the date from the DB data into XML, if possible with one example each of a date that gets transformed correctly, and one that gets transformed incorrectly.


Here is the code section that gets the date:

MyType myType = someType.addNewEvent();

WSDate wsDate = null;

wsDate = myDataObject.getDate();

if (dataIsPopulated(wsDate.getCalendar()))
{
myType.addNewDate().setDateTime(wsDate.getCalendar());
}

Here is the code that builds a portion of the XML file: (This code is from a different class.)

private MyDozerBean mapper = LoadDozer.getDozerMapper();

public void buildXML()
{

payload.setInfo((com.folder1.folder2.folder3.sampleClass) mapper.map(dataObject, com.folder1.folder2.folder3.sampleClass.class));

}


This is from the dozerBeanMapping file:

<mapping map-null="false" map-empty-string="false" type="one-way">
<class-a>folder1.folder2.folder3.folder4.folder5.myClass</class-a>
<class-b bean-factory="net.sf.dozer.util.mapping.factory.XMLBeanFactory">com.folder1.folder2.folder3.sampleClass</class-b>
</mapping>

Here are what the dates look like in my XML file:

<DateTime1>
<MyDateTime>0002-05-22T04:00:00-04:00</MyDateTime>
</DateTime1>
<DateTime2>
<MyDateTime>2013-05-24T03:00:00-04:00</MyDateTime>
</DateTime2>

 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you verified that the date gets correctly transferred to the WSDate object?

I take it "MyDateTime1" should start with "2013", like "MyDateTime2"?
 
Fred Victa
Ranch Hand
Posts: 206
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:Have you verified that the date gets correctly transferred to the WSDate object?

I take it "MyDateTime1" should start with "2013", like "MyDateTime2"?


Just to let you know, this error has occurred twice in the last month.

I ran the program in debug and it is getting correctly transferred to the WSDate object. I do not see the error anymore.

Someone suggested to me that the error occurred in the past because there could have been a memory management issue. Do you think that this is true? If so, how would I check to see if the Java program has a problem with memory management?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!