troubleshooting Question

Java Code Flow problem

Avatar of Manoj Joshi, PMP
Manoj Joshi, PMPFlag for India asked on
Java
4 Comments1 Solution272 ViewsLast Modified:
Hello Experts,
This might seem a bit weird, but here is what happens actually.
I'm using the following tools for my developmwnt environment:
IDE: eclipse Helios
Build tool : maven(using M2clipse through Eclipse)
jdk version : jdk 1.6 update 30(latest stable release for java6)

I have a skeleton of code which I would paste as below:

....
if(){

if(){
1. // some code inside
}//end of if
}
else{
if(){
2. //some part of code inside
}//end of if

}//end of else

.....

The code as you might have seen above is pretty simple one. However, I face a very strange problem when I run the debugger on the code. The debugging process shows that the from point 1 mentioned above suddenly moves into the point 2 (inside the else loop.)

Since the syntax for if-else clearly indicates that either if block is executed or the else loop is executed. However, in this case the cursor just moves from the inside of the inside of if loop(i.e point 1) and just suddenly drops into the else loops if loop (i.e point 2). There are no break or continue statements in between. Just simple code steps.

Only observation while debugging is that the condition in the inner if loop of the if loop (i.e point 1) returns null result. But still I do not understand why it should go into the the else loops if loop, if it has already gone into the first if loop.

I hope I have given enough information. If you need further information on this, kindly let me know. But can somebody please let me know why is this happening. If you have earlier faced this problem, or if you have known this, your help would be grateful.

Hope the mystery clears soon.

Kind Regards,
Manoj Joshi
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros