Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

catching null exception [duplicate]

I'm working on a java application for android and I currently am getting a problem where the debugger is stepping into my catch block and somehow ex is null? Has anyone seen anything like this before?

}
catch(Exception ex)
{
   // Debugger is coming through the catch block and ex is null ????
}
like image 270
David Carpenter Avatar asked Oct 13 '11 14:10

David Carpenter


People also ask

Should you catch NullReferenceException?

Handling NullReferenceException in release codeIt's usually better to avoid a NullReferenceException than to handle it after it occurs.

Can we catch null pointer exception C++?

There's no such thing as "null pointer exception" in C++. The only exceptions you can catch, is the exceptions explicitly thrown by throw expressions (plus, as Pavel noted, some standard C++ exceptions thrown intrinsically by standard operator new , dynamic_cast etc). There are no other exceptions in C++.

What is duplicate key exception?

The DuplicateKeyException exception is thrown if an entity EJB object or EJB local object cannot be created because an object with the same key already exists. This exception is thrown by the create methods defined in an entity bean's home or local home interface.

What happens when an exception is caught C#?

The Anatomy of C# Exceptions catch – When an exception occurs, the Catch block of code is executed. This is where you are able to handle the exception, log it, or ignore it. finally – The finally block allows you to execute certain code if an exception is thrown or not.


1 Answers

This sounds like the source code and the compiled classes are out of sync, so the debugger is stepping into the wrong block.

Try to do a clean and then a rebuild.

like image 128
Michael Krussel Avatar answered Sep 27 '22 23:09

Michael Krussel