I’m writing an android app that does a lot of stuff. I recently refactored my code to have a better structure, but suddenly I’m getting a very strange problem.
handleRequest(String str)
{
boolean foo = executeCommand(str);
this.publishProgress("FOO1: " + foo);
if (foo == false);
{
this.publishProgress("FOO2: " + foo);
sendString("Failed to execute: " + str);
}
this.publishProgress("FOO3: " + foo);
sendEOM();
}
The code above should execute a command, and store ‘foo’ with if the command was executed correctly. This code is inside an Android AsyncTask (thread) so I use ‘publishProgress’ to show a toast.
I’ve been flipping through the debugger and FOO is true! The toasts show FOO to be true the entire way through as well. However, it goes ahead and jumps inside the IF block and executes that too. I’ve never seen this before, I think its a problem with Java. I was stepping though the function ‘executeCommand’ and it looks like it is skipping return statements too.
I’ve ran the code on a virtual device and a real one and they both do this.
Any ideas? I’m completely at a loss here.
You said
remove the semicolon, it should be