Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 460173
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T22:50:48+00:00 2026-05-12T22:50:48+00:00

I created an application which stores values into the database and retrieves the stored

  • 0

I created an application which stores values into the database and retrieves the stored data. While running an application in run mode everything seems to work fine (the values are stored and retrieved successfully) but when I run in the debug mode the process throws IllegalStateException and so far haven’t found a cause.

The method which retrieves an object Recording is the following:

public Recording getRecording(String filename) {

    Recording recording = null;
    String where = RECORDING_FILENAME + "='" + filename + "'";
    Log.v(TAG, "retrieving recording: filename = " + filename);

    try {
        cursor = db.query(DATABASE_TABLE_RECORDINGS, new String[]{RECORDING_FILENAME, RECORDING_TITLE, RECORDING_TAGS, RECORDING_PRIVACY_LEVEL, RECORDING_LOCATION, RECORDING_GEO_TAGS, RECORDING_GEO_TAGGING_ENABLED, RECORDING_TIME_SECONDS, RECORDING_SELECTED_COMMUNITY}, where, null, null, null, null);

        if (cursor.getCount() > 0) {
            cursor.moveToFirst();
            //String filename = c.getString(0);
            String title = cursor.getString(1);
            String tags = cursor.getString(2);
            int privacyLevel = cursor.getInt(3);
            String location = cursor.getString(4);
            String geoTags = cursor.getString(5);
            int iGeoTaggingEnabled = cursor.getInt(6);
            String recordingTime = cursor.getString(7);
            String communityID = cursor.getString(8);
            cursor.close();
            recording = new Recording(filename, title, tags, privacyLevel, location, geoTags, iGeoTaggingEnabled, recordingTime, communityID);
        }
    }
    catch (SQLException e) {
        String msg = e.getMessage();
        Log.w(TAG, msg);
        recording = null;
    }
    return recording;
}

and it is called from another class (Settings):

private Recording getRecording(String filename) {
    dbAdapter = dbAdapter.open();
    Recording recording = dbAdapter.getRecording(filename);
    dbAdapter.close();
    return recording;
}

While running through the code above everything works fine but then I notice an exception in another thread:
alt text http://img509.imageshack.us/img509/862/illegalstateexception.jpg

and don’t know neither what is the possible cause of this exception nor how to debug the code from that thread to diagnose the cause.

I would be very thankful if anyone knew what is the possible issue here.

Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T22:50:48+00:00Added an answer on May 12, 2026 at 10:50 pm

    Looks like that cursor.close() is inside an “if” – that’s when SQLiteCursor.finalize() will throw an IllegalStateException (I googled for it). You migh be getting an empty recordset, for instance, if some other process/thread didn’t have the time to commit.

    Close it always, even if it’s result set is empty.

    I’d also advice you to access fields by names, not indices, for future compatibility. And do both close()s in finally{} blocks.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have created an application which we want to run in a 64 bit
I am working on an offline-mode iPhone application in which the first time data
I am working on an application which accepts any uploaded CSV data, stores it
I created an application which has a menu where it's items are created dynamicly.
I have created an application which needs 'hand-over' to the support group in the
I have created an application which needs to have a profile box tab which
The company where I work created this application which is core to our business
I have created a small application which opens,reads and creates Excel files. The app
Some background: I've created a Swing application which uses the Substance LaF (Thanks again,
I'm developing an application which currently have hundreds of objects created. Is it possible

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.