Greg McGowan
Greg McGowan

Reputation: 1360

Blackberry FileConnection illegalStateException

I am working on a Blackberry application that writes to the file system using the FileConnection interface.

I am getting a IllegalStateException when I try to call delete() on a certain file. The stack trace is as follows

IllegalStateException
    No detail message
    net_rim_os
     FileImpl
     remove
     0x373D
    net_rim_os-6
     ContentStoreConnection
     delete
     0x12DA
    com_companyName_blackberryClient-7
     FileUtility
     <private>
     0x14C6

The stack trace shows the exception occurs in remove() in FileImpl but I cannot find any information about this method anywhere (looks like it is a internal blackberry class)

The file is located in

file:///store/home/user/appName

Does anyone know why deleting a file from that directory would cause an illegalStateException?

We have only seen this problem once and it is proving hard to reproduce. The one occasion it did occur it is possible that there were other several other files being created and accessed in the same directory. Would this be a factor in the exception occurring?

The Blackberry OS version is 4.5.0.180 and the api version is 4.5.0

Upvotes: 1

Views: 417

Answers (1)

jprofitt
jprofitt

Reputation: 10964

Check that the file you are trying to delete is not open by another Thread. I've had this problem when forgetting to properly close() a FileConnection or InputStream in the past.

Upvotes: 2

Related Questions