06-17-2010 03:56 AM
My application tries to get size of some files on Media Card. When it tries to read some of them on Storm 2, I got this exception when calling FileConnection.fileSize() method:
#BlackBerry Event Log (cpt)
S Java Exception - IOException - 6/16 13:57:48
| Error decrypting header
Code is just simple:
FileConnection fc = (FileConnection) Connector.open(path); long fileSize = fc.fileSize(); // IOException: Error decrypting header
What is the cause of this exception? How can I fix it?
Dima Kornilov - Developer.
Solved! Go to Solution.
06-17-2010 05:16 AM
Thank you for response peter_strange.
I never seen that before, but call stack on real handheld says that fileSize() threw this exception. I don't use gzip or other streams except InputStream and DataInputStream. This issue is uncommon and I can't reproduce it on my side, this is report from one of users.
Accordingly to BB API, FileConnection.fileSize() should throw IOException if and only if the method is invoked on directory.
All this makes me think that this is a bug in API, but I wonder how to fix it.
06-18-2010 08:27 AM
Are you by any chance reading a content-protected file by any chance? May be the OS attempts to read the file as a DRM forward-locked file but the file is not such a file or comes from a different BlackBerry. One thing to check would be whether the file has a .rem extension if you mount the file system via USB Mass Storage.