I'm getting an IOException of "File system error" using FileConnection.delete() SOMETIMES when I try to delete a file even though FileConnection.exists() says it exists. I've looked at the docs and tried several things, but I'm still getting the error. Here are my exists() and delete() functions:
Code:
// I call these functions like this:
if (exists(filename))
delete(filename); // BAM!....IOException!!
public static boolean exists(String qualifiedName) {
boolean ret = false;
String parsedQualifiedName = translateFilenameToRIM( qualifiedName );
try {
defaultDrive = pickADrive();
FileConnection fconn = (FileConnection) Connector.open("file:///" + defaultDrive + parsedQualifiedName );
ret = fconn.exists();
fconn.close();
}
catch (IOException ioe)
{
}
return ret;
}
public static boolean delete(String name) {
boolean ret = false;
String parsedName = translateFilenameToRIM( name );
try {
defaultDrive = pickADrive();
FileConnection fconn = (FileConnection) Connector.open("file:///" + defaultDrive + parsedName );
if (fconn.exists())
{
fconn.delete();
}
fconn.close();
ret = true;
}
catch (IOException ioe)
{
RimLogger.logErr("F Failed delete file: " + parsedName + " " + ioe.getMessage());
}
return ret;
}
Has anyone else seen this or can offer suggestions?
Thanks,
Ferrol Blackmon