Reputation: 7258
I have the following code in my android application:
/**
* Returns a single customer object based on UUID. */
public static Customer getCustomer(UUID id)
{
try
{
Cursor cursor = CustomApp.data.db.query("Customer", customerCols,
"CustomerId='" + id.toString() + "'", null, null, null, null);
if (cursor != null)
cursor.moveToFirst();
Customer cust = new Customer(id);
// Unrelated code here
if (!cursor.isNull(23))
cust.isDeceased = (cursor.getInt(23) > 0); // EXCEPTION
// More unrelated code here
return cust;
}
catch (Exception ex)
{
ex.printStackTrace(); // This line gets skipped
return null; // Code jumps to here
}
}
I'm trying to debug it. Theres an exception on the line cust.isDeceased = (cursor.getInt(23) > 0);
(why I'm getting the exception is another question entirely). When the code reaches that line, it jumps to the catch
section. I have put a breakpoint on the line ex.printStackTrace();
but the code skips this line altogether. It just jumps straight to the return null;
line, and the stack trace is never printed. Because of this, it is making it very difficult to debug the code as I am having to guess what is wrong. (If you can see something wrong with that code then please do tell me, but it is not the purpose of this question).
I'm sorry for the lack of information/code I have presented, but as I literally have no idea why this would be happening, I do not know what is relevant and what is not. Has anyone encountered this problem before?
Upvotes: 0
Views: 137
Reputation: 6501
Log.e("TAG", "error", ex); try this instead of ex.printStackTrace(); Also try to restart eclipse.
Upvotes: 1
Reputation: 21097
remove the try catch clause, logcat will show you the detailed exception.
Upvotes: 0