Closed
Bug 201326
Opened 22 years ago
Closed 22 years ago
Rhino should be able to coerce JavaScript Date to Java Date
Categories
(Rhino Graveyard :: Core, defect)
Tracking
(Not tracked)
VERIFIED
FIXED
1.5R5
People
(Reporter: hannesw, Assigned: norrisboyd)
Details
Attachments
(1 file, 1 obsolete file)
3.73 KB,
patch
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3b) Gecko/20030210
Build Identifier: Rhino 1.5R4
Rhino does not coerce JavaScript Date objects to Java Date objects when calling
Java methods that take java.util.Date as parameter. I think that coercion would
be both quite simple and useful.
Reproducible: Always
Steps to Reproduce:
js> var d = new Date();
js> var f = new java.text.SimpleDateFormat();
js> f.format(d);
js: "<stdin>", line 18: uncaught JavaScript exception:
java.lang.IllegalArgumentException: Cannot format given Object as a Date
Comment 1•22 years ago
|
||
cc'ing Igor -
Summary: rhino should be able to coerce JavaScript Date to Java Date → Rhino should be able to coerce JavaScript Date to Java Date
Reporter | ||
Comment 2•22 years ago
|
||
I've found the problem fairly easy to fix. This patch works well for me, would
be nice if it was applied to CVS.
Comment 3•22 years ago
|
||
The patch changes includes the new DataClass field in ScriptRuntime to use it
in NativeJavaObject, a direct access method to NativeDate time and if-sequence
optimization in coerceType.
Attachment #120192 -
Attachment is obsolete: true
Comment 4•22 years ago
|
||
I commited the above patch:
js> var d = new Date();
js> var f = new java.text.SimpleDateFormat();
js> f.format(d);
4/12/03 12:49 PM
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Comment 5•22 years ago
|
||
Verified FIXED:
------------------------------ BEFORE ------------------------------
js> var d = new Date();
js> var f = new java.text.SimpleDateFormat();
js> f.format(d);
js: "<stdin>", line 3: uncaught JavaScript exception:
java.lang.IllegalArgumentException: Cannot format given Object as a Date
------------------------------ AFTER -------------------------------
js> var d = new Date();
js> var f = new java.text.SimpleDateFormat();
js> f.format(d);
4/12/03 6:14 PM
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•