04-13-2012 10:06 AM
Hi
I have app which is working fine in 9700,9880,9550,9900. But in 9900, app throwing the NullPointerException while reading the database records. Except in this device, app working fine in all other remaining devices.
Here I am attaching the snippet of code
statement = _database.createStatement(query_str);
statement.prepare();
c = statement.getCursor();
Tools.print("The Query String: "+query_str);
Tools.print("Is the cursor null? "+(c==null));
Tools.print("Is the cursor Empty? "+c.isEmpty());
while(c.position(++increment))
{
r = c.getRow();
columns = r.getColumnNames();
Tools.print("Row r equals "+r.toString());
Tools.print("How many columns does the Row r has? "+columns.length);
row_obj = new Dictionary[columns.length]; //(columns.length);
for(int i=0; i<columns.length; i++)
{
dir = new Dictionary();
dir.key = columns[i];
index = r.getColumnIndex(dir.key);
dir.value = r.getObject(index);
row_obj[i] = dir;
}
data_obj.addElement(row_obj);
}
if(row_obj != null)
{
data_arr = new Dictionary[data_obj.size()][];
data_obj.copyInto(data_arr);
data_obj = null;
statement.close();
c.close();
}
I have 8 records in db, while reading the last record i.e 8 record, its thowing the NullPointerException.
Please Note, the same code is working fine for remaining device wihout single word change.
Please let me know if wrong in this or Do I need follow different procedure for this particular device.
04-16-2012 03:43 AM
Resolved myself by checking the conditions by rows avialability.