Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

column '_data' does not exist #45

Closed
tsptoni opened this issue Feb 23, 2018 · 7 comments
Closed

column '_data' does not exist #45

tsptoni opened this issue Feb 23, 2018 · 7 comments
Labels

Comments

@tsptoni
Copy link

tsptoni commented Feb 23, 2018

When I compile the app and execute in my tablet and I try to load an .obj object, it throws this error:


02-23 21:46:19.199 29517-29517/org.andresoviedo.dddmodel2 I/Menu: Loading 'content://com.huawei.hidisk.fileprovider/root/storage/emulated/0/Biotech3D/ScanFace/Output/2018.02.23.21.32.13/Output_hd/head3d.obj'
02-23 21:46:19.204 29517-29517/org.andresoviedo.dddmodel2 E/AndroidRuntime: FATAL EXCEPTION: main
                                                                            Process: org.andresoviedo.dddmodel2, PID: 29517
                                                                            java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1000, result=-1, data=Intent { dat=content://com.huawei.hidisk.fileprovider/root/storage/emulated/0/Biotech3D/ScanFace/Output/2018.02.23.21.32.13/Output_hd/head3d.obj flg=0x3 }} to activity {org.andresoviedo.dddmodel2/org.andresoviedo.app.model3D.view.MenuActivity}: java.lang.IllegalArgumentException: column '_data' does not exist
                                                                                at android.app.ActivityThread.deliverResults(ActivityThread.java:4284)
                                                                                at android.app.ActivityThread.handleSendResult(ActivityThread.java:4327)
                                                                                at android.app.ActivityThread.-wrap22(ActivityThread.java)
                                                                                at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1624)
                                                                                at android.os.Handler.dispatchMessage(Handler.java:105)
                                                                                at android.os.Looper.loop(Looper.java:156)
                                                                                at android.app.ActivityThread.main(ActivityThread.java:6523)
                                                                                at java.lang.reflect.Method.invoke(Native Method)
                                                                                at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:942)
                                                                                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:832)
                                                                             Caused by: java.lang.IllegalArgumentException: column '_data' does not exist
                                                                                at android.database.AbstractCursor.getColumnIndexOrThrow(AbstractCursor.java:333)
                                                                                at android.database.CursorWrapper.getColumnIndexOrThrow(CursorWrapper.java:87)
                                                                                at org.andresoviedo.app.util.content.ContentUtils.getDataColumn(ContentUtils.java:128)
                                                                                at org.andresoviedo.app.util.content.ContentUtils.getPathLegacy(ContentUtils.java:49)
                                                                                at org.andresoviedo.app.util.content.ContentUtils.getPath(ContentUtils.java:34)
                                                                                at org.andresoviedo.app.model3D.view.MenuActivity.onActivityResult(MenuActivity.java:124)
                                                                                at android.app.Activity.dispatchActivityResult(Activity.java:7193)
                                                                                at android.app.ActivityThread.deliverResults(ActivityThread.java:4280)
                                                                                at android.app.ActivityThread.handleSendResult(ActivityThread.java:4327) 
                                                                                at android.app.ActivityThread.-wrap22(ActivityThread.java) 
                                                                                at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1624) 
                                                                                at android.os.Handler.dispatchMessage(Handler.java:105) 
                                                                                at android.os.Looper.loop(Looper.java:156) 
                                                                                at android.app.ActivityThread.main(ActivityThread.java:6523) 
                                                                                at java.lang.reflect.Method.invoke(Native Method) 
                                                                                at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:942) 
                                                                                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:832) 
02-23 21:46:19.223 29517-29517/org.andresoviedo.dddmodel2 I/Process: Sending signal. PID: 29517 SIG: 9

This is the part of the code responsible of this:

public static String getDataColumn(Context context, Uri uri, String selection, String[] selectionArgs) {

		Cursor cursor = null;
		final String column = "_data";
		final String[] projection = { column };

		try {
			cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs, null);
			if (cursor != null && cursor.moveToFirst()) {
				final int index = cursor.getColumnIndexOrThrow(column);
				return cursor.getString(index);
			}
		} finally {
			if (cursor != null)
				cursor.close();
		}
		return null;
	}

Any idea how to solve this?

Thanks

@andresoviedo
Copy link
Member

The app has been only tested loading files from file system, like sdcard.
What is your use case?

@tsptoni
Copy link
Author

tsptoni commented Feb 23, 2018

It loads an .obj file from the external SD Card on Android 7.0

@tsptoni
Copy link
Author

tsptoni commented Feb 23, 2018

The size of the file is 21,94Mb, may the problem is related with that?

@andresoviedo
Copy link
Member

I don't think the size is an issue. Please be sure you are loading the file from internal or sd card memory

@andresoviedo
Copy link
Member

Fixed in latest version.

@CodePoem
Copy link

CodePoem commented Jan 4, 2019

Fixed in latest version.

How to fix it?Could you point the code, please?Thank you in advance.

@andresoviedo
Copy link
Member

Hey. The latest version used a different API (ContentProvider) to read contents.
You can find the new implementation on ContentUtils.java. on method getInputstream()
Regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants