DWR doesn't correctly serialize Date from other context/frame

Description

dwr.engine._searializeAll using instanceof fails to recognize a Date as a Date when it is comes from another context (frame). The problem was documented in bug # 135, and resolved in 2.0 rc5.

The latest stable 2.0 version has a fix for Array, but not for Date. Can someone please tell me if there is a newer version available with a fix for Date objects.

The issue is documented here:

https://dwr.dev.java.net/issues/show_bug.cgi?id=135
https://directwebremoting.atlassian.net/browse/DWR-13

thank you,

Stephen

Activity

Show:
Mike Wilson
July 7, 2007, 1:53 PM

There is still use of instanceof in _serializeAll, should be exchanged for context-agnotic tests instead:

case "object":
if (data instanceof String) batch.map[name] = "String:" + encodeURIComponent(data);
else if (data instanceof Boolean) batch.map[name] = "Boolean:" + data;
else if (data instanceof Number) batch.map[name] = "Number:" + data;
else if (data instanceof Date) batch.map[name] = "Date:" + data.getTime();

Mike Wilson
July 11, 2008, 12:21 PM

I think this issue was solved from my latest checkin on the multiple frames problem?

Brice Copy
August 12, 2008, 8:54 AM

Hello,
I believe the patch from Mike was applied to util.js, but not for the engine.

I'm attaching a patch for date handling in engine.js. It resolves the context frame issue, but we couldn't find an equivalent solution for Boolean (anyone has an idea ?).

The patch was done against tag 2.0.5 (revision 2079)

Mike Wilson
August 12, 2008, 2:56 PM

Brice,
Actually the fix I am mentioning in my comment on July 11 has already fixed the problem in engine.js, though the fix was checked in after 2.0.5 was released.
So there is not yet any released version with the fix. I will close this bug report pointing at 2.0.6 for clarity.
Best regards
Mike

Assignee

Mike Wilson

Reporter

Mike Wilson

Labels

None

Documentation Required

None

Components

Fix versions

Affects versions

Priority

Major
Configure