Skip to content Skip to sidebar Skip to footer

Eclipse Debugger Is Jumping To The Wrong Return Statement

I've run into a really weird situation. I'm doing the following in Java (through Eclipse Galileo) on the Android 2.1 platform: // Get gravity & geomagnetic data to return to th

Solution 1:

Looks like succeeded is false. Debugging will make it look like the method jumps to the bottom return when you do any return. Put a log before

return NO_DATA_COULD_BE_READ;

Solution 2:

How are you sure that it jumps to the last return? You have a return in the if, this is most likely this one which is called.

Solution 3:

I guess, you are in misconception. The control is not reaching the last return statement because the earlier return statement is getting executed.

return NO_DATA_COULD_BE_READ;

Since succeeded is turning out to be false (as you said), the if-condition is satisfied and then it simply returns the null value of the NO_DATA_COULD_BE_READ string, which is inside the if-condition block.

So, Log.v("Test", "This should be printed - but it isn't!!"); is never reached as per observation.

Post a Comment for "Eclipse Debugger Is Jumping To The Wrong Return Statement"