[Mono-bugs] [Bug 655872] New: Passing null for string[] Parameters in Activity.ManagedQuery and ContentProvider.Query Causes System.ArgumentNullException

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Nov 24 17:42:20 EST 2010



           Summary: Passing null for string[] Parameters in
                    Activity.ManagedQuery and ContentProvider.Query Causes
    Classification: Mono
           Product: MonoDroid
           Version: unspecified
          Platform: x86-64
        OS/Version: Windows 7
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: Runtime
        AssignedTo: mkestner at novell.com
        ReportedBy: danomania at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---

Created an attachment (id=402095)
 --> (http://bugzilla.novell.com/attachment.cgi?id=402095)
Solution that demonstrates problem

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:
Gecko/20101026 Firefox/3.6.12

If you pass a null for the projection or selectionArgs parameters in the
Activity.ManagedQuery() or ContentResolver.Query() methods, a
System.ArgumentNullException is thrown.

The methods work as expected by replacing null with new string[]{}. Passing
null in the equivalent Java methods in an Eclipse project execute successfully.

By inspecting the error logs, it appears that the
Android.Runtime.JNIEnv.CopyArray() method is called before checking to see if
the array is null.

Reproducible: Always

Steps to Reproduce:
1. In a MonoDroid project, implement a ContentProvider
2. In your activity, call the Activity.ManagedQuery() method passing null as
the selectionArgs parameter.
3. Run the application (F5 or Ctrl-F5)
4. Wait for exception
Actual Results:  
The system throws a runtime error. The relevant log entries:

E/AndroidRuntime(  671): java.lang.RuntimeException: Unable to start activity
java.lang.IllegalArgumentException: System.ArgumentNullException: Argument
cannot be null.
E/AndroidRuntime(  671): Parameter name: src
E/AndroidRuntime(  671):   at Android.Runtime.JNIEnv.CopyArray (System.String[]
src, IntPtr dest) [0x00006] in
E/AndroidRuntime(  671):   at
(IntPtr jnienv, IntPtr native__this, IntPtr native_uri, IntPtr
native_projection, IntPtr native_selection, IntPtr native_selectionArgs, IntPtr
native_sortOrder) [0x0006e] in

Expected Results:  
Runtime execution w/o exceptions.

Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

More information about the mono-bugs mailing list