Cannot Delete RecordStore although RecordStore is closed already

Hi... my class has 2 methods which 1 of them saves image to RecordStore and the other one loads the saved image from RecordStore. In some conditions, some of the saved images need to be deleted from the RecordStore.
Well, i keep getting "javax.microedition.rms.RecordStoreException: deleteRecordStore error: record store is still open". I'm pretty sure i have closed the RecordStore but it just can't be deleted.
Below is the excerpt of my code. Since my original code is very long, i just enter the 3 relevant methods. Please kindly help. :)
  //A function to load image from the memory
    public Image LoadImage(int width, int height, String imageCid) throws RecordStoreException {
      rs = RecordStore.openRecordStore(imageCid, true);
        byte[] b = null;
        String imagename = null;
        Image image = null;
        if (rs.getNumRecords() > 0) {
            try {
                int i = rs.getNumRecords();
                for(int j = 1; j < i + 1; j++) {
                    if(rs.getRecord(j) != null) {
                        b = rs.getRecord(j);
                        ByteArrayInputStream  bin =
                            new ByteArrayInputStream( b );
                        DataInputStream   din = new DataInputStream( bin );
                        imageCid = din.readUTF();
                        int remaining =
                            (b.length-imageCid.getBytes().length-2)/4;
                        int[] rawdata = new int[remaining];
                        for(int k =0 ;k<rawdata.length ;k++) {
                            rawdata[k] = din.readInt();
                        image = Image.createRGBImage(rawdata,
                            width, height, false);
                        bin.reset();
                        din.close();
                        din =null;
            } catch (IOException e) {
                e.printStackTrace();
            } catch(RecordStoreException recordstoreexception) {
                recordstoreexception.printStackTrace();
            finally {
                System.out.println("Banner LoadImage - closing RecordStore of " + imageCid);
                 rs.closeRecordStore();
                 rs = null;
        return image;
//A function to save image to the memory of the device
    public boolean SaveImage (Image img, int width,
            int height, String imageCid) throws RecordStoreException {
          rs = RecordStore.openRecordStore(imageCid, true);
        if (img == null || width < 0 || height < 0 || imageCid == null) {
            throw new IllegalArgumentException("Check arguments");
        int[] imgRgbData = new int[width * height];
        try {
            img.getRGB(imgRgbData, 0, width, 0, 0, width, height);
        } catch (Exception e) {
            // Problem getting image RGB data
            return false;
        try {
            // Write image data to output stream (in order to get
            // the record bytes in needed form)
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            DataOutputStream dos = new DataOutputStream(baos);
            dos.writeUTF(imageCid);
            for (int i = 0; i < imgRgbData.length; i++) {
                dos.writeInt(imgRgbData);
// Open record store, create if it doesn't exist
rs.addRecord(baos.toByteArray(), 0,
baos.toByteArray().length); // Add record
} catch (RecordStoreNotFoundException rsnfe) {
// Record storage not found
System.out.println("Banner SaveImage - RecordStoreNotFound");
System.out.println("Banner SaveImage - closing RecordStore of " + imageCid);
rs.closeRecordStore();
rs = null;
return false;
} catch (RecordStoreException rse) {
// Other record storage problem
System.out.println("Banner SaveImage - RecordStoreNotException");
System.out.println("Banner SaveImage - closing RecordStore of " + imageCid);
rs.closeRecordStore();
rs = null;
return false;
} catch (IOException ioe) {
// Problem writing data
System.out.println("Banner SaveImage - IOException");
System.out.println("Banner SaveImage - closing RecordStore of " + imageCid);
rs.closeRecordStore();
rs = null;
return false;
System.out.println("Banner SaveImage - closing RecordStore of " + imageCid);
rs.closeRecordStore();
rs = null;
System.out.println("Banner SaveImage - OK");
return true; // We've successfuly done
//Delete stored image based on campaignId
private void DeleteStoredImage (String imageCid) throws RecordStoreException {
if (RecordStore.listRecordStores() != null) {
RecordStore.deleteRecordStore(imageCid);

I don't know if it's still relevant, but cut there be a situation where you open the recordstore and don't close it? Because when you open the same recordstore twice and close it just one time then you can get this exception... I see you open the recordstore outside the try block and close it in the finally block. so just looking at your if condition makes it pretty clear that when you have no records in your recordstore and you try to load the images, then the RMS doesnt get closed... and when you then try to delete it, it will give you the RecordStoreException... So best would be to put the try also around the openrecordstore method

Similar Messages

  • Deleting RecordStore..

    when I try to delete RecordStore with
    RecordStrore.deleteRecordStore("recordstorename");
    it gives RecordStoreNotOpen Exception. record store still open
    -> could any one suggest me a way to get rid of this problem. so tht if recordStore is already open by any process , close it first and delete the records..??

    Yes

  • CS4 "Already in use cannot delete" over network problem

    Hello,
    I am having a problem with a Mac on OS X not being able to open or delete any .ai files over a network on a Dell Server running Windows Server 2008. If we try to open or delete the file I get an error message "Already in use cannot delete". Also, I get a "cannot complete copy" error too. Whats weird is that both machines can see each other over the network and the Mac can read and write to all other files over the network. The server does not have anything adobe products installed at all. There is no other machine on the network that is causing these files to be in use. I have checked when the backups are done using Windows Server 2008 Backup and they are finished before anyone gets into the office, so I dont believe its the Backup program holding the files hostage. I have read in some areas that this may be a known flaw with NTFS formatting over a network, but im not sold on that idea yet.
    Any and all suggestions would be as useful to me as insulin right about now.

    Sorry one last thing. I can delete the files on the Server itself.

  • I cannot delete the old icloud account on my i5. I tried some trick but it says "your email had been already verified".. Now what to do?

    I cannot delete the old icloud account on my i5. I tried some trick but it says "your email had been already verified".. Now what to do? Please help

    Settings > iCloud > Select the Account > Delete Account

  • I have given my ipod touch4 to my grandson, but although I have reset factory settings, I cannot delete all my details eg visa details.  I have tried but it has upset my iphone and I lost my apple account on my iphone!! HELP.... please.

    have given my ipod touch4 to my grandson, but although I have reset factory settings, I cannot delete all my details eg visa details.  I have tried but it has upset my iphone and I lost my apple account on my iphone!! HELP.... please.

    Create an account for him. and use that.
    Create a NEW account/ID for her using these instructions. Make sure you follow the instructions. Many do not and if you do not you will not get the None option. You must use an email address that you have not used with Apple before. Make sure you specify a birthdate that results in being at least 13 years old
      Creating an iTunes Store, App Store, iBookstore, and Mac App Store account without a credit card
    More details of how:
      http://ipadhelp.com/ipad-help-tips-tricks/how-to-get-free-apps-from-the-app-stor e-without-a-credit-card/
    Erase the iPod by going to Settings>General>Reset>Erase all content and settings.

  • Cannot delete networks from already removed Demo VM's

    I have 2 networks that were created when I spun up 2 demo VM many months back and for some reason I cannot delete them give the below error
    Virtual network 'AX2012R3-Demo-R3DemoErik-0d6514cdf4197127' is in use and cannot be deleted.
    Virtual network 'AX2012R3-Demo-NHDOLC-60668dc52e30f509' is in use and cannot be deleted.
    The VM's, Disk and storage are all gone for many months?
    Any Ideas?

    Hi,
    From the error it appears that you may still have something yet to be deleted: What about a gateway, cloud service or website?
    Please review this article:
    https://msdn.microsoft.com/en-us/library/azure/dn195495.aspx?f=255&MSPPError=-2147217396
    Cheers
    Amjad

  • I cannot delete some songs from 4s and I already tried to sweep and delete will hook to my lap top

    I cannot delete some songs from my 4s phone and have tried all the suggestions posted.

    Hey uwscottc,
    Thanks for the question. I understand that you are experiencing issues with your iPhone in relation to music. Does the music that appeared on your device have a cloud symbol next to it when viewed in “Songs”? If so, it sounds like these songs are not yet downloaded to your phone. Instead, it sounds like you have the “Show All [Music]” setting enabled (by default in iOS 7):
    iPhone User Guide
    http://help.apple.com/iphone/7/
    Just show music that’s been downloaded from iCloud. Go to Settings > Music, then turn off Show All Music.
    Thanks,
    Matt M.

  • Cannot delete playlist from Walkman

    Hi - Just got a Z1 compact and went to put my micro sd card from my old phone into the sony. Everything is fine except i cannot delete playlists from the My Playlists section of Walkman. The playlists have no content in them, i can't add content to them, and i can't delete them. How do i get rid of them???? Suspect they have to be on the SD somewhere but cannot find them by searching the name or the file type .m3u. Any idea how i find and delete these ghost playlists?? thanks in advance!  

    Hi, I'd just like you to know that havin already tried EZ File Manager and manual deletion via USB I still couldn't delete certain non-working tracks from the Walkman app, and although I thought your advice seemed potentially dangerous, I tried it as you're a moderator so I trusted it was some 'combination' that was safe. Anyway, long story short I wiped all the media on my phone and SD, of which there was plenty, amassed over a lot of time (the music in particular). If I can't retrieve backups of the music, I'll be very angry with you. (The photos and videos were mostly backed up recently). I don't know if this was some weird, cruel joke for frustrated clueless phone users (not thinking straight late at night, in my case) but if it was, you've caused me to delete everything, and I hope you're happy with yourself. -Feargal

  • In Mail, one mailbox for Recovered Message (AOL) keeps showing 1 very large message that I cannot delete. How can I get rid of this recurring problem, please?

    In Mail on iMac, successfully running OS X Lion, one mailbox on My Mac for "Recovered Messages (from AOL)" keeps showing 1 very large message (more than 20 Mb) that I just cannot seem to delete. Each time I go into my In Box, the "loading" symbol spins and the message appears in the "Recovered Messages" mailbox. How can I get rid of this recurrent file, please?
    At the same time, I'm not receviving any new mails in my In Box, although, if I look at the same account on my MacBook Pro, I can indeed see the incoming mails (but on that machine I do not have the "recovery" problem).
    The help of a clear-thinking Apple fan would be greatly appreciated.
    Many thanks.
    From Ian in Paris, France

    Ian
    I worked it out.
    Unhide your hidden files ( I used a widget from http://www.apple.com/downloads/dashboard/developer/hiddenfiles.html)
    Go to your HD.
    Go to Users.
    Go to your House (home)
    there should be a hidden Library folder there (it will be transparent)
    Go to Mail in this folder
    The next folder ( for me ) is V2
    Click on that and the next one will be a whole list of your mail servers, and one folder called Mailboxes
    Click on that and there should be a folder called recovered messages (server) . mbox
    Click on that there a random numbered/lettered folder -> data
    In that data folder is a list of random numbered folders (i.e a folder called 2, one called 9 etc) and in EACH of these, another numbered folder, and then a folder called messages.
    In the messages folder delete all of the ebmx (I think that's what they were from memory, sorry I forgot as I already deleted my trash after my golden moment).
    This was GOLDEN for me. Reason being, when I went to delete my "recovered file" in mail, it would give me an error message " cannot delete 2500 files". I knew it was only 1 file so this was weird. Why 2500 files? Because if you click on the ebmx files like I did, hey presto, it turned out that they were ALL THE SAME MESSAGE = 2500 times. In each of those folders in the random numbers, in their related message folder.
    Now remember - DONT delete the folder, make sure you have gone to the message folder, found all those pesky ebmx files and deleted THOSE, not the folder.
    It worked for me. No restarting or anything. And recovered file. GONE.
    Started receiving and syncing mail again. Woohoo.
    Best wishes.

  • CUIC 8.5.2 Cannot delete reports

    Hi Team,
    I cannot delete some CUIC report in my stock folder as I get the message "Failed to delete the report. It may have already been deleted by another user."
    These reports were saved from the standard reports while the replication subscriber wasn't fully working.
    Any idea why I cannot delete these report as for now the subscriber is now on line ?
    Any help is very much appreciated
    Nick

      Hi Venkataramanan
    Thank you for helping me on this topic.
    Let me detail the test I made as I wanted to see how resilient was the replication process when the Publisher was off line. I have a CUIC 8.5.2 Publisher and a Subscriber running on my site with both database replicated.
    I disconnected the CUIC Publisher network cable, then I connected my IE web browser on the CUIC Subscriber admin web page.
    In the Stock Report I selected a report "Agent Temps Historique" (Agent Historical) and I filled in the requested information @start_date, @end_date et @agent_list before lauching the report. (At this stage the report was running fine.)
    Then I selected the “SaveAS” button and filled in the Name, Report category and the group permission and clicked on the “OK” button.
    At that stage I got the following popup "Save operation failed (Retrieving filter by id java.lang.NullPointerException))".
    However the report with the new name was saved without any details in the @start_date, @end_date et @agent_list ) fields.
    Then, whenever I try to delete the « SaveAs » report I get another message : "Failed to delete the report. It may have already been deleted by another user"
    The same error message appears even when I put the Publisher back online, making sure that the replication is running (with the command “utils dbreplication runtimestate”). I also selected the button “Synchronise Cluster” with no improvement.
    See underneath the CUIC log (details attached) whenever I try to delete a report named "Test_Changement1" with the Publisher and the replication online:
    0000000118: 10.157.124.40: Sep 09 2011 14:12:20.165 +0200: %CCBU_CUIC_MODEL_OBJECTS-6-UPDATE_OBJECT: %[ARGUMENT=2A72597B10000132255734940A9D7C28][MARKER=START][OBJECT_TYPE=com.cisco.ccbu.cuic.webcontrollers.report.ReportManagerController]: UPDATE the specified object.
    0000000201: 10.157.124.40: Sep 09 2011 14:12:20.169 +0200: %CCBU___________CUIC-6-INFO:  Report '2A72597B10000132255734940A9D7C28' deleted <- CuicReportManagerImpl.java:555 [com.cisco.ccbu.cuic.businesslogic.report.CuicReportManagerImpl.deleteReport]
    0000000024: 10.157.124.40: Sep 09 2011 14:12:20.214 +0200: %CCBU_CUIC_DATA_PROCESSING-3-EXCEPTION: %[EXCEPTION=org.hibernate.ObjectDeletedException: deleted object would be re-saved by cascade (remove deleted object from associations): [com.cisco.ccbu.cuic.objectmodel.reportdefinition.CuicReportDefinitionFilterImpl#612BAF811000012D5C9A7D520A9D7C28]]: There was an exception that occurred.
    What bothers me is the fact that I cannot delete a report although I admit this report was saved in a awkward condition (users are not supposed to know whenever the Publisher is down). The Subscriber should refuse to save a new report whenever the Publisher is off line, if it cannot handle it.
    Note: I did the same kind of test (Publisher disconnected) while declaring new users on a Subscriber. I didn’t get any error at all. When I re-connected the Publisher the users were properly replicated.
    To answer your questions:
    1) Did you refresh the report page to see if your reports still exist under STOCK category?
    Yes
    2) Is there anyother user trying to delete the same report?
    No

  • Cannot delete file from external hard drive (error code 36) in Finder, but Terminal is ok

    I have a relatively new Macbook Pro Retina 15" and have a Western Digital 1 TB Passport.  I've been using the passport for about a year now without any problems on older Macbooks in my house.  I used to be able to read and write to this drive no problem.  I am using the Paragon NTFS for Mac software in order to read and write to the NTFS drive.  When I navigate through the drive in Finder, if I try to create a new folder, I do not have a problem.  If I try to delete that folder I just created, I get this error:
    The Finder can’t complete the operation because some data in “untitled folder” can’t be read or written.
    (Error code -36)
    The folder has nothing in it whatsoever.  I just created it.  But if I go to Terminal and I run
    rm -rf "untitled folder"
    This works fine.  Why is Terminal acting different than Finder?  This does not happen on my other Macbooks.  Thanks in advance.

    Thanx for such qucik reply!!! The pages were great, it had an answer for my problem, but unfortunately it also involved me dealing with it only on the MacIntosh HD itself, not on mounted external drive I suppose... So it didn't work they say that there is an icon in the left corner indicating locked folder - I don't see any icon on it. It says you can untick the box to unlock the folder - there is no tick to be unticked. Finally, they say that if I don't have permition or rights I cannot delete it. But how do i change permittion which already says that i can read and write in it? So everything appears to be normal only I cannot delete it. there is not even any warnig telling me I don't have enough rights, it just requires the password and after me typing it in it makes the sound of scraping paper but does nothing more. I aslo had some problems with emptying Trash after being seemingly succesful with one file and had got so far to have them appear in the Trash (no clue how this one actully got there though..) I followd the advice and emptied the Trash with Terminal. The Folder is still there but it shows 0 Kb... So far so good BUT: It is still on the external drive, so I obviously only managed to copy it into the Trash!!! Phew, innit a bit too tight to poor owners, this macbook?? I want my rights back!

  • Cannot Delete SMS Text Message From My Blackberry Curve -

    I cannot delete a SMS text message from my Blackberry Curve. What are some options I can try that would remove the text message?

    you already reset the device taking out the battery? if yes View your Saved Messages folder and see if it is also there
    If I help you with any inquire, thank you for click kudos in my post.
    If your issue has been solved, please mark the post was solved.

  • When I access my google e-mail account on the I-pad my inbox has at least 6 e-mails with no sender and no subject (absent via I-phone, Mac or PC) I cannot delete them as they cannot be selected- how do I stop them and clear the ones there now?

    When I access my google e-mail account on the I-pad my inbox has at least 6 e-mails with no sender and no subject (absent via I-phone, Mac or PC) I cannot delete them as they cannot be selected- how do I stop them and clear the ones there now?

    Try turning the account off and on : Settings > Mail, Contacts, Calendars , then tap the account on the right, slide Mail to 'off', exit settings and go back into the Mail app, and then go back to Settings and slide Mail back to 'on'
    If that doesn't work then try closing the Mail app completely : from the home screen (i.e. not with the Mail app 'open' on-screen) double-click the home button to bring up the taskbar, then press and hold any of the apps on the taskbar for a couple of seconds or so until they start shaking, then press the '-' in the top left of the Mail app to close it, and touch any part of the screen above the taskbar so as to stop the shaking and close the taskbar.
    Also do a reset : press and hold both the sleep and home buttons for about 10 to 15 seconds (ignore the red slider), after which the Apple logo should appear - you won't lose any content, it's the iPad equivalent of a reboot.

  • Cannot delete specific files.

    I am unable to delete certain files, but I can delete others. Finder says "The operation cannot be completed because the item...is in use." I have tried:
    *Alt+Empty Trash
    *Secure delete
    *Empty trash from the Terminal
    *Repair permissions
    *Verify disk
    *Various utilities (Trash it!, OnyX, etc.)
    *Restart
    *Closed all applications
    I have noticed that if I try to delete from the Terminal it says "rm: /Users/mymacrules/.Trash/Cannot Delete/nl.lproj: Directory not empty". I also tried to move one file that would not delete from the trash, this file disappears when I click on it, but is there after restart. As long as that specific file is on the desktop it also makes another folder disappear. Even though I can't see it in Finder I can see it with the "ls" command. Any ideas?

    mymacrules wrote:
    I have noticed that if I try to delete from the Terminal it says "rm: /Users/mymacrules/.Trash/Cannot Delete/nl.lproj: Directory not empty".
    Right. The rm command by default will not delete nonempty directories. To force it to, use the recursive flag:
    rm -r /Users/mymacrules/.Trash/Cannot Delete/nl.lproj
    But keep in mind that I'm just a Unix person...people like Joshz who know MacOS better than me may know good reasons to not use the Terminal to try to empty the trash.

  • Cannot delete file on windows

    WE have an application. This application processes a list of files in a directory. Once it has processed, it is deleted. We are using the File.delete() API to delete the file. This application works fine on Unix, but when run on Windows, the delete method returns false status. It cannot delete the file and neither does it throw the exception. Is there any way to find out why this delete is failing. We have no clue.

    Maybe the file you get by the new operation
    tion doesn't exist.
    Pls check the return value of the
    the File.exists();.I can't believe that
    your code failed to delete the file if the return
    value is true.sudhirkd never said delete() returned true when it shouldn't have. Regarding exists(), it returns the value that matches the file's actual existence in the file system. Please run the following code on a Windows system to check for yourself:
            java.io.File file = new File ("temp.file");
            java.io.FileWriter out = new FileWriter (file);
            System.out.println ("file.delete() returns: " + file.delete ());
            System.out.println ("file exists: " + file.exists ());
            out.close (); // THIS IS THE IMPORTANT BIT
            System.out.println ("out closed");
            System.out.println ("file.delete() returns: " + file.delete ());
            System.out.println ("file exists: " + file.exists ());it will return something like this:
    file.delete() returns: false
    file exists: true
    out closed
    file.delete() returns: true
    file exists: false
    Once again, note that it is the explicit close() of the file writer that matters here, not running System.gc(). Relying on garbage collector is a sign of very immature implementation and unprofessional programming style. Java programmers need to be as careful about releasing resources as C/C++ programmers -- just because the heap memory is handled for you automatically does not mean you could ignore file handles, temp files, socket handles, etc.
    The example applies to Windows. Explicitly closing file handles is equally important on UNIX as well. For example, failure to do so and relying on GC may cause a JVM process to run out of file handles very quickly [default max is ~20 on Solaris unless you explicitly increase the soft porcess limits].
    Vlad.

Maybe you are looking for

  • Why won't itunes work with windows 8.1?  i tunes can not locate my music.

    Why won't windows 8.1 let itunes locate my music?  I deleted and downloaded, still won't do it.  But like majic after I installed windows 8.1 my computer had a XBOX music player appear, that found my 3200 songs and it was able to play the entire libr

  • Iphone not showing up in device list

    my iphone is not showing up in itunes or preview.

  • Rescheduling of Production Orders using COHV

    Hi, My Client Requirement is:- There are more production orders . I have to reschedule that production order one after the other. When I change 1st production order by 2 days in future then all the production orders are reschedule after 1st productio

  • The connection parameters file could not be found

    Hi, I`m receiving the message "The connection parameters file could not be found" every time I try to access my local sybase data base from dbisqlc.exe. I work with Sebel 78 and I have entered as parameters my ID, my password and the path to the .dbf

  • The application acrobat quits Unexpectedly

    error listed below Date/Time: 2007-05-17 16:11:25.885 +0100 OS Version: 10.4.9 (Build 8P135) Report Version: 4 Command: Acrobat Path: /Applications/Adobe Acrobat 7.0 Professional/Adobe Acrobat 7.0 Professional.app/Contents/MacOS/Acrobat Parent: Windo