Deprecated: Function get_magic_quotes_gpc() is deprecated in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 99

Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 619

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1169

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176
8000 Cursor returned by DatabaseAdapter seems volatile. · Issue #32 · androrm/androrm · GitHub
Nothing Special   »   [go: up one dir, main page]

Skip to content

Cursor returned by DatabaseAdapter seems volatile. #32

@OnlyInAmerica

Description

@OnlyInAmerica

First off, I love your work.
Calls to the ORM seems to behave reliably even when initiated from multiple threads. However I'm experiencing issues using Androrm's DatabaseAdapter with a ContentProvider.

An example:

public class OWContentProvider extends ContentProvider {
    public Cursor query(Uri uri, String[] projection, String selection,
        String[] selectionArgs, String sortOrder) {
      DatabaseAdapter adapter = DatabaseAdapter.getInstance(getContext().getApplicationContext());
      ...
      Cursor result = adapter.open().query(SQLString);
      adapter.close();  // I've tried removing this line and modifying DatabaseAdapter to never close it's connection
      return
    }
} 

Within a few requests this will inevitably produce a java.lang.IllegalStateException: attempt to re-open an already-closed object or a android.database.StaleDataException: Attempting to access a closed CursorWindow.Most probable cause: cursor is deactivated prior to calling this method. . If I call adapter.close() before returning I'll get the IllegalStateException pretty reliably.

Is there a preferred way to safely get a Cursor via androrm?

Example java.lang.IllegalStateException trace. The ContentProvider calls are coming from a Loader which is controlled by a AutoCompleteTextView.
12-23 01:17:11.155: E/AndroidRuntime(11696): java.lang.IllegalStateException: attempt to re-open an already-closed object: SQLiteQuery: SELECT _id, name FROM owrecordingtag where name LIKE "%p%" 12-23 01:17:11.155: E/AndroidRuntime(11696): at android.database.sqlite.SQLiteClosable.acquireReference(SQLiteClosable.java:55) 12-23 01:17:11.155: E/AndroidRuntime(11696): at android.database.sqlite.SQLiteQuery.fillWindow(SQLiteQuery.java:58) 12-23 01:17:11.155: E/AndroidRuntime(11696): at android.database.sqlite.SQLiteCursor.fillWindow(SQLiteCursor.java:151) 12-23 01:17:11.155: E/AndroidRuntime(11696): at android.database.sqlite.SQLiteCursor.onMove(SQLiteCursor.java:124) 12-23 01:17:11.155: E/AndroidRuntime(11696): at android.database.AbstractCursor.moveToPosition(AbstractCursor.java:214) 12-23 01:17:11.155: E/AndroidRuntime(11696): at android.database.CursorWrapper.moveToPosition(CursorWrapper.java:162) 12-23 01:17:11.155: E/AndroidRuntime(11696): at android.support.v4.widget.CursorAdapter.getItem(CursorAdapter.java:213) 12-23 01:17:11.155: E/AndroidRuntime(11696): at android.widget.AutoCompleteTextView.buildImeCompletions(AutoCompleteTextView.java:1122) 12-23 01:17:11.155: E/AndroidRuntime(11696): at android.widget.AutoCompleteTextView.showDropDown(AutoCompleteTextView.java:1082) 12-23 01:17:11.155: E/AndroidRuntime(11696): at android.widget.AutoCompleteTextView.updateDropDownForFilter(AutoCompleteTextView.java:971) 12-23 01:17:11.155: E/AndroidRuntime(11696): at android.widget.AutoCompleteTextView.onFilterComplete(AutoCompleteTextView.java:953) 12-23 01:17:11.155: E/AndroidRuntime(11696): at android.widget.Filter$ResultsHandler.handleMessage(Filter.java:285) 12-23 01:17:11.155: E/AndroidRuntime(11696): at android.os.Handler.dispatchMessage(Handler.java:99) 12-23 01:17:11.155: E/AndroidRuntime(11696): at android.os.Looper.loop(Looper.java:137) 12-23 01:17:11.155: E/AndroidRuntime(11696): at android.app.ActivityThread.main(ActivityThread.java:5039) 12-23 01:17:11.155: E/AndroidRuntime(11696): at java.lang.reflect.Method.invokeNative(Native Method) 12-23 01:17:11.155: E/AndroidRuntime(11696): at java.lang.reflect.Method.invoke(Method.java:511) 12-23 01:17:11.155: E/AndroidRuntime(11696): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 12-23 01:17:11.155: E/AndroidRuntime(11696): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 12-23 01:17:11.155: E/AndroidRuntime(11696): at dalvik.system.NativeStart.main(Native Method)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0