Closed Bug 51462 Opened 24 years ago Closed 24 years ago

error case: File.isDir returns 'false' for invalid parameter

Categories

(Core Graveyard :: Installer: XPInstall Engine, defect, P3)

defect

Tracking

(Not tracked)

VERIFIED INVALID

People

(Reporter: depman1, Assigned: dveditz)

Details

builds 2000-09-05-08-M18. all platforms.
1. Go to http://jimbob/trigger3.html
2. Enter f_fileop_fileisdirectory_err.xpi in URL field (http://jimbob/jars).
3. Trigger. OK.
4. Check logfile.
Result: Returns 'false' for invalid parameters (i.e. strings) to File.isDir
Expected: Error -208 (although the API returns a boolean, it still should catch 
invalid params and return the error).

script:

initInstall("Functional: f_fileop_fileisdirectory_err", "functional", "1.1.1.1", 
0);

err1 = File.isDirectory("myFile");
logComment("String input to File.isDirectory should return -208 = " + err1);

err2 = File.isDirectory(10);
logComment("Integer input to File.isDirectory should return -208 = " + err2);

err3 = File.isDirectory();
logComment("Empty input to File.isDirectory should return -208 = " + err3);

err4 = File.isDirectory(null);
logComment("Null input to File.isDirectory should return -208 = " + err4);

performInstall();
Sorry, only two values from a boolean. If it's a directory you get true, 
anything else you get false.  false by itself doesn't tell you what it is -- 
that's why isFile() and exists() are there, to help people narrow it down.
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → INVALID
But then this routine (and others that return booleans like File.isFile) isn't 
handling error conditions. 'False' then is either a syntax error or indicates 
the target is not a directory. It would be desirable for the script writer to 
know when the routine has an invalid input. Maybe it would be better if these 
routines returned an integer value and convert 1 & 0 to 'True' & 'False' 
respectively.
Changing QA Contact to David.  Ccing me.
QA Contact: jimmylee → depstein
They are supposed to handle error conditions just fine, they just don't report 
them. This is hardly unusual behavior, it is quite similar to the behavior of 
the underlying nsILocalFile API we are using.
.
Status: RESOLVED → VERIFIED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.