×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    48

    Uncatchable exception using RecordStore??

    Hi everyone. I've a very strange problem with RecordStore.
    In my MIDlet I download a file and then I save it in the RecordStore.

    If the file is too large the method addRecord(....) seems to throw an exception
    cause maybe it runs out of memory or space in the record store.
    The weird thing is that if I do:

    try{
    int index=0;
    index=rs.addRecord(.....);
    .......
    other istructions;

    }catch(Exception e){
    exception handler code
    }finally{
    do something
    }

    The "other istructions" are never executed and index is still 0, thus indicating that the addRecord throws some kind of exceptions , but the exception handler code is never executed too!!! while the "do something" code in the finally block is executed normally.
    WHAT THE HELL IS HAPPENING?? How can I catch this mysteriuos exception if not catching the type Exception??

    Thank u

  2. #2
    Nokia Developer Expert
    Join Date
    Jun 2005
    Posts
    923

    Re: Uncatchable exception using RecordStore??

    This seems to happen because you're running out of memory, and when this happens what's thrown by the platform is java.lang.OutOfMemoryError, which is an instance of Error, not Exception.

    That's why your handler code is not being executed. In order to have it catching this error, you should change your catch block to something like:

    Code:
    try {
    
    }
    catch(Throwable t) {
    //check whether t is an Error or Exception with instanceof
    }
    or you should catch the Error explicitly, like this:

    Code:
    try {
    
    }
    catch(OutOfMemoryError err) {
      // do something
    }
    Daniel

  3. #3
    Registered User
    Join Date
    May 2006
    Posts
    48

    Re: Uncatchable exception using RecordStore??

    Thank u very much! It works now

  4. #4
    Super Contributor
    Join Date
    Dec 2005
    Location
    Europe/Poland/Warsaw
    Posts
    1,699

    Re: Uncatchable exception using RecordStore??

    hi,
    @Paranoid_Android
    just as note, because you've mentioned that:
    RecordStore.getSizeAvailable()
    called prior to write operation into RMS,
    regards,
    Peter

Similar Threads

  1. RecordStore bug on Series 60
    By ncerezo2 in forum Mobile Java General
    Replies: 21
    Last Post: 2009-11-26, 10:12
  2. VS.Net 2003 Carbide 2.01 and epoc32.exe
    By ValentinK in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 2
    Last Post: 2007-01-12, 12:31
  3. RecordEnumeration throwing null pointer exception
    By kralvarado in forum Mobile Java General
    Replies: 2
    Last Post: 2006-04-13, 04:07
  4. Catching an exception
    By btnokdev in forum Mobile Java General
    Replies: 2
    Last Post: 2003-10-11, 14:45
  5. can not successfully link any sample using .NET
    By lobotomat in forum Symbian Tools & SDKs
    Replies: 2
    Last Post: 2002-08-20, 00:29

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •