Closed
Bug 229895
Opened 22 years ago
Closed 22 years ago
Unable to call java.io.File.delete() method
Categories
(Rhino Graveyard :: Core, defect)
Tracking
(Not tracked)
RESOLVED
INVALID
1.5R5
People
(Reporter: stephane.sr.riviere, Assigned: norrisboyd)
Details
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5) Gecko/20031007 Firebird/0.7
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5) Gecko/20031007 Firebird/0.7
I use Rhino in a standalone Java application, and the scripts mainly manipulate
Java objects.
It seems to be impossible to call the delete() methods on java.io.File objects.
Reproducible: Always
Steps to Reproduce:
1. Create a File object [ var photo = new java.io.File('/my/photo.jp'); ]
2. Try to delete it [ photo.delete(); ]
3. Compile & Run the script !
Actual Results:
An Exception is thrown :
SyntaxError: missing name after . operator (<myScript>; line 815)
at org.mozilla.javascript.NativeGlobal.constructError(NativeGlobal.java:597)
at org.mozilla.javascript.TokenStream.reportSyntaxError(TokenStream.java:1324)
...
Expected Results:
Compiled correctly and delete the file ?
| Reporter | ||
Comment 1•22 years ago
|
||
As I suspected, this is directly linked to the "delete" Javascript keyword.
I've found a workaround by using the array notation (I just use
photo['delete']() instead of photo.delete() ) but this gives a less-readable
script.
So, is a fix possible or would it require too much work, compared to the use of
array notation ?
At least, this should be clearly indicated somewhere in the documentation.
| Assignee | ||
Comment 2•22 years ago
|
||
Your diagnosis and workaround are correct. This behavior is mandated by the ECMA
spec, so there's no fix possible.
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•