I have written some code in try statement and during debugging,the code is working fine.
But after try statement, control is moving to catch statement and it is throwing Null Pointer Exception. Here is the code:-
Asked
Active
Viewed 364 times
-5

Rodger Nadal
- 309
- 2
- 8
- 21
-
5Please post your code, not images of your code. – Axel May 17 '17 at 10:08
-
Recompile your code or clean it. – Sandeep B May 17 '17 at 10:09
-
2Take a look at your exception StackTrace, it should tell you which line throws the exception. – Mark May 17 '17 at 10:10
-
What does test.log do? Are you able to see the text "Clicking on sing in link" in logs? If not, then this might be the issue. test variable might be null. – Max08 May 17 '17 at 10:10
-
Keep in mind that in debug mode, if you stop at a line, that line has not yet been executed. So if you get to `test.log(...` and jump into the catch when you step forward, that line's the big, bad exceptionthrower. – Mark May 17 '17 at 10:13
-
1if `test` is `null` you will cause NPEs in both `try` and `catch`. – luk2302 May 17 '17 at 10:14
1 Answers
1
The statements in the catch braces will be executed only if the statments in the try braces did throw an Exception.
Here, I think your test
var is null, that's why you have that nullpointer.

TheWildHealer
- 1,546
- 1
- 15
- 26