Dear All, Please help me I m facing NullPointerException.
In following code i m retreiving some values from a table and storing them in a vector. In case of response when it get null then loop goes to NullPointerException so remaining variables(responseflag,url,urlflag,) does't get value so again it next code gives nullpointerexception.
To expand on that, here's the Sherlock Holmes' rule to finding null pointers.
1. Print the stack trace (in your code you don't print anything. NEVER swallow a stack trace). 2. Look at the line where the exception happens. 3. Look at each segment in the code. A segment is essentially an object between dots. For example, in a code like a.someMethod().someOtherMethod(), there are 3 segments. 4. Take all but the last segment into consideration. 5. Eliminate segments that CANNOT be null (see if you have declared them already or if such methods will definitely return a value). Add log statements if needed.
Whatever remains, however confident you are, must be null and hence causing the NPE.