Finalizing a cursor that has not been deactivated or closed?
<p>this is my code</p>

<pre><code>public class sendInformation  {
    public SQLiteDatabase newDB;
    JSONObject jObject;
    JSONArray jArray = new JSONArray();

    public void getValues()
    {
        try
        {
            newDB = SQLiteDatabase.openDatabase("/data/data/com..../databases/...db",null,SQLiteDatabase.CONFLICT_NONE);    
        }catch(SQLException e)
        {
            Log.d("Error","Error while Opening Database");
            e.printStackTrace();
        }
        try
        {
            Cursor c = newDB.rawQuery("Select * from table",null);
            if (c.getCount()==0) 
            {
                c.close();
                Log.d("","no items on the table");              
            }else
            {
                c.moveToFirst();    

                while(c.moveToNext()) {
                    jObject = new JSONObject();
                    jObject.put("ID", c.getString(c.getColumnIndex("ID")));
                    jObject.put("Notes", c.getString(c.getColumnIndex("Notes")));
                    jObject.put("Cellphone", c.getString(c.getColumnIndex("Cellphone")));
                    jObject.put("Date", "null");
                    jObject.put("Address", "null");
                    jArray.put(jObject);
                }

                c.close();
                Log.d("","ALL the data in the DB"+jArray.toString());
                int arrayLength=jArray.length();
                Log.d("","Lenght of the jArray"+arrayLength);
                HttpParams httpParams = new BasicHttpParams();
                HttpConnectionParams.setConnectionTimeout(httpParams,9000);
                HttpConnectionParams.setSoTimeout(httpParams, 9000);

                HttpClient client = new DefaultHttpClient(httpParams);

                String url = "http://10.100.138.214:8080/..../test.php?arrayLength="+arrayLength;

                HttpPost request = new HttpPost(url);
                request.setEntity(new ByteArrayEntity(jArray.toString().getBytes("UTF8")));      
                request.setHeader("json", jArray.toString());

                HttpResponse response = client.execute(request);
                HttpEntity entity = response.getEntity();
                // If the response does not enclose an entity, there is no need

                if (entity != null) {
                    InputStream instream = entity.getContent();

                    String result =  RestClient.convertStreamToString(instream);
                    Log.i("Read from server", result); 
                }
            }       
        } catch (UnsupportedEncodingException uee) {
            Log.d("Exceptions", "UnsupportedEncodingException");
            uee.printStackTrace();
        }catch (Throwable t) {
            Log.d("","request fail"+t.toString());
        }

        this.newDB.close(); 
    }
}
</code></pre>

<p>It is supposed to close all my cursors but I don't know where my problem is. I hope someone can help me with this. I think it is not too difficult but I can't see the issue.</p>
