Anki-Android icon indicating copy to clipboard operation
Anki-Android copied to clipboard

[Bug] no such column: `_display_name`

Open david-allison opened this issue 1 year ago • 2 comments

2.17beta6

https://ankidroid.org/acra/app/1/bug/132527/report/6eb783db-db1f-4a4d-b53c-26882c956961

android.database.sqlite.SQLiteException: no such column: _display_name (code 1 SQLITE_ERROR[1]): , while compiling: SELECT _display_name FROM ClipboardImageTable WHERE (id=894) ORDER BY _data
	at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:186)
	at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:142)
	at android.content.ContentProviderProxy.query(ContentProviderNative.java:481)
	at android.content.ContentResolver.query(ContentResolver.java:1226)
	at android.content.ContentResolver.query(ContentResolver.java:1158)
	at android.content.ContentResolver.query(ContentResolver.java:1114)
	at com.ichi2.utils.ImportUtils$FileImporter.getFileNameFromContentProvider(SourceFile:25)
	at com.ichi2.utils.ImportUtils$FileImporter.getFileCachedCopy(SourceFile:1)
	at com.ichi2.utils.ImportUtils$FileImporter.getFileCachedCopy(SourceFile:5)
	at com.ichi2.utils.ImportUtils.getFileCachedCopy(SourceFile:1)
	at com.ichi2.anki.NoteEditor.onCollectionLoaded$lambda$11(SourceFile:48)
	at com.ichi2.anki.NoteEditor.m(SourceFile:1)
	at com.ichi2.anki.h5.onClick(SourceFile:1)
	at android.view.View.performClick(View.java:7792)
	at android.widget.TextView.performClick(TextView.java:16112)
	at com.google.android.material.button.MaterialButton.performClick(SourceFile:12)
	at android.view.View.performClickInternal(View.java:7769)
	at android.view.View.access$3800(View.java:910)
	at android.view.View$PerformClick.run(View.java:30218)
	at android.os.Handler.handleCallback(Handler.java:938)
	at android.os.Handler.dispatchMessage(Handler.java:99)
	at android.os.Looper.loopOnce(Looper.java:226)
	at android.os.Looper.loop(Looper.java:313)
	at android.app.ActivityThread.main(ActivityThread.java:8669)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)

david-allison avatar Feb 23 '24 05:02 david-allison

@david-allison I would like to work on this issue, please assign me the issue

javaman97 avatar Feb 23 '24 07:02 javaman97

Awesome, thanks!!!

david-allison avatar Feb 23 '24 08:02 david-allison

@david-allison Till now, I have setup the codebase on my local system and refer some previous similar bugs on Stack Overflow that suggests updating 'Database Version' will work and I did the same.

In ContentResolverUtilTest, I have also tested testViaMimeType() and it is passing the testcase.

How will I come to know that it is fixed, or I need to use some other way to check if it is completed or not ?

javaman97 avatar Feb 24 '24 02:02 javaman97

Which similar bugs did you discover on StackOverflow?

david-allison avatar Feb 24 '24 04:02 david-allison

Which similar bugs did you discover on StackOverflow?

@david-allison Not 100% exactly similar, but it will help with our issue.

https://stackoverflow.com/questions/16820106/android-database-sqlite-sqliteexception-no-such-column https://github.com/android/architecture-components-samples/issues/695

javaman97 avatar Feb 24 '24 09:02 javaman97

Neither of those are relevant

The error message is a generic problem: a column in SQLite can't be found

Focus your Google search on the column name.

I don't believe I found anything relevant when I looked, but have a cursory check

david-allison avatar Feb 24 '24 09:02 david-allison

Neither of those are relevant

The error message is a generic problem: a column in SQLite can't be found

Focus your Google search on the column name.

I don't believe I found anything relevant when I looked, but have a cursory check

https://stackoverflow.com/questions/59817509/android-database-sqlite-sqliteexception-no-such-column-bucket-display-name https://github.com/ankidroid/Anki-Android/issues/7748

javaman97 avatar Feb 24 '24 10:02 javaman97

The first isn't the correct column name, the second is

david-allison avatar Feb 24 '24 11:02 david-allison

The fix would be to return null if an exception is thrown:

https://github.com/ankidroid/Anki-Android/blob/041f9d113ecf5046b2575ca6e72498c497a8422e/AnkiDroid/src/main/java/com/ichi2/utils/ImportUtils.kt#L248-L257

david-allison avatar Feb 25 '24 03:02 david-allison

@david-allison Is it advisable to utilize a try-catch block?

DevP-ai avatar Feb 25 '24 11:02 DevP-ai

yes

david-allison avatar Feb 25 '24 11:02 david-allison

can i work on it?

DevP-ai avatar Feb 25 '24 11:02 DevP-ai

The issue's already assigned, it'd be best to give @javaman97 some time to work on it

david-allison avatar Feb 25 '24 11:02 david-allison

@david-allison I have fixed the issue, and I made the commit as well. I don't know why I am not able to push to my Repo. I am trying from past few hours.

Screenshot 2024-02-25 214132

I am trying to fix it ASAP.

javaman97 avatar Feb 25 '24 16:02 javaman97

What's the output of git remote -v?

david-allison avatar Feb 25 '24 16:02 david-allison

remote: Permission to ankidroid/Anki-Android.git denied to javaman97. fatal: unable to access 'https://github.com/ankidroid/Anki-Android.git/': The requested URL returned error: 403

Screenshot 2024-02-25 215106

Getting this error while pushing the commit to local branch and it is asking for GitHub Login Credentials still it is connected. Apart from it, I tried some other projects as well where I am committing and pushing the changes, its working fine.

@david-allison Please have a look !

javaman97 avatar Feb 25 '24 16:02 javaman97

I don't think you posted the output of git remote -v

Your issue is that you cloned upstream (ankidroid/Anki-Android), rather than your fork (javaman97/Anki-Android)

david-allison avatar Feb 25 '24 17:02 david-allison

@javaman97 Clone the repository using the following link: [email protected]:javaman97/Anki-Android.git

DevP-ai avatar Feb 25 '24 17:02 DevP-ai