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

Ask A Question

Stats

  • Questions 225k
  • Answers 225k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer On virtual lists, Windows fires RetrieveVirtualItem events in many strange… May 13, 2026 at 1:04 am
  • Editorial Team
    Editorial Team added an answer When you cast pointers across the hierarchy, actual numerical pointer… May 13, 2026 at 1:04 am
  • Editorial Team
    Editorial Team added an answer I will try to answer my own question after some… May 13, 2026 at 1:04 am

Related Questions

I am working on an application which accepts any uploaded CSV data, stores it
We have a current application where user login credentials are stored in a SQL
In several web application projects I've been a part of, the client asks to
I been working the whole week to troubleshot a production error. I have eventually
I'm working on an application that is supposed to create products (like shipping insurance

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.