Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 20
Registered: ‎11-17-2008
My Device: Not Specified
Accepted Solution

IOException: Error decrypting header

Hello,

 

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)
#PVer: 4.2.0.323
#AVer: 5.0.0.713

S Java Exception - IOException - 6/16 13:57:48
| Error decrypting header
| net_rim_os-2(4BEF0320)
|  PosixFileInputStream
|  <init>
|  0x8051
| net_rim_os-2(4BEF0320)
|  PosixFileConnection
|  <private>
|  0x7699
| net_rim_os-2(4BEF0320)
|  PosixFileConnection
|  <private>
|  0x7252
| net_rim_os-2(4BEF0320)
|  PosixFileConnection

|  fileSize
|  0x627C

 

Code is just simple:

 

                    fc = (FileConnection) Connector.open(path);
                    long fileSize = fc.fileSize();

 

 

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?

 

 

 

Thank you,

 

Dima Kornilov - Developer.

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: IOException: Error decrypting header

I don't think this is the problem in your case, but the only time I remember seeing this error was when i was reading a non gzipped file using a gzip stream. 

Developer
Posts: 20
Registered: ‎11-17-2008
My Device: Not Specified

Re: IOException: Error decrypting header

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.

http://www.blackberry.com/developers/docs/5.0.0api/javax/microedition/io/file/FileConnection.html#fi...

 

All this makes me think that this is a bug in API, but I wonder how to fix it.

Highlighted
Developer
Posts: 1,474
Registered: ‎04-14-2009
My Device: Not Specified

Re: IOException: Error decrypting header

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.