I found a problem online and started doing it for fun. The question was to identify the method which causes a NullPointerException
in a java application. Here is the code for the same.
Code:
public void theChainLinkFence() {
System.out.println(Constants.Fence.GREETING);
chain.is().only().as().strong().as().its().weakest().link();
ChainFence.allowThrough(chain);
}
The third line throws the exception, but I am not sure how to debug a line with multiple method calls. Kindly provide your suggestion on how to approach this problem.
PS: Chain is a class present in an external jar file with no source given.
Update: A similar Question gave me an idea on how to approach the problem.